Merge branch 'master' of https://github.com/marcelveldt/plugin.video.mb3sync
Conflicts: resources/lib/LibrarySync.py
This commit is contained in:
commit
150f276005
1 changed files with 15 additions and 10 deletions
|
@ -8,6 +8,7 @@ import xbmcaddon
|
|||
import xbmcvfs
|
||||
import json
|
||||
import sqlite3
|
||||
import inspect
|
||||
import threading
|
||||
import urllib
|
||||
from datetime import datetime, timedelta, time
|
||||
|
@ -403,7 +404,7 @@ class LibrarySync():
|
|||
userid = downloadUtils.getUserId()
|
||||
|
||||
# TODO --> extend support for episodes
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": { "movieid": ' + str(id) + ', "properties" : ["playcount", "file"] }, "id": "1"}')
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovieDetails", "params": { "movieid": ' + str(id) + ', "properties" : ["playcount", "file"] }, "id": "1"}')
|
||||
if json_response != None:
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
movie = None
|
||||
|
@ -887,7 +888,7 @@ class LibrarySync():
|
|||
kodiItem = self.getKodiMovie(id)
|
||||
utils.logMsg("deleting movie from Kodi library",id)
|
||||
if kodiItem != None:
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "params": { "movieid": %i}, "id": 1 }' %(kodiItem["movieid"]))
|
||||
self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "params": { "movieid": %i}, "id": 1 }' %(kodiItem["movieid"]))
|
||||
|
||||
path = os.path.join(movieLibrary,id)
|
||||
xbmcvfs.rmdir(path)
|
||||
|
@ -907,7 +908,7 @@ class LibrarySync():
|
|||
kodiItem = self.getKodiTVShow(id)
|
||||
utils.logMsg("deleting tvshow from Kodi library",id)
|
||||
if kodiItem != None:
|
||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "params": { "tvshowid": %i}, "id": 1 }' %(kodiItem["tvshowid"]))
|
||||
self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "params": { "tvshowid": %i}, "id": 1 }' %(kodiItem["tvshowid"]))
|
||||
path = os.path.join(tvLibrary,id)
|
||||
xbmcvfs.rmdir(path)
|
||||
|
||||
|
@ -990,7 +991,7 @@ class LibrarySync():
|
|||
|
||||
|
||||
def getKodiMovie(self, id):
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
movie = None
|
||||
|
||||
|
@ -1003,7 +1004,7 @@ class LibrarySync():
|
|||
return movie
|
||||
|
||||
def getKodiTVShow(self, id):
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
tvshow = None
|
||||
if(jsonobject.has_key('result')):
|
||||
|
@ -1015,7 +1016,7 @@ class LibrarySync():
|
|||
|
||||
def getKodiEpisodes(self, id):
|
||||
episodes = None
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "contains", "field": "path", "value": "' + id + '"}, "properties": ["art", "genre", "plot", "mpaa", "cast", "studio", "sorttitle", "title", "originaltitle", "imdbnumber", "year", "rating", "thumbnail", "playcount", "file", "fanart"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
tvshow = None
|
||||
if(jsonobject.has_key('result')):
|
||||
|
@ -1024,7 +1025,7 @@ class LibrarySync():
|
|||
tvshows = result['tvshows']
|
||||
tvshow = tvshows[0]
|
||||
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "plot", "season", "episode", "showtitle", "file", "lastplayed", "rating", "resume", "art", "streamdetails", "firstaired", "runtime", "writer", "cast", "dateadded"], "sort": {"method": "episode"}}, "id": 1}' %tvshow['tvshowid'])
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "plot", "season", "episode", "showtitle", "file", "lastplayed", "rating", "resume", "art", "streamdetails", "firstaired", "runtime", "writer", "cast", "dateadded"], "sort": {"method": "episode"}}, "id": 1}' %tvshow['tvshowid'])
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
episodes = None
|
||||
if(jsonobject.has_key('result')):
|
||||
|
@ -1034,7 +1035,7 @@ class LibrarySync():
|
|||
return episodes
|
||||
|
||||
def getKodiEpisodeByMbItem(self, MBitem):
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "is", "field": "title", "value": "' + MBitem.get("SeriesName").encode('utf-8') + '"} }, "id": "libTvShows"}')
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetTVShows", "params": { "filter": {"operator": "is", "field": "title", "value": "' + MBitem.get("SeriesName").encode('utf-8') + '"} }, "id": "libTvShows"}')
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
episode = None
|
||||
if(jsonobject.has_key('result')):
|
||||
|
@ -1044,7 +1045,7 @@ class LibrarySync():
|
|||
tvshow = tvshows[0]
|
||||
|
||||
# find the episode by combination of season and episode
|
||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["playcount","season", "resume", "episode"], "sort": {"method": "episode"}}, "id": 1}' %tvshow['tvshowid'])
|
||||
json_response = self.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["playcount","season", "resume", "episode"], "sort": {"method": "episode"}}, "id": 1}' %tvshow['tvshowid'])
|
||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||
episodes = None
|
||||
if(jsonobject.has_key('result')):
|
||||
|
@ -1095,7 +1096,11 @@ class LibrarySync():
|
|||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def executeJSONRPC(self, command):
|
||||
print "ExecuteJSONRPC called!"
|
||||
print inspect.stack()[1][3]
|
||||
return xbmc.executeJSONRPC(command)
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue