fix small typos
add delete option to context menu
This commit is contained in:
parent
b24e881f18
commit
8e2cae3b13
3 changed files with 37 additions and 20 deletions
|
@ -82,6 +82,9 @@ if __name__ == '__main__':
|
|||
#Set custom song rating
|
||||
options.append(utils.language(30407))
|
||||
|
||||
#delete item
|
||||
options.append(utils.language(30409))
|
||||
|
||||
#addon settings
|
||||
options.append(utils.language(30408))
|
||||
|
||||
|
@ -120,3 +123,13 @@ if __name__ == '__main__':
|
|||
#Open addon settings
|
||||
xbmc.executebuiltin("Addon.OpenSettings(plugin.video.emby)")
|
||||
|
||||
if options[ret] == utils.language(30409):
|
||||
#delete item from the server
|
||||
if xbmcgui.Dialog().yesno("Do you really want to delete this item ?", "This will delete the item from the server and the file(s) from disk!"):
|
||||
import downloadutils
|
||||
doUtils = downloadutils.DownloadUtils()
|
||||
url = "{server}/emby/Items/%s?format=json" % embyid
|
||||
doUtils.downloadUrl(url, type="DELETE")
|
||||
|
||||
xbmc.sleep(500)
|
||||
xbmc.executebuiltin("Container.Update")
|
|
@ -272,6 +272,7 @@
|
|||
<string id="30406">Remove from Emby favorites</string>
|
||||
<string id="30407">Set custom song rating</string>
|
||||
<string id="30408">Emby addon settings</string>
|
||||
<string id="30409">Delete item from the server</string>
|
||||
|
||||
|
||||
</strings>
|
||||
|
|
|
@ -428,18 +428,19 @@ def BrowseContent(viewname, type="", folderid=None, filter=""):
|
|||
|
||||
#get the actual listing
|
||||
if filter == "recent":
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending").get("Items",[])
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending")
|
||||
elif filter == "random":
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending").get("Items",[])
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending")
|
||||
elif filter == "recommended":
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite").get("Items",[])
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
|
||||
elif filter == "sets":
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite").get("Items",[])
|
||||
listing = emby.getFilteredSection("", itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
|
||||
else:
|
||||
listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False).get("Items",[])
|
||||
listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False)
|
||||
|
||||
#process the listing
|
||||
for item in listing:
|
||||
if listing:
|
||||
for item in listing.get("Items"):
|
||||
li = createListItemFromEmbyItem(item)
|
||||
if item.get("IsFolder") == True:
|
||||
#for folders we add an additional browse request, passing the folderId
|
||||
|
@ -479,11 +480,13 @@ def createListItemFromEmbyItem(item):
|
|||
|
||||
allart = art.getAllArtwork(item)
|
||||
|
||||
if item["Type"] in ["Photo","PhotoAlbum"]:
|
||||
if item["Type"] is "Photo":
|
||||
#listitem setup for pictures...
|
||||
img_path = allart.get('Primary')
|
||||
li.setProperty("path",img_path)
|
||||
picture = doUtils.downloadUrl("{server}/Items/%s/Images" %itemid)[0]
|
||||
picture = doUtils.downloadUrl("{server}/Items/%s/Images" %itemid)
|
||||
if picture:
|
||||
picture = picture[0]
|
||||
if picture.get("Width") > picture.get("Height"):
|
||||
li.setArt( {"fanart": img_path}) #add image as fanart for use with skinhelper auto thumb/backgrund creation
|
||||
li.setInfo('pictures', infoLabels={ "picturepath": img_path, "date": premieredate, "size": picture.get("Size"), "exif:width": str(picture.get("Width")), "exif:height": str(picture.get("Height")), "title": "blaat" })
|
||||
|
|
Loading…
Reference in a new issue