The branch, frodo has been updated
       via  23a3fafc84e850dd1f4545f061a00c849da1633d (commit)
      from  dbcab8656b0d2a108dac3633137c1f6541a302ca (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=23a3fafc84e850dd1f4545f061a00c849da1633d

commit 23a3fafc84e850dd1f4545f061a00c849da1633d
Author: beenje <[email protected]>
Date:   Mon Apr 29 22:36:42 2013 +0200

    [plugin.video.trakt_list_manager] updated to version 0.1.1

diff --git a/plugin.video.trakt_list_manager/addon.py 
b/plugin.video.trakt_list_manager/addon.py
index 7b0ef9c..2416d27 100644
--- a/plugin.video.trakt_list_manager/addon.py
+++ b/plugin.video.trakt_list_manager/addon.py
@@ -140,47 +140,22 @@ def show_customlist(list_slug):
             ),
         ]
 
-    items = []
+    raw_movies = (
+        dict(m['movie'].items() + [('plays', m.get('plays', 0))])
+        for m in api.get_list(list_slug).get('items', [])
+        if m['type'] == 'movie'
+    )
+    items = format_movies(raw_movies)
+    for item in items:
+        item['context_menu'] = context_menu(
+            list_slug=list_slug,
+            imdb_id=item.get('imdb_id', ''),
+            tmdb_id=item.get('tmdb_id', '')
+        )
     plugin.set_content('movies')
