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

Not Updating #13

Open fonikz opened 10 months ago

fonikz commented 10 months ago

It hasn't updated the XML Guide Data since I first started the program. Stopping and starting the container doesn't seem to restart it either.

chris102994 commented 10 months ago

I'm sorry you're having issues but you gave me zero context to the issues you're having. At MINIMUM I need:

fonikz commented 9 months ago

Well there's another issue, I can't find the logs. Here's the command, but there are no files in that folder. I've tried to search my drive for the ToonamiAftermath files but for some reason can't find them. But they do exist, if I go to localhost:8000 the site is there. And the file seems to only update when I completely close the container (not just stopping it) and starting it in a new container.

docker run \ --name=docker-toonamiaftermath \ -p 8000:8000 \ -v ~/.config/toonamiaftermath:/config \ --restart unless-stopped \ christopher102994/docker-toonamiaftermath:ubuntu-18-latest

chris102994 commented 9 months ago

Okay @fonikz - I need your DOCKER logs. Not any logs mounted from the running container.

You should be able to see your running images with docker ps - once we confirm your container is running you'll see the name (docker-toonamiaftermath). Once we confirm it's up those logs are what we need with docker logs docker-toonamiaftermath.

fonikz commented 9 months ago

https://pastebin.com/32B7erjM It's running. Output from that log.

chris102994 commented 9 months ago

Everything looks fine to me. Try deleting that running image docker rmi -f docker-toonamiaftermath (I think) and re-running the command with some new options:

docker run \ 
    --name=docker-toonamiaftermath \ 
    -p 8000:8000 \ 
    -v ~/.config/toonamiaftermath:/config \ 
    -v ~/.data/toonamiaftermath:/data \ 
    -e LOG_LEVEL="DEBUG" \
    --restart unless-stopped \ 
    christopher102994/docker-toonamiaftermath:ubuntu-18-latest

What I'm doing here is mounting the cache to ~/.data/toonamiaftermath (this lets us see what we're actually writing - prob need to add that to the notes so +1) and I'm turning the log level to debug which allows me to see issues.

Once you do this I need:

  1. Show me what's in your config and data folders w/ ls -lah ~/.data/toonamiaftermath/ and ls -lah ~/.config/toonamiaftermath/
  2. Give me the new docker logs.
  3. Give me the 2 files this project provides from http://<ip>:<port>/ToonamiAftermath.m3u and http://<ip>:port/ToonamiAftermathGuide.xml

Further I'd like to know why you think it's not updating? I've been running the latest tag for a few years now pretty stably with no issues. Emby scrapes it just fine. If you're using Plex or Jellyfin I'm afraid I wont be able to troubleshoot those.

fonikz commented 9 months ago

The problem may be that my terminal isn't registering \ as continuing on the next line. The first time I tried to run it, I got errors that -p wasn't a command, etc. So I put it in a .sh and ran it that way, then I saw that ~/.data hadn't been created. Reducing it all down to a single line and running it may have fixed all my issues.

fonikz commented 9 months ago

https://pastebin.com/1rDdfbu3 There's the output of the two ls commands, plus the docker logs

ToonamiAftermathGuide.txt

ToonamiAftermath.txt

The two files, renamed .txt to make github happy

chris102994 commented 9 months ago

That xmltv file is up to date. Not sure why you think you have issues.

fonikz commented 9 months ago

Like I said I think the issue may have been the new lines not registering. It would always update when I first started a new container but then not update anymore. I will keep an eye on it for a few days and make sure it's updating.

thegdoubleodees commented 9 months ago

What are you using to read the xml data? I thought i had a similar issue with xteve but xteve was the issue

chris102994 commented 9 months ago

Emby reads it. No reason for xteve

thegdoubleodees commented 9 months ago

I use plex and xteve, i had to tweak settings on xteve to keep pulling in new data

chris102994 commented 9 months ago

I used to use xteve and it used to be integrated into this project but honestly saw little need for it in my setup with emby. Last I used it worked fine with xteve. Pretty much the same codebase now.

fonikz commented 9 months ago

It's still not updating itself. Seems to have updated 4 days ago when I first ran it and then no more. Docker says it's running and has been up for 4 days 0209444c1797 christopher102994/docker-toonamiaftermath:ubuntu-18-latest "/init" 4 days ago Up 4 days 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp docker-toonamiaftermath

