Closed CelticWebSolutions closed 4 years ago
still causes a restart loop as out keeps getting errors once run
Please post the errors here.
I build the image with the command sudo docker build -t stigger/trakt-for-appletv .
Output of build can be seen here [https://pastebin.com/kRHdnJ76] This creates an image that is called stigger/trakt-for-appletv
The I run the image which gives errors, the initial error was
python3: can't open file 'tvremote.py': [Errno 2] No such file or directory
So I changed the docker file to run tvscrobbler.py as per the GitHub instructions in the readme.
rebuild the image from the new docker file and I then get the error (screenshot)
PermissionError: [Errno 13] Permission denied: 'data/config.yml'`
Looks like there may be a permissions error but I can't work out how to fix it.
I'm also not sure where it would be asking for me to login when it's running in a docker container on my Synology. When I couldn't get it to run on docker on my Synology, I tried to run it on my Mac but just running the scripts there failed too. different error I'll pop that in another issue report for you.
Were you able to replicate this error? I just can’t get the docket container to run :( myself and so many other have been hunting for exactly this for some time so I’m keen to find what’s causing it to fail.
I pushed some updates and now the permission error should be resolved.
I'm also not sure where it would be asking for me to login when it's running in a docker container on my Synology
I'm not sure, to be honest, never had any experience with Synology. If there is a way to get a proper shell access, then you can just run the container interactively the first time (add -i
, omit -d
).
Alternatively, do the initial setup on some other machine, then copy the contents of data
directory into /opt/TVRemote/data
inside the container and restart it. Or put it into data
of this project and rebuild the image. If you do that, then don't share the image with anybody, because it will contain your credentials.
Thank for the update, I think we're close enow, the container asked for the auth ket for trat then once I gave it the key, it threw the following error
Exception in callback ScrobblingRemoteProtocol.connection_made(<_SelectorSoc...e, bufsize=0>>) handle: <Handle ScrobblingRemoteProtocol.connection_made(<_SelectorSoc...e, bufsize=0>>)> Traceback (most recent call last): File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/opt/TVRemote/scrobbling.py", line 52, in connection_made super().connection_made(transport) File "/opt/TVRemote/media_remote.py", line 48, in connection_made pairing(socket, self.config['device_info']) File "/opt/TVRemote/pairing.py", line 117, in pairing appletv_public = parsed[kTLVType_PublicKey] KeyError: b'\x03'
I was able to reproduce this problem and will try to look into it later this week.
@CelticWebSolutions Pushed a fix, please try again.
Thanks, updated container and now I can't get Trakt to generate a code, keep getting error on tract website "Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."
I've managed to get past the tract authorisation part by adding an existing config and tarot.auth file, now it just sat and did nothing....
I deleted the container and set it up with higher privileges and then set the network to be same as host. It's now saying ready! I think we're near perfect now. Only issue in the container is the OAUTH failing. doesn't effect it running directly on my Mac though, only while it's in the container. I'll experiment some more and see if I can fix that if you can't replicate it. I'll update when I get it all working 100%
Thank you for all your time and effort!
Quick update, Netflix works great, Amazon on the other hand fails with an error as follows
Exception in thread Thread-5: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 214, in get_amazon_details url = self.config['amazon']['get_playback_resources_url'] % contentIdentifier KeyError: 'get_playback_resources_url'
Definitely some serious progress here, I'm really impressed how well the Netflix one worked!
Glad that it works!
The Amazon support is a bit tricky and requires some additional configuration. Besides, I haven't used Amazon Prime for some time, so it might be non-functional at the moment. Nevertheless, please give it a try, and if this works for you, I'll put something into readme.
ubid-acbde
, x-acbde
, at-acbde
asin
parameter with %s
.config.yml
using the following structure:
amazon:
cookie: ubid-acbde=<value>; x-acbde=<value>; at-acbde=<value>
get_playback_resources_url: https://atv-ps-eu.amazon.de/cdp/catalog/GetPlaybackResources?asin=%s&consumptionType=Streaming&<...>
OK I've found the details above, my cookies are UK not de, for example, instead of ubid-acbde I have ubidacbuk I've changed them to show as such in the entry in the config. exmaple being
amazon: cookie: ubid-acbuk=262-3051744-8224249; x-acbuk=
I assume thats correct?
As for the url, I've found that in the network inspector, it's extremely long, which part do I need?
Here it is (modified some numbers within so as not to give any access to my account)
Thanks again for all your help, I'll be assembling thsi in a simple package for Synology users once we get this sorted.
OK I've found the details above, my cookies are UK not de, for example, instead of ubid-acbde I have ubidacbuk I've changed them to show as such in the entry in the config
Yes, in that case you should have ubid-acbuk
, x-acbuk
and at-acbuk
.
As for the url, I've found that in the network inspector, it's extremely long, which part do I need?
asin=B085F2BPQJ
with asin=%s
Widevine2License
with CatalogMetadata
OK so my url would be something like
get_playback_resources_url: https://atv-ps-eu.amazon.co.uk/cdp/catalog/GetPlaybackResources?asin=%s&consumptionType=Streaming&desiredResources=CatalogMetadata&deviceID=a635aec3812f4c94d7e2e0c96ecaa562179c421951ef98d170cf56e2&deviceTypeID=AOAGZA014O5RE&firmware=1&gascEnabled=false&marketplaceID=A1F83G7C2ARO7P&resourceUsage=ImmediateConsumption&userWatchSessionId=88eb2a09-1abe-4d8d-bd29-a43aa72f5064&videoMaterialType=Feature&playerType=html5&clientId=f22dbddb-ef2c-48c5-8876-bed0d47594fd&operatingSystemName=Mac%20OS%20X&operatingSystemVersion=10.15.4&deviceDrmOverride=CENC&deviceStreamingTechnologyOverride=DASH
Does that look right?
First time I tried, before you gave me the details to change in the url, it stopped the system from talking to trakt all together, with the modified url, it talks to trakt about Netflix but still throws an error while using amazon with the following log
Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 211, in get_amazon_details known = self.config['amazon']['titles'].get(contentIdentifier) KeyError: 'titles'
We must be close now! Could you possibly send me your own config so I can break it down to work with my details?
Yes, the URL looks fine.
Regarding the exception, please add titles: {}
to the amazon section, so it looks like this:
amazon:
titles: {}
cookie: ubid-acbuk=<value>; x-acbuk=<value>; at-acbuk=<value>
get_playback_resources_url: https://atv-ps-eu.amazon.co.uk/cdp/catalog/GetPlaybackResources?asin=%s&consumptionType=Streaming&desiredResources=CatalogMetadata&deviceID=a635aec3812f4c94d7e2e0c96ecaa562179c421951ef98d170cf56e2&deviceTypeID=AOAGZA014O5RE&firmware=1&gascEnabled=false&marketplaceID=A1F83G7C2ARO7P&resourceUsage=ImmediateConsumption&userWatchSessionId=88eb2a09-1abe-4d8d-bd29-a43aa72f5064&videoMaterialType=Feature&playerType=html5&clientId=f22dbddb-ef2c-48c5-8876-bed0d47594fd&operatingSystemName=Mac%20OS%20X&operatingSystemVersion=10.15.4&deviceDrmOverride=CENC&deviceStreamingTechnologyOverride=DASH
Unfortunately that still didn't work.
On playing something in Amazon I get
Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 214, in get_amazon_details url = self.config['amazon']['get_playback_resources_url'] % contentIdentifier TypeError: not enough arguments for format string
On Stopping I get
Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 214, in get_amazon_details url = self.config['amazon']['get_playback_resources_url'] % contentIdentifier TypeError: not enough arguments for format string
Any more suggestions?
Looks like the get_playback_resources_url
value is invalid. Make sure that every value is in a single line without returns, and that %s
is present in the right place.
I'll give it another go now and see what happens
Tried again and still didn't work. I previously got the url from Chrome, so this time I've got it from Safari and it is different, here it is
https://atv-ps-eu.amazon.co.uk/cdp/catalog/GetPlaybackResources?asin=B085F2BPQJ&consumptionType=Streaming&desiredResources=PlaybackUrls&deviceID=7f0629695bfc468a8c34e642227fa51559248c3d5563b1e08b3d2d83&deviceTypeID=AOAGZA014O5RE&firmware=1&gascEnabled=false&marketplaceID=A1F83G8C2ARO7P&resourceUsage=ImmediateConsumption&userWatchSessionId=78fa2f63-52d9-4e09-b839-d93ca7644ddd&videoMaterialType=Feature&playerType=html5&clientId=f22dbddb-ef2c-48c5-8876-bed0d47594fd&operatingSystemName=Mac%20OS%20X&operatingSystemVersion=10.15.4&deviceDrmOverride=FairPlay&deviceStreamingTechnologyOverride=HLS&deviceProtocolOverride=Https&supportedDRMKeyScheme=SINGLE_KEY&videoMinBitrate=50000&liveManifestType=live&deviceBitrateAdaptationsOverride=CBR&languageFeature=MLFv2
I have replaced the sin with %s as stated but this time I can't find wide vine to replace with CatalogMetadata. So it would appear that this url is different. I'm assuming some details in that url will be different on the Apple TV too? Or is that not an issue?
No, it's not an issue.
OK, I think I know what's wrong: please try again the first version of the URL, but drop the &operatingSystemName=Mac%20OS%20X
part.
OK, building now with that one part of the url removed. I'll update you shortly.
still an exception
Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 219, in get_amazon_details episode = data['catalogMetadata']['catalog']['episodeNumber'] KeyError: 'catalogMetadata'
Well, at least we're 5 lines of code further this time :)
oh yes lol! 219 now instead of 214, I hadn't noticed!
Try to use this URL, but replace values for deviceID
and deviceTypeID
with yours: https://atv-ps-eu.amazon.co.uk/cdp/catalog/GetPlaybackResources?asin=%s&consumptionType=Streaming&desiredResources=CatalogMetadata&firmware=1&resourceUsage=ImmediateConsumption&videoMaterialType=Feature&titleDecorationScheme=primary-content&deviceID=your_value&deviceTypeID=your_value
Used your url and got the following error
Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/lib/python3.7/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/opt/TVRemote/scrobbling.py", line 94, in <lambda> Thread(target=lambda: inner()).start() File "/opt/TVRemote/scrobbling.py", line 91, in inner handler(operation, progress) File "/opt/TVRemote/scrobbling.py", line 204, in handle_amazon title, season, episode = self.get_amazon_details(self.now_playing_metadata.contentIdentifier) File "/opt/TVRemote/scrobbling.py", line 219, in get_amazon_details episode = data['catalogMetadata']['catalog']['episodeNumber'] KeyError: 'catalogMetadata'
OK, let's slightly change our approach. Our goal is to derive a working URL that has desiredResources
set to CatalogMetadata
. The algorithm is to take an existing URL and iteratively modify it until we get what we want. For tests, to make sure that the URL is correct, you can just open it in the browser and see, whether you get an error or a sensible response.
So, the steps, approximately, are:
desiredResources=CatalogMetadata
&operatingSystemName=Mac%20OS%20X
asin
value with %s
and put the result into config.If you want, we can try to chat via IM to make it more interactive, might be quicker that way.
Managed to shorten the URL a little while keeping it as a working URL, unfortunately I'm not getting anywhere with the software side of things though, all up for IM if you are available. What IM did you have in mind?
I've built from your docker file but this results in a docker image that fails to run, looking at the log, it says can't find tvremote.py. So I changed this to tvscrobbler.py, this unfortunately still causes a restart loop as out keeps getting errors once run. Is anybody else able to build a working image from the docker file please?
I'm running on a Synology NAS.
Any help greatly appreciated.