Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Apple Tv not found when running setup #36

Closed
theprinceofspace opened this issue Nov 13, 2022 · 17 comments · Fixed by #49
Closed

New Apple Tv not found when running setup #36

theprinceofspace opened this issue Nov 13, 2022 · 17 comments · Fixed by #49
Labels
bug Something isn't working

Comments

@theprinceofspace
Copy link

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.

@theprinceofspace theprinceofspace added the bug Something isn't working label Nov 13, 2022
@dmunozv04
Copy link
Owner

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
Copy link
Author

theprinceofspace commented Nov 13, 2022

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
Copy link
Owner

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

@theprinceofspace
Copy link
Author

theprinceofspace commented Nov 13, 2022 via email

@dmunozv04
Copy link
Owner

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
Copy link
Owner

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

@theprinceofspace
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

dmunozv04 commented Nov 14, 2022

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

@theprinceofspace
Copy link
Author

theprinceofspace commented Nov 14, 2022

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

Identifiers:

  • F4:3...
  • F4...

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
Copy link
Owner

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
Copy link
Owner

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

@theprinceofspace
Copy link
Author

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants