mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Support delete keymap
This commit is contained in:
parent
3ac5c4ebb0
commit
eb83cfb6a4
2 changed files with 39 additions and 11 deletions
|
@ -35,12 +35,22 @@ class Context(object):
|
|||
|
||||
_selected_option = None
|
||||
|
||||
def __init__(self, transcode=False):
|
||||
def __init__(self, transcode=False, delete=False):
|
||||
|
||||
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')
|
||||
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,15 +156,20 @@ class Context(object):
|
|||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.emby)')
|
||||
|
||||
elif selected == OPTIONS['Delete']:
|
||||
delete = True
|
||||
self.delete_item()
|
||||
|
||||
if not settings('skipContextMenu.bool'):
|
||||
def delete_item(self):
|
||||
|
||||
if not dialog("yesno", heading="{emby}", line1=_(33015)):
|
||||
delete = False
|
||||
delete = True
|
||||
|
||||
if delete:
|
||||
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
|
||||
if not settings('skipContextMenu.bool'):
|
||||
|
||||
if not dialog("yesno", heading="{emby}", line1=_(33015)):
|
||||
delete = False
|
||||
|
||||
if delete:
|
||||
LOG.info("fake deleted %s", self.item['Id'])
|
||||
#TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
|
||||
|
||||
def transcode(self):
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue