add compatibility with KODI < 17
more minor cleanups
This commit is contained in:
parent
c70ca839e6
commit
52309f543a
2 changed files with 41 additions and 15 deletions
11
addon.xml
11
addon.xml
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.vidfltr" name="VIDFLTR Music Videos" version="0.9.3" provider-name="bassdart">
|
<addon id="plugin.video.vidfltr" name="VIDFLTR Music Videos" version="0.9.4" provider-name="bassdart">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.kodi-six" />
|
<import addon="script.module.kodi-six" />
|
||||||
|
@ -11,10 +11,10 @@
|
||||||
</extension>
|
</extension>
|
||||||
<extension point="xbmc.addon.metadata">
|
<extension point="xbmc.addon.metadata">
|
||||||
<summary lang="en_GB">assorted collection of mostly electronic music videos</summary>
|
<summary lang="en_GB">assorted collection of mostly electronic music videos</summary>
|
||||||
<description lang="en_GB">Addon for https://vidfltr.slashproc.org</description>
|
<description lang="en_GB">Add-on to play videos listed on https://vidfltr.slashproc.org</description>
|
||||||
<disclaimer lang="en_GB">A few videos don't work in every country</disclaimer>
|
<disclaimer lang="en_GB">A few videos don't work in every country</disclaimer>
|
||||||
<summary lang="de_DE">assorted collection of mostly electronic music videos</summary>
|
<summary lang="de_DE">assorted collection of mostly electronic music videos</summary>
|
||||||
<description lang="de_DE">Addon für https://vidfltr.slashproc.org</description>
|
<description lang="de_DE">Add-on für https://vidfltr.slashproc.org</description>
|
||||||
<disclaimer lang="de_DE">Ein Paar Videos funktionieren nicht in allen Ländern</disclaimer>
|
<disclaimer lang="de_DE">Ein Paar Videos funktionieren nicht in allen Ländern</disclaimer>
|
||||||
<language></language>
|
<language></language>
|
||||||
<platform>all</platform>
|
<platform>all</platform>
|
||||||
|
@ -23,7 +23,10 @@
|
||||||
<website>https://vidfltr.slashproc.org/</website>
|
<website>https://vidfltr.slashproc.org/</website>
|
||||||
<email></email>
|
<email></email>
|
||||||
<source>https://kodi.slashproc.org/repo/plugin.video.vidfltr/</source>
|
<source>https://kodi.slashproc.org/repo/plugin.video.vidfltr/</source>
|
||||||
<news>0.9.3
|
<news>0.9.4
|
||||||
|
- add compatibility with KODI < 17
|
||||||
|
- more minor cleanups
|
||||||
|
0.9.3
|
||||||
- Minor cleanups
|
- Minor cleanups
|
||||||
0.9.2
|
0.9.2
|
||||||
- New: "More from..." artist context menu
|
- New: "More from..." artist context menu
|
||||||
|
|
43
default.py
43
default.py
|
@ -18,7 +18,9 @@ pluginhandle = int(sys.argv[1])
|
||||||
translation = addon.getLocalizedString
|
translation = addon.getLocalizedString
|
||||||
addonDir = xbmc.translatePath(addon.getAddonInfo('path'))
|
addonDir = xbmc.translatePath(addon.getAddonInfo('path'))
|
||||||
defaultFanart = os.path.join(addonDir, 'resources/images/noicon.png')
|
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')
|
icon = os.path.join(addonDir, 'noicon.png')
|
||||||
addon_work_folder = xbmc.translatePath("special://profile/addon_data/" + addonID)
|
addon_work_folder = xbmc.translatePath("special://profile/addon_data/" + addonID)
|
||||||
jsonVideos = xbmc.translatePath("special://profile/addon_data/" + addonID + "/videos.json")
|
jsonVideos = xbmc.translatePath("special://profile/addon_data/" + addonID + "/videos.json")
|
||||||
|
@ -48,6 +50,8 @@ ccounthigh = int(addon.getSetting("ccounthigh"))
|
||||||
likecounthigh = int(addon.getSetting("likecounthigh"))
|
likecounthigh = int(addon.getSetting("likecounthigh"))
|
||||||
# dislike count considered to be high
|
# dislike count considered to be high
|
||||||
dislikecounthigh = int(addon.getSetting("dislikecounthigh"))
|
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 ;)
|
# 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)
|
# XBMC.PlayMedia(plugin://plugin.video.vidfltr/?mode=sortTitlesBy&url=year%7crandom%7c-1,isdir)
|
||||||
|
@ -276,7 +280,10 @@ def styles():
|
||||||
length = len(channels)
|
length = len(channels)
|
||||||
channels.sort()
|
channels.sort()
|
||||||
for channel in channels:
|
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()
|
endOfDirectory()
|
||||||
|
|
||||||
|
|
||||||
|
@ -753,10 +760,13 @@ def sortTitlesBy(limit, sort, start):
|
||||||
else:
|
else:
|
||||||
maximum = len(result)
|
maximum = len(result)
|
||||||
# play all (TODO)
|
# play all (TODO)
|
||||||
addDir(translation(30109), '', '', fanart)
|
# addDir(translation(30109), '', '', fanart)
|
||||||
# back to VIDFLTR (only useful if the back history would be cleared)
|
# back to VIDFLTR (only useful if the back history would be cleared)
|
||||||
# if start > 0:
|
# if start > 0:
|
||||||
# addDir(translation(30108), '', 'main', fanart)
|
# 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]:
|
for entry in result[start:end]:
|
||||||
addVideo(entry, mycount)
|
addVideo(entry, mycount)
|
||||||
if maximum > end and sort != "random" and channel != "year":
|
if maximum > end and sort != "random" and channel != "year":
|
||||||
|
@ -829,7 +839,7 @@ def search(channel=""):
|
||||||
result.append(cEntry)
|
result.append(cEntry)
|
||||||
|
|
||||||
|
|
||||||
result.sort(key=lambda entry: entry['style'].lower())
|
result.sort(key=lambda entry: entry['title'].lower())
|
||||||
for entry in result:
|
for entry in result:
|
||||||
addVideo(entry)
|
addVideo(entry)
|
||||||
endOfDirectory()
|
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)
|
u = sys.argv[0] + "?url=" + urllib.quote_plus(url.encode('utf-8')) + "&mode=" + str(mode)
|
||||||
# xbmc.log(msg=u, level=xbmc.LOGNOTICE)
|
# xbmc.log(msg=u, level=xbmc.LOGNOTICE)
|
||||||
ok = True
|
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 = ""
|
description = ""
|
||||||
if mode == "showChannel":
|
if mode == "showChannel":
|
||||||
data = getStyles()
|
data = getStyles()
|
||||||
|
@ -912,6 +927,10 @@ def addDir(name, url, mode, iconimage, total=0):
|
||||||
|
|
||||||
def addVideo(entry, mycount="playcount"):
|
def addVideo(entry, mycount="playcount"):
|
||||||
ok = True
|
ok = True
|
||||||
|
|
||||||
|
# initiaize the global video playlist. The item will be added later
|
||||||
|
# playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
|
||||||
|
|
||||||
# Altlast. Sinn dahinter?
|
# Altlast. Sinn dahinter?
|
||||||
if len(entry) > 7:
|
if len(entry) > 7:
|
||||||
dateadded = datetime.utcfromtimestamp(float(entry['slug']))
|
dateadded = datetime.utcfromtimestamp(float(entry['slug']))
|
||||||
|
@ -944,20 +963,24 @@ def addVideo(entry, mycount="playcount"):
|
||||||
#link = entry['slug']
|
#link = entry['slug']
|
||||||
fanart = entry['thumbnail']
|
fanart = entry['thumbnail']
|
||||||
duration = entry['duration']
|
duration = entry['duration']
|
||||||
# Soll man das nun nutzen oder nicht?
|
# if (xbmcversion < 17):
|
||||||
# Mit offscreen=true werden Listen zigmal schneller dargestellt (klappt erst ab krypton)
|
li = xbmcgui.ListItem(title)
|
||||||
li = xbmcgui.ListItem(title, offscreen=True)
|
# 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.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.setArt({'thumb': fanart})
|
||||||
li.setProperty("fanart_image", fanart)
|
li.setProperty("fanart_image", fanart)
|
||||||
|
|
||||||
li.setProperty('IsPlayable', 'true')
|
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([
|
li.addContextMenuItems([
|
||||||
(translation(30121),'XBMC.Container.Update(plugin://'+addonID+'/?mode=sortTitlesBy&url=%26start%3d'+slug+'%26limit%3drelated%26sort%3dnone)',),
|
(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+')',)
|
(translation(30122),'XBMC.Container.Update(plugin://'+addonID+'/?mode=sortArtists&url=relartists%7C'+slug+')',)
|
||||||
],replaceItems=True)
|
])
|
||||||
ok = xbmcplugin.addDirectoryItem(handle=pluginhandle, url=url, listitem=li)
|
ok = xbmcplugin.addDirectoryItem(handle=pluginhandle, url=url, listitem=li)
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
|
|
Loading…
Reference in a new issue