mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Merge branch 'master' of https://github.com/MediaBrowser/Emby.Kodi
This commit is contained in:
commit
eccfaf983f
6 changed files with 29 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.emby"
|
<addon id="plugin.video.emby"
|
||||||
name="Emby"
|
name="Emby"
|
||||||
version="0.0.4"
|
version="0.0.5"
|
||||||
provider-name="Emby.media">
|
provider-name="Emby.media">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
|
|
|
@ -98,22 +98,31 @@ class Kodi_Monitor(xbmc.Monitor):
|
||||||
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)
|
WriteKodiDB().updatePlayCountFromKodi(item, type, playcount)
|
||||||
if method == "VideoLibrary.OnRemove":
|
if method == "VideoLibrary.OnRemove":
|
||||||
xbmc.log('Intercepted remove from sender: ' + sender + ' method: ' + method + ' data: ' + data)
|
xbmc.log('Intercepted remove from sender: ' + sender + ' method: ' + method + ' data: ' + data)
|
||||||
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
if WINDOW.getProperty("suspendDeletes") == "True":
|
||||||
|
#This is a handshake to not try to delete if the item was removed from the Kodi DB due to sync
|
||||||
|
xbmc.log('Item deleted by sync')
|
||||||
|
WINDOW.setProperty("suspendDeletes", "False")
|
||||||
|
return
|
||||||
jsondata = json.loads(data)
|
jsondata = json.loads(data)
|
||||||
if jsondata != None:
|
if jsondata != None:
|
||||||
if jsondata.get("type") == "episode":
|
if jsondata.get("type") == "episode":
|
||||||
episodeid = jsondata.get("id")
|
episodeid = jsondata.get("id")
|
||||||
WINDOW = xbmcgui.Window( 10000 )
|
MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;")
|
||||||
#ignore if the item has just been deleted by the background sync
|
#MBlist[0] is the ID, and [1] the title
|
||||||
if not WINDOW.getProperty(episodeid,"deleted"):
|
url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json'
|
||||||
MBlist = WINDOW.getProperty("episodeid" + str(episodeid)).split(";;")
|
#This is a check to see if the item exists on the server, if it doesn't it may have already been deleted by another client
|
||||||
url='http://' + server + '/mediabrowser/Items?Ids=' + MBlist[1] + '&format=json'
|
data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0)
|
||||||
data = DownloadUtils().downloadUrl(url=url, suppress=True, popup=0)
|
result = json.loads(data)
|
||||||
if data != "":
|
item = result.get("Items")[0]
|
||||||
return_value = xbmcgui.Dialog().yesno("Confirm Delete", "Delete: "+ MBlist[0] + "\n on Emby Server?\nEmbyID: " + MBlist[1])
|
if WINDOW.getProperty("embyid" + item.get("Id")) == "deleted":
|
||||||
if return_value:
|
xbmc.log('Item was already deleted: ' + str(MBlist))
|
||||||
url='http://' + server + '/mediabrowser/Items/' + MBlist[1]
|
elif data != "":
|
||||||
xbmc.log('Deleting via URL: ' + url)
|
return_value = xbmcgui.Dialog().yesno("Confirm Delete", "Delete: "+ MBlist[0] + "\n on Emby Server?")
|
||||||
DownloadUtils().downloadUrl(url, type="DELETE")
|
if return_value:
|
||||||
|
url='http://' + server + '/mediabrowser/Items/' + MBlist[1]
|
||||||
|
xbmc.log('Deleting via URL: ' + url)
|
||||||
|
DownloadUtils().downloadUrl(url, type="DELETE")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -580,7 +580,7 @@ class LibrarySync():
|
||||||
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
allMB3EpisodeIds = set(allMB3EpisodeIds)
|
||||||
for episode in allKodiEpisodeIds:
|
for episode in allKodiEpisodeIds:
|
||||||
if episode.get('episodeid') not in allMB3EpisodeIds:
|
if episode.get('episodeid') not in allMB3EpisodeIds:
|
||||||
WINDOW.setProperty(episode.get('episodeid'),"deleted")
|
WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted")
|
||||||
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
|
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
|
||||||
cleanneeded = True
|
cleanneeded = True
|
||||||
totalItemsDeleted += 1
|
totalItemsDeleted += 1
|
||||||
|
|
|
@ -790,9 +790,13 @@ class WriteKodiDB():
|
||||||
if episode != None:
|
if episode != None:
|
||||||
strmfile = episode["file"]
|
strmfile = episode["file"]
|
||||||
nfofile = strmfile.replace(".strm",".nfo")
|
nfofile = strmfile.replace(".strm",".nfo")
|
||||||
|
WINDOW = xbmcgui.Window( 10000 )
|
||||||
|
WINDOW.setProperty("suspendDeletes", "True")
|
||||||
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "params": { "episodeid": %i}, "id": 1 }' %(episode["episodeid"]))
|
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "params": { "episodeid": %i}, "id": 1 }' %(episode["episodeid"]))
|
||||||
xbmcvfs.delete(strmfile)
|
xbmcvfs.delete(strmfile)
|
||||||
xbmcvfs.delete(nfofile)
|
xbmcvfs.delete(nfofile)
|
||||||
|
while WINDOW.getProperty("suspendDeletes") == "True":
|
||||||
|
xbmc.sleep(100)
|
||||||
|
|
||||||
def addTVShowToKodiLibrary( self, item ):
|
def addTVShowToKodiLibrary( self, item ):
|
||||||
itemPath = os.path.join(tvLibrary,item["Id"])
|
itemPath = os.path.join(tvLibrary,item["Id"])
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Playback"> <!-- Extra Sync options -->
|
<category label="Playback"> <!-- Extra Sync options -->
|
||||||
<setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="false" visible="true" enable="true" />
|
<setting id="addExtraPlaybackArt" type="bool" label="Add extra playback art" default="true" visible="true" enable="true" />
|
||||||
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
|
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
|
||||||
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
|
<setting id="smbpassword" type="text" label="30008" default="" option="hidden" visible="true" enable="true" />
|
||||||
</category>
|
</category>
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Service():
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
# background worker for database sync
|
# background worker for database sync
|
||||||
if DownloadUtils().authenticate(retreive=False) != "":
|
if DownloadUtils().authenticate(retreive=True) != "":
|
||||||
|
|
||||||
# Correctly launch the websocket, if user manually launches the add-on
|
# Correctly launch the websocket, if user manually launches the add-on
|
||||||
if (self.newWebSocketThread == None):
|
if (self.newWebSocketThread == None):
|
||||||
|
|
Loading…
Reference in a new issue