Merge remote-tracking branch 'MediaBrowser/master' into develop

This commit is contained in:
tomkat83 2016-03-10 08:12:20 +01:00
commit e7d96e9a00
3 changed files with 71 additions and 2 deletions

View file

@ -51,6 +51,7 @@ if __name__ == '__main__':
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
item = emby_db.getItem_byKodiId(itemid, itemtype)
embycursor.close()
if item: embyid = item[0]
logMsg("Contextmenu opened for embyid: %s - itemtype: %s" %(embyid,itemtype))

View file

@ -66,7 +66,8 @@ class Main:
'companion': entrypoint.plexCompanion,
'switchuser': entrypoint.switchPlexUser,
'deviceid': entrypoint.resetDeviceId,
'reConnect': entrypoint.reConnect
'reConnect': entrypoint.reConnect,
'delete': entrypoint.deleteItem
}
if "/extrafanart" in sys.argv[0]:
@ -108,7 +109,24 @@ class Main:
if mode == "settings":
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.plexkodiconnect)')
elif mode in ("manualsync", "repair"):
entrypoint.RunLibScan(mode)
if utils.window('emby_online') != "true":
# Server is not online, do not run the sync
xbmcgui.Dialog().ok(heading="Emby for Kodi",
line1=("Unable to run the sync, the add-on is not "
"connected to the Emby server."))
utils.logMsg("EMBY", "Not connected to the emby server.", 1)
return
if utils.window('emby_dbScan') != "true":
import librarysync
lib = librarysync.LibrarySync()
if mode == "manualsync":
librarysync.ManualSync().sync(dialog=True)
else:
lib.fullSync(repair=True)
else:
utils.logMsg("EMBY", "Database scan is already running.", 1)
elif mode == "texturecache":
import artwork
artwork.Artwork().FullTextureCacheSync()

View file

@ -285,6 +285,56 @@ def resetDeviceId():
line1=language(33033))
xbmc.executebuiltin('RestartApp')
##### Delete Item
def deleteItem():
# Serves as a keymap action
if xbmc.getInfoLabel('ListItem.Property(embyid)'): # If we already have the embyid
embyid = xbmc.getInfoLabel('ListItem.Property(embyid)')
else:
dbid = xbmc.getInfoLabel('ListItem.DBID')
itemtype = xbmc.getInfoLabel('ListItem.DBTYPE')
if not itemtype:
if xbmc.getCondVisibility('Container.Content(albums)'):
itemtype = "album"
elif xbmc.getCondVisibility('Container.Content(artists)'):
itemtype = "artist"
elif xbmc.getCondVisibility('Container.Content(songs)'):
itemtype = "song"
elif xbmc.getCondVisibility('Container.Content(pictures)'):
itemtype = "picture"
else:
utils.logMsg("EMBY delete", "Unknown type, unable to proceed.", 1)
return
embyconn = utils.kodiSQL('emby')
embycursor = embyconn.cursor()
emby_db = embydb.Embydb_Functions(embycursor)
item = emby_db.getItem_byKodiId(dbid, itemtype)
embycursor.close()
try:
embyid = item[0]
except TypeError:
utils.logMsg("EMBY delete", "Unknown embyId, unable to proceed.", 1)
return
if utils.settings('skipContextMenu') != "true":
resp = xbmcgui.Dialog().yesno(
heading="Confirm delete",
line1=("Delete file from Emby Server? This will "
"also delete the file(s) from disk!"))
if not resp:
utils.logMsg("EMBY delete", "User skipped deletion for: %s." % embyid, 1)
return
doUtils = downloadutils.DownloadUtils()
url = "{server}/emby/Items/%s?format=json" % embyid
utils.logMsg("EMBY delete", "Deleting request: %s" % embyid, 0)
doUtils.downloadUrl(url, type="DELETE")
##### ADD ADDITIONAL USERS #####
def addUser():