How to get the path to the file from the listitem, where is this possible?
#1
Tried to do with this variant:
pyrhon:

def getPath(li):
    def getFilePath(method, name, id):
        params = {'properties': ['file']}
        data = {'jsonrpc': '2.0', 'params': params, 'id': '1'}
        data['method'] = method
        params[name + 'id'] = id
        deserialization = json.loads(xbmc.executeJSONRPC(json.dumps(data)))
        return deserialization['result'][name + 'details']['file']

    content = xbmc.getInfoLabel('Container.Content')

    if content == "movies":
        path = getFilePath('VideoLibrary.GetMovieDetails', 'movie', li.getVideoInfoTag().getDbId())
    elif content == "episodes":
        path = getFilePath('VideoLibrary.GetEpisodeDetails', 'episode', li.getVideoInfoTag().getDbId())
    elif content == "songs":
        path = getFilePath('AudioLibrary.GetSongDetails', 'song', li.getMusicInfoTag().getDbId())
    else:
        path = li.getPath().decode('UTF-8')
    return path

But is there really no simpler way?
Reply
#2
Those didn't work for you?
python:
sys.listitem.getVideoInfoTag().getPath()
or
python:
xbmc.getInfoLabel('ListItem.Path')
Reply
#3
If only it were that simple!

xbmc.getInfoLabel ('ListItem.Path') - does not always process the needed item if the listitem is obtained by clicking on the context menu.
Reply
#4
(2019-09-15, 09:39)FreakMurderer Wrote: If only it were that simple!

xbmc.getInfoLabel ('ListItem.Path') - does not always process the needed item if the listitem is obtained by clicking on the context menu.

You are correct and that's why I suggested 2 different ways, from context menu I usually this one;
python:
sys.listitem.getVideoInfoTag().getPath()
which should work in addons and library, skin.shortcuts created widgets is a different story.
Reply
#5
sys.listitem.getVideoInfoTag().getPath()
ALSO DONT WORK, OMG!
Reply

Logout Mark Read Team Forum Stats Members Help
How to get the path to the file from the listitem, where is this possible?0