ToonamiAftermathGuide.txt

Docker log: https://pastebin.com/va0eBryN

fonikz commented 9 months ago

output2.txt

Sorry here's the complete log output using &> instead of just >

chris102994 commented 9 months ago

@fonikz Run these commands:

  1. docker exec -it docker-toonamiaftermath ps -ef | grep -i cron
  2. docker exec -it docker-toonamiaftermath cat /etc/crontab | grep -i ta-wrapper
  3. docker exec -it docker-toonamiaftermath cat /app/ta-wrapper.sh
  4. docker exec -it docker-toonamiaftermath ls -lah /etc/services.d/cron/
  5. docker exec -it docker-toonamiaftermath cat /etc/services.d/cron/run
  6. docker exec -it docker-toonamiaftermath /app/ta-wrapper.sh
fonikz commented 9 months ago

[sudo] password for hukt: 
root         428       1  0 Nov04 ?        00:00:00 s6-supervise cron
root         431     428  0 Nov04 ?        00:00:00 /usr/sbin/cron -f -L 4
hukt@ubuntustudio:~$ sudo docker exec -it docker-toonamiaftermath cat /etc/crontab | grep -i ta-wrapper
0       */12    *       *       *       root /app/ta-wrapper.sh
hukt@ubuntustudio:~$ sudo docker exec -it docker-toonamiaftermath cat /app/ta-wrapper.sh

/usr/bin/python3 /app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.pyhukt@ubuntustudio:~$ sudo docker exec -it docker-toonamiaftermath ls -ldocker exec -it docker-toonamiaftermath ls -lah /etc/services.d/cron/
total 20K
drwxrwxr-x 1 root root 4.0K Sep 10  2020 .
drwxrwxr-x 1 root root 4.0K Apr  7  2021 ..
-rwxr-xr-x 1 root root  308 Sep 10  2020 run
hukt@ubuntustudio:~$ sudo docker exec -it docker-toonamiaftermath cat /etc/services.d/cron/run
#!/usr/bin/with-contenv bash

. pkg-manager

case "$MANAGER" in
                apt-get )
                    exec /usr/sbin/cron -f -L 4
                    ;;
                apk )
                                        exec /usr/sbin/crond -f -S -l 5 -c /etc/crontabs
                    ;;
                *)
                    ;;
esac

hukt@ubuntustudio:~$ sudo docker exec -it docker-toonamiaftermath /app/ta-wrapper.sh
OCI runtime exec failed: exec failed: unable to start container process: exec /app/ta-wrapper.sh: exec format error: unknown
hukt@ubuntustudio:~$ ```
chris102994 commented 9 months ago

Well looks like that's your issue. You're doing something to delete /app/ta-wrapper.sh as you can see above it doesn't exist.

chris102994 commented 9 months ago

Whoops looks like it does but it put the output behind your next terminal command. Disregard. Looks like the last one doesn't work for me that way either (I did from inside the running container).

try:

docker exec -it dockertoonamiaftermath exec /usr/bin/python3 /app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py

fonikz commented 9 months ago

dockertoonamiaftermath changed to docker-toonamiaftermath, and it's now performing an update.

chris102994 commented 9 months ago

Okay so that's a manual one. Not sure why yours isn't working. Honestly I haven't updated this in ~3 years as it's been and still is perfectly stable for me on unraid. I have an older (now deprecated) alpine based image: alpine-3.10-latest perhaps that would work on your setup. It should contain the same code (I haven't tested) - IIRC I just took it off the repo because it didn't seem like 2 versions were needed.

To perform this delete your running image and perform the same run command with this tag rather than ubuntu-18-latest

fonikz commented 9 months ago

That image seems to be hanging on starting xteve...

fonikz commented 9 months ago

I think this is the right xteve log. I appreciate your help on this, it's a great program and if push comes to shove I'll just keep updating it manually, it's still worth the effort having TA in Emby.



2023/11/09 01:43:52 [xTeVe] Version:               2.1.2 Build: 0121
2023/11/09 01:43:52 [xTeVe] Database Version:      2.1.0
2023/11/09 01:43:52 [xTeVe] System IP Addresses:   IPv4: 2 | IPv6: 0
2023/11/09 01:43:52 [xTeVe] Hostname:              290171b89abf
2023/11/09 01:43:52 [xTeVe] System Folder:         /config/
2023/11/09 01:43:52 [xTeVe] Load Settings:         /config/settings.json
2023/11/09 01:43:52 [xTeVe] Temporary Folder:      /tmp/xteve/2020-01-FPIF-UZHM5N/
2023/11/09 01:43:52 [xTeVe] GitHub:                https://github.com/xteve-project
2023/11/09 01:43:52 [xTeVe] Git Branch:            master [xteve-project]
2023/11/09 01:43:52 [xTeVe] SSDP / DLNA:           true
2023/11/09 01:43:53 [xTeVe] Update Available:      Version: 2.2.0.0200
2023/11/09 01:43:53 [xTeVe] Update Server:         GitHub
2023/11/09 01:43:53 [xTeVe] Start Update:          Branch: master
2023/11/09 01:43:53 [ZIP] New version (xteve_2): 2.2.0.0200
2023/11/09 01:43:53 [ZIP] Download new version...
2023/11/09 01:43:54 [ZIP] Update file: xteve
2023/11/09 01:43:54 [ZIP] Unzip ZIP file...
2023/11/09 01:43:54 [ZIP] Unzip ZIP file...OK
2023/11/09 01:43:54 [ZIP] Copy binary file...
2023/11/09 01:43:54 [ZIP] Copy binary file...OK
2023/11/09 01:43:54 [ZIP] Update Successful
For help run: /app/xteve -h

2023/11/09 01:43:54 [xTeVe] Version:                2.2.0 Build: 0200
2023/11/09 01:43:54 [xTeVe] Database Version:       2.1.0
2023/11/09 01:43:54 [xTeVe] System IP Addresses:    IPv4: 2 | IPv6: 0
2023/11/09 01:43:54 [xTeVe] Hostname:               290171b89abf
2023/11/09 01:43:54 [xTeVe] System Folder:          /config/
2023/11/09 01:43:54 [xTeVe] Load Settings:          /config/settings.json
2023/11/09 01:43:54 [xTeVe] Temporary Folder:       /tmp/xteve/2020-01-FPIF-UZHM5N/
2023/11/09 01:43:54 [xTeVe] GitHub:                 https://github.com/xteve-project
2023/11/09 01:43:54 [xTeVe] Git Branch:             master [xteve-project]
2023/11/09 01:43:54 [xTeVe] SSDP / DLNA:            true
2023/11/09 01:43:55 [xTeVe] UUID:                   2020-01-FPIF-UZHM5N
2023/11/09 01:43:55 [xTeVe] Tuner (Plex / Emby):    1
2023/11/09 01:43:55 [xTeVe] EPG Source:             XEPG
2023/11/09 01:43:55 [xTeVe] Plex Channel Limit:     480
2023/11/09 01:43:55 [xTeVe] Unfiltered Chan. Limit: 480
2023/11/09 01:43:55 [xTeVe] Backup Path:            /config/backup/
2023/11/09 01:43:55 [xTeVe] Backup file:            /config/backup/xteve_auto_backup_20231109_0143.zip
2023/11/09 01:43:55 [xTeVe] Open:                   /data/ToonamiAftermath/ToonamiAftermath.m3u
2023/11/09 01:43:55 [xTeVe] Check File:             /data/ToonamiAftermath/ToonamiAftermath.m3u
2023/11/09 01:43:55 [xTeVe] Save File:              /data/ToonamiAftermath/ToonamiAftermath.m3u [ID: MEFSLBL3WKWEQXYX469O]
2023/11/09 01:43:55 [xTeVe] Open:                   /data/ToonamiAftermath/Toonami_Aftermath_Guide.xml
2023/11/09 01:43:55 [xTeVe] Check File:             /data/ToonamiAftermath/Toonami_Aftermath_Guide.xml
2023/11/09 01:43:55 [xTeVe] Save File:              /data/ToonamiAftermath/Toonami_Aftermath_Guide.xml [ID: XYDP47B15C52LOH6R46J]
2023/11/09 01:43:55 [xTeVe] All streams:            8
2023/11/09 01:43:55 [xTeVe] Active streams:         8
2023/11/09 01:43:55 [xTeVe] Filter:                 0
2023/11/09 01:43:55 [xTeVe] XEPG:                   Parse XMLTV file: ToonamiAftermath
2023/11/09 01:43:55 [xTeVe] XEPG:                   Update database
2023/11/09 01:43:55 [xTeVe] XEPG:                   Save DB file
2023/11/09 01:43:55 [xTeVe] XEPG:                   Map channels
2023/11/09 01:43:55 [xTeVe] XEPG:                   Cleanup database
2023/11/09 01:43:55 [xTeVe] XEPG Channels:          7
2023/11/09 01:43:55 [xTeVe] DVR IP:                 172.17.0.2:34400
2023/11/09 01:43:55 [xTeVe] Web Interface:          http://172.17.0.2:34400/web/ | xTeVe is also available via the other 1 IP.
2023/11/09 01:43:55 [xTeVe] XEPG:                   Create XMLTV file (/config/data/xteve.xml)
2023/11/09 01:43:55 [xTeVe] Create Dummy Guide:     Time offset +0000 - MTV97 (US) (English)
2023/11/09 01:43:55 [xTeVe] Create Dummy Guide:     Time offset +0000 - MTV97 (US) (English)
2023/11/09 01:43:55 [xTeVe] Create Dummy Guide:     Time offset +0000 - Random Movies (US) (English)
2023/11/09 01:43:55 [xTeVe] XEPG:                   Compress XMLTV file (/config/data/xteve.xml.gz)
2023/11/09 01:43:55 [xTeVe] XEPG:                   Create M3U file (/config/data/xteve.m3u)
2023/11/09 01:43:55 [xTeVe] XEPG:                   Ready to use
2023/11/09 01:43:55 [xTeVe] Image Caching:          Images are cached (117)
2023/11/09 01:44:02 [xTeVe] Image Caching:          Done
2023/11/09 01:44:02 [xTeVe] XEPG:                   Create XMLTV file (/config/data/xteve.xml)
2023/11/09 01:44:02 [xTeVe] Create Dummy Guide:     Time offset +0000 - MTV97 (US) (English)
2023/11/09 01:44:02 [xTeVe] Create Dummy Guide:     Time offset +0000 - Random Movies (US) (English)
2023/11/09 01:44:02 [xTeVe] Create Dummy Guide:     Time offset +0000 - MTV97 (US) (English)
2023/11/09 01:44:02 [xTeVe] XEPG:                   Compress XMLTV file (/config/data/xteve.xml.gz)
2023/11/09 01:44:02 [xTeVe] XEPG:                   Create M3U file (/config/data/xteve.m3u)
```
chris102994 commented 9 months ago

Okay yeah I forgot about that. Don't use the alpine version. Looks like it still has xteve in it. There's a reason I quit using xteve - it's not super good. When I get some free time I'll re-enable the builds and try to fix your issue if I can reproduce it. Likely the container needs to be updated.

fonikz commented 1 month ago

Revisiting this issue, using ChatGPT to try and help me out here because I'm a very unskilled programmer. ChatGPT walked me through running bash inside the toonamiaftermath container.

When I run service cron status it returns cron: unrecognized service but when I try to install cron, cron is already the newest version (3.0pl1-128.1ubuntu1)

ls -l /etc/init.d/cron returns No Such File or Directory

Running cron directly: cron: can't lock /var/run/crond.pid, otherpid may be 438: Resource temporarily unavailable

/var/run/crond.pid just output the text 438

I removed the crond.pid file and then was able to start cron manually, but no cron jobs are scheduled. Reading from the Dockerfile.debian, the setup for the cron job was 0 */12 * * * root /app/ta-wrapper.sh

My crontab looks like this

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
0       */12    *       *       *       root /app/ta-wrapper.sh

but crontab -l -u root says "no crontab for root"

According to ChatGPT, this is because /etc/crontab is a system-wide crontab and not user-specific. So maybe now this will update correctly, I guess I'll wait and see.

fonikz commented 1 month ago

Still not working.

Now ChatGPT has walked me through setting up logging from the cronjob itself. I can run ta-wrapper.sh from the terminal, but when Cron tries to run the job,

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 20, in <module>
    from ToonamiAftermath import media, mediaInfo, taChannels
ModuleNotFoundError: No module named 'ToonamiAftermath'

It was suggested I define the PYTHONPATH to /app in ta-wrapper.sh, but then I get the error that it can't find the modules

Traceback (most recent call last):
  File "/app/ToonamiAftermath/ToonamiAftermath/toonami_aftermath.py", line 20, in <module>
    from ToonamiAftermath import media, mediaInfo, taChannels
ImportError: cannot import name 'media'