Files.GetDirectory Question
#1
Hello everyone, I'm trying to load the files in the root system directory (of an XBMC running on OS X) using the following command:

{"jsonrpc":"2.0","id":1,"method":"Files.GetDirectory","params":{"directory":"/","media":"files","sort":{"method":"file"},"properties":["file","size","title","thumbnail"]}}

The command works fine in Frodo, but seems to crash XBMC Gotham (13.0-ALPHA12) every time. I'm not sure if this is a bug or if the syntax has been changed for this command?

I tried examining the debug logs, but they only show receipt of the JSON command, then nothing further:

Quote:10:26:07 T:4656709632 DEBUG: JSONRPC: Incoming request: {"jsonrpc":"2.0","id":1,"method":"Files.GetDirectory","params":{"directory":"/","media":"files","sort":{"method":"file"},"properties":["file","size","title","thumbnail"]}}

I also have the crash dump if that helps:

EDIT: please upload logs to pastebin or xbmclogs.com and do not paste them in forum !
http://pastebin.com/raw.php?i=2BSdmRqH
Reply
#2
Thanks for the report. I think I have found the problem and will provide a fix ASAP.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Thanks for the quick response. If you need anything else just let me know!
Reply
#4
I have already made PR4321 which should fix this problem.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
Hello, i have a related question about "Files.GetDirectory". I'm trying to recieve files, located in "files" table in MyVideos78.db. Wiki says that it should "Get the directories and files in the given directory". For exaple i'm trying:

Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": ["title", "file", "playcount", "lastplayed"], "directory":"plugin://plugin.video.youtube/", "media":"files"}, "id": "watched_items"}')

Than it returns only directories, no files, whereas the table in db file also contains watched items like plugin://plugin.video.youtube/?[params] (what i did verify):

Quote:{
"jsonrpc": "2.0",
"id": "watched_items",
"result": {
"files": [
{
"filetype": "directory",
"title": "",
"type": "unknown",
"file": "plugin://plugin.video.youtube/?path=/root/explore&login=false&",
"label": "Explore YouTube"
},
{
"filetype": "directory",
"title": "",
"type": "unknown",
"file": "B:\\Video\\incoming\\",
"label": "My Downloads"
},
{
"filetype": "directory",
"title": "",
"type": "unknown",
"file": "plugin://plugin.video.youtube/?path=/root/search&login=false&folder=true&store=searches&",
"label": "Search"
},
{
"filetype": "directory",
"title": "",
"type": "unknown",
"file": "plugin://plugin.video.youtube/?path=/root/login&action=settings&",
"label": "Login.."
}
],
"limits": {
"start": 0,
"total": 4,
"end": 4
}
}
}

What i do wrong? And is exists any possibility to retrieve these items? I'am a beginner on json-rpc, than sorry for beginner question
Reply
#6
Files.GetDirectory doesn't look into the database. In your case it starts the youtube plugin and asks it for the items (files and/or directories) in the path you provided. It should result in the same list of items that you see in the user interface when browsing to that location (in your case the root) in the youtube plugin.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
Thank you for clear explanation. Do realize that Files.GetDirectory is no related to db. Will be grateful if somebody explain or point to a link explained how to access the items in "files" table.
Reply
#8
There is no direct access to items in the "files" table. You can only retrieve specific media items (movies, musicvideos, episodes ...) and get their "file" property. But that way you won't get access to plugin items etc stored in the "files" table.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#9
(2014-03-04, 22:19)Montellese Wrote: I have already made PR4321 which should fix this problem.

Testing in 13.0-beta2 resolves the crash, but yields the following response:

Code:
error = {
    code = "-32602";
    message = "Invalid params.";
};

The following message is present in the log at the time of the request:

Code:
DEBUG: CUtil::GetMatchingSource: no matching source found for [/]

Is there some configuration change I need to make to allow this behavior in Gotham?
Reply
#10
You have to have "/" as a source defined in your library otherwise you can't access it through Files.GetDirectory.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#11
(2014-03-27, 21:16)Montellese Wrote: You have to have "/" as a source defined in your library otherwise you can't access it through Files.GetDirectory.

I just wanted to confirm that this is the intended behavior? Frodo required no such configuration, and allowed full browsing out of the box (/ returned the Unix root or the boot drive on Windows, with all other drive letters fully accessible).

There doesn't seem to be any way to configure the "/" source on the Windows version (thus removing that feature). Must each drive letter be added manually going forward?
Reply
#12
This has been added as a security measure because we shouldn't allow access to directories/files like /etc/passwd et al. by default through our API.

Have you tried manually typing in "/" (instead of using the "Browse" button) as a source path in XBMC on Windows?
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#13
(2014-03-28, 09:16)Montellese Wrote: This has been added as a security measure because we shouldn't allow access to directories/files like /etc/passwd et al. by default through our API.

Have you tried manually typing in "/" (instead of using the "Browse" button) as a source path in XBMC on Windows?

I did try entering "/". With Frodo this works as expected, but with Gotham (13.0-beta2) I get the following error when adding:

Quote:Unable to connect

Quote:Could not retrieve directory information.
This could be due to the network not being connected.
Would you like to add it anyway?

If I force the addition, the entry shows up with the same size listed as for Frodo, but when I attempt to access "/" via Files.GetDirectory the following error is returned:

Quote:error = {
code = "-32602";
message = "Invalid params.";
};

The following line is present in the log at the attempted time of access:

Quote:ERROR: XFILE::CDirectory::GetDirectory - Error getting /
Reply

Logout Mark Read Team Forum Stats Members Help
Files.GetDirectory Question0