diff --git a/addon.xml b/addon.xml index 516779b..0f6c434 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -11,10 +11,10 @@ assorted collection of mostly electronic music videos - Addon for https://vidfltr.slashproc.org + Add-on to play videos listed on https://vidfltr.slashproc.org A few videos don't work in every country assorted collection of mostly electronic music videos - Addon für https://vidfltr.slashproc.org + Add-on für https://vidfltr.slashproc.org Ein Paar Videos funktionieren nicht in allen Ländern all @@ -23,7 +23,10 @@ https://vidfltr.slashproc.org/ https://kodi.slashproc.org/repo/plugin.video.vidfltr/ - 0.9.3 + 0.9.4 +- add compatibility with KODI < 17 +- more minor cleanups +0.9.3 - Minor cleanups 0.9.2 - New: "More from..." artist context menu diff --git a/default.py b/default.py index 2153554..de6ea4e 100644 --- a/default.py +++ b/default.py @@ -18,7 +18,9 @@ pluginhandle = int(sys.argv[1]) translation = addon.getLocalizedString addonDir = xbmc.translatePath(addon.getAddonInfo('path')) defaultFanart = os.path.join(addonDir, 'resources/images/noicon.png') -fanart = os.path.join(addonDir, 'noicon.png') +#fanart = os.path.join(addonDir, 'noicon.png') +# don't use special folder icons as long as there is'nt a nice icon for every style +fanart = 'DefaultFolder.png' icon = os.path.join(addonDir, 'noicon.png') addon_work_folder = xbmc.translatePath("special://profile/addon_data/" + addonID) jsonVideos = xbmc.translatePath("special://profile/addon_data/" + addonID + "/videos.json") @@ -48,6 +50,8 @@ ccounthigh = int(addon.getSetting("ccounthigh")) likecounthigh = int(addon.getSetting("likecounthigh")) # dislike count considered to be high dislikecounthigh = int(addon.getSetting("dislikecounthigh")) +# needed for comapatibilty mode used with KODI <= 17 aka Krypton +xbmcversion = int(xbmc.getInfoLabel('System.BuildVersion')[:2]) # play from here. Does work in general but refreshes the container which is bit contra-productive in random lists ;) # XBMC.PlayMedia(plugin://plugin.video.vidfltr/?mode=sortTitlesBy&url=year%7crandom%7c-1,isdir) @@ -276,7 +280,10 @@ def styles(): length = len(channels) channels.sort() for channel in channels: - addDir(channel, '&style=' + channel + '&sort=' + sort, 'showChannel', getFanart(channel), length) +# don't use special folder icons as long as there is'nt a nice icon for every style +# addDir(channel, '&style=' + channel + '&sort=' + sort, 'showChannel', getFanart(channel), length) +# don't use special folder icons as long as there is'nt a nice icon for every style + addDir(channel, '&style=' + channel + '&sort=' + sort, 'showChannel', fanart, length) endOfDirectory() @@ -753,10 +760,13 @@ def sortTitlesBy(limit, sort, start): else: maximum = len(result) # play all (TODO) - addDir(translation(30109), '', '', fanart) +# addDir(translation(30109), '', '', fanart) # back to VIDFLTR (only useful if the back history would be cleared) # if start > 0: # addDir(translation(30108), '', 'main', fanart) +# hm, do I really want to replace the playlist on entering a folder? +# playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) +# playlist.clear() for entry in result[start:end]: addVideo(entry, mycount) if maximum > end and sort != "random" and channel != "year": @@ -829,7 +839,7 @@ def search(channel=""): result.append(cEntry) - result.sort(key=lambda entry: entry['style'].lower()) + result.sort(key=lambda entry: entry['title'].lower()) for entry in result: addVideo(entry) endOfDirectory() @@ -893,7 +903,12 @@ def addDir(name, url, mode, iconimage, total=0): u = sys.argv[0] + "?url=" + urllib.quote_plus(url.encode('utf-8')) + "&mode=" + str(mode) # xbmc.log(msg=u, level=xbmc.LOGNOTICE) ok = True - liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage, offscreen=True) +# if (xbmcversion < 17): + liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) +# else: +# With offscreen=true large lists (=folder) load much faster (needs >= krypton) +# But at the end, the differences are minimal in VIDFLTR, so just drop it :-) +# liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage, offscreen=True) description = "" if mode == "showChannel": data = getStyles() @@ -912,6 +927,10 @@ def addDir(name, url, mode, iconimage, total=0): def addVideo(entry, mycount="playcount"): ok = True + +# initiaize the global video playlist. The item will be added later +# playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) + # Altlast. Sinn dahinter? if len(entry) > 7: dateadded = datetime.utcfromtimestamp(float(entry['slug'])) @@ -944,20 +963,24 @@ def addVideo(entry, mycount="playcount"): #link = entry['slug'] fanart = entry['thumbnail'] duration = entry['duration'] - # Soll man das nun nutzen oder nicht? - # Mit offscreen=true werden Listen zigmal schneller dargestellt (klappt erst ab krypton) - li = xbmcgui.ListItem(title, offscreen=True) +# if (xbmcversion < 17): + li = xbmcgui.ListItem(title) +# else: +# li = xbmcgui.ListItem(title, offscreen=True) li.setInfo(type="video", infoLabels={ "mediatype": mediatype, "Title": title, "Originaltitle": tracktitle, "Genre": style, "Director": director, "PlotOutline": description, "Plot": description, "Tagline": style, "Artist": entry['artists'], "dateadded": dateadded, "playcount": playcount, "Duration": duration}) li.setArt({'thumb': fanart}) li.setProperty("fanart_image", fanart) - li.setProperty('IsPlayable', 'true') - + +# I could add all entries to the current, global playlist but it doesn't look right +# Imo at the end it's better if the user just uses "play from here" or the auto play next setting +# playlist.add(url=url, listitem=li) + li.addContextMenuItems([ (translation(30121),'XBMC.Container.Update(plugin://'+addonID+'/?mode=sortTitlesBy&url=%26start%3d'+slug+'%26limit%3drelated%26sort%3dnone)',), (translation(30122),'XBMC.Container.Update(plugin://'+addonID+'/?mode=sortArtists&url=relartists%7C'+slug+')',) - ],replaceItems=True) + ]) ok = xbmcplugin.addDirectoryItem(handle=pluginhandle, url=url, listitem=li) return ok