chris102994 / docker-toonamiaftermath

This is a simple project that scrapes the website and generates an M3U playlist every 12 hours along with a XMLTV object that is hosted over NGINX. The XMLTV and M3U playlist can be directly imported to Emby or Plex. Or if you'd like a buffer you can also import them into xteve or tvheadend.
https://chris102994.github.io/containers/docker-toonamiaftermath/
GNU Lesser General Public License v3.0
40 stars 6 forks source link

Need help setting up cronjob for EPG #9

Closed CHJ85 closed 2 years ago

CHJ85 commented 2 years ago

Hi there. I've been trying for days figuring out how to set up a cron job for the EPG. But nothing seems to work. I've tried docker run --name docker-toonamiaftermath echo "0 */12 * * * root /app/ta-wrapper.sh" >> /etc/crontab but this gave me permission denied. Then I tried running ta-wrapper.sh manually. But now I'm getting this error: /usr/bin/python3: can't open file '/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py': [Errno 2] No such file or directory. I've had it up to here with Docker. It's the most frustrating thing to work with. Anyway. Do you think you could post instructions in the README file? I'm sure I can't be the only one having trouble with all this.

chris102994 commented 2 years ago

I'm not sure what you're trying to accomplish here.

If you're running this container on your system then there's no need to setup a cron for it. Essentially this means that the container already runs a cron job on that schedule within the container. There is nothing for you to do outside the container.

I can leave this issue open and add the option to specify the cron schedule for the containers environment variables at a later time when I have time to work on this project.

CHJ85 commented 2 years ago

Thanks. But that's just it though. The container says it's been running for 5 days straight, but the latest version of the xmltv file is from the day I installed the script. So obviously something ain't right, hence why I need to set up a cronjob.

thegdoubleodees commented 2 years ago

I run a cronjob on my host to restart the container every night...solved my problem

chris102994 commented 2 years ago

That could work though I'm not sure what to tell you.

Can you post the logs?

i.e. docker logs <container name>

CHJ85 commented 2 years ago

Of course.

docker logs 2f5629cd5a4e
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 50-toonami-attrs: applying... 
[fix-attrs.d] 50-toonami-attrs: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-users-and-groups: executing... 
usermod: no changes
[cont-init.d] 01-users-and-groups: exited 0.
[cont-init.d] 05-init-mounted-folders: executing... 
[05-init-mounted-folders]: First boot with mounted /config/log detected.
[cont-init.d] 05-init-mounted-folders: exited 0.
[cont-init.d] 10-display-container-info: executing... 
[10-display-container-info]: 
-------------------------
# USER DEFINED VARIABLES:
-------------------------
LC_ALL=C.UTF-8
GROUPNAME=user
USERNAME=user
PUID=900
FIRST_RUN=TRUE
PGID=900
-------------------------
# UID/GID of user:
-------------------------
UID: 900
GID: 900
-------------------------
# FOLDER PERMISSIONS:
-------------------------
drwxr-xr-x 1 user user 4096 Apr  7 02:57 /app
drwxr-xr-x 7 user user 4096 Sep 14 15:46 /config
drwxr-xr-x 1 user user 4096 Apr  7 02:57 /defaults
-------------------------
[cont-init.d] 10-display-container-info: exited 0.
[cont-init.d] 40-fix-toonami-attrs: executing... 
First boot with mounted /data/ToonamiAftermath detected.
[cont-init.d] 40-fix-toonami-attrs: exited 0.
[cont-init.d] 50-first-run: executing... 
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
ValueError: unsupported format character 'A' (0x41) at index 90
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
ValueError: unsupported format character 'A' (0x41) at index 90
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
2021-09-14 15:46:28,042 ToonamiAftermath-Logger get_media [ERROR]: The URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 has no media info.
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
ValueError: unsupported format character 'A' (0x41) at index 90
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
ValueError: unsupported format character 'A' (0x41) at index 90
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
2021-09-14 15:46:48,068 ToonamiAftermath-Logger get_media [ERROR]: The URL https://api.toonamiaftermath.com/media?scheduleName=Toonami%20Aftermath%20EST&dateString=2021-09-14&count=200 has no media info.
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: must be real number, not URLError
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: must be real number, not URLError
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
2021-09-14 15:47:08,096 ToonamiAftermath-Logger get_media [ERROR]: The URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 has no media info.
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: must be real number, not URLError
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/lib/python3.6/http/client.py", line 1281, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1327, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1276, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1042, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 980, in send
    self.connect()
  File "/usr/lib/python3.6/http/client.py", line 1434, in connect
    super().connect()
  File "/usr/lib/python3.6/http/client.py", line 952, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 237, in get_json_obj_from_url
    raw_data = urlopen(json_url, context=self.URL_CONTEXT).read()
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 526, in open
    response = self._open(req, data)
  File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
    '_open', req)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 1368, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.6/urllib/request.py", line 1327, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 994, in emit
    msg = self.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 840, in format
    return fmt.format(record)
  File "/usr/lib/python3.6/logging/__init__.py", line 577, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.6/logging/__init__.py", line 338, in getMessage
    msg = msg % self.args
TypeError: must be real number, not URLError
Call stack:
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 372, in <module>
    main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 368, in main
    ta.main()
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 89, in main
    self.get_media(channel_object=channel)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 134, in get_media
    json_object = self.get_json_obj_from_url(json_url=prepared_url)
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 245, in get_json_obj_from_url
    self.LOGGER.error('Error getting data from URL {} due to connection issue.'.format(json_url), connectionError)
