How it works:
Copy the default web interface from the global kodi addons folder to your user addon folders, modify addon.xml.
Modify index.html,
add to the body tag onload="favid=0;" just to be sure that javascript won't cry.
make some div or span onclick="favid=gotofav(favurl,favid+1);"
or any favorite ID you wish :-)
or do it in jQuery if you desire so, i currently can't be bothered researching howto.
Modify xbmc.launcher.js to include a new js file with this contents:
favurl='jsonrpc?request={"jsonrpc":"2.0", "method":"Favourites.GetFavourites", "params": { "properties": ["window","path","thumbnail","windowparameter"] }, "id": 1 }';
favid=0;
function gotofav(favurl){
$.getJSON(favurl, function( data ) {
var items = [];
$.each( data, function( ke, va ) {
$.each( va, function( key, vall ) {
if (key=='favourites'){
if (favid < 1){
favid=vall.length;
}
//}
if (favid >vall.length){ favid=0;}
$.each( vall, function( keyz, valz ) {
if (favid==keyz){
if (valz['type'] == 'media'){
xbmc.rpc.request({
'context': this,
'method': 'Player.Open',
'id': '1',
'params': {
'item': {
'file': valz['path']
}
}});
}
if (valz['type'] == 'window'){
xbmc.rpc.request({
'context': this,
'method': 'GUI.ActivateWindow',
'id': '1',
'params': {
"window": "videos",
"parameters": [valz['windowparameter']]
}});
}
if (valz['type'] == 'script'){
//alert(valz.toSource());
xbmc.rpc.request({
'context': this,
'method': 'Addons.ExecuteAddon',
"wait": false,
'id': '1',
'params': {
'addonid': valz['path']
}
});
}
}
// }
});
}
});
});
});
return favid;
}
It's not as pretty as can be, but it works great :-).
Geen opmerkingen:
Een reactie posten