Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582

    CLI command songinfo bug?

    HI,

    i'm facing a problem using cli command songinfo:

    when and only when a track is added via the 'browse music folder' menu AND as part of a cue sheet, songinfo reports just the url (with the relative position of the track) but not details.

    In the web page, album and genre are reported, but not artist.

    The same track, when added via the artist/album/track browse menues is reported with full details, as expected.
    Single files when added via the browse music folder are reported with full details, as expected.

    Is this a bug in cli songinfo?

    by the way, what I would like to archive is get artist, album, title and coverart url from the current playing track, is there some alternative?

    thanks, Marco.
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

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

    CLI command songinfo bug?

    > when and only when a track is added via the 'browse music folder' menu
    > AND as part of a cue sheet, songinfo reports just the url (with the
    > relative position of the track) but not details.


    What exact query are you using?

    --

    Michael

  3. #3
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582
    Quote Originally Posted by mherger View Post
    > when and only when a track is added via the 'browse music folder' menu
    > AND as part of a cue sheet, songinfo reports just the url (with the
    > relative position of the track) but not details.


    What exact query are you using?

    --

    Michael
    I'm using a library that compute the command and handle connection, but at the end the command line sent is this one:

    00:e0:4c:68:ce:78 songinfo 0 100 url:file:///media/musica1/Classica/Albinoni,%20Tomaso/Adagio,%20Cinque%20Concerti%20-%20I%20Solisti%20Veneti,%20Scimone,%20Paillard/Adagio%20-%20%20Cinque%20Concerti.wav#947.786666666667-1433.77333333333

    But i need some more investigation, in some case (as the one above) it returns all the informations as expected, in some others no:

    00:e0:4c:68:ce:78 songinfo 0 100 url:file:///media/musica1/Classica/Albinoni,%20Tomaso/12%20Concertos%20OP.%2010%20-%20I%20Solisti%20Veneti%3B%20Claudio%20Scimone%20( ERATO,%201981)/CD%201/12%20Concertos%20Op.%2010%20(CD%201)%20CD1.wav#727 .906666666667-924.8
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

  4. #4
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582
    Quote Originally Posted by marcoc1712 View Post
    I'm using a library that compute the command and handle connection, but at the end the command line sent is this one:

    00:e0:4c:68:ce:78 songinfo 0 100 url:file:///media/musica1/Classica/Albinoni,%20Tomaso/Adagio,%20Cinque%20Concerti%20-%20I%20Solisti%20Veneti,%20Scimone,%20Paillard/Adagio%20-%20%20Cinque%20Concerti.wav#947.786666666667-1433.77333333333

    But i need some more investigation, in some case (as the one above) it returns all the informations as expected, in some others no:

    00:e0:4c:68:ce:78 songinfo 0 100 url:file:///media/musica1/Classica/Albinoni,%20Tomaso/12%20Concertos%20OP.%2010%20-%20I%20Solisti%20Veneti%3B%20Claudio%20Scimone%20( ERATO,%201981)/CD%201/12%20Concertos%20Op.%2010%20(CD%201)%20CD1.wav#727 .906666666667-924.8
    Still investigating, seems to me that also the web page reflects the same difference, in the second case when I enque via the music folder browse i don't see band and composer.

    b.t.w there is a way to get song/album info (artist, composer, band) via HTTP, similar as we do for coverart? That will be the optimal solution for me.
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

  5. #5
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,872

    CLI command songinfo bug?

    > b.t.w there is a way to get song/album info (artist, composer, band)
    > via HTTP request (from javascript) and not cli? That will be the
    > optimal solution for me.


    You can do a POST request to /jsonrpc.js, with the following content:

    {{"id": 1,"method":"slim.request","params":["player
    MAC",["songinfo",0,99,"tags:abc"]}}

    The last part obviously can change. It's any command as documented in
    the CLI documentation.

    You can open your browser's dev tools and see how the LMS web UI is
    sending queries to the server.

    --

    Michael

  6. #6
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582
    Quote Originally Posted by mherger View Post
    > b.t.w there is a way to get song/album info (artist, composer, band)
    > via HTTP request (from javascript) and not cli? That will be the
    > optimal solution for me.


    You can do a POST request to /jsonrpc.js, with the following content:

    {{"id": 1,"method":"slim.request","params":["player
    MAC",["songinfo",0,99,"tags:abc"]}}

    The last part obviously can change. It's any command as documented in
    the CLI documentation.

    You can open your browser's dev tools and see how the LMS web UI is
    sending queries to the server.

    --

    Michael
    That's exactly wat I was looking for, many thanks.


    btw:


    first track:
    Code:
    {
    "method": "slim.request",
    "params": [
      "00:e0:4c:68:ce:78",
      [
      "songinfo",
      "0",
      99,
      "url:file:///media/musica1/Classica/Albinoni,%20Tomaso/Adagio,%20Cinque%20Concerti%20-%20I%20Solisti%20Veneti,%20Scimone,%20Paillard/Adagio%20-%20%20Cinque%20Concerti.wav#947.786666666667-1433.77333333333"
    ],
    ],
    "result": {
    "songinfo_loop": [
      {
    "id": 30451
    },
      {
    "title": "Concerto a 5 in do maggiore, Op. 5 no. 5: I.Allegro, II.Adagio, III.Allegro"
    },
      {
    "artist": "Tomaso Giovanni Albinoni"
    },
      {
    "coverid": "6e05d31c"
    },
      {
    "duration": 2866.367
    },
      {
    "album_id": "1853"
    },
      {
    "filesize": "505627212"
    },
      {
    "genre": "Classica"
    },
      {
    "coverart": "1"
    },
      {
    "artwork_track_id": "6e05d31c"
    },
      {
    "comment": "Generated by: Mymusic v. 1.2 beta TEMPLATE: Logitech SqueezeServer Scan::PlayList::CUE v. 7.5.0"
    },
      {
    "album": "Adagio: Orchestra da camera J. F. Paillard / Cinque Concerti: I Solisti Veneti"
    },
      {
    "modificationTime": "Wednesday 23 December 2009, 16:40"
    },
      {
    "type": "wav"
    },
      {
    "genre_id": "7"
    },
      {
    "bitrate": "1411kbps CBR"
    },
      {
    "artist_id": "2844"
    },
      {
    "tracknum": "3"
    },
      {
    "year": "0"
    },
      {
    "compilation": "0"
    },
      {
    "addedTime": "Monday 18 September 2017, 19:08"
    },
      {
    "dlna_profile": "LPCM"
    },
      {
    "channels": "2"
    },
      {
    "samplesize": "16"
    },
      {
    "playcount": "1"
    },
      {
    "samplerate": "44100"
    },
      {
    "lastUpdated": "Monday 4 December 2017, 12:52"
    }
    ],
    },
    "id": 1
    }
    second one:
    Code:
    {
    "id": 1,
    "params": [
      "00:e0:4c:68:ce:78",
      [
      "songinfo",
      "0",
      99,
      "url:file:///media/musica1/Classica/Albinoni,%20Tomaso/12%20Concertos%20OP.%2010%20-%20I%20Solisti%20Veneti%3B%20Claudio%20Scimone%20( ERATO,%201981)/CD%201/12%20Concertos%20Op.%2010%20(CD%201)%20CD1.wav#727 .906666666667-924.8"
    ],
    ],
    "result": {},
    "method": "slim.request"
    }
    Here what happens in the wab page:


    Name:  2017-12-05.jpg
Views: 54
Size:  146.6 KBName:  2017-12-05 (1).jpg
Views: 54
Size:  144.9 KBName:  2017-12-05 (2).jpg
Views: 54
Size:  135.4 KB

    As you could see in the last picture, when recalled from the artist browse the track is reported with all the details.
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

  7. #7
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582
    Quote Originally Posted by mherger View Post
    > b.t.w there is a way to get song/album info (artist, composer, band)
    > via HTTP request (from javascript) and not cli? That will be the
    > optimal solution for me.


    You can do a POST request to /jsonrpc.js, with the following content:

    {{"id": 1,"method":"slim.request","params":["player
    MAC",["songinfo",0,99,"tags:abc"]}}

    The last part obviously can change. It's any command as documented in
    the CLI documentation.

    You can open your browser's dev tools and see how the LMS web UI is
    sending queries to the server.

    --

    Michael
    Hi Michael,

    I'm able to run the commands and work very well and is much faster than the java lib i'm using, but... is not working with node.js (and in most of modern application supporting CORS, I suppose), where I get the error:

    Code:
    Failed to load http://192.168.1.101:9000/jsonrpc.js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
    For what I'm aware of, is becouse the server miss the Access-Control-Allow-Origin, enabling cross domain access. I thinlk I have no way to workaround this but is up to you to add that header to the response. In spring this is done by adding an annaotation like that:

    @CrossOrigin(origins = "*")

    don't know how to do it in PERL.

    Are you aware of any viable workaound or solution?

    Thanks, Marco.
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

  8. #8
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,872
    node.js run as a server cares about CORS? That would be news to me. I've worked with node.js accessing any kind of remote web service. IMHO it shouldn't suffer from CORS limitations.

    Code:
    const request = require('request');
    
    request.post(
    	{
    		url: 'http://localhost:9000/jsonrpc.js', 
    		form: JSON.stringify({id:1,method:'slim.request',params:['',['serverstatus',0,99]]})
    	},
    	function(err, httpResponse, body) {
    		console.log(body);
    	}
    )
    Working perfectly fine here.
    Michael

    http://www.herger.net/slim-plugins - Spotty, MusicArtistInfo

  9. #9
    Senior Member
    Join Date
    Dec 2009
    Location
    Albinea (Bologna Area) Italy
    Posts
    582
    Quote Originally Posted by mherger View Post
    node.js run as a server cares about CORS? That would be news to me. I've worked with node.js accessing any kind of remote web service. IMHO it shouldn't suffer from CORS limitations.

    Code:
    const request = require('request');
    
    request.post(
    	{
    		url: 'http://localhost:9000/jsonrpc.js', 
    		form: JSON.stringify({id:1,method:'slim.request',params:['',['serverstatus',0,99]]})
    	},
    	function(err, httpResponse, body) {
    		console.log(body);
    	}
    )
    Working perfectly fine here.

    Not working for me.

    In my application I'm using fetch, but I've installed request (nice piece of software) and tried, still not working for me.

    As before, in DevTools I could see the response with data, but both body and httpResponse are empty and err contains: "Failed to fetch". Note that the status in the header is 200 OK.

    Problem is that request origin is http://localhost:3000, when LMS server is located on a different machine, say 192.168.10.101:9000, this trigger the CORS problem, have you tried in a similar situation?

    If so, are you shure you did not disable CORS in your browser? This will work, but I s not a solution, I could not ask every user to do that.

    For me is not urgent, I've solved proxing the request via a spring server running beside (in the same domain of) the node.js server, is a suboptimal solution but it works.

    I think lms server should avoid this and allow access at least from inside the same local network or subnet.

    Please, let me know if I'm wrong and a better solution exists, I'm quite noob with JS.
    __________________________________________________ ______________________
    Author of C-3PO plugin, Squeezelite-R2, Falcon Web interface - See www.marcoc1712.it

  10. #10
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,872

    CLI command songinfo bug?

    > Problem is that request origin is http://localhost:3000, when LMS server
    > is located on a different machine, say 192.168.10.101:9000, this trigger
    > the CORS problem, have you tried in a similar situation?
    >
    > If so, are you shure you did not disable CORS in your browser? This


    You said you were running code in node.js, not in a browser. That's very
    different. In a browser, yes, I would expect it to fail.

    > For me is not urgent, I've solved proxing the request via a spring
    > server running beside (in the same domain of) the node.js server, is a
    > suboptimal solution but it works.


    ?!? why would you need spring if you were running node.js anyway?

    I think you should try to explain what exactly you want to achieve.
    Forget about the components you're running for a moment. Just tell us
    what you want to do.

    --

    Michael

Posting Permissions

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