Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

copile with JS_HAS_FILE_OBJECT=1

Help
Anonymous
2013-01-25
2013-05-30

  • Anonymous
    2013-01-25

    I read somewhere that to enable to open files (java.io.File(fileName)), one have to compile mediatomb with JS_HAS_FILE_OBJECT=1

    what's the syntax ? setting this as a variable or on command line doesn't change the final file size, and this word is not found among the src files
    Is it possible or not implemented ?

     
  • Jin
    Jin
    2013-01-26

    File IO support has been removed from SpiderMonkey, just google for it, you'll hit a few posts about that.

     

  • Anonymous
    2013-02-09

    hello again :)

    i found absolutly nothing about that on the web, after weeks of searching
    i finally wandered on the jsapi irc at https://client00.chat.mibbit.com/?url=irc%3A%2F%2Firc.mozilla.org%2Fjsapi

    people here told me this :
    1) libjs do implement the read(file) command
    2) however it's not implemented either in libjs.so.1 as i test it : ReferenceError: read is not defined
    3) they told me that too :
    if you're not running the shell directly, the list of all available commands is dependent on the consumer managing the JS engine

    so, is that mediatomb that implement the available commands for libjs ?
    if so, and since read() is not implemented, why should i try to compile libjs with JS_HAS_FILE_OBJECT ?

    from my point of view, mediatomb without any readfile ability is useless since without it you cannot associate xml from MCM or whatever with the scanned movies.

    will you implement something to read files one day or another ?
    thanks

     
  • Jin
    Jin
    2013-02-09

    Well, if I had to implement read and file associated functions myself, then what exactly would that JS_HAS_FILE_OBJECT do? What's the difference to the other custom functions that we implemented for MediaTomb (i.e. the ones for adding virtual containers and so on)? That part is not quite clear to me.

    Now, next thing, did you read the documentation regarding playlists? This is an interface that allows you to read ASCII files line by line in your JS playlist parser, isn't that what you were looking for? The only thing you need to do is to make sure that you setup config.xml to recognize your "special" XML files as your custom playlists, so that they get fed to the playlist parser JS script which you then can adjust to do whatever you want to.

     

  • Anonymous
    2013-02-12

    exactly :) thanks for your time, again…

    well if the JS_HAS_FILE_OBJECT is the solution then… I just have to successfully compile libjs with JS_HAS_FILE_OBJECT=1, that I still (5 hours spend already) didn't manage to do.
    I changed my SDK to a fedora 16 VM toolchained for my NAS, which is even supported by rpmfusion !
    Result I still can't compile it correctly and the mozilla forums are non-existent, there is only the IRC but I still got to meet the right person to help me, and that's not that easy… but it's not the subject. almost, yet.

    next thing : yes i can read xml or nfo files with readln() from the playlist.js, then i just have to implement a JS xml parser, that will not be too difficult (nothing on the web about it, i searched so much already)

    however : the problem is how to link the nfo describing the movie to the movie obj
    Maybe with the movie filename (as for m3u), but i can't guess the extension from the file, and the movie filename is NOT inside the nfo file. that's my only one problem :
    how to link the xml and the movie file if I can't get the movie filename from the playlist file ?

    it seems to be a so little problem, but it's a very big issue, that cannot be resolved like that.

    to add an object (video or music or whatever) in the database the command you & I know it :

    addCdsObject(obj, createContainerChain(chain));
    

    with chain as the directory we can navigate with the TV remote.
    1) chain point to an media object : obj
    2) while reading an xml with playlist.js obj is ANOTHER object than the movie, it's the playlist object.
    3) to link the playlist content to the corresponding media (movie, music…) here is the function available :

    addPlaylistItem(location, title, playlistChain, order)
    

    ===> location is included for m3u playlists, as the documentation asks for (full path name), unfortunately it is not inside the xml file for movies.
    In fact, xml files for movies are generated by 3rd party softwares, sometimes shareware, sometimes freewares, but never open source. you _cannot _modify the generated xml to your needs.

    the only one thing I can do as an example, while I can't compile with JS_HAS_FILE_OBJECT, is running another personal script (shell) on my movies directory, that recursively modify afterward all the nfo files by adding an xml tag inside the nfo files, with the full path name of the corresponding movie… something like that…

    that's a long time trip, maybe solvable, but what a lot of trouble for a libjs compilation problem… everything starts from there.

    I don't even mention libjs don't include JS_HAS_FILE_OBJECT anymore with version 1.8.5 as you told me already, the only one version shipped with a configure file… older version I cannot compile them without it.

    I don't know what to think.
    mediatomb rely on a library that do not ship the necessary open file functions anymore, and in the other hand I can create a solution by myself, but that's a lot of scripts to run.

    the purpose of all these softwares are to facilitate your life but till now, I just spent hours for a little result lol

     
  • Jin
    Jin
    2013-02-12

    Can't you write a simple shell/perl/python script that would populate all your XML files with the file name of the video? I think you do not really need more than that to get the info into MediaTomb…

     

  • Anonymous
    2013-02-12

    lol i'll do that as soon as i abandon the possibility of compiling libjs-1.7.0 with JS_HAS_FILE_OBJECT , which will not be long…

     

  • Anonymous
    2013-02-12

    btw did you heard about a JS XML parser ? (i love to save my time)

     

  • Anonymous
    2013-02-14

    OKAYYYY i finaly made it to compile libjs with JS_HAS_FILE_OBJECT : version 1.8.0.rc1 !!

    http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz

    i give here the commands for those who would need it one day :

    i686:

    make -f Makefile.ref BUILD_OPT=1 JS_HAS_FILE_OBJECT=1 JS_THREADSAFE=1 DIST=/path/to/nspr
    

    x86_64:

     make -f Makefile.ref BUILD_OPT=1 JS_HAS_FILE_OBJECT=1 JS_THREADSAFE=1 DIST=/path/to/nspr LDFLAGS="-L/usr/lib64 -lm"
    

    then for reading a file from mediatomb here is an example :

    var file = new File("/full/path/to/file.txt");
    file.open("read", "text");
    output = file.readln();
    print("common.js : debug : file="+file.path);
    print("common.js : debug : file.readln="+output);
    file.close();
    
     

  • Anonymous
    2013-02-14

    i'll tell you more about JS_HAS_FILE_OBJECT, unless you find another way to open/modify files than using libjs :

    upon the detection of a played movie, you can update the NFO/XML tags "playcount" and "watched" (last watched date), thus can lead to a completely new vision of managing your media files in the future…

     
  • alex sayle
    alex sayle
    2013-02-28

    or you could ditch JS all together and use a python run time ;)

    https://github.com/crankcube/mediatomb