tyrsarm / peertube-headless-seeder

This container uses Python, Selenium, and Firefox to monitor and seed live streams of a PeerTube channel headlessly.
17 stars 3 forks source link

Not sure if this is an error or not - isPlaying.txt.txt #5

Closed davralin closed 1 year ago

davralin commented 1 year ago

Just poked abit through the code, while my python-skills are non-existent, I believe this might be wrong:

/playlive.py#L27

    playingfile = open("isPlaying.txt.txt", "w+")
CGBassPlayer commented 1 year ago

I would argue that it along with these lines would be the issue as this just opens a file to write, passes, then closes before doing the write that you mentioned.

In Python, it best to use the

with open('file.txt', 'w') as f:
    f.write("Text for the file")

because using the with will automatically handle opening and closing the file for you so you don't have to worry about it. I think the author didn't realize that is how it worked and did a pass on them and then manually opened and close it themselves.

Strit commented 1 year ago

I just saw this error in the sparse logs and I wonder if it's related:

18:06:57 No new videos
Data Loaded
Got URL
18:07:05 Checking Again
Exception in thread Thread-2 (start_get_url):
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/app/./main.py", line 15, in start_get_url
    get_url = GetURL(urls, wait_time)(urls, wait_time)
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/get_url.py", line 10, in __init__
    self.main_loop()
  File "/app/get_url.py", line 46, in main_loop
    newid = int(idfile.read())
            ^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '[8076]'
tyrsarm commented 1 year ago

The second ".txt" from isPlaying.txt is a typo from me. I am removing the second ".txt" right now. Thank you @davralin for bringing this to my attention.

tyrsarm commented 1 year ago

I created a separate issue for what @CGBassPlayer mentioned so I can fix it later or close it when we get environment variables working.