Big thanks for this great plugins.
My favourite
is the Video Favourites addon, because of the direct links.
I added the "add favourite" feature, which was commented out. But it might be a little dirty.
I cut of the not needed parts of the kodi favourites.xml with a new function.
line 395-402 (undo commenting)
python:
'''
items.append(
{
'label': "Favourites",
'path': plugin.url_for('add_favourites',path=path),
'thumbnail':get_icon_path('favourites'),
})
line 204-230 (its from your simple favourites with a small new function (see below))
python:
@plugin.route('/add_favourites/<path>')
def add_favourites(path):
items =
kodi_favourites = "special://profile/favourites.xml"
output_file = "%sfavourites.xml" % path
f = xbmcvfs.File(kodi_favourites,"rb")
data = f.read()
favourites = re.findall("<favourite.*?</favourite>",data)
for fav in favourites:
url = ''
match = re.search('>(.*?)<',fav)
if match:
url = match.group(1)
label = ''
match = re.search('name="(.*?)"',fav)
if match:
label = match.group(1)
thumbnail = get_icon_path('unknown')
match = re.search('thumb="(.*?)"',fav)
if match:
thumbnail = match.group(1)
if url:
context_items =
context_items.append(("[COLOR yellow]%s[/COLOR] " % 'Add', 'XBMC.RunPlugin(%s)' % (plugin.url_for(add_favourite, favourites_file=output_file, name=label, url=transform(url), thumbnail=thumbnail, filetype="unknown"))))
item = {
'label': unescape(label),
'path': url,#plugin.url_for('execute',url=unescape(url)),
'thumbnail':unescape(thumbnail),
'context_menu': context_items,
}
items.append(item)
return items
line 45 (new function "transform")
python:
def transform( str ):
str = str.replace("ActivateWindow(10025,"", "")
str = str.replace("amp;", "")
str = str.replace("",return)", "")
return str
I hope this was understandable.
I tested it a while and it works so far.
Greetings