dmunozv04 / iSponsorBlockTV

SponsorBlock client for all YouTube TV clients.
GNU General Public License v3.0
2.21k stars 92 forks source link

Docker Installation Newb Issue #21

Closed theprinceofspace closed 2 years ago

theprinceofspace commented 2 years ago

Hi, I am new to this world and just got a synology NAS with basically everything setup in docker. This sounds like a dream come true but I can't get past the installation steps.

I create the empty config.json file on my NAS. SSH in and run this:

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--setup

Which gives me this error:

You are running in docker, you have to mount the config file.
Please check the README.md for more information.
Traceback (most recent call last):
  File "/app/main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 29, in app_start
    config = load_config(args.file)
  File "/app/iSponsorBlockTV/helpers.py", line 18, in load_config
    return config
UnboundLocalError: local variable 'config' referenced before assignment

Any help/suggestions would be appreciated here. thanks.

dmunozv04 commented 2 years ago

The error message suggests that the config file hasn’t been mounted correctly. If the file isn’t created before running the container, docker will create a folder and not a file. Try these steps:

  1. Erase the folder created by docker: /volume1/docker/isponsorblocktv/config.json
  2. Create a blank file touch /volume1/docker/isponsorblocktv/config.json

Let me know if you have other issues

theprinceofspace commented 2 years ago

So, I do have a blank "touch config.json" file in the isponsorblocktv folder. Am I running the correct commands here? still getting an error on step 1.

docker run --rm -it \ --network=host \ -v /volume1/docker/isponsorblocktv/touch config.json:/app/config.json \ ghcr.io/dmunozv04/isponsorblocktv \ --setup

Produces this error:

docker: invalid reference format.

This is a dead end I cannot get past.

dmunozv04 commented 2 years ago

Touch is a command that creates a file. You should first run touch config.json which will make a file called config.json and then run the original docker command.

The other option you have is to download the template config file and place it in the folder, making sure to rename it to config.json. Hopefully this should work

theprinceofspace commented 2 years ago

Thanks for getting back to me. I saved and renamed the config file template in that folder I created. but when I enter this

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--setup

I am still getting errors.

You are running in docker, you have to mount the config file.
Please check the README.md for more information.
Traceback (most recent call last):
  File "/app/main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 29, in app_start
    config = load_config(args.file)
  File "/app/iSponsorBlockTV/helpers.py", line 18, in load_config
    return config
UnboundLocalError: local variable 'config' referenced before assignment

I have a very low level of understanding here (isn't the -v command mounting the file?) and google is failing to help me troubleshoot this.

bucketsadmin commented 2 years ago

I just ran into this myself, the fix here was making sure that the config.json permissions allow the docker container to access the entire folder structure in the host volume.

theprinceofspace commented 2 years ago

Great! How do I change that? Alter that initial code somehow?

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--setup
dmunozv04 commented 2 years ago

Try this:

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
-e PUID=0 \
-e PGID=0 \
-e iSPBTV_docker= \
ghcr.io/dmunozv04/isponsorblocktv \
--setup
theprinceofspace commented 2 years ago

same error message.

You are running in docker, you have to mount the config file.
Please check the README.md for more information.
Traceback (most recent call last):
  File "/app/main.py", line 3, in <module>
    helpers.app_start()
  File "/app/iSponsorBlockTV/helpers.py", line 29, in app_start
    config = load_config(args.file)
  File "/app/iSponsorBlockTV/helpers.py", line 18, in load_config
    return config
UnboundLocalError: local variable 'config' referenced before assignment
dmunozv04 commented 2 years ago

Can you attach the config.json file you are using?

theprinceofspace commented 2 years ago

config json Sure, added .gif to the end so github would let me upload it. I just copied over the file you linked above.

theprinceofspace commented 2 years ago

well that didn't work. trying again. zipped version attached. config.json.zip

dmunozv04 commented 2 years ago

Also, can you test this other command?:

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
-e PUID=0 \
-e PGID=0 \
-e 
ghcr.io/dmunozv04/isponsorblocktv \
--setup
theprinceofspace commented 2 years ago

flag needs an argument: 'e' in -e

dmunozv04 commented 2 years ago

Sorry, try this instead: (it didn’t copy correctly)

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
-e PUID=0 \
-e PGID=0 \
-e iSPBTV_docker= \
ghcr.io/dmunozv04/isponsorblocktv \
--setup
dmunozv04 commented 2 years ago

If that works I’ll fix it properly when I’ve got time

theprinceofspace commented 2 years ago

oh, here's a new one. weird

-sh: ghcr.io/dmunozv04/isponsorblocktv: No such file or directory

dmunozv04 commented 2 years ago

Try using your original command and erasing the config.json. Replace it with the contents of this: https://github.com/dmunozv04/iSponsorBlockTV/raw/main/config.json.template

theprinceofspace commented 2 years ago

I had to reconnect to the network and the previous code you gave me works now!! going through setup now. 😀

dmunozv04 commented 2 years ago

Nice!

dmunozv04 commented 2 years ago

Please let me know if everything worked to be able to close the issue

theprinceofspace commented 2 years ago

ok. I actually made an error in the config file location that was causing the endless reboot cycle. now it's working flawlessly!! thanks so much for holding my hand through this. and building something incredible.

(also sorry for replying in the wrong thread)

theprinceofspace commented 2 years ago

Recap of what worked for me on my synology NAS. Use as a beginners guide if you like.

Make sure that the option to connect to apple TV's in the home app is set to allow anyone from this network.

Download the template config file and place it in a folder, making sure to rename it to config.json.

for me that location was /volume1/docker/isponsorblocktv/config.json referenced below.

In terminal, SSH into your synology NAS ssh (user)@(local IP) -p (port)

docker run --rm -it \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
-e PUID=0 \
-e PGID=0 \
-e iSPBTV_docker= \
ghcr.io/dmunozv04/isponsorblocktv \
--setup

Go through the setup steps. You will need to create a youtube API, not a big deal.

Once that is complete, your config file will be modified with your preferences. Run the container:

docker pull ghcr.io/dmunozv04/isponsorblocktv
docker run -d \
--name iSponsorBlockTV \
--restart=unless-stopped \
--network=host \
-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv

That's it.

dmunozv04 commented 2 years ago

Thanks for the kind words and the tutorial. I’ll make sure to put it in the wiki. Also, some nice improvements are coming soon

theprinceofspace commented 2 years ago

Cool, looking forward to it. I had a whole yt-dlp setup on my NAS to get ads out of the few channels I watch regularly and into plex, recognized as tv shows. This is a much better solution!

Next time you are looking for a new project, podcast ads have gotten quite obnoxious and there are currently no sponsorblock like solutions. Maybe something that lives in docker, collects your subs, strips ads out and creates a new RSS feed you can use in your podcast app of choice? With options like 'skip rebroadcasts' too? this could be tougher with dynamically inserted ads but there are probably ways to correct for that. Maybe an ad database like how the plex skip intro function works - detects identical audio across episodes.