Kodi Community Forum
Files.GetDirectory please help me - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: Files.GetDirectory please help me (/showthread.php?tid=309231)



Files.GetDirectory please help me - isdito - 2017-03-10

Hello.

Any people could explain me why this give me error:

var url:String ='http://192.168.1.150:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": "directory": "home", "media": "files"}}'

Inside videos --> Files --> Movies (This is the path)

ERROR:

{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

I am new and I not find all the tree of jason to understand..

Sorry my bad english.


RE: Files.GetDirectory please help me - jonib - 2017-03-10

(2017-03-10, 02:01)isdito Wrote: var url:String ='http://192.168.1.150:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": "directory": "home", "media": "files"}}'
Try this:
Code:
var url:String ='http://192.168.1.150:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": {"directory": "home", "media": "files"}}}'

jonib


RE: Files.GetDirectory please help me - isdito - 2017-03-10

Hello jonib.

This not work for me, give me

ioErrorHandlerJeff: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://192.168.1.150:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": {"directory": "home", "media": "files"}}}" errorID=2032]


CODE ###########################################################################

import flash.net.*;
import flash.errors.IOError;
import flash.events.Event;
import flash.events.*;
import flash.net.*;
//DEVUELVE LAS LISTAS

var url:String ='http://192.168.1.150:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"properties": {"directory": "home", "media": "files"}}}'
trace (url);
var _request:URLRequest = new URLRequest(url);
_request.method = URLRequestMethod.GET;

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onComplete2);

loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.load(_request);

function onComplete (evt:Event):void {
trace(evt.target.data);
}
function onComplete2 (e:IOErrorEvent):void {
trace("VAMOS A VER QUE ERROR: " + e.toString());
}
####################################################################

What do you tink. Where is all the methods and all the properties. Thank you for all


RE: Files.GetDirectory please help me - isdito - 2017-03-10

Hello Ok I fixed.

var url:String ='http://192.168.1.150:8080/jsonrpc?request={"jsonrpc":"2.0","id":1,"method":"Files.GetDirectory","params":{"directory":"/home/osmc/Movies", "media":"video"}}'


It is necesary
1.- a id
2.- you must create a path of the video directory inside Kodi
3.- Capitalization be carefull
4.- Not put files put video in the type of media
5.- Also I put port 8080 free to the ip

This works in this moment.


RE: Files.GetDirectory please help me - Wimpie - 2017-03-11

Don't know if you need it, but "media = files" does work for me:

Code:
JSON_req = {"jsonrpc":"2.0",
                    "id":1,
                    "method":"Files.GetDirectory",
                    "params":{"directory":my_dir_unicode, "media":"files"}}
gives:

Code:
{u'id': 1,
u'jsonrpc': u'2.0',
u'result': {u'files': [{u'file': u'W:\\Everybody Wants Some!! (2016)\\Everybody Wants Some!! (2016).BluRay.strm',
                         u'filetype': u'file',
                         u'label': u'Everybody Wants Some!! (2016).BluRay.strm',
                         u'type': u'unknown'},
                        {u'file': u'W:\\Everybody Wants Some!! (2016)\\fanart.jpg',
                         u'filetype': u'file',
                         u'label': u'fanart.jpg',
                         u'type': u'unknown'},
                        {u'file': u'W:\\Everybody Wants Some!! (2016)\\movie.nfo',
                         u'filetype': u'file',
                         u'label': u'movie.nfo',
                         u'type': u'unknown'},
                        {u'file': u'W:\\Everybody Wants Some!! (2016)\\poster.jpg',
                         u'filetype': u'file',
                         u'label': u'poster.jpg',
                         u'type': u'unknown'},
                        {u'file': u'W:\\Everybody Wants Some!! (2016)\\BIUfiles\\',
                         u'filetype': u'directory',
                         u'label': u'BIUfiles',
                         u'type': u'unknown'}],
             u'limits': {u'end': 5, u'start': 0, u'total': 5}}}