trakt / script.trakt

Trakt.tv movie and TV show scrobbler for Kodi
GNU General Public License v2.0
322 stars 149 forks source link

Trakt script stopped working on XBMC due to Trakt 2.0? #190

Closed rgoossens closed 9 years ago

rgoossens commented 9 years ago

I noticed that since yesterday the trakt plugin in XBMC is unable to scrobble any watched series or movies. I get an connection error message.

I think this might be due to the new trakt 2.0 API (http://docs.trakt.apiary.io/)? Anyone else who noticed this?

At the same time, will the plugin get updated for Kodi 14.0 Helix as well?

tdragonite commented 9 years ago

Scrobbling now working, but library sync...

20:51:48 T:2651337760 NOTICE: [trakt] [traktAPI] getData(): urllib2.Request( https://api.trakt.tv/user/library/shows/collection.json/b6135e0f7510a44021fac8c03c36c81a17be35d9/tdragonite/min ) 20:51:48 T:2651337760 NOTICE: [trakt] [traktAPI] getData(): urllib2.urlopen() 20:51:48 T:2651337760 NOTICE: [trakt] [traktAPI] traktRequest(): (0) Server Busy ({"status":"failure","error":"server is over capacity"}) 20:51:54 T:2651337760 NOTICE: [trakt] [traktAPI] traktRequest(): (1) Request URL ' https://api.trakt.tv/user/library/shows/collection.json/b6135e0f7510a44021fac8c03c36c81a17be35d9/tdragonite/min ' 20:51:54 T:2651337760 NOTICE: [trakt] [traktAPI] getData(): urllib2.Request( https://api.trakt.tv/user/library/shows/collection.json/b6135e0f7510a44021fac8c03c36c81a17be35d9/tdragonite/min ) 20:51:54 T:2651337760 NOTICE: [trakt] [traktAPI] getData(): urllib2.urlopen() 20:51:55 T:2651337760 NOTICE: [trakt] [traktAPI] traktRequest(): (1) Server Busy ({"status":"failure","error":"server is over capacity"}) 20:52:01 T:2651337760 NOTICE: [trakt] [traktAPI] traktRequest(): (2) Request URL ' https://api.trakt.tv/user/library/shows/collection.json/b6135e0f7510a44021fac8c03c36c81a17be35d9/tdragonite/min' 20:52:01 T:2651337760 NOTICE: [trakt] [traktAPI] __getData(): urllib2.Request(https://api.trakt.tv/user/library/shows/c

MrsAngelD commented 9 years ago

Just started having this issue as well

ghost commented 9 years ago

Me too. Invalid username or password, which would fit with an api change.

TerrorKeed commented 9 years ago

same here

TerrorKeed commented 9 years ago

Both SYNC & SCROBBLE not working not even LOG-IN

kvanbiesen commented 9 years ago

Should be fairly easy to fix, as the Xbmc doesnt require the Oauth authentication but the Token Based. Its bascily then fetchin the token from the website and pass it to every request made to trakt. Some of the urls need to be changed but should all in all be a quick (partial fix

disrupted commented 9 years ago

are your capable of fixing this addon? @kvanbiesen

kvanbiesen commented 9 years ago

Think i can, i have applied for a token based reauest but i am doubting they will give it. Since the code is open, everybody will be able to use that token and almost nobody will use the Oauth. That why i think, they havent adapted the script yet

razzeee commented 9 years ago

Scrobble is in fact working correctly here, same for login. Ratings are broken.

I think ratings is one of the apis that would get a port, but it does return "server busy" at the moment

ghost commented 9 years ago

It seems that I can login when I change my email to my username (previously the email worked ok). Now I can see a couple of errors:

The last error is what I see when scrobbling, the first two when trying to sync movies and shows. Scrobble requests are retried 4 times and all fail the same way.

I think that v1 API should still work in the near future: http://forum.kodi.tv/showthread.php?tid=138745&page=83

Crossfire92 commented 9 years ago

Same here... since Trakt.TV 2.0 sync isn't working anymore (Seems to be an API issue). Login issues have been fixed after one or two days (think by trakt themselve)

s7eele commented 9 years ago

I am not a developer but I am very interested in fixing this add-on. If I can be of any assistance please advise. I want to ask one question in particular as I have found contradicting information across the various forums:

Is rating within Kodi working for anyone?

As most have reported, scrobbling and sync appear to be working but when I receive the prompt to rate an item it is still using the 'weak sauce' to 'totally ninja' scale. It is my understanding that this was eliminated and trakt is now simply using a scale of 1 - 10 (debates on that currently underway, lol). I have not had success rating anything via Kodi yet but some folks have reported success on their end. Any input is appreciated!

razzeee commented 9 years ago

Ratings can't work.

It's using an v1 endpoint that wasn't ported (same for collected & watched shows)

kvanbiesen commented 9 years ago

Its not that "hard" to fix the plugin. It needs to implement the token based authentication. I can fix that. But I need to get a token from trakt.tv in orde to fix it.But i doubt they will give it.

The oauth method is way more secure. With the token based option, expecially in kodi, its visible in plain sight and so everbody will use it, avoiding the harder Oauth method. That is why they slacking i guess.

Options for them:

I have for now a script that acts as a proxy between kodi/xbmc and trakt.tv. It works reasonable but requirerst a pc with a brower in orde to get past the Oauth verification...+ rating and stuff doesnt work (havent implemented it, cause i dont use it ^^), but syncing collection works as in the old version.

Its messy like hell, but i'm to lazy to sync collection manually. So would like to see this fixed trough xbmc itself

Amoenus commented 9 years ago

Why not include the token in separate file and do not release it to the sourcecode? Even better it can be part of closed source library that can be included with the project?

kvanbiesen commented 9 years ago

Possible, But its almost the same. IF they release the closed sourced library. Then every1 can import it again :D, closed source lib is almost as good as public token :( (almost!!).

Source code from this script doesnt need that much changes.

disrupted commented 9 years ago

I thought every user has an own (unique) token to authorize the Media Center Plugins?! http://docs.trakt.apiary.io/#reference/authentication-media-centers

Amoenus commented 9 years ago

As I understand they have a testing enviroment now, so I would say they could release a token for dev work only without accessing the live data, as for spammers no real point spamming that

razzeee commented 9 years ago

I don't know why your speculate like that. It's really easy to get the needed token. Required one yesterday and moved the source code to v2. It's still pretty rough but scrobble (with pause, resume etc) and ratings are working. Everything else is probably broken.

disrupted commented 9 years ago

@Razzeee sounds good. gonna install your fork on my system asap ;-)

razzeee commented 9 years ago

@freeman212 no guarantee. As said did this some hours ago, have tested some cases, but there probably will be wrong matches

disrupted commented 9 years ago

@Razzeee bleeding edge is good enough for me ;-)

dsara commented 9 years ago

@kvanbiesen If you need to have your API application approved for a media center (using the user auth token method) the fastest way of getting your app approved is joining the "trakt api" community on Google+ and then asking for approval there, replying to the pinned post from Justin Nemeth. They have said that is the fastest way to get your app approved right now as the built in process isn't working very well. I don't think they will have any objections to approving your app to use the user auth token method as they designed it specifically for media centers.

kvanbiesen commented 9 years ago

gonna try that,

i was requesting it trough the trakt.tv site itself, but no response at all there :/

ikarampa commented 9 years ago

It scrobbles my TV and movies but not the ratings. It cannot sync series playcounts from trak.tv

Crossfire92 commented 9 years ago

Anyone working on this? There is no reaction from the developer :/

razzeee commented 9 years ago

@Crossfire92 yes, as you might know from this topic

brimur commented 9 years ago

Razeee I think the better question is what is the status of the v2 plugin? The existing one is scrobbling but not syncing. Is the new one syncing at this point so that both could be installed side by side or is it a complete rewrite and nothing is working yet?

razzeee commented 9 years ago

@brimur I'm rewriting alot, so I've kicked out alot too. Scrobble, Rate and Collection sync up (no playcount updates or deletes) should work. Movie collection sync should work without problems, episodes just for new shows (for now)

But it's very early and very bleeding edge. There will be errors, problems and mismatches at this point.

brimur commented 9 years ago

Great work Razeee, thanks! Your update should satisfy a lot of curious people. The sync is the most important for me, I test kodi on experimental boxes at home and its nice to be able to sync the library so I dont see my watched eps :+1:

gborri commented 9 years ago

Razee: where is it possible to get the new code?

thanks Giovanni

On Wed, Jan 14, 2015 at 10:56 AM, brimur notifications@github.com wrote:

Great work Razeee, thanks! Your update should satisfy a lot of curious people. The sync is the most important for me, I test kodi on experimental boxes at home and its nice to be able to sync the library so I dont see my watched eps [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/trakt/script.trakt/issues/190#issuecomment-69893100.

brimur commented 9 years ago

@gborri https://github.com/Razzeee/script.trakt

razzeee commented 9 years ago

Master currently only supports scrobble and rating. So you should check https://github.com/Razzeee/script.trakt/tree/dev But as said, very bleeding edge

Crossfire92 commented 9 years ago

Wow, a big thank you for your work! Now, there is hope again. Looking forward for a stable release :smiley:

s7eele commented 9 years ago

deleted

apologies, posted in wrong place

danpowell88 commented 9 years ago

Looks slightly more promising

19:16:58 T:1484  NOTICE: [trakt] [Movies Sync] Compared movies, found 2546 to add.
19:16:58 T:1484  NOTICE: [trakt] [Movies Sync] 2546 movie(s) will be added to trakt.tv collection.
19:17:03 T:1484  NOTICE: [trakt] [Movies Sync] Movies on trakt.tv (0), movies in Kodi (0).
19:17:03 T:1484  NOTICE: [trakt] [Movies Sync] Complete.
19:19:19 T:692  NOTICE: [trakt] [Episodes Sync] Shows on trakt.tv (0), shows in Kodi (498).
19:19:19 T:692  NOTICE: [trakt] [Episodes Sync] Episodes on trakt.tv (0), episodes in Kodi (18881).
19:19:19 T:692  NOTICE: [trakt] [Episodes Sync] Complete.
19:19:19 T:692  NOTICE: [trakt] [Sync] Finished synchronization with trakt.tv

Not getting errors its just not loading any data from trakt, looks like some of the settings have changed also, theres nothing there for movies anymore or about not updating counts (not that i care about that part).

razzeee commented 9 years ago

@thecubical I will remove alot of things, to get it cleaned up and not start working on 6 different fronts.

There is a problem with the trakt api atm (can't auth, getting no token) so we have to wait. Thats probably why your movies were not loaded/added.

rudf0rd commented 9 years ago

The new version of Kodi is being a pain. I'm getting an import error on the connection pooling library (log below). I know Kodi is using it's own python. My system python is 2.7 and I see 2.6 in the Kodi logs. Any ideas why the OSX Kodi version has issue importing from this standard library??

14:58:14 T:4549251072   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.ImportError'>
                                            Error Contents: cannot import name LifoQueue
                                            Traceback (most recent call last):
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/default.py", line 6, in <module>
                                                from service import traktService
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/service.py", line 9, in <module>
                                                from traktapi import traktAPI
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/traktapi.py", line 9, in <module>
                                                from trakt import Trakt
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/trakt/__init__.py", line 1, in <module>
                                                from trakt.client import TraktClient, __version__
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/trakt/client.py", line 2, in <module>
                                                from trakt.core.http import HttpClient
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/trakt/core/http.py", line 2, in <module>
                                                from trakt.core.request import TraktRequest
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/trakt/core/request.py", line 1, in <module>
                                                from requests import Request
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/__init__.py", line 58, in <module>
                                                from . import utils
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/utils.py", line 26, in <module>
                                                from .compat import parse_http_list as _parse_list_header
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/compat.py", line 7, in <module>
                                                from .packages import chardet
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/packages/__init__.py", line 3, in <module>
                                                from . import urllib3
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/packages/urllib3/__init__.py", line 10, in <module>
                                                from .connectionpool import (
                                              File "/Users/sean/Library/Application Support/Kodi/addons/script.trakt/requests/packages/urllib3/connectionpool.py", line 12, in <module>
                                                from Queue import LifoQueue, Empty, Full
                                            ImportError: cannot import name LifoQueue
                                            -->End of Python script error report<--
razzeee commented 9 years ago

@rudf0rd ony thing I know is @S7eele is having the same problem on android

rudf0rd commented 9 years ago

So the oddity when inspecting the Queue module inside of connectionpool.py is that it is looking for queue @ /Users/sean/Library/Application Support/Kodi/addons/script.trakt/Queue.pyo. Which definitely doesn't exist. Pathing is getting jacked up somehow. @S7eele what version are you on in android?

s7eele commented 9 years ago

@rudf0rd i am indeed receiving the same script error when running the -dev branch on android as @razzeee mentioned above, -master branch does not generate the script error, i just updated to Helix to eliminate Gotham as the issue and the same problem exists, don't know much about it except that it involves the requestor module (i think, urllib3?), if I can do anything to help let me know but I am not a developer

I also wanted to see if you or anyone else has noticed behavior that I am seeing with regard to rating, I am prompted to rate items as long as they are stored locally or on a local smb share but when I play .strm files that have been added to my library by either SALTS, Genesis or 1Ch I never receive the prompt to rate, might as well mention that even when I am prompted to submit a rating that rating never makes it to the trakt website

If you, or anyone else reading this, has noticed behavior like this or can confirm that rating has worked for you when playing .strm files in Kodi please reply and let me know

thx all

edit - you snuck in and posted while i was writing this, to answer your question directly, I am running Helix 14.0 on Android but I saw the same behavior while running Gotham, just upgraded to Helix today, ill take a look for the subject file

razzeee commented 9 years ago

@S7eele can you check your exclusion config in the trakt config? the code relevant is here https://github.com/Razzeee/script.trakt/blob/master/utilities.py lines 146-179

@rudf0rd we could try https://github.com/beenje/script.module.requests2 as its a kodi package already, could mean that's tested. could also mean it breaks...

s7eele commented 9 years ago

@razzeee will do but may take me a bit, have a couple errands to run, bbiab

@rudf0rd just making sure you saw that i am currently running Helix 14.0 but until yesterday I was running Gotham 13.2, we were posting at the same time last night so wasn't sure you saw my answer in post above

s7eele commented 9 years ago

@Razzeee im still not home but i took a look at the code you referenced and i have checked several times throughout this process and i am certain that none of the exclude options are enabled in the add-on settings, will have to wait until i get home if you want me to check the actual files involved

anaconda commented 9 years ago

Kodi, and XBMC before it, is forcing case insensitivity for imports on OS X. I'd suggest you rename queue.py to e.g. _queue.py (or better sync_queue.py). I'm pretty sure script.module.requests2 would expose the same problem.

s7eele commented 9 years ago

if im reading correctly it shouldn't be necessary for android, correct?

rudf0rd commented 9 years ago

I have both a requests and requests2 module in my addons folder. Last night, I tried editing the script.trakt addon to require requests from the library I already had. As @anaconda thought, it surfaced the error in the same place in the existing library.

@S7eele thanks for the heads up on the version.. I guess that can be ruled out.

@Razzeee I'll test again with the requests2 library and see if i can replicate the pathing.

@anaconda so you're suggesting we include our own version of queue.py inside the plugin, then rename it to avoid conflict?

anaconda commented 9 years ago

@S7eele hm interesting. I don't know about Android, however this issue on OS X is caused by Kodi itself - that happens in a code path explicitly excluding Android, but there could be something else going on there. I'm not really an Android expert, so unfortunately I can't help.

@rudf0rd I'm suggesting to rename https://github.com/trakt/script.trakt/blob/master/queue.py - what's happening is that Kodi on OS X is forced to ignore case on imports and the add-on's directory has precedence over the system directory containing the standard Python library modules. So instead of the stdlib Queue [1] module it's trying to import the queue module in the add-on directory, which is something completely different. (Btw this seems completely wrong to me so I've proposed a patch for Kodi - still unreviewed - but you'll still encounter this error on previous versions which are no longer maintained.)

[1] https://docs.python.org/2.6/library/queue.html

s7eele commented 9 years ago

@anaconda certainly appreciate you taking the time to respond, I started reviewing the link you provided in your first post but when I saw OSX and the explicit exclusion of Android I figured that i was probably dealing with something different

With that said, I can't help feeling there is something in common between the problem @rudf0rd posted for OS X and the one @Razzeee has been helping me with on Android.This feeling is based on what I see in the error logs for each, they both show a very close (possibly identical) python exception being thrown, involving the same exact files and such, this may be very easily explained by any of you that are more skilled than I with python, if interested my log excerpt showing the errors that look almost identical to those posted above by @rudf0rd can be found on pastebin at this link:

http://pastebin.com/Yp0MpuzX

thx to all

razzeee commented 9 years ago

@s7eele and @rudf0rd please let me know if this fixes anything https://github.com/Razzeee/script.trakt/commit/b55fed3dbf479982b60f73d2c68a97a30b1c9e33