New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library items like artists (db:contributor.name=...) favorites don't return the URL in the CLI #459
Comments
Would you get an error back or something? Anything in server.log? What LMS version? I don't see any code validating the URL. |
LMS version latest 7.9 you missunderstood me. < favorites items 0 100 with_url:1 |
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 |
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: 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 ;-) |
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:
|
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 ?
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... |
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); Would you mind giving this a try? |
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. I would be happy to get this fix also in 7.9, but i guess is to much to ask for. |
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? |
For most operations the id of the items is enough, but for storing them in the LMS favorite list or in the zone favorites it isn't as the LMS doesn't support our id schema and in zone favorites it's also not a good idea as those ids change when the DB is reindexed. The change introduces function which resolves the URL for the passed items. For some this is easy, but for artists/albums... we are using a LMS internal schema which is also understood by the LMS favorites. Retrieving the URLs from the favorite list is also crucial and until LMS-Community/slimserver#459 is fixed Storing Albums/Artist/... works fine, but restoring them from the zone favorites might not play the correct item.
I'm writing an integration into a smart home (loxone). |
It's probably more something for the spotty plugin, but i have a similar problem retrieving URLs from there, using the following query:
|
Please submit an issue in http://github.com/michaelherger/Spotty-Plugin/issues instead. |
The CLI provides an API for adding new entries to the favorites list. For all entries a URL and a Name needs to be provided.
Right now it's not possible to add an Artist or a complete Album to the favorites as no URL can be retrieved for those entries.
Adding Artists/Albums using the WebUI seems to work fine and results in entries with the following URL:
db:contributor.name=AC%20DC&libraryTracks.library=-1
If this is generic and can be done also from the CLI, it would be great if this convention is documented somwhere
The text was updated successfully, but these errors were encountered: