Initial commit

This commit is contained in:
gpkvt 2022-08-12 20:48:25 +02:00
commit 38a3f3dd64
43 changed files with 5321 additions and 0 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text eol=lf

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
debug.xml
debug.json
docker-compose.override.yml
*.pyc

661
LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

121
README.md Normal file
View File

@ -0,0 +1,121 @@
# IRL Docker Image
Provides tools and services for IRL streaming with OBS Studio as Docker Container.
## Prerequisites
You will need:
* [OBS Studio](https://obsproject.com/download)
* [OBS Websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-of-obs-studio-made-easy.466/)
* [VLC](https://www.videolan.org/vlc/index.html)
* [git](https://git-scm.com/downloads)
* [Docker](https://docs.docker.com/docker-for-windows/install/)
* [Live U Solo](https://gosolo.tv)
## RTMP Endpoint
* Port `1935`
## Webserver
* Port `80`
## docker-compose.yml
It is strongly advised to make use of `docker-compose` to build the image and run the container. Please create a `docker-compose.override.yml` to adjust the required settings to your needs. Use your full RTMP target URL as `STREAMKEY`. It's recommended to include a secret in your URL, e.g. `rtmp://yourserver.invalid:1935/live?key=<YOURSECRET>`
You can find an example in: `./examples/docker-compose/docker-compose.override.example.yml`
### Container Handling
#### Clone the repo
Use `powershell`, `cmd` or an WSL2 instance and go to the desired location on your local machine (e.g. `c:\users\IRL\`) using `cd`. Then execute the following command:
```
git clone https://gitlab.com/gpvkt/twitch-irl-docker.git
```
This process must be done only once. The repo content will be cloned into the subdirectory called `docker`.
### Start container (first time run)
Use the `powershell` or `cmd` to go to your repo directory on your local machine (e.g. `c:\users\IRL\docker\`) using `cd`. Remember to create your `docker-compose.override.yml`. Then simply run the following command to start the Container, if needed docker-compose will start the build process.
```
docker-compose up
```
If the container starts successfully you should see something like (followed by more or less verbose status messages depending on your log level):
```
rtmp_1 | fcgiwrap STARTING
rtmp_1 | ircbot STARTING
rtmp_1 | liveucollector STARTING
rtmp_1 | nginx STARTING
rtmp_1 | obsctl STARTING
rtmp_1 | php STARTING
rtmp_1 | rtmpcollector STARTING
```
### Update image
To update your Docker image run the following commands inside your repo directory (e.g. `c:\users\IRL\docker\`):
```
git pull
docker-compose build
docker-compose up -d
```
### Troubleshooting
If something works wrong you can examine the status of your container by running `docker-compose logs`. To get even more informations you can switch inside your running container by executing `docker-compose exec rtmp /bin/zsh`. Once you're inside the container you can examine the logfiles of all processes using the following commands:
```
cat /var/log/supervisor/nginx.log
cat /var/log/supervisor/irl.log
```
To see the status of the processes or to restart them you can use the following commands:
```
supervisorctl status
supervisorctl restart nginx
supervisorctl restart php
supervisorctl restart fcgiwrap
supervisorctl restart obsctl
supervisorctl restart rtmpcollector
supervisorctl restart liveucollector
supervisorctl restart ircbot
```
If your docker image doesn't not reflect the expected changes after pulling an repo update run the following commands inside your repo directory:
```
git pull origin master
docker-compose kill
docker-compose rm --force
docker-compose build
docker-compose up -d
```
## OBS Studio
After installation OBS Studio you need to add the obs-websocket plugin (https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/). We recommend using the 64 bit versions. Use a strong password, as you may need to expose the websocket port to the internet.
Also you need to add the required scenes in OBS, you will find an importable example in `./examples/obs/IRL.json`. Please note that the example uses an VLC source for RTMP, so you need to have VLC installed. If you use OBS 64 bit you will need to use VLC 64 bit as well.
IMPORTANT: The Names of Scene-, Filter-, Audiosources etc. will be used as IDs in the OBS Web Remote App, therefore they MUST NOT contain any spaces and special Characters (like `"'|/\^<>?*#'&%$()[]{}§!,.`).
Please note that LiveU uses `/live/live` as default RTMP endpoint.
## OBS Web Remote
An webbased OBS Remote Interface is included. You can reach it via `http://localhost/remote.py`. The Interface is password protected. The username is `admin`, the password is identical to your `OBS_PASSWORD` you set in `docker-compose.override.yml`.
## Router/Firewall
You need to expose the RTMP Port (e.g. `1935`) and the webserver port (e.g. `80`) to the internet. Please configure your router and/or firewall accordingly. We also recommend to use an fixed IP Address for your Server, if you don't have one use an DynDNS service to get an domain name that always matches your current IP.

48
build/Dockerfile Normal file
View File

@ -0,0 +1,48 @@
FROM debian:bullseye
RUN apt-get update
RUN apt-get install build-essential gettext-base -y
RUN apt-get install wget curl unp unzip daemon apt-transport-https software-properties-common ffmpeg -y
RUN apt-get install -y nginx libnginx-mod-rtmp
RUN apt-get install -y php-fpm
RUN mkdir /run/php
RUN apt-get install -y fcgiwrap memcached
RUN apt-get install -y zsh mc apache2-utils
RUN apt-get install -y python3 python3-yaml python3-requests python3-oauthlib python3-pip python3-bs4 python3-memcache
RUN apt-get install -y git
RUN pip3 install argparse
RUN pip3 install irc
RUN pip3 install obs-websocket-py
RUN pip3 install lxml
RUN apt-get install -y supervisor coreutils
COPY ./supervisord/*.conf /etc/supervisor/conf.d/
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /var/www/html/
COPY ./www/* /var/www/html/
COPY ./debug/rtmp_stats.xml /var/www/html/debug.xml
COPY ./debug/router_stats.json /var/www/html/debug.json
RUN chown www-data:www-data /var/www/html/ -R
RUN chmod +x /var/www/html/set_ext.py
RUN chmod +x /var/www/html/index.py
RUN chmod +x /var/www/html/ext_data.py
RUN chmod +x /var/www/html/data.py
RUN mkdir -p /opt/scripts
COPY ./scripts/ /opt/scripts/
RUN chmod +x /opt/scripts/*.py -R
COPY ./startup.sh /startup.sh
RUN chmod +x /startup.sh
VOLUME /opt/scripts/vol/
VOLUME /var/www/html/
EXPOSE 1935
EXPOSE 80
CMD "/startup.sh"

847
build/debug/netgear.json Normal file
View File

@ -0,0 +1,847 @@
{
"wwanadv" : {
"curBand" : "LTE B20",
"MNC" : "02",
"end" : "",
"txLevel" : -2,
"MNCFmt" : 2,
"primScode" : -1,
"plmnSrvErrBitMask" : 0,
"RAC" : 0,
"MCC" : "262",
"rxLevel" : -93,
"LAC" : 12345,
"country" : "DEU",
"radioQuality" : 59,
"cellId" : 12345678,
"chanId" : 6000,
"chanIdUl" : 24000
},
"accesscontrol" : {
"schedulerBlockingActive" : false,
"schedulerEnabled" : false,
"blocksites" : {
"macList" : [
{}
],
"patternList" : [
{}
],
"enabled" : false,
"end" : 0,
"macMode" : "Blacklist",
"patternMode" : "Blacklist"
},
"nlpc" : {
"filterLevel" : "None",
"enabled" : false,
"macList" : [
{}
],
"end" : 0,
"username" : ""
},
"schedulerSupported" : true,
"schedulerList" : [
{}
],
"schedulerDefaultMode" : "WwanOn",
"end" : 0
},
"mediaserver" : {
"dlnaSupported" : true,
"dlnaEnabled" : false,
"dlnaFriendlyName" : "ReadyDLNA",
"end" : 0
},
"eventlog" : {
"catLevel" : [
{
"catlevel_mask" : 0,
"category" : "ServiceAllowed",
"enabled" : false
},
{}
],
"level" : 0,
"logDuration" : 0,
"end" : 0
},
"fota" : {
"fwupdater" : {
"end" : "",
"isRejectable" : false,
"chkTimeLeft" : 0,
"statusCode" : 200,
"chkallow" : true,
"state" : "NoNewFw",
"available" : false,
"dloadSize" : 0,
"description" : "",
"error" : false,
"chkstatus" : "Initial",
"isPostponable" : false,
"dloadProg" : 0,
"lastChkDate" : 1305753260
}
},
"wifi" : {
"RTSthreshold" : 2347,
"status" : "On",
"wps" : {
"end" : "",
"blocked" : true,
"status" : "Succeeded",
"enabled" : "Disabled",
"supported" : "Both",
"mode" : "PBC"
},
"privacy" : false,
"SSIDreminder" : true,
"accessBlackList" : {
"count" : 0,
"list" : [
{}
]
},
"MAC" : "AA-BB-CC-DD-EE-FF",
"wmmEnabled" : true,
"maxClientSupported" : 30,
"passPhrase" : "1234ABCD",
"5gBandwidth" : "VHT80",
"channel" : 0,
"passwordReminder" : true,
"offload" : {
"enabled" : false,
"activationRequired" : false,
"bars" : 0,
"supported" : true,
"status" : "Off",
"dataTransferred" : {
"tx" : 0,
"rx" : 0,
"end" : ""
},
"scanList" : [
{}
],
"networkList" : [
{}
],
"end" : "",
"stationIPv4" : "0.0.0.0",
"scanProgress" : "Idle",
"connectionSsid" : "",
"rssi" : 0,
"timeOn" : 0,
"securityStatus" : "Disconnected"
},
"maxClientCnt" : 20,
"SSID" : "Nighthawk",
"clientCount" : 1,
"end" : "",
"aux" : {
"chan" : 1,
"end" : "",
"passPhrase" : "",
"status" : "Off",
"encryption" : "WPA2_Personal_AES",
"SSID" : "",
"mode" : "M802_11_BGN",
"maxClientCnt" : 10,
"AuxMode" : "Off",
"hiddenSSID" : false,
"enabled" : false
},
"accessControl" : "None",
"hiddenSSID" : false,
"enabled" : true,
"fragThreshold" : 2346,
"maxClientLimit" : 30,
"mode" : "M802_11_ANAC",
"accessWhiteList" : {
"list" : [
{}
],
"count" : 0
},
"2gBandwidth" : "HT20",
"country" : "FR",
"encryption" : "WPA2_Personal_AES",
"txPower" : "Short",
"guest" : {
"timerValue" : 3600,
"DHCP" : {
"range" : {
"low" : "192.168.2.20",
"high" : "192.168.2.99",
"end" : ""
}
},
"passPhrase" : "1234ABCD",
"encryption" : "WPA2_Personal_AES",
"accessProfile" : "Full",
"maxClientCnt" : 20,
"SSID" : "suche_5G",
"privacy" : false,
"chan" : 0,
"status" : "Off",
"generatePassphrase" : false,
"mode" : "M802_11_ANAC",
"timerEnable" : false,
"timerTimestamp" : 0,
"enabled" : false,
"hiddenSSID" : false
}
},
"router" : {
"UPNPIgdVersion" : 2,
"ipPassThroughSupported" : true,
"DMZaddress" : "192.168.1.4",
"usbNetworkTethering" : true,
"Ipv6Supported" : true,
"clientList" : {
"count" : 1,
"list" : [
{
"IP" : "192.168.21.64",
"MAC" : "64:5D:86:DD:E6:22",
"media" : "WiFi",
"source" : "PrimaryAP",
"name" : "yogibear"
},
{}
]
},
"usbMode" : "None",
"domainName" : "net",
"usbTetherSupported" : true,
"DHCP" : {
"DNS1" : "8.8.8.8",
"USBpcIP" : "192.168.21.4",
"DNS2" : "1.1.1.1",
"DNSmode" : "Auto",
"serverEnabled" : true,
"range" : {
"low" : "192.168.21.20",
"end" : "",
"high" : "192.168.21.99"
}
},
"DMZenabled" : false,
"portFilteringEnabled" : false,
"ipPassThroughEnabled" : false,
"portFwdList" : [
{}
],
"forceSetup" : false,
"portFilterWhiteList" : [
{}
],
"VPNpassthrough" : true,
"gatewayIP" : "192.168.21.1",
"portFwdEnabled" : false,
"hostName" : "m2login",
"UPNPsupported" : true,
"portFilteringMode" : "None",
"portFilterBlackList" : [
{}
],
"end" : "",
"netMask" : "255.255.255.0",
"usbTetheringActive" : false,
"UPNPenabled" : false
},
"lcd" : {
"inactivityTimerAC" : 60,
"brightnessOnAC" : "Dim",
"brightnessOnUSBIntVal" : 2,
"brightnessOnBatt" : "Dim",
"backlightEnabled" : true,
"brightnessOnBattIntVal" : 2,
"lockScreenEnable" : false,
"backlightActive" : false,
"inactivityTimerUSB" : 60,
"lockScreenUsePin" : false,
"backlightOverride" : "Off",
"inactivityTimer" : 60,
"end" : "",
"brightnessOnACIntVal" : 2,
"brightnessOnUSB" : "Dim"
},
"general" : {
"SVN" : "4",
"wifiACLURL" : "/Forms/wifiACL",
"ATTDeviceId" : "",
"LEDenabled" : false,
"devTemperature" : 27,
"showWebInfo" : true,
"usbDevicesURL" : "/Forms/readyshareUsbDevicesInfo",
"factoryResetStatus" : "NotStarted",
"deviceName" : "Nighthawk M2",
"HWversion" : "1.0",
"warrantyDateCode" : "",
"truInstallSupported" : false,
"showAdvHelp" : true,
"setupCompleted" : true,
"BLversion" : "SDX24_10.25.00.06\n",
"manufacturer" : "Netgear, Incorporated",
"truInstallEnabled" : false,
"SPClockStatus" : "SPCLocked",
"reconditionDate" : "0",
"useMetricSystem" : true,
"PRIversion" : "05.04",
"verMajor" : 42,
"truInstallAvailable" : false,
"FWversion" : "NTGX24_10.17.08.00",
"profileURL" : "/Forms/profile",
"ESN" : "",
"genericResetStatus" : "NotStarted",
"currTime" : 1305760186,
"appVersion" : "NTGX24_10.17.08.00",
"FSN" : "60M196NE00328",
"truInstallVersion" : "",
"languageSelected" : true,
"environment" : "Target",
"verMinor" : 0,
"supportedLangList" : [
{
"isDefault" : "true",
"isCurrent" : "true",
"id" : "en",
"label" : "English",
"token1" : "/romfs/lcd/en.tr",
"token2" : ""
},
{
"token2" : "",
"isDefault" : "false",
"isCurrent" : "false",
"id" : "ar_AR",
"label" : "العربية (Arabic)",
"token1" : "/romfs/lcd/ar_AR.tr"
},
{
"label" : "Deutsch (German)",
"token1" : "/romfs/lcd/de_DE.tr",
"id" : "de_DE",
"isCurrent" : "false",
"isDefault" : "false",
"token2" : ""
},
{
"isDefault" : "false",
"isCurrent" : "false",
"id" : "es_ES",
"label" : "Español (Spanish)",
"token1" : "/romfs/lcd/es_ES.tr",
"token2" : ""
},
{
"id" : "fr_FR",
"isCurrent" : "false",
"label" : "Français (French)",
"token1" : "/romfs/lcd/fr_FR.tr",
"isDefault" : "false",
"token2" : ""
},
{
"token2" : "",
"token1" : "/romfs/lcd/it_IT.tr",
"label" : "Italiano (Italian)",
"isCurrent" : "false",
"id" : "it_IT",
"isDefault" : "false"
},
{
"isDefault" : "false",
"token1" : "/romfs/lcd/no_NO.tr",
"label" : "Norsk (Norwegian)",
"id" : "no_NO",
"isCurrent" : "false",
"token2" : ""
},
{
"token2" : "",
"token1" : "/romfs/lcd/pl_PL.tr",
"label" : "Polski (Polish)",
"isCurrent" : "false",
"id" : "pl_PL",
"isDefault" : "false"
},
{
"token2" : "",
"isDefault" : "false",
"label" : "Suomi (Finnish)",
"token1" : "/romfs/lcd/fi_FI.tr",
"id" : "fi_FI",
"isCurrent" : "false"
},
{
"isCurrent" : "false",
"id" : "sv_SE",
"label" : "Svenska (Swedish)",
"token1" : "/romfs/lcd/sv_SE.tr",
"isDefault" : "false",
"token2" : ""
},
{
"token2" : "",
"isDefault" : "false",
"id" : "tu_TU",
"isCurrent" : "false",
"token1" : "/romfs/lcd/tu_TU.tr",
"label" : "Türkçe (Turkish)"
},
{}
],
"buildDate" : "2020/08/21",
"packageName" : "MR2100-100EUS_23114195_NTGX24_10.17.08.00_00_Generic_05.04_00",
"pinChangeURL" : "/Forms/pinChange",
"HIDenabled" : false,
"activated" : true,
"companyName" : "NETGEAR",
"upTime" : 489,
"PRIid" : "23114195",
"timeZoneOffset" : 7200,
"portCfgURL" : "/Forms/portCfg",
"portFilterURL" : "/Forms/portFilter",
"systemAlertList" : {
"list" : [
{}
],
"count" : 0
},
"IMEI" : "355316100244533",
"model" : "MR2100",
"MEID" : "",
"keyLockState" : "Locked",
"webAppVersion" : "MR2100-100EUS_04.02.171.00\n",
"TCAaccepted" : true,
"defaultLanguage" : "en",
"modemFwVersion" : "SDX24_10.25.00.06",
"configURL" : "/Forms/config",
"nwFoldersURL" : "/Forms/readyshareNWFoldersInfo",
"apiVersion" : "2.0",
"activationDate" : "0"
},
"power" : {
"standby" : {
"onIdle" : {
"timer" : {
"onAC" : 0,
"onBattery" : 300,
"onUSB" : 0,
"end" : ""
}
},
"ethernet" : {
"timer" : {
"onBattery" : 120,
"end" : ""
}
}
},
"batteryName" : "W10A",
"resetreason" : 16,
"battChargeLevel" : 98,
"actionOnUsb" : "ChargeOnly",
"wifiOff" : {
"end" : "",
"onUsbConnect" : true,
"onTethered" : false
},
"lpm" : false,
"choiceOnUsb" : "NoAction",
"batteryState" : "Normal",
"end" : "",
"PMState" : "Online",
"battLowThreshold" : 15,
"battChargeSource" : "None",
"SmState" : "Online",
"buttonHoldTime" : 268435455,
"batteryTempState" : "Normal",
"batteryTemperature" : 27,
"resetRequired" : "NoResetRequired",
"charging" : false,
"batteryVoltage" : 4119,
"battChargeAlgorithm" : "Normal",
"deviceTempCritical" : false,
"autoOn" : {
"enable" : true,
"end" : ""
},
"autoOff" : {
"onIdle" : {
"timer" : {
"end" : "",
"onBattery" : 0,
"onAC" : 0
}
},
"onUSBdisconnect" : {
"countdownTimer" : 0,
"end" : "",
"enable" : false
}
},
"boost" : {
"end" : "",
"cableConnected" : false
}
},
"cradle" : {
"secondarySSID" : "",
"primarySSID" : "",
"mode" : false,
"smartMode" : false,
"secondaryPassphrase" : "",
"url" : "",
"primaryPassphrase" : "",
"autoIPT" : false,
"end" : ""
},
"led" : {
"end" : ""
},
"sim" : {
"imsi" : "123456789012345",
"mep" : {},
"end" : "",
"SPN" : "",
"pin" : {
"mode" : "Disabled",
"retry" : 3,
"end" : ""
},
"status" : "Ready",
"phoneNumber" : "",
"sprintSimLock" : 0,
"iccid" : "12345678901234567890",
"puk" : {
"retry" : 10
}
},
"ui" : {
"serverDaysLeftHide" : false,
"disableSettingsOnLCD" : false,
"stealthEnabled" : false,
"promptActivation" : true,
"end" : 0
},
"ethernet" : {
"offload" : {
"enabled" : false,
"on" : false,
"timeOn" : 0,
"tx" : 0,
"ipv4Addr" : "0.0.0.0",
"supported" : true,
"rx" : 0,
"end" : "",
"ipv6Addr" : "0000:0000:0000:0000:0000:0000:0000:0000"
},
"mac" : "AA-BB-CC-DD-EE-FF"
},
"webd" : {
"hintNumber" : 0,
"hideAdminPassword" : false,
"adminPassword" : "****************",
"end" : "",
"ownerModeEnabled" : false
},
"ready" : {
"shareSupported" : false,
"deviceShare" : {
"end" : 0,
"usbDevicesInfo" : [
{}
],
"networkDeviceName" : "readyshare",
"nwFoldersInfo" : [
{}
],
"extMediaSupported" : true,
"workgroupName" : "workgroup",
"removeUsbDeviceResult" : "None"
},
"cloudSupported" : false,
"shareEnabled" : false,
"cloud" : {
"end" : 0,
"registrationStatus" : "Unregistered"
},
"cloudEnabled" : false
},
"session" : {
"supportedLangList" : [
{
"id" : "en",
"isCurrent" : true,
"label" : "English"
},
{
"label" : "العربية (Arabic)",
"id" : "ar_AR",
"isCurrent" : false
},
{
"label" : "Deutsch (German)",
"id" : "de_DE",
"isCurrent" : false
},
{
"id" : "es_ES",
"isCurrent" : false,
"label" : "Español (Spanish)"
},
{
"label" : "Français (French)",
"id" : "fr_FR",
"isCurrent" : false
},
{
"label" : "Italiano (Italian)",
"id" : "it_IT",
"isCurrent" : false
},
{
"id" : "no_NO",
"isCurrent" : false,
"label" : "Norsk (Norwegian)"
},
{
"label" : "Polski (Polish)",
"isCurrent" : false,
"id" : "pl_PL"
},
{
"label" : "Suomi (Finnish)",
"id" : "fi_FI",
"isCurrent" : false
},
{
"isCurrent" : false,
"id" : "sv_SE",
"label" : "Svenska (Swedish)"
},
{
"label" : "Türkçe (Turkish)",
"isCurrent" : false,
"id" : "tu_TU"
},
{}
],
"lang" : "en",
"clientIP" : "192.168.21.64",
"secToken" : "yaak7ej6ahfohW0Gai5Ocahph2aiB4a",
"userRole" : "Admin",
"hintDisplayPassword" : ""
},
"failover" : {
"end" : ""
},
"wwan" : {
"autoBandRegionChanged" : false,
"prlVersion" : 0,
"currentPSserviceType" : "LTE",
"signalStrength" : {
"rssi" : -61,
"rscp" : 0,
"bars" : 4,
"sinr" : -1,
"rsrp" : -93,
"rsrq" : -15,
"ecio" : 0,
"end" : ""
},
"mtuChangeEnabled" : false,
"netRegMode" : "Auto",
"sessDuration" : 75,
"roamMenuDisplay" : false,
"inactivityCause" : 30404,
"dataUsage" : {
"disableAutoReset" : false,
"serverRechargeUrl" : "",
"generic" : {
"lastReset" : "1305738170",
"nextBillingDate" : "1306533600",
"dataTransferred" : 156481533,
"end" : "",
"fallbackSupported" : false,
"billingCycleRemainder" : 8,
"userDisplayFormat" : "BillingCycle",
"lastSync" : "0",
"billingDay" : 1,
"dataTransferredRoaming" : 0,
"dataLimitValid" : true,
"lastSucceeded" : "0",
"usageHighWarning" : 80,
"billingCycleLimit" : 268435456000
},
"serverDaysLeft" : 0,
"serverErrorCode" : "",
"server" : {
"end" : "",
"accountType" : "",
"subAccountType" : ""
},
"total" : {
"cdmaLifeRx" : 0,
"lteBillingRx" : 0,
"lteBillingTx" : 0,
"lteLifeRx" : 0,
"gwLifeRx" : 0,
"lteLifeTx" : 0,
"gwLifeTx" : 0,
"end" : "",
"gwBillingTx" : 0,
"cdmaLifeTx" : 0,
"cdmaBillingRx" : 0,
"cdmaBillingTx" : 0,
"gwBillingRx" : 0
},
"planDescription" : "",
"accountType" : "Unknown",
"dataWarnEnable" : true,
"serverDataRemaining" : 0,
"share" : {
"end" : "",
"enabled" : false,
"lastSync" : "0",
"dataTransferredOthers" : 0
},
"remote" : {
"end" : ""
},
"prepaidAccountState" : "Hot",
"serverDataTransferredIntl" : 0,
"prepaidStackedPlansIntl" : 0,
"prepaidStackedPlans" : 0,
"serverDataValidState" : "Invalid",
"serverMsisdn" : "",
"serverLowBalance" : false,
"planSize" : 0,
"serverDataTransferred" : 0
},
"bandDisablementMaskLTE" : "0x0000000000000000",
"connectionText" : "4G+",
"mtuSize" : 0,
"netSelEnabled" : "Enabled",
"registerNetworkDisplay" : "Vodafone.de",
"connectionType" : "IPv4Only",
"ERITestMode" : false,
"connection" : "Connected",
"currentNWserviceType" : "LteService",
"bandRegion" : [
{
"index" : 0,
"name" : "Auto",
"current" : true
},
{
"index" : 1,
"name" : "WCDMA All",
"current" : false
},
{
"name" : "LTE All",
"index" : 2,
"current" : false
},
{}
],
"dataTransferred" : {
"txb" : "39837",
"totalb" : "41639",
"rxb" : "1802"
},
"roamingType" : "Home",
"roamingEnhancedIndicator" : 0,
"IP" : "10.32.42.23",
"laa" : {
"supported" : false,
"enabled" : false,
"end" : ""
},
"roamingGuardDom" : "NotForcedDisabled",
"sessStartTime" : 1305760111,
"roaming" : false,
"netScanStatus" : "NotStarted",
"netManualNoCvg" : false,
"roamingMode" : "HomeOnly",
"roamingGuardIntl" : "NotForcedDisabled",
"IPv6" : "",
"bandDisablementMask" : "0x0000000000000000",
"autoconnect" : "HomeNetwork",
"profileList" : [
{
"pdproamingtype" : "IPV4",
"access_control" : 0,
"name" : "Gigacube",
"username" : "",
"type" : "IPV4",
"ipaddr" : "0.0.0.0",
"password" : "",
"index" : 1,
"authtype" : "None",
"id" : "Gigacube",
"apn" : "home.vodafone.de"
},
{
"pdproamingtype" : "IPV4",
"access_control" : 0,
"name" : "Vodafone",
"username" : "vodafone",
"type" : "IPV4",
"password" : "****************",
"ipaddr" : "0.0.0.0",
"index" : 2,
"authtype" : "CHAP",
"apn" : "web.vodafone.de",
"id" : "Vodafone"
},
{}
],
"registerRejectCode" : -1,
"ca" : {
"end" : "",
"SCCcount" : 2
},
"promptForPwd" : "Disabled",
"LTEBandPriority" : "0",
"RAT" : "Auto",
"LTEeHRPDConfig" : "NotForcedLTEAndeHRPDEnabled",
"profile" : {
"promptForApnSelection" : false,
"default" : "Gigacube",
"end" : "",
"defaultLTE" : "Gigacube"
}
},
"custom" : {
"dsaLocalUrl" : "https://m2login:443/dsa",
"lastWifiChan" : 13,
"hideAdminPassword" : false,
"hiddenMenuEnabled" : false,
"end" : 0,
"carrierSim" : "Unknown"
},
"sms" : {
"ready" : true,
"sendEnabled" : true,
"end" : "",
"unreadMsgs" : 0,
"msgCount" : 0,
"trans" : [
{}
],
"sendMsg" : [
{}
],
"msgs" : [
{}
],
"sendSupported" : true
}
}

View File

@ -0,0 +1 @@
{ "Connection": "4G", "Service": "LTE", "Temp": "30°C", "Accu": "30°C", "Signal": "4/5", "Charge": "96%", "Voltage": "4109mV", "TempCrit": "false", "AccuCrit": "Normal", "Charging": "false", "Network": "Vodafone.de" }

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="stat.xsl" ?>
<rtmp>
<nginx_version>1.14.2</nginx_version>
<nginx_rtmp_version>1.1.4</nginx_rtmp_version>
<built>Aug 24 2020 10:18:43</built>
<pid>1769</pid>
<uptime>331288</uptime>
<naccepted>927</naccepted>
<bw_in>2063176</bw_in>
<bytes_in>91542320679</bytes_in>
<bw_out>2110696</bw_out>
<bytes_out>90168782731</bytes_out>
<server>
<application>
<name>live</name>
<live>
<stream>
<name>live</name>
<time>657650</time><bw_in>2105248</bw_in>
<bytes_in>211221566</bytes_in>
<bw_out>2105248</bw_out>
<bytes_out>207973546</bytes_out>
<bw_audio>103712</bw_audio>
<bw_video>2001536</bw_video>
<client><id>875208</id><address>172.18.0.1</address><time>642170</time><flashver>LNX 9,0,124,2</flashver><dropped>0</dropped><avsync>-19</avsync><timestamp>662760</timestamp><active/></client>
<client><id>875144</id><address>172.18.0.1</address><time>658550</time><dropped>0</dropped><avsync>-19</avsync><timestamp>662760</timestamp><publishing/><active/></client>
<meta><video><width>1920</width><height>1080</height><frame_rate>25</frame_rate><codec>H264</codec><profile>High</profile><compat>0</compat><level>4.2</level></video><audio><codec>AAC</codec><profile>LC</profile><channels>2</channels><sample_rate>48000</sample_rate></audio></meta>
<nclients>2</nclients>
<publishing/>
<active/>
</stream>
<nclients>2</nclients>
</live>
</application>
</server>
</rtmp>

133
build/nginx/nginx.conf Normal file
View File

@ -0,0 +1,133 @@
load_module "modules/ngx_rtmp_module.so";
user www-data;
worker_processes 1;
events {
worker_connections 1024;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
access_log /nginx_access.log;
error_log /nginx_error.log info;
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
allow all;
satisfy any;
}
location /stat.xsl {
root /var/www/html;
allow all;
satisfy any;
}
location / {
root /var/www/html;
try_files $uri $uri/index.py;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~* remote.js$ {
root /var/www/html;
allow all;
satisfy any;
}
location ~* debug.xml$ {
root /var/www/html;
allow all;
satisfy any;
}
location ~* \.php$ {
root /var/www/html/;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
allow all;
satisfy any;
}
location ~* data.py$ {
gzip off;
root /var/www/html/;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
allow all;
satisfy any;
}
location ~* set_obs.py$ {
gzip off;
root /var/www/html/;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
allow all;
satisfy any;
}
location ~* set_ext.py$ {
gzip off;
root /var/www/html/;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
allow all;
satisfy any;
}
location ~* \.py$ {
gzip off;
root /var/www/html/;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
allow 127.0.0.1;
auth_basic "Login with your OBS remote password";
auth_basic_user_file /var/www/.htpasswd;
satisfy any;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
allow publish all;
on_publish http://localhost/auth.php;
drop_idle_publisher 10s;
}
}
}

247
build/scripts/irc_bot.py Normal file
View File

@ -0,0 +1,247 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import importlib
import time
import random
import logging
import memcache
import irc.bot
from pprint import pprint
from lib import obs as obsremote
try:
from vol import irc_commands
logging.info('Successfully imported external commands file')
ext_commands = True
except Exception as e:
logging.warning('No valid external commands file found')
logging.warning(e)
ext_commands = False
ignore = [ "StreamElements", "Nightbot", "Streamlabs", "Moobot" ]
greeter = []
last_online_message = 10
last_offline_message = 10
last_bitrate_msg = 10
class TwitchBot(irc.bot.SingleServerIRCBot):
def __init__(self, conf):
self.channel = '#' + conf['IRC_CHANNEL']
self.cooldown = conf['IRC_COOLDOWN']
self.cooldownTime = time.time() - int(conf['IRC_COOLDOWN'])
self.conf = conf
self._active = True
server = 'irc.chat.twitch.tv'
port = 6667
logging.info('Connecting to ' + str(server) + ' on port ' + str(port) + '...')
irc.bot.SingleServerIRCBot.__init__(self, [(server, port, 'oauth:' + conf['IRC_OAUTH_TOKEN'])], conf['IRC_USERNAME'], conf['IRC_USERNAME'])
def start(self):
logging.debug('Starting IRC-Bot...')
self._connect()
while self._active:
self.reactor.process_once(timeout=0.2)
def die(self):
logging.debug('Stopping IRC-Bot...')
self.connection.disconnect("Disconnect")
self._active = False
def on_welcome(self, c, e):
logging.info('Joining ' + str(self.channel))
c.cap('REQ', ':twitch.tv/membership')
c.cap('REQ', ':twitch.tv/tags')
c.cap('REQ', ':twitch.tv/commands')
c.join(self.channel)
logging.info('Bot is ready')
c.privmsg(self.channel, self.conf['IRC_BOT_EMOTE'] + ' A wild IRL bot appears!')
def on_pubmsg(self, c, e):
global greeter
if e.arguments[0][:1] == '!':
cmd = e.arguments[0].split(' ')[0][1:]
self.do_command(e, cmd)
elif self.conf['IRC_GREETER_WELCOME']:
logging.debug('Check for greet')
for tag in e.tags:
if tag['key'] == 'display-name':
nickname = tag['value']
logging.debug('Found display-name')
if nickname not in greeter and nickname not in ignore:
c.privmsg(self.channel, str(self.conf['IRC_GREETER_WELCOME']) + " " + str(nickname) + " " + str(self.conf['IRC_GREETER_EMOTE']))
logging.debug('Greetings send')
greeter.append(nickname)
else:
logging.debug('Already greeted')
else:
logging.debug('Could not found display-name, skipping greet')
return
def display_size(self, bytes_in):
units = [ 'bytes', 'KB', 'MB', 'GB', 'TB' ]
step_unit = 1024
for unit in units:
if bytes_in < step_unit:
return "%3.1f %s" % (bytes_in, unit)
bytes_in /= step_unit
def display_time(self, seconds, granularity=2):
intervals = (
('weeks', 604800), # 60 * 60 * 24 * 7
('days', 86400), # 60 * 60 * 24
('hours', 3600), # 60 * 60
('minutes', 60),
('seconds', 1),
)
result = []
for name, count in intervals:
value = int(seconds) // count
if value:
seconds -= int(value) * count
if int(value) == 1:
name = name.rstrip('s')
result.append("{} {}".format(value, name))
return ', '.join(result[:granularity])
def do_command(self, e, cmd):
mc = memcache.Client(['localhost:11211'], debug=0)
obs_remote = obsremote.ObsRemote(self.conf)
obs_remote.connect()
c = self.connection
currentTime = time.time()
logging.info('Got command')
if float(currentTime) - float(self.cooldownTime) >= float(self.cooldown) or self.get_role(e.tags) == "moderator" or self.get_role(e.tags) == "broadcaster":
logging.debug(e.tags)
if cmd == "bitrate":
try:
current_bitrate = mc.get('RTMP_BITRATE')
c.privmsg(self.channel, str(self.conf['IRC_BITRATE_MSG_PRE']) + ": " + str(current_bitrate) + " " + str(self.conf['IRC_BITRATE_MSG_SUF']))
except:
c.privmsg(self.channel, "There was an error fetching the bitrate, sorry. Please try again, later.")
if cmd == "reload":
logging.info('Got RELOAD command')
role = self.get_role(e.tags)
if role == "broadcaster" or role == "moderator":
if mc.get('OBS_CURRENT_SCENE') == self.conf['OBS_LIVE_SCENE']:
logging.debug('Reloading LIVE scene')
obs_remote.set_scene(self.conf['OBS_BRB_SCENE'])
obs_remote.set_scene(self.conf['OBS_LIVE_SCENE'])
else:
logging.info('Not in LIVE scene, will not reload')
else:
logging.debug('User was not authorized for RELOAD command')
if cmd == "brb":
logging.info('Got BRB command')
role = self.get_role(e.tags)
if role == "broadcaster" or role == "moderator":
logging.debug('Switching to FORCED_BRB_SCENE')
obs_remote.set_scene(self.conf['OBS_FORCED_BRB_SCENE'])
else:
logging.debug('User was not authorized for BRB command')
if cmd == "live":
logging.info('Got LIVE command')
role = self.get_role(e.tags)
if role == "broadcaster":
logging.debug('Switching to LIVE_SCENE')
obs_remote.set_scene(self.conf['OBS_LIVE_SCENE'])
else:
logging.debug('User was not authorized for LIVE command')
if cmd == "irlstatus":
logging.info('Got IRLSTATUS command')
role = self.get_role(e.tags)
if role == "broadcaster" or role == "moderator":
try:
uptime = self.display_time(float(mc.get('RTMP_UPTIME')), 5)
connections = float(mc.get('RTMP_NACCEPTED')) / 2 if mc.get('RTMP_NACCEPTED') else "an unknown number of"
bytes_in = self.display_size(float(mc.get('RTMP_BYTES_IN_SUM')))
last_reconnect = self.display_time(float(mc.get('RTMP_LAST_RECONNECT')))
c.privmsg(self.channel, "The current uptime is: " + str(uptime) + " there were " + str(connections) + " reconnects. A total of " + str(bytes_in) + " were transferred. The last disconnect was "+ str(last_reconnect) +" ago.")
except:
c.privmsg(self.channel, "There was an error fetching the status, sorry. Please try again, later.")
if cmd == "irlclear":
logging.info('Got IRLclear command')
role = self.get_role(e.tags)
if role == "broadcaster" or role == "moderator":
self.clear_greeter()
c.privmsg(self.channel, "Greeter was cleared.")
if ext_commands:
importlib.reload(irc_commands)
if cmd in irc_commands.commands:
logging.info('Got Custom command')
try:
roles = irc_commands.commands[cmd]['roles']
text = irc_commands.commands[cmd]['text']
logging.debug(roles)
logging.debug(text)
if self.get_role(e.tags) in roles or "any" in roles:
c.privmsg(self.channel, str(random.choice(text)))
except Exception as e:
logging.warning('Error during processing of custom command')
logging.warning(e)
else:
logging.info('Still in cooldown period')
return
def get_role(self, tags):
for tag in tags:
if tag['key'] == "badges":
if tag['value']:
badges = tag['value'].split(',')
for badge in badges:
role = badge.split('/')
logging.debug('Role: ' + str(role[0]))
return role[0]
logging.debug('Could not get role')
return False
def clear_greeter(self):
global greeter
greeter = []
return
def main():
from lib import config
conf = config.get_config()
mc = memcache.Client(['localhost:11211'], debug=0)
while not mc.get('OBS_STREAMING_STATUS'):
logging.info('OBS is not streaming, delaying bot init, will check again in 10 seconds...')
time.sleep(10)
logging.basicConfig(format='%(asctime)s %(module)s %(levelname)s: %(message)s')
logging.getLogger().setLevel(conf['LOG_LEVEL'])
bot = TwitchBot(conf)
bot.start()
if __name__ == "__main__":
main()

View File

174
build/scripts/lib/config.py Normal file
View File

@ -0,0 +1,174 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import os
import logging
logging.basicConfig(format='%(asctime)s %(module)s %(levelname)s: %(message)s')
vars = [
'OBS_URL',
'OBS_PORT',
'OBS_PASSWORD',
'OBS_START_SCENE',
'OBS_LIVE_SCENE',
'OBS_BRB_SCENE',
'OBS_FORCED_BRB_SCENE',
'OBS_OFFLINE_SCENE',
'LOW_BITRATE',
'RTMP_STAT_URL',
'RTMP_STREAM_NAME',
'LIVEU',
'LIVEU_TOKEN_TTL',
'LIVEU_USERNAME',
'LIVEU_PASSWORD',
'LIVEU_URL',
'LIVEU_UNIT',
'LIVEU_API',
'IRC_CHANNEL',
'IRC_USERNAME',
'IRC_OAUTH_TOKEN',
'IRC_COOLDOWN',
'IRC_GREETER_WELCOME',
'IRC_GREETER_EMOTE',
'IRC_BOT_EMOTE',
'IRC_BITRATE_MSG_PRE',
'IRC_BITRATE_MSG_SUF',
'IRC_LOW_BITRATE_MSG_INTERVAL',
'PUSHOVER_USER_KEY',
'PUSHOVER_APP_TOKEN',
'LOG_LEVEL',
'DAYFLAT',
'CHAT_HEIGHT',
'DEBUG',
'EXTDATA'
]
def get_config():
''' Get config values from environment, see `examples/docker-compose/docker-compose.override.yml` for details '''
conf = {}
for var in vars:
if var not in os.environ:
conf[var] = False
else:
conf[var] = os.environ.get(var)
if not conf['LOG_LEVEL']:
logging.getLogger().setLevel(logging.ERROR)
logging.warning('LOG_LEVEL is not set, using default')
conf['LOG_LEVEL'] = logging.ERROR
else:
logging.info('Log level: %s', conf['LOG_LEVEL'])
logging.getLogger().setLevel(conf['LOG_LEVEL'])
if not conf['DEBUG']:
conf['DEBUG'] = False
else:
logging.warning('Debug-Mode is active')
conf['DEBUG'] = True
if not conf['EXTDATA']:
conf['EXTDATA'] = False
else:
logging.warning('Using external data source')
conf['EXTDATA'] = True
if not conf['DAYFLAT']:
logging.warning('DAYFLAT is not set, using default')
conf['DAYFLAT'] = False
if not conf['IRC_CHANNEL']:
logging.warning('IRC_CHANNEL is not set, disabling bot')
conf['IRC_CHANNEL'] = False
if not conf['IRC_COOLDOWN']:
logging.warning('IRC_COOLDOWN is not set, using default')
conf['IRC_COOLDOWN'] = 30
if not conf['IRC_GREETER_WELCOME']:
logging.warning('IRC_GREETER_WELCOME is not set, disabling greeter')
conf['IRC_GREETER_WELCOME'] = False
if not conf['IRC_GREETER_EMOTE']:
logging.warning('IRC_GREETER_EMOTE is not set, using default')
conf['IRC_GREETER_EMOTE'] = "HeyGuys"
if not conf['IRC_BOT_EMOTE']:
logging.warning('IRC_BOT_EMOTE is not set, using default')
conf['IRC_BOT_EMOTE'] = "MrDestructoid"
if not conf['IRC_BITRATE_MSG_PRE']:
logging.warning('IRC_BITRATE_MSG_PRE is not set, using default')
conf['IRC_BITRATE_MSG_PRE'] = "Current bitrate:"
if not conf['IRC_BITRATE_MSG_SUF']:
logging.warning('IRC_BITRATE_MSG_SUF is not set, using default')
conf['IRC_BITRATE_MSG_SUF'] = "kBit/sec."
if not conf['IRC_LOW_BITRATE_MSG_INTERVAL']:
logging.warning('IRC_LOW_BITRATE_MSG_INTERVAL is not set, using default')
conf['IRC_LOW_BITRATE_MSG_INTERVAL'] = 30
if not conf['OBS_URL']:
logging.warning('OBS_URL is not set, using default')
conf['OBS_URL'] = "host.docker.internal"
if not conf['OBS_PORT']:
logging.warning('OBS_PORT is not set, using default')
conf['OBS_PORT'] = "4444"
if not conf['OBS_START_SCENE']:
logging.warning('OBS_START_SCENE is not set, using default')
conf['OBS_START_SCENE'] = 'START'
if not conf['OBS_LIVE_SCENE']:
logging.warning('OBS_LIVE_SCENE is not set, using default')
conf['OBS_LIVE_SCENE'] = 'LIVE'
if not conf['OBS_BRB_SCENE']:
logging.warning('OBS_BRB_SCENE is not set, using default')
conf['OBS_BRB_SCENE'] = 'BRB'
if not conf['OBS_FORCED_BRB_SCENE']:
logging.warning('OBS_FORCED_BRB_SCENE is not set, using default')
conf['OBS_FORCED_BRB_SCENE'] = 'FORCED_BRB'
if not conf['OBS_OFFLINE_SCENE']:
logging.warning('OBS_OFFLINE_SCENE is not set, using default')
conf['OBS_OFFLINE_SCENE'] = 'OFFLINE'
if not conf['RTMP_STAT_URL']:
logging.warning('RTMP_STAT_URL is not set, using default')
conf['RTMP_STAT_URL'] = "http://localhost/stats/"
if not conf['RTMP_STREAM_NAME']:
logging.warning('RTMP_STREAM_NAME is not set, using default')
conf['RTMP_STREAM_NAME'] = "live"
if not conf['LOW_BITRATE']:
logging.warning('LOW_BITRATE is not set, using default')
conf['LOW_BITRATE'] = 500
if conf['IRC_CHANNEL']:
if not conf['IRC_USERNAME']:
logging.critical('IRC_USERNAME is not set')
raise Exception('Config Error')
if not conf['IRC_OAUTH_TOKEN']:
logging.critical('IRC_OAUTH_TOKEN is not set')
raise Exception('Config Error')
if not conf['OBS_PASSWORD']:
logging.critical('OBS_PASSWORD is not set')
raise Exception('Config Error')
return conf
def main():
conf = get_config()
print(conf)
if __name__ == "__main__":
main()

219
build/scripts/lib/obs.py Normal file
View File

@ -0,0 +1,219 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import logging
from obswebsocket import obsws, requests
class ObsRemote():
def __init__(self, conf):
global stats
self._error = False
self._stats = False
self._conf = conf
stats = {}
stats['streaming'] = False
def connect(self):
try:
logging.debug('Connecting to OBS')
self._ws = obsws(self._conf['OBS_URL'], self._conf['OBS_PORT'], self._conf['OBS_PASSWORD'])
self._ws.connect()
self._ws.register(stream_status)
except:
logging.error('Could not connect to OBS')
self._error = "connect"
self._ws = False
pass
return self._ws
def is_streaming(self):
logging.debug('is_streaming')
try:
logging.debug('Getting streaming status')
status = self._ws.call(requests.GetStreamingStatus())
status = status.getStreaming()
logging.debug('Streaming status: %s', status)
self._is_streaming = status
except:
logging.warning('Could not get streaming status')
self._is_streaming = False
self._error = "is_streaming"
return self._is_streaming
def get_scene(self):
logging.debug('get_scene')
try:
logging.debug('Getting current OBS scene')
scene = self._ws.call(requests.GetCurrentScene())
current_scene = scene.getName()
self._current_scene = current_scene
except:
logging.warning('Could not get current OBS scene')
self._current_scene = False
self._error = "get_scene"
return self._current_scene
def get_sources_and_filter(self):
logging.debug('get_sources_and_filter')
active_vlc_sources = ""
active_filters = ""
active_audio = ""
muted_vlc_sources = ""
muted_filters = ""
muted_audio = ""
volume_settings = ""
logging.debug('Getting OBS scene elements')
sources = self._ws.call(requests.GetSourcesList())
for s in sources.getSources():
if s['typeId'] == "vlc_source":
active_vlc_sources += str(s['name'])+','
filters = self._ws.call(requests.GetSourceFilters(s['name']))
for f in filters.getFilters():
if f['enabled']:
active_filters += str(s['name'])+'|'+str(f['name'])+','
else:
muted_filters += str(s['name'])+'|'+str(f['name'])+','
else:
muted_vlc_sources = str(s['name'])+','
if s['typeId'] == "vlc_source" or s['typeId'] == 'ffmpeg_source' or s['typeId'] == 'wasapi_input_capture' or s['typeId'] == 'wasapi_output_capture':
audio_status = self._ws.call(requests.GetMute(s['name']))
if audio_status.getMuted():
muted_audio += str(s['name'])+','
volume_settings += '0'+','
else:
active_audio += str(s['name'])+','
volume = self._ws.call(requests.GetVolume(s['name']))
volume_settings += str(round(float(volume.getVolume()) * 100,1))+','
active_vlc_sources = active_vlc_sources[:-1]
active_filters = active_filters[:-1]
active_audio = active_audio[:-1]
muted_vlc_sources = muted_vlc_sources[:-1]
muted_filters = muted_filters[:-1]
muted_audio = muted_audio[:-1]
volume_settings = volume_settings[:-1]
sources_and_filter = { "active_vlc_sources": active_vlc_sources, "active_filters": active_filters, "active_audio": active_audio, "muted_vlc_sources": muted_vlc_sources, "muted_filters": muted_filters, "muted_audio": muted_audio, "volume_settings": volume_settings}
return sources_and_filter
def set_scene(self, scene):
logging.debug('set_scene')
try:
logging.debug('Settings OBS scene')
self._ws.call(requests.SetCurrentScene(scene))
sources = self._ws.call(requests.GetSourcesList())
# Reload all vlc_sources in scene, otherwise video might get stuck
for s in sources.getSources():
if s['typeId'] == 'vlc_source':
self._ws.call(requests.SetSceneItemRender(s['name'], False))
self._ws.call(requests.SetSceneItemRender(s['name'], True))
current_scene = self._ws.call(requests.GetCurrentScene())
except Exception as e:
logging.warning('Could not set OBS scene')
logging.warning(e)
current_scene = False
self._error = "set_scene"
pass
self._current_scene = current_scene
return current_scene
def error(self):
logging.debug('OBS Error: %s', str(self._error))
error = self._error
self._error = False
return error
def get(self):
logging.debug('get')
global stats
return stats
stats = {}
def stream_status(message):
logging.debug('stream_status')
global stats
# pyobs thread crashes when OBS gets closed
# We need to know as we won't get any status infos afterwards
# As we will receive many other events after Exit we need to make sure
# that stats will not be overwritten, otherwise there is no way to
# inform the main loop.
if stats['streaming'] == "Exit":
return
if message.name == "Exiting":
logging.debug('OBS was shut down')
stats['streaming'] = "Exit"
stats['error'] = False
return
# Collect stats, as only certain events will have the dict key below
# we wrap everything in try/except. This may produce errors in debuglog.
# TODO: Check event type
try:
stats = {
'num-dropped-frames': message.getNumDroppedFrames(),
'preview-only': message.getPreviewOnly(),
'num-total-frames': message.getNumTotalFrames(),
'stream-timecode': message.getTotalStreamTime(),
'output-total-frames': message.getOutputTotalFrames(),
'average-frame-time': message.getAverageFrameTime(),
'kbits-per-sec': message.getKbitsPerSec(),
'render-missed-frames': message.getRenderMissedFrames(),
'total-stream-time': message.getTotalStreamTime(),
'memory-usage': message.getMemoryUsage(),
'bytes-per-sec': message.getBytesPerSec(),
'strain': message.getStrain(),
'recording': message.getRecording(),
'cpu-usage': message.getCpuUsage(),
'replay-buffer-active': message.getReplayBufferActive(),
'output-skipped-frames': message.getOutputSkippedFrames(),
'fps': message.getFps(),
'render-total-frames': message.getRenderTotalFrames(),
'streaming': message.getStreaming(),
'free-disk-space': message.getFreeDiskSpace(),
}
except Exception as e:
logging.error(e)
stats = {
'streaming': False,
'error': True
}
logging.debug(stats)
def main():
print("Nothing to see here")
if __name__ == "__main__":
main()

212
build/scripts/lib/rtmp.py Normal file
View File

@ -0,0 +1,212 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import time
import json
import requests
import logging
from bs4 import BeautifulSoup
from pprint import pprint
class RtmpStats():
def __init__(self, conf):
self._error = False
self._conf = conf
self._stream = conf['RTMP_STREAM_NAME']
self._error = self.error()
self._xml_timestamp = 0
self._xml = False
if self._conf['DEBUG']:
logging.warning('Debug mode active: Using http://localhost/debug.xml as RTMP status source')
self._conf['RTMP_STAT_URL'] = 'http://localhost/debug.xml'
def get_tag(self, xml, tag):
for value in xml.find_all(tag):
return str(value.text)
return 0
def load(self):
''' Load stats from RTMP server '''
logging.debug('Getting RTMP data from: ' + str(self._conf['RTMP_STAT_URL']))
try:
logging.debug('Loading RTMP stats')
xml = requests.get(self._conf['RTMP_STAT_URL'])
if xml.status_code != 200:
logging.error('Could not get RTMP stats from %s', str(self._conf['RTMP_STAT_URL']))
self._error = True
xml = xml.text
logging.debug('Parsing RTMP stats')
xml = BeautifulSoup(xml, 'lxml')
self._xml_timestamp = time.time()
self._xml = xml
return xml
except Exception as e:
logging.error('Could not get/parse RTMP stats from %s', str(self._conf['RTMP_STAT_URL']))
logging.error(e)
self._error = True
return False
def get(self):
''' Returns RTMP stat values '''
xml = self.load()
rtmp_stats = {}
rtmp_stats['uptime'] = self.get_tag(xml, 'uptime')
rtmp_stats['accepted'] = self.get_tag(xml, 'naccepted')
rtmp_stats['bw_in_sum'] = self.get_tag(xml, 'bw_in')
rtmp_stats['bw_out_sum'] = self.get_tag(xml, 'bw_out')
rtmp_stats['bytes_in_sum'] = self.get_tag(xml, 'bytes_in')
rtmp_stats['bytes_out_sum'] = self.get_tag(xml, 'bytes_out')
for stream in xml.findAll('stream'):
stream_name = self.get_tag(stream, 'name')
if stream_name not in rtmp_stats:
rtmp_stats[stream_name] = {}
rtmp_stats[stream_name]['video'] = {}
rtmp_stats[stream_name]['audio'] = {}
rtmp_stats[stream_name]['audio'] = {}
rtmp_stats[stream_name]['client'] = {}
rtmp_stats[stream_name]['bw_audio'] = self.get_tag(stream, 'bw_audio')
rtmp_stats[stream_name]['bw_video'] = self.get_tag(stream, 'bw_video')
rtmp_stats[stream_name]['bw_in'] = self.get_tag(stream, 'bw_in')
rtmp_stats[stream_name]['bw_out'] = self.get_tag(stream, 'bw_out')
rtmp_stats[stream_name]['bytes_in'] = self.get_tag(stream, 'bytes_in')
rtmp_stats[stream_name]['bytes_out'] = self.get_tag(stream, 'bytes_out')
rtmp_stats[stream_name]['clients'] = self.get_tag(stream, 'nclients')
for video in stream.find_all('video'):
rtmp_stats[stream_name]['video']['width'] = self.get_tag(video, 'width')
rtmp_stats[stream_name]['video']['height'] = self.get_tag(video, 'height')
rtmp_stats[stream_name]['video']['frame_rate'] = self.get_tag(video, 'frame_rate')
rtmp_stats[stream_name]['video']['codec'] = self.get_tag(video, 'codec')
rtmp_stats[stream_name]['video']['profile'] = self.get_tag(video, 'profile')
for audio in stream.find_all('audio'):
rtmp_stats[stream_name]['audio']['channels'] = self.get_tag(audio, 'channels')
rtmp_stats[stream_name]['audio']['sample_rate'] = self.get_tag(audio, 'sample_rate')
rtmp_stats[stream_name]['audio']['codec'] = self.get_tag(audio, 'codec')
rtmp_stats[stream_name]['audio']['profile'] = self.get_tag(audio, 'profile')
client_id = 0
for client in stream.find_all('client'):
if id not in rtmp_stats[stream_name]['client']:
rtmp_stats[stream_name]['client'][client_id] = {}
rtmp_stats[stream_name]['client'][client_id]['address'] = self.get_tag(client, 'address')
rtmp_stats[stream_name]['client'][client_id]['time'] = self.get_tag(client, 'time')
rtmp_stats[stream_name]['client'][client_id]['flashver'] = self.get_tag(client, 'flashver')
rtmp_stats[stream_name]['client'][client_id]['dropped'] = self.get_tag(client, 'dropped')
rtmp_stats[stream_name]['client'][client_id]['avsync'] = self.get_tag(client, 'avsync')
rtmp_stats[stream_name]['client'][client_id]['timestamp'] = self.get_tag(client, 'timestamp')
if self.get_tag(client, 'publishing'):
rtmp_stats[stream_name]['client'][client_id]['publishing'] = True
else:
rtmp_stats[stream_name]['client'][client_id]['publishing'] = False
client_id = client_id + 1
self._stats = rtmp_stats
return rtmp_stats
def check_low_bitrate(self):
''' Check if bitrate is below threshold '''
bitrate = self.get_bitrate()
if int(bitrate) <= int(self._conf['LOW_BITRATE']):
logging.info('Bitrate is low')
return True
else:
logging.debug('Bitrate is good')
return False
def get_bitrate(self):
''' Get current bitrate for given stream '''
stream = self._conf['RTMP_STREAM_NAME']
streams = 0
xml = self.load()
try:
#bitrate = xml.select_one('rtmp server application ' + stream + ' stream bw_in')
bitrate = xml.select_one('rtmp bw_in')
streams = len(xml.find_all('publishing'))
if not streams:
streams = 1
bitrate = bitrate.text
bitrate = int(bitrate) / 1024 / int(streams)
except Exception as e:
bitrate = 0
logging.warning('Could not get bitrate')
logging.warning(e)
self._error = True
pass
logging.debug('Current Bitrate: %s', str(bitrate))
self._bitrate = bitrate
return bitrate
def get_publishing_status(self):
''' Get publishing status for given stream '''
logging.debug('Getting publishing status for: ' + str(self._conf['RTMP_STREAM_NAME']))
stream = self._conf['RTMP_STREAM_NAME']
xml = self.load()
try:
publishing = xml.select_one('rtmp server application ' + str(stream) + ' stream publishing')
except Exception as e:
publishing = False
logging.warning('Could not get publishing status')
logging.warning(e)
self._error = True
pass
if publishing:
publishing = True
else:
publishing = False
return publishing
def error(self):
logging.debug('RTMP Error: %s', str(self._error))
return self._error
def get_json(self):
json_stats = json.loads(json.dumps(self._stats), parse_int=str)
return json_stats
def main():
print("Nothing to see here")
if __name__ == "__main__":
main()

View File

@ -0,0 +1,138 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import yaml
import time
import logging
import memcache
import requests as webrequests
from pprint import pprint
from lib import config
conf = config.get_config()
def login(liveu_username, liveu_password, liveu_url):
login_header = {
'Origin': 'https://solo.liveu.tv',
'Authorization': 'Basic '+ liveu_password,
'Content-Type': 'application/json;charset=UTF-8',
'Accept': 'application/json, text/plain, */*',
'Referer': 'https://solo.liveu.tv/login',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.102 Safari/537.36',
'DNT': '1',
'x-user-name': liveu_username
}
login_payload = '{"return_to":"https://solo.liveu.tv/#/dashboard/units"}'
if conf['DEBUG']:
return "DEBUG"
try:
r = webrequests.post(liveu_url, data=login_payload.encode(), headers=login_header)
rjson = r.json()
if r.status_code == 200 and 'access_token' in rjson['data']['response']:
access_token = rjson['data']['response']['access_token']
else:
access_token = 'invalid'
logging.fatal("Could not get access token")
except Exception as e:
logging.warning("Could not connect to service or invalid JSON response")
logging.warning(e)
access_token = False
return access_token
def get_data(access_token, liveu_unit, liveu_api, endpoint):
api_header = {
'Accept': 'application/json, text/plain, */*',
'Referer': 'https://solo.liveu.tv/dashboard/units/' + str(liveu_unit),
'Origin': 'https://solo.liveu.tv',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.102 Safari/537.36',
'Authorization': 'Bearer ' + str(access_token),
'DNT': '1'
}
liveu_api = liveu_api + '/' + str(liveu_unit) + '/' + str(endpoint)
if conf['DEBUG']:
if endpoint == "status":
ryaml = '{"deviceId":"Boss100_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","upTime":2305.560333,"liveuVersion":null,"state":"streaming","battery":{"connected":true,"percentage":64,"runTimeToEmpty":100,"discharging":false,"charging":true},"lu1100":null,"modems":[{"connected":true,"name":"Ethernet","downlinkKbps":0,"uplinkKbps":632,"enabled":true,"port":"eth0","technology":"","upSignalQuality":4,"downSignalQuality":1,"activeSim":"","isCurrentlyRoaming":false,"kbps":632,"signalQuality":2},{"connected":false,"name":"No network","downlinkKbps":0,"uplinkKbps":0,"enabled":false,"port":"wlan0","technology":"","upSignalQuality":3,"downSignalQuality":3,"activeSim":"","isCurrentlyRoaming":false,"kbps":0,"signalQuality":3},{"connected":false,"name":"No Device","downlinkKbps":0,"uplinkKbps":0,"enabled":true,"port":"0","technology":"","upSignalQuality":3,"downSignalQuality":3,"activeSim":"","isCurrentlyRoaming":false,"kbps":0,"signalQuality":3},{"connected":false,"name":"No Device","downlinkKbps":0,"uplinkKbps":0,"enabled":true,"port":"1","technology":"","upSignalQuality":3,"downSignalQuality":3,"activeSim":"","isCurrentlyRoaming":false,"kbps":0,"signalQuality":3},{"connected":false,"name":"No Device","downlinkKbps":0,"uplinkKbps":0,"enabled":true,"port":"2","technology":"","upSignalQuality":3,"downSignalQuality":3,"activeSim":"","isCurrentlyRoaming":false,"kbps":0,"signalQuality":3},{"connected":false,"name":"No Device","downlinkKbps":0,"uplinkKbps":0,"enabled":true,"port":"3","technology":"","upSignalQuality":3,"downSignalQuality":3,"activeSim":"","isCurrentlyRoaming":false,"kbps":0,"signalQuality":3}],"videoMode":"1080p60","applicationType":"video","video":{"state":"streaming","channelUniqueId":null,"modemKeys":["eth0","wlan0","0","1","2","3"],"speedTest":null,"videoStandard":"1080p60"},"databridge":{"state":"idle","channelUniqueId":null,"modemKeys":["eth0","wlan0","0","1","2","3"],"speedTest":null},"filetransfer":null,"bitrate":632,"IsCameraConnected":false,"fetch logs":{"state":"idle","channelUniqueId":null,"modemKeys":null,"speedTest":null}}'
ryaml = yaml.load(ryaml, Loader=yaml.FullLoader)
else:
try:
r = webrequests.get(liveu_api, headers=api_header)
ryaml = yaml.load(r.text, Loader=yaml.FullLoader)
except Exception as e:
logging.warning("Could get or parse information from service")
logging.info(e)
return ryaml
def main():
logging.basicConfig(format='%(asctime)s %(module)s %(levelname)s: %(message)s')
logging.getLogger().setLevel(conf['LOG_LEVEL'])
mc = memcache.Client(['localhost:11211'], debug=0)
counter = conf['LIVEU_TOKEN_TTL']
mc.set('LIVEU', conf['LIVEU'])
# wait for other services to populate memcache data
logging.info('Waiting for other services...')
time.sleep(10)
while conf['LIVEU']:
logging.info('-------------------------------------------------------------------------------')
if not mc.get('OBS_STREAMING_STATUS'):
logging.info('OBS is not streaming, skipping...')
time.sleep(300)
continue
if int(counter) >= int(conf['LIVEU_TOKEN_TTL']):
logging.info("Getting LiveU access token")
access_token = login(conf['LIVEU_USERNAME'], conf['LIVEU_PASSWORD'], conf['LIVEU_URL'])
counter = 0
if access_token:
logging.debug('Getting LiveU infos')
data = get_data(access_token, conf['LIVEU_UNIT'], conf['LIVEU_API'], 'status')
if data:
if 'battery' in data:
logging.info('LiveU Battery status')
for key, value in data['battery'].items():
mc.set('LIVEU_BATTERY_'+str(key.upper()), float(value))
logging.info(str(key) +': ' + str(value))
else:
logging.warning('Could not get liveU battery status')
else:
logging.error('Could not get data from liveU webservice')
else:
logging.error('Error obtaining access_token for liveU')
logging.info('-------------------------------------------------------------------------------')
time.sleep(30)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,247 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import sys
import time
import logging
import requests
import memcache
from lib import config
from lib import obs as obsremote
from pprint import pprint
conf = config.get_config()
# Must be AFTER import config, as config sets default logging options
logging.basicConfig(format='%(asctime)s %(module)s %(levelname)s: %(message)s')
logging.getLogger().setLevel(conf['LOG_LEVEL'])
mc = memcache.Client(['localhost:11211'], debug=0)
def pushover_send(user, token, msg):
if user and token:
logging.debug('Send message to pushover')
r = requests.post("https://api.pushover.net/1/messages.json", data={ "token": token, "user": user, "message": str(msg) })
logging.debug(r)
return r
else:
return False
def countdown(t):
while t:
if logging.getLogger().level <= 20:
mins, secs = divmod(t, 60)
timeformat = '{:02d}:{:02d}'.format(mins, secs)
sys.stdout.write(timeformat + "\r")
time.sleep(1)
t -= 1
def print_info():
logging.info('-------------------------------------------------------------------------------')
logging.info('Stream Status')
logging.info("OBS Connection : %s", str(mc.get('OBS_CONNECTED')))
logging.info("OBS Streaming : %s", str(mc.get('OBS_STREAMING_STATUS')))
logging.info("OBS Scene : %s", str(mc.get('OBS_CURRENT_SCENE')))
logging.info("Bitrate : %s", str(mc.get('RTMP_BITRATE')))
logging.info("Low threshold : %s", str(conf['LOW_BITRATE']))
logging.info("Low bitrate : %s", str(mc.get('LOW_BITRATE')))
logging.info("Publishing : %s", str(mc.get('RTMP_PUBLISHING')))
logging.info('-------------------------------------------------------------------------------')
logging.info('OBS Stats')
logging.info("CPU usage : %s", str(mc.get('OBS_CPU-USAGE')))
logging.info("Memory usage : %s", str(mc.get('OBS_MEMORY-USAGE')))
logging.info("Free disk space : %s", str(mc.get('OBS_FREE-DISK-SPACE')))
logging.info("Stream timecode : %s", str(mc.get('OBS_STREAM-TIMECODE')))
logging.info("FPS : %s", str(mc.get('OBS_FPS')))
logging.info("kbits/sec. : %s", str(mc.get('OBS_KBITS-PER-SEC')))
logging.info("bytes/sec. : %s", str(mc.get('OBS_BYTES-PER-SEC')))
logging.info("Dropped frames : %s", str(mc.get('OBS_NUM-DROPPED-FRAMES')))
logging.info("Total frames : %s", str(mc.get('OBS_NUM-TOTAL-FRAMES')))
logging.info("Output skipped frames: %s", str(mc.get('OBS_OUTPUT-SKIPPED-FRAMES')))
logging.info("Output total frames : %s", str(mc.get('OBS_OUTPUT-TOTAL-FRAMES')))
logging.info("Avg. frame time : %s", str(mc.get('OBS_AVERAGE-FRAME-TIME')))
logging.info("Render total frames : %s", str(mc.get('OBS_RENDER-TOTAL-FRAMES')))
logging.info("Render missed frames : %s", str(mc.get('OBS_RENDER-MISSED-FRAMES')))
logging.info("Total stream time : %s", str(mc.get('OBS_TOTAL-STREAM-TIME')))
logging.info("Preview only : %s", str(mc.get('OBS_PREVIEW-ONLY')))
logging.info("Recording : %s", str(mc.get('OBS_RECORDING')))
logging.info("Strain : %s", str(mc.get('OBS_STRAIN')))
logging.info("Replay Buffer : %s", str(mc.get('OBS_REPLAY-BUFFER-ACTIVE')))
logging.info('-------------------------------------------------------------------------------')
logging.info("Active VLC Sources : %s", str(mc.get('OBS_ACTIVE_VLC_SOURCES')))
logging.info("Active Filters : %s", str(mc.get('OBS_ACTIVE_FILTERS')))
logging.info("Muted Audio Sources : %s", str(mc.get('OBS_MUTED_AUDIO')))
logging.info("Volume Settings : %s", str(mc.get('OBS_VOLUME_SETTINGS')))
logging.info('-------------------------------------------------------------------------------')
return True
def main():
o = False
obs_connected = False
obs_streaming_info_resend = True
rtmp_error_info_resend = True
forced_scene_info_resend = True
low_bitrate_info_resend = True
switch_to_brb = False
pu = conf['PUSHOVER_USER_KEY']
pt = conf['PUSHOVER_APP_TOKEN']
obs_remote = obsremote.ObsRemote(conf)
current_scene = obs_remote.get_scene()
mc.set('OBS_CONNECTED', "False")
mc.set('OBS_STREAMING_STATUS', "False")
mc.set('OBS_CURRENT_SCENE', current_scene)
active_vlc_sources = ""
active_filters = ""
muted_audio = ""
while True:
while not obs_connected:
logging.debug('Trying to connect to OBS')
obs = obs_remote.connect()
if obs:
obs_connected = True
logging.debug('OBS connection established')
pushover_send(pu,pt,'OBS connection established')
mc.set('OBS_CONNECTED', "True")
else:
logging.debug('OBS is not connected, waiting...')
pushover_send(pu,pt,'OBS is not connected, next connection attempt will be in 60 seconds.')
print_info()
mc.set('OBS_CONNECTED', "False")
obs_connected = False
countdown(60)
continue
mc.set('OBS_CONNECTED', "True")
if not obs_remote.is_streaming():
logging.info('OBS is not streaming')
mc.set('OBS_STREAMING_STATUS', "False")
current_scene = obs_remote.get_scene()
mc.set('OBS_CURRENT_SCENE', current_scene)
if obs_streaming_info_resend:
pushover_send(pu,pt,'OBS is not streaming, will check again in 5 seconds. This message is only sent once.')
obs_streaming_info_resend = False
print_info()
countdown(5)
else:
obs_streaming_info_resend = True
if mc.get("rtmp_error"):
logging.error('There was an RTMP error')
if rtmp_error_info_resend:
pushover_send(pu,pt,'There was an RTMP error, will check again in 30 seconds. This message is only sent once.')
rtmp_error_info_resend = False
print_info()
countdown(30)
continue
else:
rtmp_error_info_resend = True
obs_error = obs_remote.error()
if obs_error:
logging.error('There was an OBS error (%s)', obs_error)
pushover_send(pu,pt,'There was an OBS error. Will try again in 10 seconds. Stop the stream to stop this message from being sent.')
print_info()
countdown(10)
continue
else:
mc.set('OBS_CONNECTED', "True")
o = obs_remote.get()
try:
logging.info('Fetching OBS details')
for key, value in o.items():
mc.set('OBS_' + str(key).upper(), value)
except:
logging.warning('Error submitting OBS data to memcache')
current_scene = obs_remote.get_scene()
mc.set('OBS_CURRENT_SCENE', current_scene)
current_streaming_status = obs_remote.is_streaming()
mc.set('OBS_STREAMING_STATUS', current_streaming_status)
sources_and_filter = obs_remote.get_sources_and_filter()
if sources_and_filter:
mc.set('OBS_ACTIVE_VLC_SOURCES', sources_and_filter['active_vlc_sources'])
mc.set('OBS_ACTIVE_FILTERS', sources_and_filter['active_filters'])
mc.set('OBS_ACTIVE_AUDIO', sources_and_filter['active_audio'])
mc.set('OBS_MUTED_VLC_SOURCES', sources_and_filter['muted_vlc_sources'])
mc.set('OBS_MUTED_FILTERS', sources_and_filter['muted_filters'])
mc.set('OBS_MUTED_AUDIO', sources_and_filter['muted_audio'])
mc.set('OBS_VOLUME_SETTINGS', sources_and_filter['volume_settings'])
if not mc.get('RTMP_PUBLISHING') or mc.get('RTMP_LOW_BITRATE'):
logging.debug('No RTMP client is publishing with an sufficient bitrate')
if low_bitrate_info_resend:
pushover_send(pu,pt,'No RTMP client is publishing with an sufficient bitrate. Bitrate is '+str(mc.get('RTMP_BITRATE'))+' kbit/sec. - This message is only sent once.')
low_bitrate_info_resend = False
switch_to_brb = True
else:
switch_to_brb = False
low_bitrate_info_resend = True
# Check if we're in a scene we are not allowed to switch automatically.
if current_scene.startswith('FORCED') or current_scene == conf['OBS_OFFLINE_SCENE']:
logging.info('FORCED/OFFLINE scene active, will not switch scene.')
if forced_scene_info_resend:
pushover_send(pu,pt,'FORCED/OFFLINE scene active, will not switch scene. This message is only sent once.')
forced_scene_info_resend = False
print_info()
time.sleep(1)
continue
# Check if we need to automatically switch scenes.
if switch_to_brb:
if current_scene != conf['OBS_BRB_SCENE']:
logging.debug('Switching to BRB scene')
pushover_send(pu,pt,'Switching to BRB scene. The scene will be active for at least 5 seconds.')
obs_remote.set_scene(conf['OBS_BRB_SCENE'])
countdown(10)
else:
if current_scene != conf['OBS_LIVE_SCENE']:
logging.debug('Switching from BRB to LIVE')
pushover_send(pu,pt,'Switching to LIVE scene. Bitrate is '+str(mc.get('RTMP_BITRATE'))+' kbit/sec.')
obs_remote.set_scene(conf['OBS_LIVE_SCENE'])
forced_scene_info_resend = True
if o:
if o['streaming'] == "Exit":
logging.critical('OBS was shut down!')
pushover_send(pu,pt,'OBS was shut down! Will check again in 30 seconds. This message is only sent once.')
obs_connected = False
obs_streaming_info_resend = False
rtmp_error_info_resend = False
time.sleep(30)
print_info()
time.sleep(1)
if __name__ == "__main__":
main()

View File

@ -0,0 +1,85 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import time
import logging
import memcache
from pprint import pprint
from lib import config
from lib import rtmp
def main():
conf = config.get_config()
r = rtmp.RtmpStats(conf)
# Must be AFTER import config, as config sets default logging options
logging.basicConfig(format='%(asctime)s %(module)s %(levelname)s: %(message)s')
logging.getLogger().setLevel(conf['LOG_LEVEL'])
logging.debug('Connecting to memcache')
mc = memcache.Client(['localhost:11211'], debug=0)
while True:
try:
rtmp_stats = r.get()
stream = conf['RTMP_STREAM_NAME']
mc.set("RTMP_ERROR", r.error())
mc.set("RTMP_PUBLISHING", r.get_publishing_status())
mc.set("RTMP_BITRATE", r.get_bitrate())
mc.set("RTMP_LOW_BITRATE", r.check_low_bitrate())
while not r.get_publishing_status():
logging.warning('RTMP isn\'t publishing, waiting for incoming stream...')
mc.set("RTMP_LOW_BITRATE", True)
mc.set("RTMP_BITRATE", 0)
time.sleep(1)
continue
last_reconnect = int(rtmp_stats[stream]['client'][0]['time']) / 1000
mc.set("RTMP_UPTIME", rtmp_stats['uptime'])
mc.set("RTMP_LAST_RECONNECT", str(last_reconnect))
mc.set("RTMP_NACCEPTED", rtmp_stats['accepted'])
mc.set("RTMP_BYTES_IN", rtmp_stats[stream]['bytes_in'])
mc.set("RTMP_BYTES_IN_SUM", rtmp_stats['bytes_in_sum'])
logging.info('-------------------------------------------------------------------------------')
logging.info('RTMP Status')
logging.info("Monitored Stream : %s", str(stream))
logging.info("Publishing : %s", str(mc.get('RTMP_PUBLISHING')))
logging.info("Bitrate : %s", str(mc.get('RTMP_BITRATE')))
logging.info("Uptime (Total) : %s", str(mc.get('RTMP_UPTIME')))
logging.info("Uptime (Stream) : %s", str(mc.get('RTMP_LAST_RECONNECT')))
logging.info("Accepted : %s", str(mc.get('RTMP_NACCEPTED')))
logging.info("Bytes In (Stream) : %s", str(mc.get('RTMP_BYTES_IN')))
logging.info("Bytes In (Total) : %s", str(mc.get('RTMP_BYTES_IN_SUM')))
logging.info("Error : %s", str(mc.get('RTMP_ERROR')))
logging.info('-------------------------------------------------------------------------------')
except Exception as e:
logging.error('Error getting values from RTMP')
logging.info(e)
time.sleep(10)
time.sleep(1)
if __name__ == "__main__":
main()

View File

View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Important:
# Prefix any "text" with non ASCII chars with "u", e.g.:
# "äüöß" becomes u"äüöß"
# brb, live, irlstatus, irlclear, bitrate are reserved command keywords
# roles must contain any valid roles for the command (or "any")
# common roles are "broadcaster", "moderator", "any"
commands={
"ping": { "roles": ["broadcaster", "moderator"], "text": [u"pong"] },
"wo": { "roles": ["any"], "text": [u"EARTH!!! (most probably)", u"ZZ 9 Plural Z Alpha"] },
}

23
build/startup.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
cp /var/www/html/auth.php /tmp/auth.php
/usr/bin/envsubst '${STREAMKEY}' < /tmp/auth.php > /var/www/html/auth.php
cp /var/www/html/obs_settings.py /tmp/obs_settings.py
/usr/bin/envsubst < /tmp/obs_settings.py > /var/www/html/obs_settings.py
echo ${OBS_PASSWORD} | /usr/bin/htpasswd -c -i /var/www/.htpasswd admin
echo "Password for Admin-Interface: ${OBS_PASSWORD}"
/etc/init.d/memcached start
chmod 777 /var/run/
rm /var/run/fcgiwrap.socket > /dev/null 2>&1
if [ ${LIVEU} != "True" ]; then
echo "Removing LiveU service"
rm /etc/supervisor/conf.d/liveu_collector.conf
fi
touch /opt/scripts/vol/__init__.py
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
/usr/bin/supervisorctl status
tail -f /var/log/supervisor/irl.log

View File

@ -0,0 +1,8 @@
[program:fcgiwrap]
command=/usr/sbin/fcgiwrap -s unix:/var/run/fcgiwrap.socket -f
autostart=true
autorestart=true
user=www-data
stdout_logfile=/var/log/supervisor/fcgiwrap.log
stderr_logfile=/var/log/supervisor/fcgiwrap.log
socket=unix:///var/run/fcgiwrap.socket

View File

@ -0,0 +1,8 @@
[program:ircbot]
user=root
command=/opt/scripts/irc_bot.py
directory=/opt/scripts/
stdout_logfile=/var/log/supervisor/irl.log
stderr_logfile=/var/log/supervisor/irl.log
autostart=true
autorestart=true

View File

@ -0,0 +1,8 @@
[program:liveucollector]
user=root
command=/opt/scripts/liveu_collector.py
directory=/opt/scripts/
stdout_logfile=/var/log/supervisor/irl.log
stderr_logfile=/var/log/supervisor/irl.log
autostart=true
autorestart=true

View File

@ -0,0 +1,9 @@
[program:nginx]
user=root
command=/usr/sbin/nginx -g 'daemon off;'
directory=/usr/sbin/
stdout_logfile=/var/log/supervisor/nginx.log
stderr_logfile=/var/log/supervisor/nginx.log
autostart=true
autorestart=true

View File

@ -0,0 +1,8 @@
[program:obsctl]
user=root
command=/opt/scripts/obs_controller.py
directory=/opt/scripts/
stdout_logfile=/var/log/supervisor/irl.log
stderr_logfile=/var/log/supervisor/irl.log
autostart=true
autorestart=true

View File

@ -0,0 +1,9 @@
[program:php]
user=root
command=/usr/sbin/php-fpm7.4 -F
directory=/var/www/html/
stdout_logfile=/var/log/supervisor/php.log
stderr_logfile=/var/log/supervisor/php.log
autostart=true
autorestart=true

View File

@ -0,0 +1,8 @@
[program:rtmpcollector]
user=root
command=/opt/scripts/rtmp_collector.py
directory=/opt/scripts/
stdout_logfile=/var/log/supervisor/irl.log
stderr_logfile=/var/log/supervisor/irl.log
autostart=true
autorestart=true

BIN
build/www/ajax-loader.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

17
build/www/auth.php Normal file
View File

@ -0,0 +1,17 @@
<?php
// Why PHP you may ask, it everything else is python?!
// Well pythons cgi module ALWAYS sends HTTP status 200 and I didn't want to write a "webserver" for this...
$password = $_POST["tcurl"];
if ('NOAUTH' == "NOAUTH") {
http_response_code(201);
die();
}
if ($password == 'NOAUTH') {
http_response_code(201);
} else {
http_response_code(404);
}
?>

101
build/www/data.py Normal file
View File

@ -0,0 +1,101 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import obs_settings
import cgitb
import memcache
import string
import json
from pprint import pprint
if obs_settings.debug:
cgitb.enable()
safe = string.ascii_letters + string.digits
def safeid(s):
s = ''.join([c for c in s if c in safe])
while not s[0] in string.c:
s = s[1:]
return str(s)
def check_mc_value_float(value):
if value == None:
return 0
else:
return float(value)
def check_mc_value_bool(value):
if value:
return "True"
else:
return "False"
def check_mc_value_string(value):
if value is None:
return "False"
else:
return str(value)
print("HTTP/1.0 200 OK")
print("Content-type:application/json;charset=utf-8\r\n")
mc = memcache.Client(['localhost:11211'], debug=0)
dayflat = check_mc_value_bool(obs_settings.dayflat)
dropped_frames = check_mc_value_float(mc.get('OBS_NUM-DROPPED-FRAMES'))
uptime = check_mc_value_float(mc.get('OBS_STREAM-TIMECODE'))
cpu_usage = check_mc_value_float(mc.get('OBS_CPU-USAGE'))
bitrate_out = check_mc_value_float(mc.get('OBS_KBITS-PER-SEC'))
bitrate_in = check_mc_value_float(mc.get('RTMP_BITRATE'))
dropped_connections = check_mc_value_float(mc.get('RTMP_NACCEPTED'))
battery_connected = check_mc_value_bool(mc.get('LIVEU_BATTERY_CONNECTED'))
battery_charging = check_mc_value_bool(mc.get('LIVEU_BATTERY_CHARGING'))
battery_discharging = check_mc_value_bool(mc.get('LIVEU_BATTERY_DISCHARGING'))
battery_percentage = check_mc_value_float(mc.get('LIVEU_BATTERY_PERCENTAGE'))
battery_time = check_mc_value_float(mc.get('LIVEU_BATTERY_RUNTIMETOEMPTY'))
liveu = check_mc_value_bool(mc.get('LIVEU'))
current_scene = check_mc_value_string(mc.get('OBS_CURRENT_SCENE'))
streaming_status = check_mc_value_string(mc.get('OBS_STREAMING_STATUS'))
obs_status = check_mc_value_string(mc.get('OBS_CONNECTED'))
low_bitrate = check_mc_value_bool(mc.get('RTMP_LOW_BITRATE'))
active_vlc_sources = check_mc_value_string(mc.get('OBS_ACTIVE_VLC_SOURCES'))
active_filters = check_mc_value_string(mc.get('OBS_ACTIVE_FILTERS'))
active_audio = check_mc_value_string(mc.get('OBS_ACTIVE_AUDIO'))
muted_vlc_sources = check_mc_value_string(mc.get('OBS_MUTED_VLC_SOURCES'))
muted_filters = check_mc_value_string(mc.get('OBS_MUTED_FILTERS'))
muted_audio = check_mc_value_string(mc.get('OBS_MUTED_AUDIO'))
connection = ""
service = ""
if mc.get('ESP32') is not None:
ext_data = json.loads(mc.get('ESP32'))
if 'Connection' in ext_data:
connection = ext_data['Connection']
if 'Service' in ext_data:
service = ext_data['Service']
print('{"numdroppedframes": "%s", "totalstreamtime": "%s", "cpuusage": "%s", "kbitspersec": "%s", "bitrate": "%s", "connections": "%s", "batteryconnected": "%s", "batterycharging": "%s", "batterydischarging": "%s", "batterypercentage": "%s", "batterytime": "%s", "liveu": "%s", "currentscene": "%s", "activevlcsources": "%s", "activefilters": "%s", "activeaudio": "%s", "mutedvlcsources": "%s", "mutedfilters": "%s", "mutedaudio": "%s", "streamingstatus": "%s", "obsstatus": "%s", "lowbitrate": "%s", "dayflat": "%s", "connection": "%s %s"}' % (dropped_frames, uptime, cpu_usage, bitrate_out, bitrate_in, dropped_connections, battery_connected, battery_charging, battery_discharging, battery_percentage, battery_time, liveu, current_scene, active_vlc_sources, active_filters, active_audio, muted_vlc_sources, muted_filters, muted_audio, streaming_status, obs_status, low_bitrate, dayflat, service, connection))

41
build/www/ext_data.py Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import obs_settings
import cgitb
import memcache
import json
if obs_settings.debug:
cgitb.enable()
print("HTTP/1.0 200 OK")
print("Content-type:application/json;charset=utf-8\r\n")
mc = memcache.Client(['localhost:11211'], debug=0)
if obs_settings.debug:
with open('debug.json') as json_file:
data = json.dumps(json.load(json_file))
mc.set("ESP32", data)
ext_data = mc.get("ESP32")
print(ext_data)

202
build/www/index.py Normal file
View File

@ -0,0 +1,202 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import obs_settings
import cgi, cgitb
from obswebsocket import obsws, requests
from pprint import pprint
if obs_settings.debug:
cgitb.enable()
print("HTTP/1.0 200 OK")
print("Content-type:text/html;charset=utf-8\r\n")
form = cgi.FieldStorage()
action = form.getvalue('action')
param = form.getvalue('param')
host = obs_settings.host
port = obs_settings.port
password = obs_settings.password
dayflat = obs_settings.dayflat
extdata = obs_settings.extdata
liveu = obs_settings.liveu
offline_scene = obs_settings.offline_scene
channel = obs_settings.channel
chat_height = obs_settings.chat_height
if not chat_height:
chat_height = int(500)
connected = False
ws = obsws(host, port, password)
try:
ws.connect()
connected = True
except:
connected = False
if connected:
scenes = ws.call(requests.GetSceneList())
sources = ws.call(requests.GetSourcesList())
print('''<!DOCTYPE html>
<html lang="en">
<head>
<title>OBS Remote</title>
<style>
body { font-family:sans-serif;margin:0px;padding:0px;font-size:smaller; }
button { width:100%;cursor:pointer;margin:0px;padding-top:10px;padding-bottom:10px;background-color:#eee;border:1px solid #888;border-radius:5px;text-align:center;line-height:150px;font-weight:bold;font-size:xx-large; }
#content { width:100%;margin-left:auto;margin-right:auto; }
div.status { text-align:center;background-color:#009bea;color:#fff;border:1px solid #888;border-radius:5px;width:99%;margin:5px;margin-left:auto;margin-right:auto;padding-top:10px;padding-bottom:10px; }
div.stream { width:99%;margin:5px;margin-left:auto;margin-right:auto;margin-top:25px;margin-bottom:25px; }
div.audio { width:99%;margin:5px;margin-left:auto;margin-right:auto; }
div.scene { width:99%;margin:5px;margin-left:auto;margin-right:auto; }
div.source { width:99%;margin:5px;margin-left:auto;margin-right:auto; }
div.filter { width:99%;margin:5px;margin-left:auto;margin-right:auto; }
button.scene.active { background-color:#333;color:#eee; }
button.stream { background-color:green;color:#fff; }
button.stream.active { background-color:red;color:#fff; }
button.audio { background-color:green;color:#fff; }
button.audio.active { background-color:red;color:#fff; }
button.source { background-color:#009bea;color:#fff; }
button.filter.active { background-color:red;color:#fff; }
button.filter { background-color:green;color:#fff; }
.modal { display:none;position:fixed;z-index:1000;top:0;left:0;height:100%;width:100%;background:rgba(255,255,255,.8) url('./ajax-loader.gif') 50% 50% no-repeat;}
body.loading .modal { overflow:hidden; }
body.loading .modal { display:block; }
div.error { display:none;position:absolute;z-index:1000;top:50%;left:50%;margin-top:-180px;width:600px;margin-left:-350px;padding:50px;background:rgba(255,255,255,.9);border:10px solid #CC0000;color:#CC0000;font-weight:bold; }
#ajaxerror.visible { display:block; }
#obserror.visible { display:block; }
#lowbitrate.visible { display:block; }
</style>
<script src="./jquery.js"></script>''')
if connected:
print('<script src="./remote.js"></script>')
print('</head>')
print('<body><div id="content">')
if connected:
print('<div id="status">')
print(' <div class="status" id="info">N/A</div>')
if liveu:
print(' <div class="status" id="liveu">N/A</div>')
if extdata:
print(' <div class="status" id="extdata">N/A</div')
print('</div>')
if channel:
print('<div id="chat">')
print(' <iframe id="twitchchat" style="display:none;" scrolling="0" frameborder="0" src="https://www.twitch.tv/embed/{0}/chat?parent=localhost" height="500px" width="100%"></iframe>'.format(str(channel)))
print(' <div class="status" onClick="$(\'#twitchchat\').fadeToggle(\'slow\', \'linear\');">Show/Hide chat</div>')
print('</div>')
print('<div id="stream">')
print(' <div id="streamform">')
if dayflat:
print(' <div class="stream"><button id="startbutton" class="stream" onclick="clickButton({{cmd="stream", action="start", dayflat=True}});">Start Stream</button></div>')
else:
print(' <div class="stream"><button id="startbutton" class="stream" onclick="clickButton({{cmd="stream", action="start"}});">Start Stream</button></div>')
print(' </div>')
print('</div>')
print('<div id="scene">')
print(' <div id="sceneform">')
for s in scenes.getScenes():
id = str(s['name'])
print(' <div class="scene"><button id="{0}" class="scene" onclick=\'clickButton({{cmd: "scene", action: "{0}"}});\'>{0}</button></div>'.format(id))
print(' </div>')
print('</div>')
print('<div id="source">')
print(' <div id="sourceform">')
for s in sources.getSources():
if s['typeId'] == "vlc_source":
id = str(s['name'])
print(' <div class="source"><button id="{0}" class="source" onclick=\'clickButton({{cmd: "source", action: "{0}"}});\'>Reload {0}</button></div>'.format(id))
print(' <div class="filter">')
filters = ws.call(requests.GetSourceFilters(s['name']))
for f in filters.getFilters():
id = str(s['name'])+'|'+str(f['name'])
filter = str(s['name'])+'|'+str(f['name'])
print(' <button id="{0}" class="filter" onclick=\'clickButton({{cmd: "source", action: "filter", filter: "{1}", state: "1"}});\'>{0}</button>'.format(id, filter))
print(' </div>')
print(' </div>')
print('</div>')
print('<div id="audio">')
print(' <div id="audioform">')
for s in sources.getSources():
id = str(s['name'])
if s['typeId'] == 'ffmpeg_source' or s['typeId'] == 'wasapi_input_capture' or s['typeId'] == 'wasapi_output_capture':
print(' <div class="audio"><button id="{0}" class="audio" onclick=\'clickButton({{cmd: "audio", action: "{0}"}});\'>{0}</button></div>'.format(id))
print(' </div>')
print('</div>')
else:
print('<div id="fatal"><center><p class="error fatal">FATAL: Could not connect to OBS.</p></center></div>')
print('</div>')
print('''<div class="modal"></div>
<script>
$(document).ready(function() {
$("body").addClass("loading");
setTimeout(function(){
console.log('removing loading')
$("body").removeClass("loading");
},3000);
});
</script>
<div id="ajaxerror" class="error">There was an error fetching the current state, will retry...<br /><br />Stream might be in BRB scene but we are unable to check, right now.<br /><br />Please note that it might take some seconds until the proper state will be displayed after this error is gone.</div>
<div id="obserror" class="error">Connecting to OBS...</div>
<div id="lowbitrate" class="error">The bitrate is low, stream is on hold...</div>
''')
if obs_settings.extdata:
print('''
<script>
$(document).ready(function() {
setInterval(function() {
$.ajax({
datatype: "json",
url: "/ext_data.py",
cache: false,
timeout: 2000,
success: function(result) {
json = JSON.stringify(result, null, 4);
json = json.replaceAll(',',' - ');
json = json.replaceAll('"','');
json = json.substring(1, json.length-1);
$('#extdata').html(json);
},
error: function(xhr, ajaxOptions, thrownError) {
console.log("Ext data error");
console.log(xhr.status);
console.log(thrownError);
}
});
}, 1000);
});
</script>
''')
print('</body>')
print('</html>')

2
build/www/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

15
build/www/obs_settings.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
host = os.environ.get('OBS_URL', 'host.docker.internal')
port = os.environ.get('OBS_PORT', '4444')
password = os.environ.get('OBS_PASSWORD', False)
dayflat = os.environ.get('DAYFLAT', False)
liveu = os.environ.get('LIVEU', False)
offline_scene = os.environ.get('OBS_OFFLINE_SCENE', 'OFFLINE')
channel = os.environ.get('IRC_CHANNEL', False)
debug = os.environ.get('DEBUG', False)
chat_height = os.environ.get('CHAT_HEIGHT', 500)
extdata = os.environ.get('EXTDATA', False)

129
build/www/remote.js Normal file
View File

@ -0,0 +1,129 @@
function jq(id) {
return "#" + id.replace(/(\|)/g, "\\$1");
}
function clickButton({cmd=false, action=false, dayflat=false}) {
console.log(dayflat);
if (dayflat && cmd == "stream") {
alert('Dayflat active?');
}
if (cmd && action) {
$("body").addClass("loading");
$.ajax({
type: "post",
url: "./set_obs.py",
data: { "cmd": cmd, "action": action},
cache: false,
success: function() {
console.log(cmd + " command with parameter "+ action +" was send successfully.");
},
error: function() {
$('#ajaxerror').addClass("visible");
$('#lowbitrate').removeClass("visible");
$('#obserror').removeClass("visible");
console.log('Could not set OBS status')
}
});
setTimeout(function(){
$("body").removeClass("loading");
},5000);
}
}
$(document).ready(function() {
setInterval(function(){
$.ajax({
datatype: "json",
url: "/data.py",
cache: false,
timeout: 2500,
success: function(result) {
$('#ajaxerror').removeClass("visible");
var time = result.totalstreamtime / 60;
$("#info").html("Dropped Frames:&nbsp;"+parseFloat(result.numdroppedframes).toFixed(0)+" - Live:&nbsp;"+parseFloat(time).toFixed(0)+"&nbsp;Minutes - CPU:&nbsp;"+parseFloat(result.cpuusage).toFixed(2)+"% - OBS&nbsp;In:&nbsp;"+parseFloat(result.bitrate).toFixed(0)+"kb/s - OBS&nbsp;Out:&nbsp;"+parseFloat(result.kbitspersec).toFixed(0)+"kb/s - Connections:&nbsp;"+parseFloat(result.connections).toFixed(0));
if (result.liveu == "True") {
$("#liveu").html("Connected:&nbsp;"+result.batteryconnected+" - Charging:&nbsp;"+result.batterycharging+" - Discharging:&nbsp;"+result.batterydischarging+" - Time to empty:&nbsp;"+parseFloat(result.batterytime).toFixed(0)+"&nbsp;Minutes ("+parseFloat(result.batterypercentage).toFixed(2)+"%)");
}
if (result.lowbitrate == "True" ) {
$('#lowbitrate').addClass("visible");
} else {
$('#lowbitrate').removeClass("visible");
}
$('#sceneform :button').removeClass("active");
$('#' + result.currentscene).addClass("active");
if (result.obsstatus == "False") {
$('#lowbitrate').removeClass("visible");
$('#ajaxerror').removeClass("visible");
$('#obserror').addClass("visible");
throw new Error('OBS CONNECTION ERROR');
} else {
$('#obserror').removeClass("visible");
}
if (result.streamingstatus == "True") {
$('#startbutton').addClass("active");
$('#startbutton').text("Stop Stream");
$('#startbutton').attr("onclick", "clickButton({cmd: 'stream', action: 'stop'})");
} else {
$('#startbutton').removeClass("active");
$('#startbutton').text("Start Stream");
if (result.dayflat) {
$('#startbutton').attr("onclick", "clickButton({cmd: 'stream', action: 'start', dayflat: 'True'})");
} else {
$('#startbutton').attr("onclick", "clickButton({cmd: 'stream', action: 'start'})");
}
}
if (result.activefilters) {
activefilters = result.activefilters.split(',');
for (i = 0; i < activefilters.length; i++) {
var btn = $(jq(activefilters[i]));
btn.addClass('active');
btn.text(activefilters[i] + ' (Active)');
btn.attr("onclick", "clickButton({cmd: 'source', action: 'filter|" +activefilters[i]+ "|0'})");
}
}
if (result.mutedfilters) {
mutedfilters = result.mutedfilters.split(',');
for (i = 0; i < mutedfilters.length; i++) {
var btn = $(jq(mutedfilters[i]));
btn.removeClass('active');
btn.text(mutedfilters[i] + ' (Disabled)');
btn.attr("onclick", "clickButton({cmd: 'source', action: 'filter|" +mutedfilters[i]+ "|1'})");
}
}
if (result.activeaudio) {
activeaudio = result.activeaudio.split(',')
for (i = 0; i < activeaudio.length; i++) {
var btn = $(jq(activeaudio[i]));
btn.addClass('active');
btn.text(activeaudio[i] + ' (Active)');
}
}
if (result.mutedaudio) {
mutedaudio = result.mutedaudio.split(',')
for (i = 0; i < mutedaudio.length; i++) {
var btn = $(jq(mutedaudio[i]));
btn.removeClass('active');
btn.text(mutedaudio[i] + ' (Muted)');
}
}
},
error: function(xhr, ajaxOptions, thrownError) {
$('#ajaxerror').addClass("visible");
$('#lowbitrate').removeClass("visible");
$('#obserror').removeClass("visible");
console.log("Error");
console.log(xhr.status);
console.log(thrownError);
}
});
}, 1000);
});

49
build/www/set_ext.py Normal file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import memcache
import json
import sys
from pprint import pprint
print("HTTP/1.0 200 OK")
print("Content-type:text/html;charset=utf-8\r\n")
json_error = False
mc = memcache.Client(['localhost:11211'], debug=0)
try:
r = json.load(sys.stdin)
json = json.dumps(r)
except:
json_error = True
if not json_error:
try:
mc.set("ESP32", json)
data = mc.get("ESP32")
except:
print('Could not set data')
else:
print('Invalid request')
pprint(data)

80
build/www/set_obs.py Normal file
View File

@ -0,0 +1,80 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
twitch-irl-docker
Copyright (C) 2022 gpkvt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import obs_settings
import cgi, cgitb
import memcache
import time
from obswebsocket import obsws, requests
from pprint import pprint
if obs_settings.debug:
cgitb.enable()
form = cgi.FieldStorage()
cmd = form.getvalue('cmd')
action = form.getvalue('action')
host = obs_settings.host
port = obs_settings.port
password = obs_settings.password
ws = obsws(host, port, password)
mc = memcache.Client(['localhost:11211'], debug=0)
try:
ws.connect()
except:
print("Could not connect to OBS")
if cmd == "stream":
if action == "start":
mc.set('OBS_STREAMING_STATUS', "True")
ws.call(requests.StartStreaming())
else:
mc.set('OBS_STREAMING_STATUS', "False")
ws.call(requests.StopStreaming())
if cmd == "scene":
ws.call(requests.SetCurrentScene(action))
if cmd == "audio":
ws.call(requests.ToggleMute(action))
if cmd == "source":
if 'filter|' in action:
p = action.split('|')
source = p[1]
source_filter = p[2]
toggle = p[3]
if toggle == '1':
toggle = True
else:
toggle = False
ws.call(requests.SetSourceFilterVisibility(source, source_filter, toggle))
else:
ws.call(requests.SetSceneItemRender(action,False))
ws.call(requests.SetSceneItemRender(action,True))
print("HTTP/1.0 200 OK")
print("Content-type:text/html;charset=utf-8\r\n")
time.sleep(2)

107
build/www/signal.html Normal file
View File

@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>LiveU-Status</title>
<link href="//cdn.materialdesignicons.com/3.7.95/css/materialdesignicons.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function() {
setInterval(function(){
$.ajax({
url: '/data.py',
cache: false,
success: function(result) {
var bitrate = result.bitrate;
var connectionText = result.connection;
if (typeof connectionText != 'undefined') {
$('#status').text(connectionText);
} else {
$('#status').text('');
}
if (typeof bitrate !== 'undefined') {
switch(true) {
case (bitrate >= 4000):
$('#icon').addClass('mdi-signal-cellular-3').removeClass('mdi-signal-cellular-outline').removeClass('mdi-signal-cellular-1').removeClass('mdi-signal-cellular-2');
break;
case (bitrate >= 3000):
$('#icon').addClass('mdi-signal-cellular-2').removeClass('mdi-signal-cellular-outline').removeClass('mdi-signal-cellular-1').removeClass('mdi-signal-cellular-3');
break;
case (bitrate >= 2000):
$('#icon').addClass('mdi-signal-cellular-1').removeClass('mdi-signal-cellular-outline').removeClass('mdi-signal-cellular-2').removeClass('mdi-signal-cellular-3');
break;
default:
$('#icon').addClass('mdi-signal-cellular-outline').removeClass('mdi-signal-cellular-1').removeClass('mdi-signal-cellular-2').removeClass('mdi-signal-cellular-3');
break;
}
}
},
error: function(xhr, ajaxOptions, thrownError) {
console.log('Error');
console.log(xhr.status);
console.log(thrownError);
}
});
}, 1000);
});
</script>
<style>
body {
background-color: transparent;
margin: 0px;
padding: 0px;
font-family: sans-serif;
color: #000;
overflow: hidden;
}
h1 {
margin: 0px;
padding: 0px;
color: #ddd;
font-size: 12pt;
font-weight: bold;
text-shadow: 1px 1px #333;
}
#main {
text-align:center;
}
.mdi {
font-size: 50pt;
background-color:rgba(196, 196, 196, 0.25);
border-radius: 8px;
padding-left:16px;
padding-right:16px;
text-shadow: 1px 1px #333;
}
.mdi-signal-cellular-outline {
color: red !important;
}
.mdi-signal-cellular-1 {
color: orange !important;
}
.mdi-signal-cellular-2 {
color: olive !important;
}
.mdi-signal-cellular-3 {
color: green !important;
}
</style>
</head>
<body>
<div id="main">
<i id="icon" class="mdi mdi-signal-cellular-outline"></i>
<h1 id="status">Connecting...</h1>
</div>
</body>
</html>

357
build/www/stat.xsl Normal file
View File

@ -0,0 +1,357 @@
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>RTMP statistics</title>
</head>
<body>
<xsl:apply-templates select="rtmp"/>
</body>
</html>
</xsl:template>
<xsl:template match="rtmp">
<table cellspacing="1" cellpadding="5">
<tr bgcolor="#999999">
<th>RTMP</th>
<th>#clients</th>
<th colspan="4">Video</th>
<th colspan="4">Audio</th>
<th>In bytes</th>
<th>Out bytes</th>
<th>In bits/s</th>
<th>Out bits/s</th>
<th>State</th>
<th>Record</th>
<th>Time</th>
</tr>
<tr>
<td colspan="2">Accepted: <xsl:value-of select="naccepted"/></td>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">bits/s</th>
<th bgcolor="#999999">size</th>
<th bgcolor="#999999">fps</th>
<th bgcolor="#999999">codec</th>
<th bgcolor="#999999">bits/s</th>
<th bgcolor="#999999">freq</th>
<th bgcolor="#999999">chan</th>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td/>
<td/>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="/rtmp/uptime * 1000"/>
</xsl:call-template>
</td>
</tr>
<xsl:apply-templates select="server"/>
</table>
</xsl:template>
<xsl:template match="server">
<xsl:apply-templates select="application"/>
</xsl:template>
<xsl:template match="application">
<tr bgcolor="#999999">
<td>
<b><xsl:value-of select="name"/></b>
</td>
</tr>
<xsl:apply-templates select="live"/>
<xsl:apply-templates select="play"/>
</xsl:template>
<xsl:template match="live">
<tr bgcolor="#aaaaaa">
<td>
<i>live streams</i>
</td>
<td align="middle">
<xsl:value-of select="nclients"/>
</td>
</tr>
<xsl:apply-templates select="stream"/>
</xsl:template>
<xsl:template match="play">
<tr bgcolor="#aaaaaa">
<td>
<i>vod streams</i>
</td>
<td align="middle">
<xsl:value-of select="nclients"/>
</td>
</tr>
<xsl:apply-templates select="stream"/>
</xsl:template>
<xsl:template match="stream">
<tr valign="top">
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test="active">#cccccc</xsl:when>
<xsl:otherwise>#dddddd</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td>
<a href="">
<xsl:attribute name="onclick">
var d=document.getElementById('<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>');
d.style.display=d.style.display=='none'?'':'none';
return false
</xsl:attribute>
<xsl:value-of select="name"/>
<xsl:if test="string-length(name) = 0">
[EMPTY]
</xsl:if>
</a>
</td>
<td align="middle"> <xsl:value-of select="nclients"/> </td>
<td>
<xsl:value-of select="meta/video/codec"/>&#160;<xsl:value-of select="meta/video/profile"/>&#160;<xsl:value-of select="meta/video/level"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_video"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/video/width"/>
</td>
<td>
<xsl:value-of select="meta/video/frame_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/codec"/>&#160;<xsl:value-of select="meta/audio/profile"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_audio"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:apply-templates select="meta/audio/sample_rate"/>
</td>
<td>
<xsl:value-of select="meta/audio/channels"/>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_in"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bytes_out"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_in"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td>
<xsl:call-template name="showsize">
<xsl:with-param name="size" select="bw_out"/>
<xsl:with-param name="bits" select="1"/>
<xsl:with-param name="persec" select="1"/>
</xsl:call-template>
</td>
<td><xsl:call-template name="streamstate"/></td>
<td><xsl:call-template name="recordstate"/></td>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="time"/>
</xsl:call-template>
</td>
</tr>
<tr style="display:none">
<xsl:attribute name="id">
<xsl:value-of select="../../name"/>-<xsl:value-of select="name"/>
</xsl:attribute>
<td colspan="16" ngcolor="#eeeeee">
<table cellspacing="1" cellpadding="5">
<tr>
<th>Id</th>
<th>State</th>
<th>Recording</th>
<th>Address</th>
<th>Flash version</th>
<th>Page URL</th>
<th>SWF URL</th>
<th>Dropped</th>
<th>Timestamp</th>
<th>A-V</th>
<th>Time</th>
</tr>
<xsl:apply-templates select="client"/>
</table>
</td>
</tr>
</xsl:template>
<xsl:template name="showtime">
<xsl:param name="time"/>
<xsl:if test="$time &gt; 0">
<xsl:variable name="sec">
<xsl:value-of select="floor($time div 1000)"/>
</xsl:variable>
<xsl:if test="$sec &gt;= 86400">
<xsl:value-of select="floor($sec div 86400)"/>d
</xsl:if>
<xsl:if test="$sec &gt;= 3600">
<xsl:value-of select="(floor($sec div 3600)) mod 24"/>h
</xsl:if>
<xsl:if test="$sec &gt;= 60">
<xsl:value-of select="(floor($sec div 60)) mod 60"/>m
</xsl:if>
<xsl:value-of select="$sec mod 60"/>s
</xsl:if>
</xsl:template>
<xsl:template name="showsize">
<xsl:param name="size"/>
<xsl:param name="bits" select="0" />
<xsl:param name="persec" select="0" />
<xsl:variable name="sizen">
<xsl:value-of select="floor($size div 1024)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$sizen &gt;= 1073741824">
<xsl:value-of select="format-number($sizen div 1073741824,'#.###')"/> T</xsl:when>
<xsl:when test="$sizen &gt;= 1048576">
<xsl:value-of select="format-number($sizen div 1048576,'#.###')"/> G</xsl:when>
<xsl:when test="$sizen &gt;= 1024">
<xsl:value-of select="format-number($sizen div 1024,'#.##')"/> M</xsl:when>
<xsl:when test="$sizen &gt;= 0">
<xsl:value-of select="$sizen"/> K</xsl:when>
</xsl:choose>
<xsl:if test="string-length($size) &gt; 0">
<xsl:choose>
<xsl:when test="$bits = 1">b</xsl:when>
<xsl:otherwise>B</xsl:otherwise>
</xsl:choose>
<xsl:if test="$persec = 1">/s</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template name="streamstate">
<xsl:choose>
<xsl:when test="active">active</xsl:when>
<xsl:otherwise>idle</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="clientstate">
<xsl:choose>
<xsl:when test="publishing">publishing</xsl:when>
<xsl:otherwise>playing</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="recordstate">
<xsl:choose>
<xsl:when test="recording">yes</xsl:when>
<xsl:otherwise>no</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="client">
<tr>
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test="publishing">#cccccc</xsl:when>
<xsl:otherwise>#eeeeee</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<td><xsl:value-of select="id"/></td>
<td><xsl:call-template name="clientstate"/></td>
<td><xsl:call-template name="recordstate"/></td>
<td>
<a target="_blank">
<xsl:attribute name="href">
http://apps.db.ripe.net/search/query.html&#63;searchtext=<xsl:value-of select="address"/>
</xsl:attribute>
<xsl:attribute name="title">whois</xsl:attribute>
<xsl:value-of select="address"/>:<xsl:value-of select="port"/>
</a>
</td>
<td><xsl:value-of select="flashver"/></td>
<td>
<a target="_blank">
<xsl:attribute name="href">
<xsl:value-of select="pageurl"/>
</xsl:attribute>
<xsl:value-of select="pageurl"/>
</a>
</td>
<td><xsl:value-of select="swfurl"/></td>
<td><xsl:value-of select="dropped"/></td>
<td><xsl:value-of select="timestamp"/></td>
<td><xsl:value-of select="avsync"/></td>
<td>
<xsl:call-template name="showtime">
<xsl:with-param name="time" select="time"/>
</xsl:call-template>
</td>
</tr>
</xsl:template>
<xsl:template match="publishing">
publishing
</xsl:template>
<xsl:template match="active">
active
</xsl:template>
<xsl:template match="recording">
recording
</xsl:template>
<xsl:template match="width">
<xsl:value-of select="."/>x<xsl:value-of select="../height"/>
</xsl:template>
</xsl:stylesheet>

6
docker-compose.yml Normal file
View File

@ -0,0 +1,6 @@
version: '2'
services:
rtmp:
build: ./build
restart: always

View File

@ -0,0 +1,113 @@
#include "WiFi.h"
#include "HTTPClient.h"
#include "ArduinoJson.h"
#define ONBOARD_LED 2
const char* ssid = "<YOURWLANSSID";
const char* password = "<YOURWLANPASSWORD>";
String source = "http://m1login.net/api/model.json";
String target = "https://<YOURIRLSERVER>/set_ext.py";
unsigned long lastTime = 0;
unsigned long timerDelay = 5000;
void setup() {
pinMode(ONBOARD_LED, OUTPUT);
digitalWrite(ONBOARD_LED, LOW);
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("Connecting to WiFi");
Serial.println(ssid);
}
Serial.print("Connected to the WiFi network: ");
Serial.println(WiFi.localIP());
digitalWrite(ONBOARD_LED, HIGH);
}
void loop() {
if ((millis() - lastTime) > timerDelay) {
if(WiFi.status() == WL_CONNECTED) {
Serial.print("Fetching data from ");
Serial.println(source.c_str());
HTTPClient httpget;
httpget.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
httpget.begin(source.c_str());
int httpResponseCode = httpget.GET();
if (httpResponseCode>0) {
Serial.print("GET Response code: ");
Serial.println(httpResponseCode);
String json = httpget.getString();
//Serial.println(json);
DynamicJsonDocument doc(32768);
DeserializationError error = deserializeJson(doc, json);
if (error) {
Serial.println("Could not parse JSON data.");
Serial.println(error.f_str());
return;
}
String signalStrength = doc["wwan"]["signalStrength"]["bars"];
String charging = doc["power"]["charging"];
String battChargeLevel = doc["power"]["battChargeLevel"];
String batteryVoltage = doc["power"]["batteryVoltage"];
String batteryTemperature = doc["power"]["batteryTemperature"];
String batteryTempState = doc["power"]["batteryTempState"];
String devTemperature = doc["general"]["devTemperature"];
String deviceTempCritical = doc["power"]["deviceTempCritical"];
String connectionText = doc["wwan"]["connectionText"];
String currentPSserviceType = doc["wwan"]["currentPSserviceType"];
String registerNetworkDisplay = doc["wwan"]["registerNetworkDisplay"];
String payload = "{ \"Connection\": \""+connectionText+"\", \"Service\": \""+currentPSserviceType+"\", \"Temp\": \""+devTemperature+"°C\", \"Accu\": \""+batteryTemperature+"°C\", \"Signal\": \""+signalStrength+"/5\", \"Charge\": \""+battChargeLevel+"%\", \"Voltage\": \""+batteryVoltage+"mV\", \"TempCrit\": \""+deviceTempCritical+"\", \"AccuCrit\": \""+batteryTempState+"\", \"Charging\": \""+charging+"\", \"Network\": \""+registerNetworkDisplay+"\" }";
Serial.println(payload);
Serial.print("Posting data to ");
Serial.println(target.c_str());
HTTPClient httppost;
httppost.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
httppost.begin(target.c_str());
httppost.addHeader("Content-Type", "application/json");
int postResponseCode = httppost.POST(payload);
if (postResponseCode>0) {
digitalWrite(ONBOARD_LED, HIGH);
Serial.print("POST Response code: ");
Serial.println(postResponseCode);
String postload = httppost.getString();
Serial.println(postload);
} else {
digitalWrite(ONBOARD_LED, LOW);
Serial.print("POST Error code: ");
Serial.println(postResponseCode);
}
httppost.end();
} else {
digitalWrite(ONBOARD_LED, LOW);
Serial.print("HTTP Error code: ");
Serial.println(httpResponseCode);
}
httpget.end();
} else {
Serial.println("WiFi disconnected");
digitalWrite(ONBOARD_LED, LOW);
WiFi.reconnect();
delay(timerDelay);
digitalWrite(ONBOARD_LED, HIGH);
}
lastTime = millis();
}
}

View File

@ -0,0 +1,88 @@
version: '2'
services:
rtmp:
ports:
# RTMP Port
- "1935:1935"
# Webserver Port
- "80:80"
environment:
# STREAMKEY is used for RTMP-Authentication, it must be your full RTMP-URL, e.g.: rtmp://example.com/live/live?key=SECRET
# Use NOAUTH to disable this feature
- STREAMKEY=NOAUTH
# Hostname/IP to access your OBS Websocket as viewed from Docker-Container (host.docker.internal should work)
- OBS_URL=host.docker.internal
# Port to access OBS Websocket
- OBS_PORT=4444
# Password for OBS Websocket and webremote
- OBS_PASSWORD=SECURE_PASSWORD
# Scene in OBS you use before you start the Stream (will not be switched automatically)
- OBS_START_SCENE=START
# Scene in OBS you use while being live, will be switched to OBS_BRB_SCENE when your bitrate drops below LOW_BITRATE
- OBS_LIVE_SCENE=LIVE
# Scene in OBS that will use during your bitrate is below LOW_BITRATE. Will be switched to OBS_START_SCENE when bitrate recovers
- OBS_BRB_SCENE=BRB
# Scene in OBS you use for a short break (MUST start with FORCED_ if it shouldn't be switched automatically)
- OBS_FORCED_BRB_SCENE=FORCED_BRB
# OBS offline scene
- OBS_OFFLINE_SCENE=OFFLINE
# Webremote chat height (in pixel)
- CHAT_HEIGHT=500
# Threshold (kbits/sec.) for switching from OBS_LIVE_SCENE to OBS_BRB_SCENE
- LOW_BITRATE=300
# URL to get RTMP statistics from (for bitrate, etc.), default value should work fine
- RTMP_STAT_URL=http://localhost/stat
# Name of RTMP Stream to monitor (bitrate, etc.)
- RTMP_STREAM_NAME=live
# Set LIVEU to True if you own a LiveU and want to have status infos in webremote
- LIVEU=False
# Timeout for LiveU Authentication Token
- LIVEU_TOKEN_TTL=14000
# solo.liveu.tv username
- LIVEU_USERNAME=mail@example.com
# solo.liveu.tv password (encrypted, use the developer tools in your browser to get the proper value from POST)
- LIVEU_PASSWORD=SECURE_LIVEU_PASSWORD
# LiveU Login URL (default should word fine)
- LIVEU_URL=https://p3vncpi9if.execute-api.us-east-1.amazonaws.com/prod/zendesk/userlogin
# Your LiveU Unit ID (usually starts with "Boss100_")
- LIVEU_UNIT=LIVEU_UNIT_ID
# Your LiveU Unit URL (e.g. https://lu-central.liveu.tv/luc/luc-core-web/rest/v0/units/)
- LIVEU_API=LIVEU_UNIT_URL
# Twitch Name of your channel, set this to "False" to deactivate the bot
- IRC_CHANNEL=False
# Twitch Username of your IRL Bot (e.g. your own username)
# Must be an existing Twitch account
- IRC_USERNAME=WorldsBestBot
# Twitch OAuth-Token, without "oauth:"-prefix (you can use https://www.21x9.org/twitch/ to generate one)
- IRC_OAUTH_TOKEN=123456789012345678901234567890
# Time between the bots reacts to commands (doesn't affect broadcaster and mods)
- IRC_COOLDOWN=30
# Message to anyone who enters the chat (username will be appended automatically)
# Set this to "False" (without quotes) if you don't want the bot to greet new chatters
- IRC_GREETER_WELCOME=False
# Emote(s) to append to IRC_GREETER_WELCOME (after the username)
- IRC_GREETER_EMOTE=HeyGuys
# Emote the bot sends when activated
- IRC_BOT_EMOTE=MrDestructoid
# Message-Prefix for bitrate message (do not use quotes)
- IRC_BITRATE_MSG_PRE=Current bitrate
# Message-Suffix for bitrate message (do not use quotes)
- IRC_BITRATE_MSG_SUF=kBit/sec.
# In which interval should a low bitrate message be posted?
- IRC_LOW_BITRATE_MSG_INTERVAL=30
# Message-Prefix for !bitrate command
- IRC_BITRATE_MSG_PREFIX="Current bitrate:"
# Pushover User-Key for Push-Notifications
- PUSHOVER_USER_KEY=
# Pushover App-Token for Push-Notifications
- PUSHOVER_APP_TOKEN=
# Are you on a mobile plan with dayflats?
- DAYFLAT=True
# Logfile verbosity (valid values are: CRITICAL, WARNING, INFO, DEBUG)
# In a production environment you should use CRITICAL or WARNING, otherwise logfiles will get very large.
- LOG_LEVEL=CRITICAL
# Use external data (see Wiki for details)
- EXTDATA=False

741
examples/obs/IRL.json Normal file
View File

@ -0,0 +1,741 @@
{
"AuxAudioDevice1": {
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"libobs.mute": [],
"libobs.push-to-mute": [
{
"control": true,
"key": "OBS_KEY_SPACE"
}
],
"libobs.push-to-talk": [],
"libobs.unmute": []
},
"id": "wasapi_input_capture",
"mixers": 15,
"monitoring_type": 0,
"muted": true,
"name": "MicAux",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": true,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"device_id": "{0.0.1.00000000}.{96c8ca91-5f55-42c2-b593-7265672944fe}"
},
"sync": 0,
"versioned_id": "wasapi_input_capture",
"volume": 1.0
},
"DesktopAudioDevice1": {
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"libobs.mute": [],
"libobs.push-to-mute": [],
"libobs.push-to-talk": [],
"libobs.unmute": []
},
"id": "wasapi_output_capture",
"mixers": 15,
"monitoring_type": 0,
"muted": true,
"name": "Desktop_Audio",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"device_id": "default"
},
"sync": 0,
"versioned_id": "wasapi_output_capture",
"volume": 0.0
},
"current_program_scene": "LIVE",
"current_scene": "LIVE",
"current_transition": "Fade",
"groups": [],
"modules": {
"auto-scene-switcher": {
"active": false,
"interval": 300,
"non_matching_scene": "",
"switch_if_not_matching": false,
"switches": []
},
"captions": {
"enabled": false,
"lang_id": 1031,
"provider": "mssapi",
"source": ""
},
"output-timer": {
"autoStartRecordTimer": false,
"autoStartStreamTimer": false,
"pauseRecordTimer": false,
"recordTimerHours": 0,
"recordTimerMinutes": 0,
"recordTimerSeconds": 30,
"streamTimerHours": 0,
"streamTimerMinutes": 0,
"streamTimerSeconds": 30
},
"scripts-tool": []
},
"name": "Unbenannt",
"preview_locked": false,
"quick_transitions": [],
"saved_projectors": [],
"scaling_enabled": false,
"scaling_level": 0,
"scaling_off_x": 0.0,
"scaling_off_y": 0.0,
"scene_order": [
{
"name": "LIVE"
},
{
"name": "BRB"
},
{
"name": "START"
},
{
"name": "OFFLINE"
},
{
"name": "FORCED_BRB"
}
],
"sources": [
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "text_gdiplus",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "BRB_Text",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"text": "Connection lost.\nPlease stand by."
},
"sync": 0,
"versioned_id": "text_gdiplus_v2",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "text_gdiplus",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "OFFLINE_Text",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"text": "Goodbye.\nSee you soon."
},
"sync": 0,
"versioned_id": "text_gdiplus_v2",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "text_gdiplus",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "FORCED_BRB_Text",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"text": "Short break."
},
"sync": 0,
"versioned_id": "text_gdiplus_v2",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"OBSBasic.SelectScene": [],
"libobs.hide_scene_item.FORCED_BRB_Text": [],
"libobs.show_scene_item.FORCED_BRB_Text": []
},
"id": "scene",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "FORCED_BRB",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 1,
"items": [
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 1,
"locked": false,
"name": "FORCED_BRB_Text",
"pos": {
"x": 333.0,
"y": 408.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
}
]
},
"sync": 0,
"versioned_id": "scene",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "text_gdiplus",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "START_Text",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"chatlog": false,
"extents": false,
"font": {
"face": "Arial",
"flags": 0,
"size": 256,
"style": "Standard"
},
"text": "Welcome! \nThe stream will \nstart soon!",
"transform": 0
},
"sync": 0,
"versioned_id": "text_gdiplus_v2",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"OBSBasic.SelectScene": [],
"libobs.hide_scene_item.OFFLINE_Text": [],
"libobs.show_scene_item.OFFLINE_Text": []
},
"id": "scene",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "OFFLINE",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 2,
"items": [
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 2,
"locked": false,
"name": "OFFLINE_Text",
"pos": {
"x": 224.0,
"y": 276.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
}
]
},
"sync": 0,
"versioned_id": "scene",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"OBSBasic.SelectScene": [],
"libobs.hide_scene_item.START_Text": [],
"libobs.show_scene_item.START_Text": []
},
"id": "scene",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "START",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 1,
"items": [
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 1,
"locked": false,
"name": "START_Text",
"pos": {
"x": 154.0,
"y": 143.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
}
]
},
"sync": 0,
"versioned_id": "scene",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"filters": [
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "noise_suppress_filter",
"mixers": 255,
"monitoring_type": 0,
"muted": false,
"name": "Noise_Suppression",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {},
"sync": 0,
"versioned_id": "noise_suppress_filter_v2",
"volume": 1.0
}
],
"flags": 0,
"hotkeys": {
"VLCSource.PlayPause": [],
"VLCSource.PlaylistNext": [],
"VLCSource.PlaylistPrev": [],
"VLCSource.Restart": [],
"VLCSource.Stop": [],
"libobs.mute": [],
"libobs.push-to-mute": [],
"libobs.push-to-talk": [],
"libobs.unmute": []
},
"id": "vlc_source",
"mixers": 255,
"monitoring_type": 0,
"muted": false,
"name": "VLC_RTMP_Source",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"network_caching": 1000,
"playback_behavior": "stop_restart",
"playlist": [
{
"hidden": false,
"selected": true,
"value": "rtmp://localhost/live"
},
{
"hidden": false,
"selected": false,
"value": "rtmp://localhost/live"
}
]
},
"sync": 0,
"versioned_id": "vlc_source",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "text_gdiplus",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "Text (GDI+)",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"font": {
"face": "Arial",
"flags": 0,
"size": 72,
"style": "Standard"
},
"text": "ONE SECOND, PLEASE.\nLOADING STREAM..."
},
"sync": 0,
"versioned_id": "text_gdiplus",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"libobs.mute": [],
"libobs.push-to-mute": [],
"libobs.push-to-talk": [],
"libobs.unmute": []
},
"id": "browser_source",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "Signal_Indicator",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"css": "body { background-color: transparent; margin: 0px auto; overflow: hidden; }",
"height": 200,
"restart_when_active": true,
"url": "http://localhost/signal.html",
"width": 200
},
"sync": 0,
"versioned_id": "browser_source",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"OBSBasic.SelectScene": [],
"libobs.hide_scene_item.BRB_Text": [],
"libobs.show_scene_item.BRB_Text": []
},
"id": "scene",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "BRB",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 3,
"items": [
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 3,
"locked": false,
"name": "BRB_Text",
"pos": {
"x": 118.0,
"y": 276.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
}
]
},
"sync": 0,
"versioned_id": "scene",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {
"OBSBasic.SelectScene": [],
"libobs.hide_scene_item.Signal_Indicator": [],
"libobs.hide_scene_item.Text (GDI+)": [],
"libobs.hide_scene_item.VLC_RTMP_Source": [],
"libobs.show_scene_item.Signal_Indicator": [],
"libobs.show_scene_item.Text (GDI+)": [],
"libobs.show_scene_item.VLC_RTMP_Source": []
},
"id": "scene",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "LIVE",
"prev_ver": 436207618,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 11,
"items": [
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 8,
"locked": false,
"name": "Text (GDI+)",
"pos": {
"x": 593.0,
"y": 466.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
},
{
"align": 5,
"bounds": {
"x": 1920.0,
"y": 1080.0
},
"bounds_align": 0,
"bounds_type": 2,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 11,
"locked": false,
"name": "VLC_RTMP_Source",
"pos": {
"x": 0.0,
"y": 0.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
},
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 7,
"locked": false,
"name": "Signal_Indicator",
"pos": {
"x": 1672.0,
"y": 51.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": true
}
]
},
"sync": 0,
"versioned_id": "scene",
"volume": 1.0
}
],
"transition_duration": 300,
"transitions": []
}