You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library items like artists (db:contributor.name=...) favorites don't return the URL in the CLI #459
you missunderstood me.
I'm not sure on how it is supposed to work. For artitsts/albums/genres there is no URL. So what am i supposed to use as URL to make this work ?
I also noticed that for all favorites which are artists/albums/genres... or also playlists i can't retrieve a URL from the CLI using
It would be good to show what exact queries you're using, what you expect them to do, and what you actually get. I still don't understand what you're trying to do.
The parameter to get URLs is called want_url, not with_url.
It would be good to show what exact queries you're using, what you expect them to do, and what you actually get. I still don't understand what you're trying to do.
The problem can be split into two parts. First storing an artist as favorite and then retrieving it from the list of favorites again:
I'm requesting a list of artists:
<<< artists 0 100 tags:u
The response looks like this:
<<< artists 0 100 tags%3Au id%3A232 artist%3A01 id%3A250 artist%3A28 id%3A251 artist%3A3%20Doors%20Down ...
Now the question is how can i store one of the artists in favorites. I tried to use the u (url) tag, but artists don't have a url (which makes sense).
Doing the same using the webui, shows that its possible to store artists in favorites.
Retrieving this stored artist:
<<< favorites items 0 100 want_url:1
The response for the same artist like above is this:
Also those items don't have a url, which is ok, but i have a hard time to identify that this favorite item is an artist and there is also no artist_id, which i could use for example to retrieve more information about the artist.
The parameter to get URLs is called want_url, not with_url.
yeah, sorry i just posted it wrong in the comment, my code is using it correctly ;-)
Now the question is how can i store one of the artists in favorites. I tried to use the u (url) tag, but artists don't have a url (which makes sense).
Ok, I see. Yes, there's no URL provided for artists. But what you posted in your initial comment shows how they are created:
db:contributor.name=AC%20DC
That's a LMS custom schema which says: this is a db query, give me contributors with name "AC DC". I believe the decision to do it this way was taken because IDs change between scans. So this will not be a 1:1 mapping. This URL will create a search and can potentially return multiple artists.
What you need to do is to create the "URL" by appending the URL escaped name to the db prefix. There are various prefixes available:
That tells me that this favorite doesn't have an url, is not a folder, but has items and using the image i could guess that this is an artist, but is this how it supposed to work, or is there a tag which gives me more information about the type e.g. that this is an artist ? and maybe also which artist. I know that i could use the name, but this is something the user could change and then it doesn't work anymore, while the webui still works, as it can use the internally stored url which i cannot retrieve from the CLI ?
Ok, we're getting closer... so the problem is not storing the favorite, but retrieving it. That looks like an actual bug. I'm always surprised when something basic like this turns out to be broken after years of use...
changed the title [-]Adding non-playable items to favorites using the CLI is not possible[/-][+]Library items like artists (db:contributor.name=...) favorites don't return the URL in the CLI[/+]on Nov 20, 2020
Using db:contributor.name as an url is a little bit unexpected and nothing i found in the documentation either, but atleast this part seems to work fine and i'm happy to use that ;-)
Could you even use this in your application? It's very LMS specific...
Here's my dilemma: I have a fix. But I wanted to release LMS 8.0.0 next week. And I'm not sure this fix is safe to include it in 8.0.0. But you can handle code? Here's the patch:
diff --git a/Slim/Plugin/Favorites/OpmlFavorites.pm b/Slim/Plugin/Favorites/OpmlFavorites.pm
index 78e82c250..d799c3a6b 100644
--- a/Slim/Plugin/Favorites/OpmlFavorites.pm+++ b/Slim/Plugin/Favorites/OpmlFavorites.pm@@ -180,11 +180,12 @@ sub _loadOldFavorites {
sub xmlbrowser {
my $class = shift;
+ my $dontBrowseDb = shift;
my $hash = $class->SUPER::xmlbrowser;
# optionally let the user browse into local favorite items
- if ( !$prefs->get('dont_browsedb')) {+ if ( !$prefs->get('dont_browsedb') && !$dontBrowseDb ) {
$class->_prepareDbItems($hash->{'items'});
}
diff --git a/Slim/Plugin/Favorites/Plugin.pm b/Slim/Plugin/Favorites/Plugin.pm
index 0d7720d22..7469a061f 100644
--- a/Slim/Plugin/Favorites/Plugin.pm+++ b/Slim/Plugin/Favorites/Plugin.pm@@ -749,7 +749,7 @@ sub cliBrowse {
return;
}
- my $feed = Slim::Plugin::Favorites::OpmlFavorites->new($client)->xmlbrowser;+ my $feed = Slim::Plugin::Favorites::OpmlFavorites->new($client)->xmlbrowser($request->getParam('menu') ? undef : 1);
if (my $search = $request->getParam('search')) {
my $filteredItems = _search($feed->{items}, $search);
I can see your dilemma. I guess i could a apply a workaround in my code using the name, but i would prefer having this fix. Asking the users of my app to apply this fix is not a good idea, so i guess i have to wait until this fix is released.
If you don't fix it in 8.0.0 do you have an idea when 8.0.1 would be released which could contain this fix ?
I would be happy to get this fix also in 7.9, but i guess is to much to ask for.
Activity
mherger commentedon Nov 20, 2020
Would you get an error back or something? Anything in server.log? What LMS version?
I don't see any code validating the URL.
Gagi2k commentedon Nov 20, 2020
LMS version latest 7.9
you missunderstood me.
I'm not sure on how it is supposed to work. For artitsts/albums/genres there is no URL. So what am i supposed to use as URL to make this work ?
I also noticed that for all favorites which are artists/albums/genres... or also playlists i can't retrieve a URL from the CLI using
< favorites items 0 100 with_url:1
michaelherger commentedon Nov 20, 2020
It would be good to show what exact queries you're using, what you expect them to do, and what you actually get. I still don't understand what you're trying to do.
The parameter to get URLs is called
want_url, notwith_url.Gagi2k commentedon Nov 20, 2020
The problem can be split into two parts. First storing an artist as favorite and then retrieving it from the list of favorites again:
<<< artists 0 100 tags:u
The response looks like this:
<<< artists 0 100 tags%3Au id%3A232 artist%3A01 id%3A250 artist%3A28 id%3A251 artist%3A3%20Doors%20Down ...
Now the question is how can i store one of the artists in favorites. I tried to use the u (url) tag, but artists don't have a url (which makes sense).
Doing the same using the webui, shows that its possible to store artists in favorites.
<<< favorites items 0 100 want_url:1
The response for the same artist like above is this:
<<< id%3A10 name%3A30%20Seconds%20to%20Mars type%3Aplaylist image%3Ahtml%2Fimages%2Fartists.png isaudio%3A1 hasitems%3A1
Also those items don't have a url, which is ok, but i have a hard time to identify that this favorite item is an artist and there is also no artist_id, which i could use for example to retrieve more information about the artist.
yeah, sorry i just posted it wrong in the comment, my code is using it correctly ;-)
mherger commentedon Nov 20, 2020
Ok, I see. Yes, there's no URL provided for artists. But what you posted in your initial comment shows how they are created:
That's a LMS custom schema which says: this is a db query, give me contributors with name "AC DC". I believe the decision to do it this way was taken because IDs change between scans. So this will not be a 1:1 mapping. This URL will create a search and can potentially return multiple artists.
What you need to do is to create the "URL" by appending the URL escaped name to the db prefix. There are various prefixes available:
Gagi2k commentedon Nov 20, 2020
ok, i can try to do this for saving the favorite, but is there a smart way to retrieve this information again from the favorite list ?
id%3A10 name%3A30%20Seconds%20to%20Mars type%3Aplaylist image%3Ahtml%2Fimages%2Fartists.png isaudio%3A1 hasitems%3A1That tells me that this favorite doesn't have an url, is not a folder, but has items and using the image i could guess that this is an artist, but is this how it supposed to work, or is there a tag which gives me more information about the type e.g. that this is an artist ? and maybe also which artist. I know that i could use the name, but this is something the user could change and then it doesn't work anymore, while the webui still works, as it can use the internally stored url which i cannot retrieve from the CLI ?
mherger commentedon Nov 20, 2020
Ok, we're getting closer... so the problem is not storing the favorite, but retrieving it. That looks like an actual bug. I'm always surprised when something basic like this turns out to be broken after years of use...
[-]Adding non-playable items to favorites using the CLI is not possible[/-][+]Library items like artists (db:contributor.name=...) favorites don't return the URL in the CLI[/+]Gagi2k commentedon Nov 20, 2020
Using db:contributor.name as an url is a little bit unexpected and nothing i found in the documentation either, but atleast this part seems to work fine and i'm happy to use that ;-)
mherger commentedon Nov 20, 2020
Could you even use this in your application? It's very LMS specific...
Here's my dilemma: I have a fix. But I wanted to release LMS 8.0.0 next week. And I'm not sure this fix is safe to include it in 8.0.0. But you can handle code? Here's the patch:
Would you mind giving this a try?
Gagi2k commentedon Nov 20, 2020
Hi,
thx a lot. works good for me on 7.9.
I can see your dilemma. I guess i could a apply a workaround in my code using the name, but i would prefer having this fix. Asking the users of my app to apply this fix is not a good idea, so i guess i have to wait until this fix is released.
If you don't fix it in 8.0.0 do you have an idea when 8.0.1 would be released which could contain this fix ?
I would be happy to get this fix also in 7.9, but i guess is to much to ask for.
michaelherger commentedon Nov 20, 2020
I plan to have 8.0.1 (bugfixes only) and 8.1.0 (next feature release) start to be built the same day. And I'll stop any 7.x builds.
What kind of application is it you're working on?
lms: Fix saving the correct URL in (zone)favorites
Gagi2k commentedon Nov 21, 2020
I'm writing an integration into a smart home (loxone).
Gagi2k commentedon Nov 21, 2020
It's probably more something for the spotty plugin, but i have a similar problem retrieving URLs from there, using the following query:
spotty items 0 100 want_url:1 item_id:1.0mherger commentedon Nov 22, 2020
Please submit an issue in http://github.com/michaelherger/Spotty-Plugin/issues instead.