Compare commits

...

9 commits

11 changed files with 118 additions and 131 deletions

View file

@ -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.5" provider-name="bassdart"> <addon id="plugin.video.vidfltr" name="VIDFLTR Music Videos" version="0.9.7" 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" />
@ -23,7 +23,22 @@
<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.5 <assets>
<icon>resources/img/kodi/icon.png</icon>
<fanart>resources/img/kodi/fanart.jpg</fanart>
<banner>resources/img/kodi/banner.jpg</banner>
<clearlogo>resources/img/kodi/clearlogo.png</clearlogo>
<screenshot></screenshot>
</assets>
<news>0.9.7
- Vimeo Add-on is broken, play with Youtube-DL until it's fixed
0.9.6
- add display of official/unofficial count in main artist and country folders
- fix pager enumeration in main artist and country if Video Selection isn't set to show all videos
- don't list artists with known country also in Unknown
- add page counter for main artists, countries and sorted folders
- various other fixes and cleanups
0.9.5
- fix display of quotation marks in video lists - fix display of quotation marks in video lists
- add pagination for artists on main page and countries - add pagination for artists on main page and countries
- fix Musly (similar music) sort order and filter out dupes - fix Musly (similar music) sort order and filter out dupes

View file

@ -1,3 +1,11 @@
0.9.7
- Vimeo Add-on is broken, play with Youtube-DL until it's fixed
0.9.6
- add display of official/unofficial count in main artist and country folders
- fix pager enumeration in main artist and country if Video Selection isn't set to show all videos
- don't list artists with known country also in Unknown
- add page counter for main artists, countries and sorted folders
- various other fixes and cleanups
0.9.5 0.9.5
- fix display of quotation marks in video lists - fix display of quotation marks in video lists
- add pagination for artists on main page and countries - add pagination for artists on main page and countries

View file

@ -18,11 +18,12 @@ addon = xbmcaddon.Addon(id=addonID)
pluginhandle = int(sys.argv[1]) 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/img/kodi/noicon.png')
#fanart = os.path.join(addonDir, 'noicon.png') icon = os.path.join(addonDir, 'resources/img/kodi/icon.png')
# don't use special folder icons as long as there is'nt a nice icon for every style clearlogo = os.path.join(addonDir, 'resources/img/kodi/clearlogo.png')
fanart = 'DefaultFolder.png' fanart = os.path.join(addonDir, 'resources/img/kodi/fanart.png')
icon = os.path.join(addonDir, 'noicon.png') banner = os.path.join(addonDir, 'resources/img/kodi/banner.png')
poster = os.path.join(addonDir, 'resources/img/kodi/poster.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")
jsonArtists = xbmc.translatePath("special://profile/addon_data/" + addonID + "/artists.json") jsonArtists = xbmc.translatePath("special://profile/addon_data/" + addonID + "/artists.json")
@ -32,8 +33,14 @@ maxFileAge = maxFileAge * 60
mediatype = addon.getSetting("mediatype") mediatype = addon.getSetting("mediatype")
# show only official, fanmade or all videos? # show only official, fanmade or all videos?
videoselection = str(addon.getSetting("videoselection")).lower() videoselection = str(addon.getSetting("videoselection")).lower()
# despite this selection show all in similar playlists and more from? if videoselection != "2":
relatedselection = str(addon.getSetting("relatedselection")).lower() # videoselection is set to official or fanmade
# despite this selection show all in similar playlists and more from?
relatedselection = str(addon.getSetting("relatedselection")).lower()
else:
# if videoselection is set to show all videos relatedselection should
# also be true if the setting was set to false beforehand
relatedselection = "true"
playLocalFile = str(addon.getSetting("playLocalFile")).lower() playLocalFile = str(addon.getSetting("playLocalFile")).lower()
filesinlists = int(addon.getSetting("filesinlists")) filesinlists = int(addon.getSetting("filesinlists"))
useYTDL = addon.getSetting("useytdl") useYTDL = addon.getSetting("useytdl")
@ -248,9 +255,17 @@ def play(url):
ytdl = YDStreamExtractor.getVideoInfo(idVideo) ytdl = YDStreamExtractor.getVideoInfo(idVideo)
playback_url = ytdl.streamURL() playback_url = ytdl.streamURL()
else: else:
# without youtube_dl if "vimeo" in entry['provider']:
xbmc.log(msg="without ytdl", level=xbmc.LOGDEBUG) # quick hard coded workaround
playback_url = entry['url'] xbmc.log(msg="vimeo addon is broken, playing with ytdl", level=xbmc.LOGNOTICE)
import YDStreamExtractor
idVideo = entry['purl']
ytdl = YDStreamExtractor.getVideoInfo(idVideo)
playback_url = ytdl.streamURL()
else:
# without youtube_dl
xbmc.log(msg="without ytdl", level=xbmc.LOGDEBUG)
playback_url = entry['url']
item = xbmcgui.ListItem(path=playback_url) item = xbmcgui.ListItem(path=playback_url)
@ -265,6 +280,7 @@ def play(url):
# doesn't work # doesn't work
# item.setProperty('StartOffset', '56.4') # item.setProperty('StartOffset', '56.4')
# Bug? It maybe works with StartPercent, see https://forum.kodi.tv/showthread.php?tid=129188&pid=2443114#pid2443114
# item.setProperty("VolumeAmplification", "7") # item.setProperty("VolumeAmplification", "7")
# xbmc.log(msg=item.getProperty('VolumeAmplification'), level=xbmc.LOGNOTICE) # xbmc.log(msg=item.getProperty('VolumeAmplification'), level=xbmc.LOGNOTICE)
@ -502,12 +518,14 @@ def sortArtists(channel=""):
for artist in channels: for artist in channels:
if artist in [unidecode(name.upper()) for name in entry['artists']]: if artist in [unidecode(name.upper()) for name in entry['artists']]:
if entry not in result: if entry not in result:
if videoselection == "0": # limit selection based on videoselection setting if show all isn't activated
if "true" in entry['official'].lower(): if relatedselection != "true" and videoselection != "2":
result.append(entry) if videoselection == "0":
elif videoselection == "1": if "true" in entry['official'].lower():
if "false" in entry['official'].lower(): result.append(entry)
result.append(entry) elif videoselection == "1":
if "false" in entry['official'].lower():
result.append(entry)
else: else:
result.append(entry) result.append(entry)
# show artist # show artist
@ -539,21 +557,17 @@ def sortTitlesBy(limit, sort, start):
start = int(start) start = int(start)
end = start + filesinlists end = start + filesinlists
nextstart = end + 1 nextstart = end + 1
fanart = getFanart(channel) fanart = getFanart(channel)
# limit selection if "all" isn't activated in videoselection
if videoselection != "2" and channel != "related" and channel != "relartists":
data = limitselection(data)
# limit to hits # limit to hits
if hit != "" and hit == "true": if hit != "" and hit == "true":
for entry in data: for entry in data:
if entry['hit'] == "true": if entry['hit'] == "true":
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -562,14 +576,7 @@ def sortTitlesBy(limit, sort, start):
for entry in data: for entry in data:
# played often at provider # played often at provider
if int(entry['pcount']) >= pcounthigh: if int(entry['pcount']) >= pcounthigh:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -577,14 +584,7 @@ def sortTitlesBy(limit, sort, start):
if mycount != "" and mycount == "acount" and sort != "count": if mycount != "" and mycount == "acount" and sort != "count":
for entry in data: for entry in data:
if int(entry['acount']) >= acounthigh: if int(entry['acount']) >= acounthigh:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -592,14 +592,7 @@ def sortTitlesBy(limit, sort, start):
if mycount != "" and mycount == "comments" and sort != "count": if mycount != "" and mycount == "comments" and sort != "count":
for entry in data: for entry in data:
if int(entry['comments']) >= ccounthigh: if int(entry['comments']) >= ccounthigh:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -607,15 +600,7 @@ def sortTitlesBy(limit, sort, start):
if mycount != "" and mycount == "likes" and sort != "count": if mycount != "" and mycount == "likes" and sort != "count":
for entry in data: for entry in data:
if int(entry['likes']) >= likecounthigh: if int(entry['likes']) >= likecounthigh:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
# xbmc.log(msg=str(entry['pcount']), level=xbmc.LOGNOTICE)
data = result data = result
result = [] result = []
@ -623,14 +608,7 @@ def sortTitlesBy(limit, sort, start):
if mycount != "" and mycount == "dislikes" and sort != "count": if mycount != "" and mycount == "dislikes" and sort != "count":
for entry in data: for entry in data:
if int(entry['dislikes']) >= dislikecounthigh: if int(entry['dislikes']) >= dislikecounthigh:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -638,14 +616,7 @@ def sortTitlesBy(limit, sort, start):
if mycount != "" and mycount == "controversial": if mycount != "" and mycount == "controversial":
for entry in data: for entry in data:
if int(entry['controversial']) == int(1): if int(entry['controversial']) == int(1):
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
data = result data = result
result = [] result = []
@ -653,14 +624,7 @@ def sortTitlesBy(limit, sort, start):
if channel != "" and channel != "all" and channel != "year" and channel != "related": if channel != "" and channel != "all" and channel != "year" and channel != "related":
for entry in data: for entry in data:
if entry['style'] == channel: if entry['style'] == channel:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
# or limit to last year # or limit to last year
# hm, either style or year, not both? # hm, either style or year, not both?
elif channel != "" and channel == "year": elif channel != "" and channel == "year":
@ -674,14 +638,7 @@ def sortTitlesBy(limit, sort, start):
import time import time
dateadded = datetime.fromtimestamp(time.mktime(time.strptime(entry['dateadded'], '%Y-%m-%d %H:%M:%S'))) dateadded = datetime.fromtimestamp(time.mktime(time.strptime(entry['dateadded'], '%Y-%m-%d %H:%M:%S')))
if dateadded >= lastyear: if dateadded >= lastyear:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
# related tracks (generated with musly) # related tracks (generated with musly)
elif channel != "" and channel == "related": elif channel != "" and channel == "related":
start = str(start) start = str(start)
@ -692,7 +649,6 @@ def sortTitlesBy(limit, sort, start):
slugs.extend(entry['slug'].split(", ")) slugs.extend(entry['slug'].split(", "))
# and add all related slugs # and add all related slugs
slugs.extend(entry['related'].split(", ")) slugs.extend(entry['related'].split(", "))
#xbmc.log(msg=str(slugs), level=xbmc.LOGNOTICE)
for entry in data: for entry in data:
# add all related slugs # add all related slugs
if entry['slug'] in slugs: if entry['slug'] in slugs:
@ -701,15 +657,7 @@ def sortTitlesBy(limit, sort, start):
# main slug will be filtered out. # main slug will be filtered out.
# In this case we add it again later, after sorting the result # In this case we add it again later, after sorting the result
if not filter(lambda result: result['title'] == entry['title'], result): if not filter(lambda result: result['title'] == entry['title'], result):
if videoselection != "2" and relatedselection != "true": result.append(entry)
if videoselection == "0":
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
else:
result.append(entry)
# slugs are sorted newest first because that's how they occur in the json # slugs are sorted newest first because that's how they occur in the json
# so we have to sort the result to the order in related aka the musly order (with prepended main slug) # so we have to sort the result to the order in related aka the musly order (with prepended main slug)
order_dict = {slug: index for index, slug in enumerate(slugs)} order_dict = {slug: index for index, slug in enumerate(slugs)}
@ -722,6 +670,9 @@ def sortTitlesBy(limit, sort, start):
for entry in data: for entry in data:
if entry['slug'] == start: if entry['slug'] == start:
result.insert(0, entry) result.insert(0, entry)
if relatedselection != "true":
result = limitselection(result)
maximum = len(result) maximum = len(result)
# related is a list with max 21 entries, so we have to set start always to 0 # related is a list with max 21 entries, so we have to set start always to 0
start = 0 start = 0
@ -738,29 +689,17 @@ def sortTitlesBy(limit, sort, start):
xbmc.log(msg=str(artists), level=xbmc.LOGNOTICE) xbmc.log(msg=str(artists), level=xbmc.LOGNOTICE)
# add all entries with artist in artists # add all entries with artist in artists
if entry['artists'] in artists: if entry['artists'] in artists:
if videoselection != "2" and relatedselection != "true": result.append(entry)
if videoselection == "0": xbmc.log(msg=str(results), level=xbmc.LOGNOTICE)
if "true" in entry['official']: if relatedselection != "true":
result.append(entry) result = limitselection(result)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
else:
result.append(entry)
start = 0 start = 0
# unfiltered sorted lists (by date and by numbers. But NOT controversial, which is a fixed list) # sorted lists (by date and by numbers. But NOT controversial, which is a fixed list)
else: else:
for entry in data: for entry in data:
if videoselection == "0": result.append(entry)
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
if sort != "" and sort == "random": if sort != "" and sort == "random":
random.shuffle(result) random.shuffle(result)
result = result[:filesinlists] result = result[:filesinlists]
@ -777,10 +716,17 @@ def sortTitlesBy(limit, sort, start):
modus = channel modus = channel
else: else:
modus = 'all' modus = 'all'
# sort by negated count first and then by title in lexical order.
# If count would'nt be negated one had to use reverse=true if mycount != "" and mycount == "controversial":
# But then the second sorting, by title would be reversed also # controversial is either 0 or 1 so it does not makes sense to sort upon it
result = sorted(result, key = lambda i: (-1*float(i[mycount]), i['title'])) # instead sort videos considered controversial by dislikes
# change controversial in videos.json to a float?
result = sorted(result, key = lambda i: (-1*float(i['dislikes']), i['title']))
else:
# If count would'nt be negated one had to use reverse=true
# but then the second sorting, by title would be reversed also
# sort by negated count first and then by title in lexical order.
result = sorted(result, key = lambda i: (-1*float(i[mycount]), i['title']))
# itemgetter, should be faster (hm, but does'nt work: ValueError: could not convert string to float: pcount) # itemgetter, should be faster (hm, but does'nt work: ValueError: could not convert string to float: pcount)
# importing "operator" for implementing itemgetter # importing "operator" for implementing itemgetter
#from operator import itemgetter #from operator import itemgetter
@ -930,13 +876,26 @@ def getFanart(channel):
fanart = icon fanart = icon
return fanart return fanart
def limitselection(data):
xbmc.log(msg="limit by videoselection", level=xbmc.DEBUG)
result = []
for entry in data:
if videoselection == "0":
if "true" in entry['official']:
result.append(entry)
elif videoselection == "1":
if "false" in entry['official']:
result.append(entry)
elif videoselection == "2":
result.append(entry)
return result
def addDir(name, url, mode, iconimage, total=0): 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
# if (xbmcversion < 17): # if (xbmcversion < 17):
liz = xbmcgui.ListItem(name, iconImage=icon, thumbnailImage=iconimage) liz = xbmcgui.ListItem(name, thumbnailImage=iconimage)
# else: # else:
# With offscreen=true large lists (=folder) load much faster (needs >= krypton) # 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 :-) # But at the end, the differences are minimal in VIDFLTR, so just drop it :-)
@ -952,7 +911,12 @@ def addDir(name, url, mode, iconimage, total=0):
if iconimage: if iconimage:
liz.setProperty("fanart_image", iconimage) liz.setProperty("fanart_image", iconimage)
else: else:
liz.setProperty("fanart_image", defaultFanart) liz.setProperty("fanart_image", fanart)
if iconimage:
liz.setArt({ 'fanart' : iconimage })
else:
liz.setArt({ 'fanart' : fanart })
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, totalItems=total, isFolder=True) ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, totalItems=total, isFolder=True)
return ok return ok
@ -990,7 +954,7 @@ def addVideo(entry, mycount="playcount"):
if playLocalFile == "true": if playLocalFile == "true":
description = "Provider: " + entry['provider'] + "\nprovider playcount: " + entry['pcount'] + "\nlikes: " + entry['likes'] + "\ndislikes: " + entry['dislikes'] + "\ncomments: " + entry['comments'] description = "Provider: " + entry['provider'] + "\nprovider playcount: " + entry['pcount'] + "\nlikes: " + entry['likes'] + "\ndislikes: " + entry['dislikes'] + "\ncomments: " + entry['comments']
else: else:
description = "" description = "Provider: " + entry['provider'] + ""
if "false" in entry['official'].lower(): if "false" in entry['official'].lower():
description = ( description = (
"Unofficial Video by " + director + "\n" + description) "Unofficial Video by " + director + "\n" + description)

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
resources/img/kodi/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View file

@ -81,8 +81,8 @@ msgid "Hits, grouped by style"
msgstr "Hits, gruppiert nach Musikstil" msgstr "Hits, gruppiert nach Musikstil"
msgctxt "#30022" msgctxt "#30022"
msgid "Style (not genre)" msgid "Genre"
msgstr "Stil (nicht Genre)" msgstr "Genre"
msgctxt "#30025" msgctxt "#30025"
msgid "Artists" msgid "Artists"

View file

@ -81,7 +81,7 @@ msgid "Hits, grouped by style"
msgstr "" msgstr ""
msgctxt "#30022" msgctxt "#30022"
msgid "Style (not genre)" msgid "Genre"
msgstr "" msgstr ""
msgctxt "#30025" msgctxt "#30025"