Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Internet in javascript

Loraderon
2008-07-09
2013-05-30
  • Loraderon
    Loraderon
    2008-07-09

    Hi guys, I've been trying to do some funky imdb-import scripting but I cannot use the XMLHttpRequest.

    Is it possible to add this functionality? Either by enabling the XMLHttpRequest or by adding a function something like readln that you have for playlists? Something like getResponse(url) that returns the entire body for the response.

    /Anders

     
    • Jin
      Jin
      2008-07-09

      Hi,

      the features offered by the js library seem limited in some regards (for example file operations were not supported, so we had to add the readln thing).

      Of course it is possible to add more server side functions, currently it is not planned.

      May I ask what you would like to do with this function?

      Kind regards,
      Jin

       
      • Loraderon
        Loraderon
        2008-07-10

        Hi,

        I would like to create a Sapphire-like virtual structure ( http://appletv.nanopi.net/37/movies-virtual-directory/ ) by looking at the filenames and matching them against IMDB. And then later on maybe also extending the TV Show import-script (http://mediatomb.cc/dokuwiki/scripting:scripting#parsing_of_file_names_for_tv_shows ) I created earlier.

        I think that these features would be great improvements for mediatomb.

        /Anders

         
    • Jin
      Jin
      2008-09-07

      You do realize that it would *significantly* slow down the import, which is already not very fast? :)

      Anyway, I do not think that the import script is a good place for stuff like that, I'd rather add another metadata handler that would contact imdb (or whatever service) to dl some info for the movie and populate the meta fields; the import js could then make use of that information.

       
      • Loraderon
        Loraderon
        2008-09-07

        Yes, I'm even using it on my WL 500gP :-)

        However, I don't mind the delay when importing since all I care about is the result and I don't have autoscan enabled.

        I do believe that this is the right place to put it because then people can create and share import-scripts that talks to different services (imdb, tvrage etc).
        Without the need for a new version of mediatomb when some of the services changes their api.

        /Anders

         
        • Loraderon
          Loraderon
          2008-11-04

          Gnnnh..

          I so want this feature. I would gladly create the scripts for scraping both imdb and tvrage.

          Pleeeaassseee?

           
    • Jin
      Jin
      2008-11-04

      If you so desperately want it - what's the problem with the playlist approach? I.e. custom scraping script outside of MT, creating a specific playlist with all meta descriptions, adapting the playlist.js to support your custom playlist format... the means to get the desired result are there :) And that's easier than convincing me to add http support in js :)

       
      • Loraderon
        Loraderon
        2008-11-05

        Thank you for this idea!

        I now have all my movies sorted by cast, genre, rating, year and the correct title.

        However, I cannot share this right now since it is tightly coupled to my setup at the moment.

        I do not really like this approach since I have to regenerate the playlist when adding videos (I do cache the results from imdb).

        Since I have failed with trying to convince you to add http support, is there a way to execute an external resource with parameters and get the result back in to the javascript?

        Thanks