Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1

    Basic question - how to send a playlist from javascript to LMS

    Hi,

    I have set up on the server in which I store my music collection, and on which I have LMS, a static website to browse through my collection and add information (notes, credits...). In my html pages, I have for each album the list of tracks with the corresponding local file path. I would like to know if there is a simple way (I am a beginner) to send the filenames as URL to LMS to play them (replacing the current playlist with the list of URLs). The files will of course be available to LMS as the LMS library points to the same folder on the server.

    I have worked with the CLI Interface and understand what it can do, but have absoluetly no idea as to how I can communicate with LMS from HTML/Javascript. I want to do something as simple as possible. I will have the address of the LMS server stored in a file (using front matter in a static page) as well as the list of players.

    Any help would be greatly appreciated !
    Last edited by hopkins; 2019-02-25 at 13:50.

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,294

    Basic question - how to send a playlist fromjavascript to LMS

    > I have worked with the CLI Interface and understand what it can do, but
    > have absoluetly no idea as to how I can communicate with LMS from
    > HTML/Javascript.


    You can use the same commands as in the CLI. But instead of sending them
    over telnet, you'd send them to /jsonrpc.js as JSON data. Open your
    browser's dev tools and see what happens if you eg. paste a file's URL
    in the "Tune In" box and submit it.

    --

    Michael

  3. #3
    Quote Originally Posted by mherger View Post
    > I have worked with the CLI Interface and understand what it can do, but
    > have absoluetly no idea as to how I can communicate with LMS from
    > HTML/Javascript.


    You can use the same commands as in the CLI. But instead of sending them
    over telnet, you'd send them to /jsonrpc.js as JSON data. Open your
    browser's dev tools and see what happens if you eg. paste a file's URL
    in the "Tune In" box and submit it.

    --

    Michael
    Sorry for the stupid question, but what is the "Tune In" box ?

  4. #4
    There are a few tricks, like the CORS setting on the server to avoid blocking the requests, and understanding how to define the json request based on the parameters.

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    1,708
    Quote Originally Posted by hopkins View Post
    Sorry for the stupid question, but what is the "Tune In" box ?
    On the regular LMS web interface - under Radio - the last item (typically) is
    Tune In URL
    http://pitouch.lan:9000/tunein.html?...bb:cc:dd:ee:ff
    Paul Webster
    http://dabdig.blogspot.com
    Author Radio France (FIP etc) plugin

  6. #6
    Quote Originally Posted by Paul Webster View Post
    On the regular LMS web interface - under Radio - the last item (typically) is
    Tune In URL
    http://pitouch.lan:9000/tunein.html?...bb:cc:dd:ee:ff
    Thanks, I actually found some threads with explanations and can now play the files I have on my website !
    Last edited by hopkins; 2019-02-26 at 14:55.

  7. #7
    Junior Member
    Join Date
    May 2019
    Posts
    1

    Cors Setting

    Quote Originally Posted by hopkins View Post
    There are a few tricks, like the CORS setting on the server to avoid blocking the requests, and understanding how to define the json request based on the parameters.
    Can someone point me in the direction of where the CORS setting is as for the life of me trying I cannot find it

    Thanks

  8. #8
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,158
    Goto Settings -> Advanced Tab -> Then select Security in the drop down list.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •