dmunozv04 / iSponsorBlockTV

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

New Apple Tv not found when running setup #36

Closed theprinceofspace closed 1 year ago

theprinceofspace commented 1 year ago

I got a new apple tv and when I run the setup it isn't found, no identifier or airplay credentials are added to config.json. I deleted all and tried a fresh install but that also didnt work.

I run 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

in terminal I see Found 0 Apple TV(s) in config.json. Add more? (y/n) y I hit y but it just asks for my API key next.

output looks like this:

{"apikey": "6...", "skip_categories": ["sponsor", "selfpromo", "exclusive_access", "interaction"]}

with none of the

"atvs": [{"identifier": "D261...", "airplay_credentials"

I also tried installing docker on my mac but get the same output. On the Apple TV settings Airplay is on and Allow Access is set to Same Network. All devices are on the same network.

Must be missing something here but I am out of ideas.

If there is another way to get the identifier and airplay credentials I am happy to update the config file manually. Open to options here.

dmunozv04 commented 1 year ago

You can get them this way (it’s an old guide the readme had at some point): You need to retrieve airplay keys to be able to connect to the Apple TV. (It will be made simpler in the future) For now, use atvremote, a script included in pyatv:

  1. docker run --rm -it --network=host --entrypoint /bin/bash ghcr.io/dmunozv04/isponsorblocktv
  2. atvremote scan
  3. atvremote pair --protocol airplay --id identifier you got on the previous step
  4. exit the container

I can’t give you more help if you don’t follow the issue template

theprinceofspace commented 1 year ago

I get an error trying to run that. Using the issue template below.

Before opening an issue make sure that there are no duplicates and that you are on the latest version. Describe the bug Setup not adding new Apple TV to config file

To Reproduce Run setup:

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

Expected behavior A config file which includes "atvs": [{"identifier": "D261...", "airplay_credentials" for my new apple tv.

Screenshots

image

iSponsorBlockTV server (please complete the following information): Docker on synology nas

Apple TV (please complete the following information): 2022 Apple TV 4k with ethernet

Additional context

Terminal log

-v /volume1/docker/isponsorblocktv/config.json:/app/config.json \ ghcr.io/dmunozv04/isponsorblocktv \ --setup Password: Creating config file Found 0 Apple TV(s) in config.json. Add more? (y/n) y done adding get youtube apikey here: https://developers.google.com/youtube/registering_an_application Enter your API key: AIza... Enter skip categories (space sepparated) Options: [sponsor, selfpromo, exclusive_access, interaction, poi_highlight, intro, outro, preview, filler, music_offtopic: sponsor config finished

complete config file:

{"apikey": "AIza...", "skip_categories": ["sponsor"]}

dmunozv04 commented 1 year ago

If I'm understanding this correctly, your older (not 2022) apple TV's are connecting fine, but your 2022 isn't?

theprinceofspace commented 1 year ago

Yes. Running the setup with the old Apple TV months ago worked. New one isn’t being added to the config. I no longer have the old Apple TV though.

I’m guessing there must be some network issue or something unusual with the new Apple TVs that prevents this info from being seen.

On Sun, Nov 13, 2022 at 5:44 PM David @.***> wrote:

If I'm understanding this correctly, your older (not 2022) apple TV's are connecting fine, but your 2022 isn't?

— Reply to this email directly, view it on GitHub https://github.com/dmunozv04/iSponsorBlockTV/issues/36#issuecomment-1312841627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYYTOUFBC2YCUNV7M2DMJ6TWIFVMDANCNFSM6AAAAAAR7F4NTY . You are receiving this because you authored the thread.Message ID: @.***>

dmunozv04 commented 1 year ago

My code checks for specific apple TV models. The new model hasn't been added to pyatv yet AFAIK, so maybe that's the issue. Could you edit ` if i.device_info.model in [ DeviceModel.Gen4, DeviceModel.Gen4K, DeviceModel.AppleTV4KGen2, ]: ` and change it to if True: This can be found on the : config_helpers.py file. This file can be accessed by running docker exec -it iSponsorBlockTV vi /app/iSponsorBlockTV/config_setup.py

dmunozv04 commented 1 year ago

Please let me know if this works and I'll edit it in the repository

theprinceofspace commented 1 year ago

I was able to edit the file as instructed and download your code but I am too much of a docker novice to understand how to actually run that new setup file. I even tried branching your code and running it under my username but failed to make that live. a bit embarrassing. https://github.com/theprinceofspace/iSponsorBlockTV

Sorry, any other suggestions here?

dmunozv04 commented 1 year ago

Please run

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:pr-37
--setup 

That should use the new code from my pull request

theprinceofspace commented 1 year ago

unfortunately the output was the same. {"apikey": "AIza...", "skip_categories": ["sponsor"]}

terminal:

jeff@trove:~$ sudo docker run --rm -it \

--network=host \ -v /volume1/docker/isponsorblocktv/config.json:/app/config.json \ ghcr.io/dmunozv04/isponsorblocktv:pr-37 \ --setup Unable to find image 'ghcr.io/dmunozv04/isponsorblocktv:pr-37' locally pr-37: Pulling from dmunozv04/isponsorblocktv ca7dd9ec2225: Already exists 9e124a36b9ab: Pull complete 86456952aa28: Pull complete 4ece9ef7a579: Pull complete d23932e6a297: Pull complete e958740fef39: Pull complete d13134565481: Pull complete 642faca7dec9: Pull complete 4f4fb700ef54: Pull complete 78becc03d31d: Pull complete 6a5fa721eb44: Pull complete Digest: sha256:ce151fca194c69c97f2c06018e0a9e416d809c403c8091e50228c9840568bd58 Status: Downloaded newer image for ghcr.io/dmunozv04/isponsorblocktv:pr-37 Creating config file Found 0 Apple TV(s) in config.json. Add more? (y/n) y done adding get youtube apikey here: https://developers.google.com/youtube/registering_an_application Enter your API key: AIza... Enter skip categories (space sepparated) Options: [sponsor, selfpromo, exclusive_access, interaction, poi_highlight, intro, outro, preview, filler, music_offtopic: sponsor config finished

dmunozv04 commented 1 year ago

You can get them this way (it’s an old guide the readme had at some point): You need to retrieve airplay keys to be able to connect to the Apple TV. (It will be made simpler in the future) For now, use atvremote, a script included in pyatv:

  1. docker run --rm -it --network=host --entrypoint /bin/bash ghcr.io/dmunozv04/isponsorblocktv
  2. atvremote scan
  3. atvremote pair --protocol airplay --id identifier you got on the previous step
  4. exit the container

Did you attempt this method?

theprinceofspace commented 1 year ago

Sorry again, very new to docker in general. If I literally copy and paste that first line, I get this response in terminal.

docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown.

Tried updating this part --entrypoint=/bin/bash but got the same error.

dmunozv04 commented 1 year ago

Try using this docker run --rm -it --network=host --entrypoint /bin/sh ghcr.io/dmunozv04/isponsorblocktv

theprinceofspace commented 1 year ago

WOOHOO! that worked. though it gave me a couple identifiers, both look much shorter than the previous setup.

Identifiers:

I used the second one first but it wasnt skipping ads so I tried the first one. same result though. both asked me to put in the code on the apple tv so I thought I had synced correctly. but after several tests, app restarts and apple tv restarts, still no ad skipping.

Config file

{"atvs": [{"identifier": "A8...", "airplay_credentials": "910cfb51..."}], "apikey": "AIza...", "skip_categories": ["sponsor", "selfpromo", "exclusive_access", "interaction"]}

I also deleted and reinstalled the docker container just in case that was the issue. it is running but still seeing the sponsor segments in videos where those sections skip on my laptop.

image
dmunozv04 commented 1 year ago

Please run the container with debug logs so I can diagnose the issue.

docker run --rm -it \
--network=host \
-v /PATH_TO_YOUR_CONFIG.json:/app/config.json \
ghcr.io/dmunozv04/isponsorblocktv \
--debug 
dmunozv04 commented 1 year ago

If you don’t want to post them, you can send them to my discord: dmunozv04#7198

theprinceofspace commented 1 year ago

Better news, after my last comment I rebooted the server completely (not just docker) and it works! Like magic ads are skipping just as with my old Apple TV. Thanks for holding my hand through all of this. Really appreciate it and your incredible software. You rock!

dmunozv04 commented 1 year ago

Thanks for the nice comment. I’m happy that you managed to get it working with the new apple TV!