how do I use the JSON wiki?
#1
For example, I use this bit to get the folders inside of a directory:

json:
json_season = JSON_req = {"jsonrpc":"2.0",
    "id":1,
    "method":"Files.GetDirectory",
    "params":{"directory":path/to/directory, "media":"files"}}

but how do I get to the files INSIDE of the folder? I need the full paths of each file in the folder.

I tried to look it up in the wiki but it's not clear to me. 

I appreciate some help.

Thanks a lot!
Reply
#2
you need the properties parameters


json:
json_season = JSON_req = {"jsonrpc":"2.0",
    "id":1,
    "method":"Files.GetDirectory",
    "params":{"directory":path/to/directory,
                     "media":"files",
                     "properties": ['file']}}
Reply
#3
Thank you so much! This indeed works for local files.

However if I define xbmc.getInfoLabel('ListItem.FileNameAndPath') as directory path it doesn't work. What can I do?
Reply
#4
i don't fully comprehend, you are using xbmc.getInfoLabel('ListItem.FileNameAndPath') for '"directory":path/to/directory'?

output that string to the debug log and check it's value, it may not be set the way your think it is - there also may be other factors such as missing an ending / or some such which would be in the log

------

if you are calling your addon and performing an action on the current listitem (as in from a context menu) there is an easier way

python:
import sys
path=sys.listitem.getPath()
Reply
#5
(2023-07-31, 20:36)jepsizofye Wrote: i don't fully comprehend, you are using xbmc.getInfoLabel('ListItem.FileNameAndPath') for '"directory":path/to/directory'?

output that string to the debug log and check it's value, it may not be set the way your think it is - there also may be other factors such as missing an ending / or some such which would be in the log

------

if you are calling your addon and performing an action on the current listitem (as in from a context menu) there is an easier way

python:
import sys
path=sys.listitem.getPath()
Thank you, I'll play around with it. Somehow I get an "module 'sys' has no attribute 'listitem'" though ...
Reply
#6
kodi sets listitem to sys if the addon was being called as a context menu item so i guess you are not calling your addon in this way

post more than a couple function calls so i can understand what you are doing
Reply
#7
(2023-07-31, 23:50)jepsizofye Wrote: kodi sets listitem to sys if the addon was being called as a context menu item so i guess you are not calling your addon in this way

post more than a couple function calls so i can understand what you are doing

This will be a bit off-topic...

I've just sent you a PM. Thank you very much!
Reply
#8
give me a bit ill have a look
Reply
#9
replied in pm but for everyone else -


the case is iteration, a list of episodes is wanted from a parent "Show"

solution is to list contents of "Show" path then iterate it's returned file results if they are a directory (season folder containing the episodes) in order to get the path that kodi can then play (plugin//plugin.video/season/ep/1)
Reply

Logout Mark Read Team Forum Stats Members Help
how do I use the JSON wiki?0