mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Add delete keymap entrypoint
RunPlugin(plugin://plugin.video.emby?mode=delete)
This commit is contained in:
parent
8bde429da4
commit
a5d74c8a17
2 changed files with 52 additions and 1 deletions
|
@ -62,7 +62,8 @@ class Main:
|
|||
'inprogressepisodes': entrypoint.getInProgressEpisodes,
|
||||
'recentepisodes': entrypoint.getRecentEpisodes,
|
||||
'refreshplaylist': entrypoint.refreshPlaylist,
|
||||
'deviceid': entrypoint.resetDeviceId
|
||||
'deviceid': entrypoint.resetDeviceId,
|
||||
'delete': entrypoint.deleteItem
|
||||
}
|
||||
|
||||
if "/extrafanart" in sys.argv[0]:
|
||||
|
|
|
@ -118,6 +118,56 @@ def resetDeviceId():
|
|||
line1=language(33033))
|
||||
xbmc.executebuiltin('RestartApp')
|
||||
|
||||
##### Delete Item, like the context menu action
|
||||
def deleteItem():
|
||||
|
||||
# Serves as a keymap action
|
||||
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
|
||||
|
||||
if xbmc.getInfoLabel('ListItem.Property(embyid)'): # If we already have the embyid
|
||||
embyid = xbmc.getInfoLabel('ListItem.Property(embyid)')
|
||||
else:
|
||||
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():
|
||||
|
||||
|
|
Loading…
Reference in a new issue