-    i = 0
-    for i, list_item in enumerate(api.get_list(list_slug).get('items', [])):
-        if not list_item['type'] == 'movie':
-            continue
-        movie = list_item['movie']
-        items.append({
-            'label': movie['title'],
-            'thumbnail': movie['images']['poster'],
-            'info': {
-                'count': i,
-                'code': movie.get('imdb_id', ''),
-                'year': movie.get('year', 0),
-                'plot': movie.get('overview', ''),
-                'mpaa': movie.get('certification', ''),
-                'genre': ', '.join(movie.get('genres', [])),
-                'tagline': movie.get('tagline', ''),
-                'playcount': list_item.get('plays', 0),
-                'rating': movie.get('ratings', {}).get('percentage', 0) / 10.0,
-                'votes': movie.get('ratings', {}).get('votes', 0)
-            },
-            'stream_info': {
-                'video': {'duration': movie.get('runtime', 0) * 60}
-            },
-            'replace_context_menu': True,
-            'context_menu': context_menu(
-                list_slug=list_slug,
-                imdb_id=movie.get('imdb_id', ''),
-                tmdb_id=movie.get('tmdb_id', '')
-            ),
-            'properties': {
-                'fanart_image': movie['images']['fanart'],
-            },
-            'path': plugin.url_for(
-                endpoint='show_help'
-            ),
-        })
     items.append({
         'label': _('add_movie'),
-        'info': {'count': i + 1},
+        'info': {'count': len(items) + 1},
         'path': plugin.url_for(
             endpoint='add_movie_to_customlist',
             list_slug=list_slug,
@@ -216,39 +191,15 @@ def show_watchlist():
             ),
         ]
 
-    i = 0
-    items = [{
-        'label': movie['title'],
-        'thumbnail': movie['images']['poster'],
-        'info': {
-            'count': i,
-            'code': movie.get('imdb_id', ''),
-            'year': movie.get('year', 0),
-            'plot': movie.get('overview', ''),
-            'mpaa': movie.get('certification', ''),
-            'genre': ', '.join(movie.get('genres', [])),
-            'tagline': movie.get('tagline', ''),
-            'rating': movie.get('ratings', {}).get('percentage', 0) / 10.0,
-            'votes': movie.get('ratings', {}).get('votes', 0)
-        },
-        'stream_info': {
-            'video': {'duration': movie.get('runtime', 0) * 60}
-        },
-        'replace_context_menu': True,
-        'context_menu': context_menu(
-            imdb_id=movie.get('imdb_id', ''),
-            tmdb_id=movie.get('tmdb_id', '')
-        ),
-        'properties': {
-            'fanart_image': movie['images']['fanart'],
-        },
-        'path': plugin.url_for(
-            endpoint='show_help'
-        ),
-    } for i, movie in enumerate(api.get_watchlist())]
+    items = format_movies(api.get_watchlist())
+    for item in items:
+        item['context_menu'] = context_menu(
+            imdb_id=item.get('imdb_id', ''),
+            tmdb_id=item.get('tmdb_id', '')
+        )
     items.append({
         'label': _('add_movie'),
-        'info': {'count': i + 1},
+        'info': {'count': len(items) + 1},
         'path': plugin.url_for(
             endpoint='add_movie_to_watchlist',
             refresh=True,
@@ -439,6 +390,73 @@ def open_settings():
     plugin.open_settings()
 
 
[email protected]()
+def get_xbmc_movies():
+    import json
+    query = {
+        'jsonrpc': '2.0',
+        'id': 0,
+        'method': 'VideoLibrary.GetMovies',
+        'params': {
+            'properties': ['imdbnumber', 'file']
+        }
+    }
+    response = json.loads(xbmc.executeJSONRPC(json.dumps(query)))
+    movie_dict = dict(
+        (movie['imdbnumber'], movie['file'])
+        for movie in response.get('result', {}).get('movies', [])
+    )
+    return movie_dict
+
+
[email protected]('/movie/<movie_file>/play')
+def play_movie(movie_file):
+    return plugin.set_resolved_url(movie_file)
+
+
+def format_movies(raw_movies):
+    xbmc_movies = get_xbmc_movies()
+    items = []
+    for i, movie in enumerate(raw_movies):
+        if movie.get('imdb_id', '') in xbmc_movies:
+            label = u'[B]%s[/B]' % movie['title']
+            path = plugin.url_for(
+                endpoint='play_movie',
+                movie_file=xbmc_movies[movie['imdb_id']]
+            )
+        else:
+            label = movie['title']
+            path = plugin.url_for(
+                endpoint='show_help'
+            )
+        items.append({
+            'label': label,
+            'thumbnail': movie['images']['poster'],
+            'info': {
+                'count': i,
+                'code': movie.get('imdb_id', ''),
+                'year': movie.get('year', 0),
+                'plot': movie.get('overview', ''),
+                'mpaa': movie.get('certification', ''),
+                'genre': ', '.join(movie.get('genres', [])),
+                'tagline': movie.get('tagline', ''),
+                'playcount': movie.get('plays', 0),
+                'rating': movie.get('ratings', {}).get('percentage', 0) / 10.0,
+                'votes': movie.get('ratings', {}).get('votes', 0)
+            },
+            'stream_info': {
+                'video': {'duration': movie.get('runtime', 0) * 60}
+            },
+            'replace_context_menu': True,
+            'properties': {
+                'fanart_image': movie['images']['fanart'],
+            },
+            'is_playable': True,
+            'path': path,
+        })
+    return items
+
+
 def get_api():
     logged_in = False
     api = TraktListApi()
diff --git a/plugin.video.trakt_list_manager/addon.xml 
b/plugin.video.trakt_list_manager/addon.xml
index 7c26712..127a9c8 100644
--- a/plugin.video.trakt_list_manager/addon.xml
+++ b/plugin.video.trakt_list_manager/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.trakt_list_manager" name="Trakt.tv List Manager" 
version="0.1.0" provider-name="Tristan Fischer ([email protected])">
+<addon id="plugin.video.trakt_list_manager" name="Trakt.tv List Manager" 
version="0.1.1" provider-name="Tristan Fischer ([email protected])">
     <requires>
         <import addon="xbmc.python" version="2.1.0"/>
         <import addon="script.module.xbmcswift2" version="2.4.0"/>
diff --git a/plugin.video.trakt_list_manager/changelog.txt 
b/plugin.video.trakt_list_manager/changelog.txt
index e035e50..4321f4f 100644
--- a/plugin.video.trakt_list_manager/changelog.txt
+++ b/plugin.video.trakt_list_manager/changelog.txt
@@ -1,3 +1,7 @@
+0.1.1 (29.04.2013)
+ - added feature to play movies from trakt.tv lists if they are present in 
+   the xbmc database. Present movies are bold.
+
 0.1.0 (07.03.2013)
  - added full watchlist list (add/delete movies)
  - added possibility to set the watchlist or any custom list as default list

-----------------------------------------------------------------------

Summary of changes:
 plugin.video.trakt_list_manager/addon.py      |  156 ++++++++++++++-----------
 plugin.video.trakt_list_manager/addon.xml     |    2 +-
 plugin.video.trakt_list_manager/changelog.txt |    4 +
 3 files changed, 92 insertions(+), 70 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to