Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Ratings gui #28

Merged
merged 22 commits into from

6 participants

@sschocke

I have merged the original Ratings GUI resources and code from the traktr addon into the official branch, and updated everything to work with XBMC Frodo. Needs testing, but episode, tvshow and movie rating all work from my Frodo installation.

RateMovieGUI

sschocke added some commits
@sschocke sschocke Initial ratings work
Imported windows and resources from traktr project
Made changes to utilities.py to be able to retrieve trakt.tv data required for ratings
Have so far been able to make Rate Episode window appear after viewing
c94a96a
@sschocke sschocke Ratings GUI working for TV Shows/Episodes and Movies
Ready for beta testing
0993b31
@seadog

Nice work, the window XML is a total mess and could really use a clean up and someone to sort out the terrible keyboard navigation.

I think you can get rid of the "watched" etc. images because script.trakt doesn't do watched list, recommended etc. stuff (which imo is really for the best).

I've vaguely abandoned traktr so if this gets merged then I'll just submit any patches I've created to script.trakt since it'll fulfil everything I personally use from traktr.

(on my list is removing utilities.py into a couple of different files, killing nbconnection and just using a standard https socket since afaik it's basically impossible to retry the query when using nbconnection, and re-doing the scrobbler since at the moment it's kind of complex compared to what it should actually be doing).

(Since I can't put this elsewhere, it would also be awesome if trakt.tv supported thetvdb episode IDs for show/episode/(un)library, show/episode/(un)seen, it would basically allow the same algorithm as used for the movie syncing to be used for episode syncing, and eliminate any hacks used for dvd order or anime-style episode ordering)

@sschocke

Thanks Seadog

This was sort of my first venture into the world of addon GUI work. I am still figuring out the XML, so didn't want to mess around with it, since it works. Will have a look through the images and see what's not needed.

While I was busy fixing some of the trakt.tv API calls to work, I had also started thinking that the utilities.py file is pretty crowded, and should probably be split into files for trakt functions, XBMC functions, and actual utilities. The nbconnection class also seemed a bit unnecessary. Once again, it works, so didn't want to mess with it for now.

As for the episode IDs, I know it's used in a few places. Not sure for the library updates, but I think David submitted a patch implementing this a short while ago.

@N3MIS15

I found most things in trakt utils overkill. IMO it should be just a simple yesno dialog and let the skin choose how it looks.
Advanced ratings is a bit harder tho.

I having a bit of a ramble here but i also think having the rate dialog pop up when i have rated it in the past is silly.

@seadog
UniqueID (as XBMC calls it) is only partially supported in Frodo. it will always be an unknown ID so its not 100% reliable especially when it comes to anime (I believe people use other scrapers for anime but i may be wrong).

Unique ID is used for adding to trakt and updating playcount (it compares tvdb ids). I didn't think it would be needed for unlibrary. Im not 100% sure how it an episode is represented on trakt if it has dvd order. I will gladly add it but i have no idea how it works :(
If you want it changed hit me up on XBMC forums (N3MIS15) or email N3MIS15@gmail.com

@rectifyer
Owner

I don't think it makes sense to merge this in since it's described as being a mess and needing to be recoded. I like the idea of rating after watching something or in the various xbmc content menus, but it should be a clean implementation with full support for the 10 heart ratings.

@sschocke

@rectifyer
Fair enough. Considering that more than half of the official addon is based on the old traktr code I think it's uncalled for, but that's just my opinion.

Also, advanced rating is totally supported by this implementation. The GUI needs to be updated and improved, I agree, so anyone wants to tackle that, feel free. I am way too much of a newbie when it comes to XBMC GUI XML to even try and make it better anytime soon.

@N3MIS15
I also felt that an already rated item shouldn't popup the dialog again, and as a matter of fact, that the whole "unrate" option should be removed entirely. I was simply trying to make a start towards supporting the rating in the official addon sometime in the future, and getting feedback on what should be done/included/excluded. The way traktr was doing it seemed like a good starting point. Removing the recurring popup is quite simple though, if the majority feel it should be removed.

Any chance you can assist with the redesign of the GUI parts? :)

I'll leave this branch open on my fork if anyone wants to help me get it up to speed. Until such time as everyone is happy, I think you can close the pull request @rectifyer

@sschocke

OK... I am compiling a list of proposed changes and ideas to work on:

  • Update ratings system so that dialog only pops up for unrated episodes/movies
  • Remove "Rate whole show" from episode rating dialog
  • Integrate "Rate on trakt.tv" option into the context menu in XBMC (is this even possible?) - This is how you would rate a whole show as well.
  • See if we can make the GUI simpler and prettier
    • perhaps by including details such as movie/episode being rated, and perhaps even current ratings by other users on trakt.tv
    • Simple vertical navigation for simple rating, and horizontal navigation for 10 hearts advanced rating
    • Pressing ESC or Back options should cancel out of dialog, so "skip" button is not needed. XBMC interface is done like this everywhere, and I think we should follow that standard for our dialog.

Feedback and other ideas welcome. I would really like to see this become a reality, as I really miss this feature from when I was using traktr

