-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify the Script #11
base: main
Are you sure you want to change the base?
Conversation
Temporarily converting to draft as I came across an issue with run in docker and the script not finding the Firefox web driver |
I have fix the issues I was facing as well as put in some improvements |
Awesome work. I did not even think about using the API url to filter the video list. Not including the overhaul you did. I will make the container and test it this Sunday. If it passes, I will merge it in. Thank you |
When testing the container based off of this pull request I was getting an error. This was fixed with adding these two lines in the Dockerfile at line 25: The error looks to be coming from installing GeckoDriverManager from line 32 from main.py as it looks to require /home/user directory to install. Can you please verify my findings and add the fix to the pull request if needed. The issue only appears when there is a live stream active. Log: ~ sudo docker-compose up |
While testing the pull request, I found this JSON exception also. It appears after the browser starts during a live: peertube-headless-seeder-simplify-peertube-seeder-1 | Checking for live videos |
While what the project had was a great start, this iteration has the same idea but accomplishes it in a much similar fashion as well as implements some better practices.
This PR fixes #6, closes #9, and fixes #10
How it works
The new script lives in an infinite loop. And goes as follows:
ping_interval
parameter sets this. Currently default is 300 seconds or 5 minutes) before iterating through the loop again.Script Parameters
This script now takes 2 parameters as environment variables.
api_url
: this is the base url of the peertube instance you are calling. Do not include anything other than the base URL sohttps://jupiter.tube/
.ping_interval
: this is how often the script checks peertube for a live stream. The default is 300 seconds (5 minutes) for the main docker compose and 5 seconds for the development compose.Things that need improvement
Time to wait between API calls
Using
time.sleep()
is far from the best way to handle the waiting period, but it works well enough in this first iteration of the "new" script. I would like to bring back in theschedule
module that you were using originally, so that will be in a followup PR if someone does not tackle that.Logging
Current the script just prints to the console as its way of logging while it is running, but adding real logging to the script would be helpful in case an error occurs or if a user does not wants to turn up or down how much the information is being captured.
### Type HintingI started this but as I was figuring stuff out I did not do it as much as I originally planned. Type hinting help the machine and people understand what a variable or function or parameter is suppose to be and can catch things we can miss. That'll be in a follow up PR or on this one depending on how long it stays open.I took care of this in this PR now### DocumentationEventually there should be docs adding how the script works, how to run it, and other things of that nature. Not a big deal yet, but something to think aboutI started working on this in this PRLet me know if you have any questions or concerns 🙂