Message: 'Error getting data from URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 due to connection issue.'
Arguments: (URLError(gaierror(-3, 'Temporary failure in name resolution'),),)
2021-09-14 15:47:28,123 ToonamiAftermath-Logger get_media [ERROR]: The URL https://api.toonamiaftermath.com/media?scheduleName=Snickelodeon%20EST&dateString=2021-09-14&count=200 has no media info.
[cont-init.d] 50-first-run: exited 0.
[cont-init.d] 60-fix-nginx-config: executing... 
Ensuring proper NGINX configuration.
[cont-init.d] 60-fix-nginx-config: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[run]: The Package Manager is apt-get
[nginx]: Starting . . .
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
chris102994 commented 2 years ago

Looks like you're having networking issues based on Temporary failure in name resolution.

From your host machine can you ping https://api.toonamiaftermath.com?

If you can then try pinging from inside your container: docker exec -it <container_id_or_name> ping toonamiaftermath.com

If either of those fail then it's likely your configured DNS server on your host machine (it maps to your container).

CHJ85 commented 2 years ago

Nah. It can't find ping inside the continer. ❯ docker exec -it 2f5629cd5a4e ping https://api.toonamiaftermath.com OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "ping": executable file not found in $PATH: unknown

chris102994 commented 2 years ago

Oh yeah this is because it's a stripped down container. Meaning I try not to install things we don't need. So let's try this.

  1. Ensure container /tmp has proper permissions: docker exec -it 2f56 chmod 1777 /tmp
  2. Use my apt wrapper to update pkg cache and install ping: inst-pkg iputils-ping

Then retry the last steps.

CHJ85 commented 2 years ago

Well. No network access in my docker for some reason.

❯ docker exec -it 2f56 inst-pkg iputils-ping
[inst-pkg]: The Package Manager is apt-get
[inst-pkg]: To be installed:  iputils-ping
[inst-pkg]: Installing package(s)...
[inst-pkg]: Updating packages. . . 
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
[inst-pkg]: Installing iputils-ping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package iputils-ping
[inst-pkg]: Cleaning up...

What do I do? Any idea what could cause this?
chris102994 commented 2 years ago

Lets see.

Try to restart the docker daemon: sudo systemctl restart docker

Then re-perform the steps above once the container's first-run is done.

If you still cannot ping then I suggest checking your DNS servers in /etc/resolv.conf and possibly restarting docker or your host. I recommend googles DNS servers (8.8.8.8, 8.8.4.4) .

CHJ85 commented 2 years ago

Idk about messing with those DNS settings. The file has been autogenerated by my VPN provider:

# Generated by expressvpn
search expressvpn
nameserver 10.83.0.1

That could be the issue here, but I doubt it. See. I disabled my VPN, restarted the docker daemon and tried installing ping again with no luck. Is there a way I can cronjob this outside the docker container? At this point, I would seriously prefer having this whole thing un-Dockered in the native host OS. Docker has been nothing but a nightmare so far.

chris102994 commented 2 years ago

No, there isn't a way to currently set this up outside of docker. The project is setup for this specific controlled docker environment at the moment. I built this with unRAID in mind since most home server users I know run that OS. The OS uses docker as an app store for easy app deployment.

I don't have any current plans or time to support the project in any other fashion but I don't think that the work to do so is specifically complex.

With that said I have been contemplating a new project that's similar to streamlink but for scraping TVG, EPG, and static episodes where users can write plugins for new providers. When I do that I will build this into it so that you can run it without a container if you wish.

I think your docker fix could be as simple as ensuring that:

{
    "dns":  ["8.8.8.8", "8.8.4.4"]
)

Is all that your /etc/docker/daemon.json contains.

Once that's established restart your docker daemon again.

CHJ85 commented 2 years ago

Okay. Thank you very much. But just to be clear. You mean the native /etc folder and not the one inside the docker container, right? Because the file /etc/docker/daemon.json does not exist. Because when I added this file to my host's /etc/docker folder, that gave me a whole bunch of errors and the service was not able to start.

chris102994 commented 2 years ago

Yes the one on your machine. If it doesn't exist then make it. That should be the standard docker config directory for all platforms. You'll likely need sudo access. And sometimes it doesn't exist if you have no custom docker settings.

CHJ85 commented 2 years ago

Right. But as I said, docker wouldn't start after I saved that file. I removed it again and now the service starts just fine. Still no network though. Is there no way I can setup this cron from outside of docker?

thegdoubleodees commented 2 years ago

0 11 docker restart toonamiaftermath 30 11 docker restart xteve

Just remembered I had to restart my xteve container also. Also had set plex and xteve to to refresh at a certain time to pull in everything correctly. Hope that helps you adapt it to your setup.

chris102994 commented 2 years ago

Well that won't help you since your container doesn't have internet access. I also can't help you fix issues if you don't post logs. Saying "it doesn't start" doesn't actually contribute to me helping you fix anything. Also, most of these docker issues you can google pretty easy. It's pretty commonly used. This isn't the container's issue as much as your docker setup issue.

thegdoubleodees commented 2 years ago

Just run another distro...make things simple first then make things complicated lol

CHJ85 commented 2 years ago

You're right. I'm not very tech savvy, so I wouldn't really know what to google. I barely even know what this Docker thing is. I just want the EPG xml for toonami aftermath to update. Anyway I'll try again tomorrow. I've had it with computers for one day. Thanks again for all your help.