@N3MIS15

All valid points IMO.
"Integrate "Rate on trakt.tv" option into the context menu" will be possible if this PR gets pulled into XBMC
xbmc/xbmc#1654

Im happy to give this a shot if you like.

@sschocke

@N3MIS15

So not available in Frodo, but at least somebody has done it, and it could be in a future version :+1:
I'd be very happy if you could give it a shot. Think it would be a welcome addition.

@N3MIS15

here is a rough mockup of something that i would do.

Its basicly like you mentioned in your previous post (it still needs some work but you get the idea)

@rectifyer Thoughts?

@sschocke

Just opened this up to check for any replies, and it pops up just as I am about to close the page... good timing

I love the design, although I think maybe we should keep the red/grey heart icons as part of the buttons. Other than that, it's exactly what I had in mind.

The advanced rating system with the 10 hearts could be done with a horizontal list of hearts. Perhaps even with the slider control from XBMC, but not sure if that would look so good?

@seadog

Have you seen the updated advanced rating UI I made? I think it's looks OK, it's nothing special though. (The old version wasn't great but I changed a fair amount of stuff but didn't really improve the XML all that much)

The problem you're going to have if you add more info to the rating screen is that you have to grab that info from trakt.tv which is going to slow down actually generating the box.

@N3MIS15

Yea. Just checking if it has been rated requires polling trakt. If you you do 1, you may as well do the other..

@sschocke

Part of the dialog is getting the current rating at the moment. This already returns details regarding the rating by other users, etc. If we can use the art from XBMC for the thumbnail part then there is no more polling required than what is currently done.

Another part of the script I will be changing is actually slowing things down right now. At the moment, every time the rating dialog is opened, it queries the user settings from trakt.tv to determine what kind of dialog to use, simple or advanced.

I am going to move this to a setting that gets read on start up of the addon. This will already save us 1 poll, so there is only 1 poll required to get the data, and we have to do that poll anyway to determine if we need to open the dialog in the first place.

@sschocke

@seadog
I honestly have not looked at the advanced rating interface, since I use the simple method personally. I will check it out tonight though.

@rectifyer
Owner

@N3MIS15 Yeah, I like the direction of the rating popup. If the API needs tweaks to help minimize the bandwidth, I can modify or add new calls. There are already some good ideas with the existing API methods though which should work well.

@N3MIS15

@rectifyer I used summary to get the rating info. Since the rating info is all we need ~95% of the summary data is not required. If there was a rating method that only returned rating info (rating stats with rating/rating_advanced for auth) it would make knowing if the if the media has been rated before much more efficient. It would also make the syncing trakt ratings much more efficient if that was to be considered.

So it would be http://api.trakt.tv/movie/ratings.format/apikey/title

@sschocke

@rectifyer I second David's idea. Currently I also use summary to determine if the movie/episode has already been rated. It seems a bit of a bandwidth heavy call for such a simple query. His idea would work perfectly

@seadog

re 20e84fc is it worth adding a button somewhere so you can re-get the settings without restarting xbmc?

@sschocke

@seadog I think it might be a good idea to re-initialize the settings whenever a user leaves the configuration screen for the addon. Will have to investigate how that can be done though...

@N3MIS15

I created a fork of this branch and tinkered with it. Its not complete yet but movies it working. (not sure whats happening with episodes I need to find some time to debug).
I started wanting to just add a new dialog but found myself re-writing most of the code. It has about half the footprint of the old traktutils code but is lacking error handling at the moment.
https://github.com/N3MIS15/script.trakt/tree/rating

This is what i ended up with:

@sschocke

@N3MIS15 I really like the dialog. It looks really nice.

I have started a complete recode of the API parts into two separate modules called traktAPI and xbmcAPI on another branch (local only atm), which we could later just update the dialog and rating code to use instead of the direct calls to traktJsonRequest, but IMO it's a minor issue.

One thing I am however starting to see is that we really need to specify a coding standard in terms of indentation since we are more than one or two devs working on the addon. I think @rectifyer should make the call what it should be.

I have been following the python PEP8 standard using 4 spaces as indentation, but I have run across some of the older code using 8 spaces, and @N3MIS15 using 2 spaces. 80% of the diff shown on most of the files is simply the indentation changes on the unchanged code. I think we need to address this urgently

@N3MIS15

