Support delete keymap

This commit is contained in:
angelblue05 2018-09-13 02:07:08 -05:00
parent 3ac5c4ebb0
commit eb83cfb6a4
2 changed files with 39 additions and 11 deletions

View file

@ -35,12 +35,22 @@ class Context(object):
_selected_option = None
def __init__(self, transcode=False):
def __init__(self, transcode=False, delete=False):
try:
self.kodi_id = sys.listitem.getVideoInfoTag().getDbId() or None
self.media = self.get_media_type()
self.server = sys.listitem.getProperty('embyserver') or None
item_id = sys.listitem.getProperty('embyid')
except AttributeError:
self.server = None
if xbmc.getInfoLabel('ListItem.Property(embyid)'):
item_id = xbmc.getInfoLabel('ListItem.Property(embyid)')
else:
self.kodi_id = xbmc.getInfoLabel('ListItem.DBID')
self.media = xbmc.getInfoLabel('ListItem.DBTYPE')
item_id = None
if self.server or item_id:
self.item = TheVoid('GetItem', {'ServerId': self.server, 'Id': item_id}).get()
@ -52,6 +62,9 @@ class Context(object):
if transcode:
self.transcode()
elif delete:
self.delete_item()
elif self.select_menu():
self.action_menu()
@ -143,6 +156,10 @@ class Context(object):
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
elif selected == OPTIONS['Delete']:
self.delete_item()
def delete_item(self):
delete = True
if not settings('skipContextMenu.bool'):
@ -151,7 +168,8 @@ class Context(object):
delete = False
if delete:
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
LOG.info("fake deleted %s", self.item['Id'])
#TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
def transcode(self):

View file

@ -77,6 +77,8 @@ class Events(object):
client.reset_device_id()
elif mode == 'reset':
reset()
elif mode == 'delete':
delete_item()
elif mode == 'refreshboxsets':
event('SyncLibrary', {'Id': "Boxsets:Refresh"})
elif mode == 'nextepisodes':
@ -676,3 +678,11 @@ def get_themes():
tvtunes_nfo(nfo_file, paths)
dialog("notification", heading="{emby}", message=_(33153), icon="{emby}", time=1000, sound=False)
def delete_item():
''' Delete keymap action.
'''
import context
context.Context(delete=True)