Message if PMS item could not be deleted
This commit is contained in:
parent
45a9f8081b
commit
0b2ccde834
5 changed files with 15 additions and 10 deletions
|
@ -266,6 +266,7 @@
|
||||||
<string id="30411">Set custom song rating (0-5)</string>
|
<string id="30411">Set custom song rating (0-5)</string>
|
||||||
<string id="30412">Force transcode</string>
|
<string id="30412">Force transcode</string>
|
||||||
<string id="30413">Enable Plex context menu in Kodi</string>
|
<string id="30413">Enable Plex context menu in Kodi</string>
|
||||||
|
<string id="30414">Could not delete the Plex item. Is item deletion enabled on the Plex Media Server?</string>
|
||||||
|
|
||||||
<!-- add-on settings -->
|
<!-- add-on settings -->
|
||||||
<string id="30500">Verify Host SSL Certificate (more secure)</string>
|
<string id="30500">Verify Host SSL Certificate (more secure)</string>
|
||||||
|
|
|
@ -298,6 +298,7 @@
|
||||||
<string id="30411">Set custom song rating (0-5)</string>
|
<string id="30411">Set custom song rating (0-5)</string>
|
||||||
<string id="30412">Transkodieren erzwingen</string>
|
<string id="30412">Transkodieren erzwingen</string>
|
||||||
<string id="30413">Plex Kontextmenu in Kodi aktivieren</string>
|
<string id="30413">Plex Kontextmenu in Kodi aktivieren</string>
|
||||||
|
<string id="30414">Konnte das Element nicht löschen. Ist diese Option auf dem Plex Medien Server aktiviert?</string>
|
||||||
|
|
||||||
|
|
||||||
<string id="33033">Kodi wird jetzt neu gestartet um die Änderungen anzuwenden.</string>
|
<string id="33033">Kodi wird jetzt neu gestartet um die Änderungen anzuwenden.</string>
|
||||||
|
|
|
@ -535,13 +535,11 @@ def delete_item_from_pms(plexid):
|
||||||
|
|
||||||
Returns True if successful, False otherwise
|
Returns True if successful, False otherwise
|
||||||
"""
|
"""
|
||||||
xml = downloadutils.DownloadUtils().downloadUrl(
|
if downloadutils.DownloadUtils().downloadUrl(
|
||||||
'{server}/library/metadata/%s' % plexid,
|
'{server}/library/metadata/%s' % plexid,
|
||||||
action_type="DELETE")
|
action_type="DELETE") is True:
|
||||||
try:
|
log.info('Successfully deleted Plex id %s from the PMS' % plexid)
|
||||||
xml.attrib
|
|
||||||
except AttributeError:
|
|
||||||
log.error('Could not delete Plex id %s' % plexid)
|
|
||||||
return False
|
|
||||||
log.info(xml.dump)
|
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
log.error('Could not delete Plex id %s from the PMS' % plexid)
|
||||||
|
return False
|
||||||
|
|
|
@ -191,4 +191,5 @@ class ContextMenu(object):
|
||||||
|
|
||||||
if delete:
|
if delete:
|
||||||
log.info("Deleting Plex item with id %s", self.item_id)
|
log.info("Deleting Plex item with id %s", self.item_id)
|
||||||
delete_item_from_pms(self.item_id)
|
if delete_item_from_pms(self.item_id) is False:
|
||||||
|
dialog(type_="ok", heading="{plex}", line1=lang(30414))
|
||||||
|
|
|
@ -319,6 +319,10 @@ class DownloadUtils():
|
||||||
log.info('Received text:')
|
log.info('Received text:')
|
||||||
log.info(r.text)
|
log.info(r.text)
|
||||||
return True
|
return True
|
||||||
|
elif r.status_code == 403:
|
||||||
|
# E.g. deleting a PMS item
|
||||||
|
log.error('PMS sent 403: Forbidden error for url %s' % url)
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
log.error('Unknown answer from PMS %s with status code %s. '
|
log.error('Unknown answer from PMS %s with status code %s. '
|
||||||
'Message:' % (url, r.status_code))
|
'Message:' % (url, r.status_code))
|
||||||
|
|
Loading…
Reference in a new issue