If I compare my changes to yours there are a ton of diffs, but comparing to @rectifyer master (https://github.com/N3MIS15/script.trakt/compare/rating) its all same. I too usualy use 4 spaces, but the existing code used tabs so thats what i went with for my changes. Github changes tabs to spaces..

@sschocke

I did not know about Github automatically handling the tabs to spaces thing. Might work best then if we just use tabs. I will run my files through a conversion and recommit to the branch, or do you see a better way?

Alternatively, send me a pull request... I can pull in your changes and work from there

@sschocke

@rectifyer @N3MIS15

I have pulled in all of David's changes and merged them with my own work. The new ratings GUI looks awesome, thanks David.

Everything I tested worked, so unless there are more outstanding issues to address, I think this is mergeable.

Outstanding future work includes:

  • finding a way of refreshing the users trakt.tv settings without restarting XBMC (minor issue IMO, as how often do non developers switch their ratings system, which is the only settings being used at the moment)
  • Context Menu integration : waiting for feature on the XBMC side
@N3MIS15

One thing i noticed (and correct me if I'm wrong) is that when rating an episode, the trakt API does not allow you to send the episode TVDB ID. So I'm guessing that there will be a problem with absolute/DVD ordering.

@rectifyer
Owner

Correct, I need to update some of the API methods to use the episode TVDB ID.

I like the direction the ratings UI is going. Take a look at what FireCore does for some additional inspiration, It's pretty simple yet works really well.

@N3MIS15

@rectifyer if u could supply links to the assets I will see what I can do.

@N3MIS15

Dusted off photoshop (its been a while) and come up with the simpler dialog.
PR sent to @sschocke


@seadog

Should the "Totally Ninja!" rating be on the right hand side rather than the left to make it consistent with the advanced rating UI?

@N3MIS15

The trakt site itself has "love" on left so I don't see why it should be any different here.

@sschocke

I have merged @N3MIS15 's new simplified dialog, as well as merged in all changes made to the master branch during this week. Should make it easier to merge this pull request, if it is accepted.

@rectifyer Further ideas, suggestions?

@sschocke

Updated to use urlib2 as per master branch

@sschocke

@N3MIS15 I am going to close this pull request. It does not seem like it is wanted.

@ghost

wait a bit... would be a very nice addition to the script imo.

@rectifyer
Owner
@schumi2004

I'm using this PR for a while now and works perfect. Don't see any reason not to merge it.

@rectifyer
Owner

Yeah, i'll merge it in for 2.1.0 since at this point I won't be releasing it until after my vacation anyway. That will give a few solid weeks to hammer on ratings + everything else in 2.1.0.

@rectifyer rectifyer merged commit f0d0c31 into from
@N3MIS15

I just noticed I forgot to honor the "rate each playlist item" setting. It will always rate each item. I'm pretty busy with work at the moment so i wont have time to look into it until Sunday. If someone else wants to tackle it before then, go for it.

@nate1280

I have a fix coming for the ratings stuff, and its the rate_movie/rate_episode that's not being honored, also a few other things, just doing a few quick tests before opening a pull request.

@nate1280

I believe this is working now in #52 and also added in a few checks where possible exceptions could occur.

@sschocke sschocke deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2013
  1. @sschocke

    Initial ratings work

    sschocke authored
    Imported windows and resources from traktr project
    Made changes to utilities.py to be able to retrieve trakt.tv data required for ratings
    Have so far been able to make Rate Episode window appear after viewing
Commits on Feb 3, 2013
  1. @sschocke

    Ratings GUI working for TV Shows/Episodes and Movies

    sschocke authored
    Ready for beta testing
Commits on Feb 4, 2013
  1. @sschocke
Commits on Feb 5, 2013
  1. @sschocke
  2. @sschocke

    Rating popup will only appear if item has not been previously rated

    sschocke authored
    Also removed some old commented out Debug calls
Commits on Feb 9, 2013
  1. @N3MIS15
  2. @N3MIS15

    revised rating dialog

    N3MIS15 authored
    movies only for now
  3. @sschocke

    Sort out indentation

    sschocke authored
  4. @sschocke
Commits on Feb 10, 2013
  1. @N3MIS15

    Episodes working

    N3MIS15 authored
  2. @N3MIS15

    windows.py no longer used

    N3MIS15 authored
  3. @N3MIS15

    Added some error handling

    N3MIS15 authored
  4. @N3MIS15

    Remove hardcoded string

    N3MIS15 authored
  5. @N3MIS15

    Removed thumbs.db

    N3MIS15 authored
    damn winblows
  6. @N3MIS15

    Only use poster if it exists.

    N3MIS15 authored
  7. @sschocke

    Merge branch 'rating' of https://github.com/N3MIS15/script.trakt into…

    sschocke authored
    … ratings_gui
    
    Conflicts:
    	rating.py
    	utilities.py
    	windows.py
Commits on Feb 12, 2013
  1. @N3MIS15

    Simplified the ratings dialog

    N3MIS15 authored
  2. @N3MIS15
Commits on Feb 15, 2013
  1. @sschocke

    Merge pull request #2 from N3MIS15/rating

    sschocke authored
    Simplified the ratings dialog
  2. @sschocke
Commits on Feb 16, 2013
  1. @sschocke

    Merge remote-tracking branch 'origin/master' into ratings_gui

    sschocke authored
    Conflicts:
    	utilities.py
Commits on Feb 25, 2013
  1. @sschocke

    Merge remote-tracking branch 'origin/master' into ratings_gui

    sschocke authored
    Conflicts:
    	resources/settings.xml
    	service.py
This page is out of date. Refresh to see the latest.
Showing with 594 additions and 87 deletions.
  1. +0 −82 .pylint_rc
  2. +177 −0 rating.py
  3. +11 −0 resources/language/English/strings.xml
  4. +7 −1 resources/settings.xml
  5. +380 −0 resources/skins/Default/720p/RatingDialog.xml
  6. BIN  resources/skins/Default/media/1.png
  7. BIN  resources/skins/Default/media/10.png
  8. BIN  resources/skins/Default/media/10_b.png
  9. BIN  resources/skins/Default/media/2.png
  10. BIN  resources/skins/Default/media/2_b.png
  11. BIN  resources/skins/Default/media/3.png
  12. BIN  resources/skins/Default/media/3_b.png
  13. BIN  resources/skins/Default/media/4.png
  14. BIN  resources/skins/Default/media/4_b.png
  15. BIN  resources/skins/Default/media/5.png
  16. BIN  resources/skins/Default/media/5_b.png
  17. BIN  resources/skins/Default/media/6.png
  18. BIN  resources/skins/Default/media/6_b.png
  19. BIN  resources/skins/Default/media/7.png
  20. BIN  resources/skins/Default/media/7_b.png
  21. BIN  resources/skins/Default/media/8.png
  22. BIN  resources/skins/Default/media/8_b.png
  23. BIN  resources/skins/Default/media/9.png
  24. BIN  resources/skins/Default/media/9_b.png
  25. BIN  resources/skins/Default/media/ConfluenceDialogBack.png
  26. BIN  resources/skins/Default/media/ConfluenceDialogCloseButton-focus.png
  27. BIN  resources/skins/Default/media/ConfluenceDialogCloseButton.png
  28. BIN  resources/skins/Default/media/Confluencedialogheader.png
  29. BIN  resources/skins/Default/media/Thumbs.db
  30. BIN  resources/skins/Default/media/hate.png
  31. BIN  resources/skins/Default/media/hate_nofocus.png
  32. BIN  resources/skins/Default/media/love.png
  33. BIN  resources/skins/Default/media/love_nofocus.png
  34. +2 −0  scrobbler.py
  35. +2 −1  service.py
  36. +15 −3 utilities.py
View
82 .pylint_rc
@@ -1,82 +0,0 @@
-[MASTER]
-profile=no
-ignore=CVS
-persistent=yes
-load-plugins=
-
-[MESSAGES CONTROL]
-disable=C0301
-
-[REPORTS]
-output-format=text
-include-ids=no
-files-output=no
-reports=yes
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-comment=no
-
-[TYPECHECK]
-ignore-mixin-members=yes
-ignored-classes=SQLObject
-zope=no
-generated-members=REQUEST,acl_users,aq_parent
-
-[BASIC]
-required-attributes=
-bad-functions=map,filter,apply,input
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-class-rgx=[A-Z_][a-zA-Z0-9]+$
-function-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
-method-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
-attr-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
-argument-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
-variable-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-good-names=i,j,k,ex,Run,_
-bad-names=foo,bar,baz,toto,tutu,tata
-no-docstring-rgx=__.*__
-
-[VARIABLES]
-init-import=no
-dummy-variables-rgx=_|dummy
-additional-builtins=
-
-[FORMAT]
-max-line-length=80
-max-module-lines=1000
-indent-string=' '
-
-[SIMILARITIES]
-min-similarity-lines=4
-ignore-comments=yes
-ignore-docstrings=yes
-
-[MISCELLANEOUS]
-notes=FIXME,XXX,TODO
-
-[DESIGN]
-max-args=5
-ignored-argument-names=_.*
-max-locals=15
-max-returns=6
-max-branchs=12
-max-statements=50
-max-parents=7
-max-attributes=7
-min-public-methods=2
-max-public-methods=20
-
-[CLASSES]
-ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-defining-attr-methods=__init__,__new__,setUp
-valid-classmethod-first-arg=cls
-
-[IMPORTS]
-deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
-import-graph=
-ext-import-graph=
-int-import-graph=
-
-[EXCEPTIONS]
-overgeneral-exceptions=Exception
View
177 rating.py
@@ -0,0 +1,177 @@
+# -*- coding: utf-8 -*-
+"""Module used to launch rating dialogues and send ratings to trakt"""
+
+import xbmc
+import xbmcaddon
+import xbmcgui
+import utilities
+from utilities import Debug, xbmcJsonRequest, traktJsonRequest, notification
+
+__settings__ = xbmcaddon.Addon("script.trakt")
+__language__ = __settings__.getLocalizedString
+
+rate_movies = __settings__.getSetting("rate_movie")
+rate_episodes = __settings__.getSetting("rate_episode")
+rate_each_playlist_item = __settings__.getSetting("rate_each_playlist_item")
+rate_min_view_time = __settings__.getSetting("rate_min_view_time")
+
+buttons = {
+ 10030: 'love',
+ 10031: 'hate',
+ 11030: '1',
+ 11031: '2',
+ 11032: '3',
+ 11033: '4',
+ 11034: '5',
+ 11035: '6',
+ 11036: '7',
+ 11037: '8',
+ 11038: '9',
+ 11039: '10'
+}
+
+focus_labels = {
+ 10030: __language__(1314).encode('utf-8', 'ignore'),
+ 10031: __language__(1315).encode('utf-8', 'ignore'),
+ 11030: __language__(1315).encode('utf-8', 'ignore'),
+ 11031: __language__(1316).encode('utf-8', 'ignore'),
+ 11032: __language__(1317).encode('utf-8', 'ignore'),
+ 11033: __language__(1318).encode('utf-8', 'ignore'),
+ 11034: __language__(1319).encode('utf-8', 'ignore'),
+ 11035: __language__(1320).encode('utf-8', 'ignore'),
+ 11036: __language__(1321).encode('utf-8', 'ignore'),
+ 11037: __language__(1322).encode('utf-8', 'ignore'),
+ 11038: __language__(1323).encode('utf-8', 'ignore'),
+ 11039: __language__(1314).encode('utf-8', 'ignore')
+}
+
+
+def ratingCheck(current_video, watched_time, total_time, playlist_length):
+ """Check if a video should be rated and if so launches the rating dialog"""
+
+ Debug("[Rating] Rating Check called for " + current_video['type'] + " id=" + str(current_video['id']) );
+ if __settings__.getSetting("rate_"+current_video['type']):
+ if (watched_time/total_time)*100>=float(rate_min_view_time):
+ if (playlist_length <= 1) or (rate_each_playlist_item == 'true'):
+ rateMedia(current_video['id'], current_video['type'])
+
+
+def rateMedia(media_id, media_type):
+ """Launches the rating dialog"""
+ if media_id == None:
+ Debug('[Rating] Missing media_id')
+ return
+
+ if media_type == 'movie':
+ xbmc_media = xbmcJsonRequest({'jsonrpc': '2.0', 'id': 0, 'method': 'VideoLibrary.GetMovieDetails', 'params': {'movieid': media_id, 'properties': ['title', 'imdbnumber', 'year']}})['moviedetails']
+ if xbmc_media == None:
+ Debug('[Rating] Failed to retrieve movie data from XBMC')
+ return
+
+ trakt_summary = traktJsonRequest('POST', '/movie/summary.json/%%API_KEY%%/' + xbmc_media['imdbnumber'])
+ if trakt_summary == None:
+ Debug('[Rating] Failed to retrieve movie data from trakt')
+ return
+
+ if trakt_summary['rating'] or trakt_summary['rating_advanced']:
+ Debug('[Rating] Movie has been rated')
+ return
+
+ else:
+ episode = xbmcJsonRequest({'jsonrpc': '2.0', 'id': 0, 'method': 'VideoLibrary.GetEpisodeDetails', 'params': {'episodeid': media_id, 'properties': ['uniqueid', 'tvshowid', 'episode', 'season']}})['episodedetails']
+ if episode == None:
+ Debug('[Rating] Failed to retrieve episode data from XBMC')
+ return
+
+ xbmc_media = xbmcJsonRequest({'jsonrpc': '2.0', 'id': 0, 'method': 'VideoLibrary.GetTVShowDetails', 'params': {'tvshowid': episode['tvshowid'], 'properties': ['imdbnumber']}})['tvshowdetails']
+ if xbmc_media == None:
+ Debug('[Rating] Failed to retrieve tvshow data from XBMC')
+ return
+
+ xbmc_media['episode'] = episode
+
+ trakt_summary = traktJsonRequest('POST', '/show/episode/summary.json/%%API_KEY%%/'+str(xbmc_media['imdbnumber'])+'/'+str(xbmc_media['episode']['season'])+'/'+str(xbmc_media['episode']['episode']))
+ if trakt_summary == None:
+ Debug('[Rating] Failed to retrieve show/episode data from trakt')
+ return
+
+ xbmc_media['year'] = trakt_summary['show']['year']
+
+ if trakt_summary['episode']['rating'] or trakt_summary['episode']['rating_advanced']:
+ Debug('[Rating] Episode has been rated')
+ return
+
+ rating_type = utilities.traktSettings['viewing']['ratings']['mode']
+ xbmc.executebuiltin('Dialog.Close(all, true)')
+
+ gui = RatingDialog(
+ "RatingDialog.xml",
+ __settings__.getAddonInfo('path'),
+ media_type=media_type,
+ media=xbmc_media,
+ rating_type=rating_type
+ )
+
+ gui.doModal()
+ del gui
+
+
+class RatingDialog(xbmcgui.WindowXMLDialog):
+ def __init__(self, xmlFile, resourcePath, defaultName='Default', forceFallback=False, media_type=None, media=None, rating_type=None):
+ self.media_type = media_type
+ self.media = media
+ self.rating_type = rating_type
+
+ def onInit(self):
+ self.getControl(10014).setVisible(self.rating_type == 'simple')
+ self.getControl(10015).setVisible(self.rating_type == 'advanced')
+
+ if self.media_type == 'movie':
+ self.getControl(10012).setLabel('%s (%s)' % (self.media['title'], self.media['year']))
+ else:
+ self.getControl(10012).setLabel('%s - %s' % (self.media['label'], self.media['episode']['label']))
+
+ if self.rating_type == 'simple':
+ self.setFocus(self.getControl(10030)) #Focus Loved Button
+ else:
+ self.setFocus(self.getControl(11037)) #Focus 8 Button
+
+
+ def onClick(self, controlID):
+ if controlID in buttons:
+ self.rateOnTrakt(buttons[controlID])
+ self.close()
+
+
+ def onFocus(self, controlID):
+ if controlID in focus_labels:
+ self.getControl(10013).setLabel(focus_labels[controlID])
+ else:
+ self.getControl(10013).setLabel('')
+
+
+ def rateOnTrakt(self, rating):
+ if self.media_type == 'movie':
+ params = {'title': self.media['title'], 'year': self.media['year'], 'rating': rating}
+
+ if self.media['imdbnumber'].startswith('tt'):
+ params['imdb_id'] = self.media['imdbnumber']
+
+ elif self.media['imdbnumber'].isdigit():
+ params['tmdb_id']
+
+ data = traktJsonRequest('POST', '/rate/movie/%%API_KEY%%', params, passVersions=True)
+
+ else:
+ params = {'title': self.media['label'], 'year': self.media['year'], 'season': self.media['episode']['season'], 'episode': self.media['episode']['episode'], 'rating': rating}
+
+ if self.media['imdbnumber'].isdigit():
+ params['tvdb_id'] = self.media['imdbnumber']
+
+ elif self.media['imdbnumber'].startswith('tt'):
+ params['imdb_id'] = self.media['imdbnumber']
+
+ data = traktJsonRequest('POST', '/rate/episode/%%API_KEY%%', params, passVersions=True)
+
+ if data != None:
+ notification(__language__(1201).encode('utf-8', 'ignore'), __language__(1167).encode('utf-8', 'ignore')) # Rating submitted successfully
View
11 resources/language/English/strings.xml
@@ -102,6 +102,17 @@
<string id="1310">Successfully added to watch-list</string>
<string id="1311">Failed to remove from watch-list</string>
<string id="1312">Successfully removed from watch-list</string>
+ <string id="1313">What Did You Think?</string>
+ <string id="1314">Totaly Ninja!</string>
+ <string id="1315">Weak Sauce :(</string>
+ <string id="1316">Terrible</string>
+ <string id="1317">Bad</string>
+ <string id="1318">Poor</string>
+ <string id="1319">Meh</string>
+ <string id="1320">Fair</string>
+ <string id="1321">Good</string>
+ <string id="1322">Great</string>
+ <string id="1323">Superb</string>
<!-- auto update / sync -->
<string id="1180">start movie collection update</string>
View
8 resources/settings.xml
@@ -39,4 +39,10 @@
<setting id="xbmc_episode_playcount" type="bool" label="1409" default="true"/>
<setting id="clean_trakt_episodes" type="bool" label="1414" default="false"/>
</category>
-</settings>
+ <category label="1030"><!-- Rating -->
+ <setting id="rate_movie" type="bool" label="1031" default="false"/>
+ <setting id="rate_episode" type="bool" label="1032" default="false"/>
+ <setting id="rate_each_playlist_item" type="bool" label="1033" default="true"/>
+ <setting id="rate_min_view_time" type="slider" label="1034" range="0,5,100" default="75"/>
+ </category>
+</settings>
View
380 resources/skins/Default/720p/RatingDialog.xml
@@ -0,0 +1,380 @@
+<window>
+ <coordinates>
+ <system>1</system>
+ <posx>340</posx>
+ <posy>235</posy>
+ </coordinates>
+
+ <animation effect="fade" time="250">WindowOpen</animation>
+ <animation effect="fade" time="250">WindowClose</animation>
+
+ <controls>
+ <!--DIALOG BASE-->
+ <control type="group">
+ <control type="image"> <!--DIALOG BACKGROUND-->
+ <description>Background</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>600</width>
+ <height>250</height>
+ <texture>ConfluenceDialogBack.png</texture>
+ </control>
+
+ <control type="image">
+ <description>Dialog Header Image</description>
+ <posx>40</posx>
+ <posy>16</posy>
+ <width>520</width>
+ <height>40</height>
+ <texture>Confluencedialogheader.png</texture>
+ </control>
+
+ <control type="label" id="10011"> <!--DIALOG TITLE-->
+ <description>Title</description>
+ <posx>0</posx>
+ <posy>27</posy>
+ <width>600</width>
+ <height>20</height>
+ <label>$ADDON[script.trakt 1313]</label>
+ <align>center</align>
+ <aligny>center</aligny>
+ </control>
+
+ <control type="label" id="10012"> <!--MEDIA TITLE-->
+ <description>Title</description>
+ <posx>0</posx>
+ <posy>75</posy>
+ <width>600</width>
+ <height>20</height>
+ <label></label>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font12</font>
+ <textcolor>FFBBBBBB</textcolor>
+ </control>
+
+ <control type="label" id="10013"> <!--RATING TITLE-->
+ <description>Title</description>
+ <posx>0</posx>
+ <posy>185</posy>
+ <width>600</width>
+ <height>20</height>
+ <label></label>
+ <align>center</align>
+ <aligny>center</aligny>
+ <font>font12</font>
+ <textcolor>FFBBBBBB</textcolor>
+ </control>
+
+ <control type="button">
+ <description>Close Window button</description>
+ <posx>510</posx>
+ <posy>8</posy>
+ <width>64</width>
+ <height>32</height>
+ <label></label>
+ <onclick>PreviousMenu</onclick>
+ <texturefocus>ConfluenceDialogCloseButton-focus.png</texturefocus>
+ <texturenofocus>ConfluenceDialogCloseButton.png</texturenofocus>
+ <visible>system.getbool(input.enablemouse)</visible>
+ </control>
+ </control>
+
+ <!--SIMPLE -->
+ <control type="group" id="10014">
+ <control type="button" id="10030">
+ <description>Love Button</description>
+ <posx>170</posx>
+ <posy>110</posy>
+ <width>100</width>
+ <height>60</height>
+ <label></label>
+ <texturefocus>love.png</texturefocus>
+ <texturenofocus>love_nofocus.png</texturenofocus>
+ <aligny>center</aligny>
+ <align>center</align>
+ <onleft>10031</onleft>
+ <onright>10031</onright>
+ </control>
+
+ <control type="button" id="10031">
+ <description>Hate Button</description>
+ <posx>330</posx>
+ <posy>110</posy>
+ <width>100</width>
+ <height>60</height>
+ <label></label>
+ <texturefocus>hate.png</texturefocus>
+ <texturenofocus>hate_nofocus.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>10030</onleft>
+ <onright>10030</onright>
+ </control>
+ </control>
+
+ <!--ADVANCED-->
+ <control type="group" id="10015">
+ <control type="button" id="11030">
+ <description>1 Button</description>
+ <posx>80</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>1.png</texturefocus>
+ <texturenofocus>1.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11039</onleft>
+ <onright>11031</onright>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="button" id="11031">
+ <description>2 Button</description>
+ <posx>125</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>2.png</texturefocus>
+ <texturenofocus>2.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11030</onleft>
+ <onright>11032</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11032)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>2 Button Placeholder</description>
+ <posx>125</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>2_b.png</texture>
+ <visible>Control.HasFocus(11030)</visible>
+ </control>
+
+ <control type="button" id="11032">
+ <description>3 Button</description>
+ <posx>170</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>3.png</texturefocus>
+ <texturenofocus>3.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11031</onleft>
+ <onright>11033</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>3 Button Placeholder</description>
+ <posx>170</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>3_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)</visible>
+ </control>
+
+ <control type="button" id="11033">
+ <description>4 Button</description>
+ <posx>215</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>4.png</texturefocus>
+ <texturenofocus>4.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11032</onleft>
+ <onright>11034</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>4 Button Placeholder</description>
+ <posx>215</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>4_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)</visible>
+ </control>
+
+ <control type="button" id="11034">
+ <description>5 Button</description>
+ <posx>260</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>5.png</texturefocus>
+ <texturenofocus>5.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11033</onleft>
+ <onright>11035</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>5 Button Placeholder</description>
+ <posx>260</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>5_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)</visible>
+ </control>
+
+ <control type="button" id="11035">
+ <description>6 Button</description>
+ <posx>305</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>6.png</texturefocus>
+ <texturenofocus>6.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11034</onleft>
+ <onright>11036</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)|!Control.HasFocus(11034)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>6 Button Placeholder</description>
+ <posx>305</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>6_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)|Control.HasFocus(11034)</visible>
+ </control>
+
+ <control type="button" id="11036">
+ <description>7 Button</description>
+ <posx>350</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>7.png</texturefocus>
+ <texturenofocus>7.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11035</onleft>
+ <onright>11037</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)|!Control.HasFocus(11034)|!Control.HasFocus(11035)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>7 Button Placeholder</description>
+ <posx>350</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>7_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)|Control.HasFocus(11034)|Control.HasFocus(11035)</visible>
+ </control>
+
+ <control type="button" id="11037">
+ <description>8 Button</description>
+ <posx>395</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>8.png</texturefocus>
+ <texturenofocus>8.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11036</onleft>
+ <onright>11038</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)|!Control.HasFocus(11034)|!Control.HasFocus(11035)|!Control.HasFocus(11036)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>8 Button Placeholder</description>
+ <posx>395</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>8_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)|Control.HasFocus(11034)|Control.HasFocus(11035)|Control.HasFocus(11036)</visible>
+ </control>
+
+ <control type="button" id="11038">
+ <description>9 Button</description>
+ <posx>440</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>9.png</texturefocus>
+ <texturenofocus>9.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11037</onleft>
+ <onright>11039</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)|!Control.HasFocus(11034)|!Control.HasFocus(11035)|!Control.HasFocus(11036)|!Control.HasFocus(11037)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>9 Button Placeholder</description>
+ <posx>440</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>9_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)|Control.HasFocus(11034)|Control.HasFocus(11035)|Control.HasFocus(11036)|Control.HasFocus(11037)</visible>
+ </control>
+
+ <control type="button" id="11039">
+ <description>10 Button</description>
+ <posx>485</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <label></label>
+ <texturefocus>10.png</texturefocus>
+ <texturenofocus>10.png</texturenofocus>
+ <align>center</align>
+ <aligny>center</aligny>
+ <onleft>11038</onleft>
+ <onright>11030</onright>
+ <visible allowhiddenfocus="true">!Control.HasFocus(11030)|!Control.HasFocus(11031)|!Control.HasFocus(11032)|!Control.HasFocus(11033)|!Control.HasFocus(11034)|!Control.HasFocus(11035)|!Control.HasFocus(11036)|!Control.HasFocus(11037)|!Control.HasFocus(11038)</visible>
+ <animation effect="zoom" end="115,115" center="auto" time="100">focus</animation>
+ </control>
+
+ <control type="image">
+ <description>10 Button Placeholder</description>
+ <posx>485</posx>
+ <posy>130</posy>
+ <width>35</width>
+ <height>35</height>
+ <texture>10_b.png</texture>
+ <visible>Control.HasFocus(11030)|Control.HasFocus(11031)|Control.HasFocus(11032)|Control.HasFocus(11033)|Control.HasFocus(11034)|Control.HasFocus(11035)|Control.HasFocus(11036)|Control.HasFocus(11037)|Control.HasFocus(11038)</visible>
+ </control>
+ </control>
+
+ </controls>
+
+</window>
View
BIN  resources/skins/Default/media/1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/10_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/2_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/3_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/4_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/5_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/6_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/7_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/8_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/9_b.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/ConfluenceDialogBack.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/ConfluenceDialogCloseButton-focus.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/ConfluenceDialogCloseButton.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/Confluencedialogheader.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/Thumbs.db
Binary file not shown
View
BIN  resources/skins/Default/media/hate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/hate_nofocus.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  resources/skins/Default/media/love.png
Diff not rendered
View
BIN  resources/skins/Default/media/love_nofocus.png
Diff not rendered
View
2  scrobbler.py
@@ -9,6 +9,7 @@
import utilities
from utilities import Debug
+from rating import ratingCheck
# read settings
__settings__ = xbmcaddon.Addon("script.trakt")
@@ -106,6 +107,7 @@ def playbackEnded(self):
if self.watchedTime != 0:
if 'type' in self.curVideo: #and 'id' in self.curVideo:
self.check()
+ ratingCheck(self.curVideo, self.watchedTime, self.totalTime, self.playlistLength)
self.watchedTime = 0
self.startTime = 0
self.curVideo = None
View
3  service.py
@@ -2,7 +2,7 @@
#
import xbmcaddon
-from utilities import Debug, checkSettings
+from utilities import Debug, checkSettings, getTraktSettings
from notification_service import NotificationService
__settings__ = xbmcaddon.Addon("script.trakt")
@@ -15,6 +15,7 @@
# starts update/sync
def autostart():
if checkSettings(True):
+ getTraktSettings()
# startup notifcation service
NotificationService()
View
18 utilities.py
@@ -25,8 +25,10 @@
username = __settings__.getSetting("username").strip()
password = __settings__.getSetting("password").strip()
+pwd = sha.new(__settings__.getSetting("password").strip()).hexdigest()
debug = __settings__.getSetting("debug")
retries = int(float(__settings__.getSetting("retries")))
+traktSettings = None
def Debug(msg, force = False):
if(debug == 'true' or force):
@@ -239,15 +241,15 @@ def getEpisodeDetailsFromXbmc(libraryId, fields):
try:
# get tvdb id
rpccmd_show = json.dumps({'jsonrpc': '2.0', 'method': 'VideoLibrary.GetTVShowDetails', 'params':{'tvshowid': result['result']['episodedetails']['tvshowid'], 'properties': ['year', 'imdbnumber']}, 'id': 1})
-
+
result_show = xbmc.executeJSONRPC(rpccmd_show)
Debug('[VideoLibrary.GetTVShowDetails] ' + result_show)
result_show = json.loads(result_show)
-
+
# add to episode data
result['result']['episodedetails']['tvdb_id'] = result_show['result']['tvshowdetails']['imdbnumber']
result['result']['episodedetails']['year'] = result_show['result']['tvshowdetails']['year']
-
+
return result['result']['episodedetails']
except KeyError:
Debug("getEpisodeDetailsFromXbmc: KeyError: result['result']['episodedetails']")
@@ -364,3 +366,13 @@ def scrobbleEpisodeOnTrakt(tvdb_id, title, year, season, episode, uniqueid, dura
if response == None:
Debug("scrobbleEpisodeOnTrakt(): Error in request")
return response
+
+def getTraktSettings():
+ """Get the users settings from trakt.tv"""
+ global traktSettings
+
+ response = traktJsonRequest('POST', '/account/settings/%%API_KEY%%', passVersions=True)
+ if response == None:
+ Debug("Error in request from 'getTraktSettings()'")
+
+ traktSettings = response
Something went wrong with that request. Please try again.