Skip to content
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

How do I build the full plugin for testing? (v9 user defined roles) #41

Open
scbash opened this issue Dec 22, 2024 · 0 comments
Open

How do I build the full plugin for testing? (v9 user defined roles) #41

scbash opened this issue Dec 22, 2024 · 0 comments

Comments

@scbash
Copy link

scbash commented Dec 22, 2024

LMS Cast bridge has quickly become my most used method for listening to music from LMS. Thanks for a great plugin!

After updating LMS to 9.0.1 yesterday, I started experimenting with the new user defined artist roles -- I've historically tagged my music with a separate "DisplayArtist" field to have a human readable artist tag while the standard "Artist" tag is for library organization. I found that after defining a custom role in LMS, the v9 LMS CLI does return the user defined roles when prompted (A vs a), so this morning I hacked up a version of squeeze2cast using my specific role (patch below). Running it by hand works as expected.

I think a more usable form of this would be to add an "artist role" preference in the plugin web UI that defaults to "artist" but can be customized by the user to any of the known roles (and falls back to "artist" if the specified role isn't found in the metadata). I'm happy to keep working on this, but I haven't found documentation on how you build the full plugin? I'd like to at least simulate that locally to test installing the plugin and setting up the parameters myself. Any thoughts on that?

Thanks!

diff --git a/application/squeezelite/main.c b/application/squeezelite/main.c
index 3eef503..aecb345 100644
--- a/application/squeezelite/main.c
+++ b/application/squeezelite/main.c
@@ -342,7 +342,7 @@ uint32_t sq_get_metadata(sq_dev_handle_t handle, metadata_t *metadata, int token
        // use -1 to get what's playing
        if (token == -1) index = 0;
 
-       sprintf(cmd, "%s status - %d tags:xcfldatgrKNoITH", ctx->cli_id, index + 1);
+       sprintf(cmd, "%s status - %d tags:xcfldAtgrKNoITH", ctx->cli_id, index + 1);
        rsp = cli_send_cmd(cmd, false, false, ctx);
 
        if (!rsp || !*rsp) {
@@ -378,12 +378,20 @@ uint32_t sq_get_metadata(sq_dev_handle_t handle, metadata_t *metadata, int token
 
        if (cur) {
                metadata->title = cli_find_tag(cur, "title");
-               metadata->artist = cli_find_tag(cur, "artist");
                metadata->album = cli_find_tag(cur, "album");
                metadata->genre = cli_find_tag(cur, "genre");
                metadata->remote_title = cli_find_tag(cur, "remote_title");
                metadata->artwork = cli_find_tag(cur, "artwork_url");
 
+               // TODO: displayartist should be "artist role" preference set via web UI
+               if ((p = cli_find_tag(cur, "displayartist")) != NULL) {
+                       metadata->artist = p;
+                       LOG_INFO("[%p] found DisplayArtist! %s", ctx, metadata->artist);
+               } else {
+                       metadata->artist = cli_find_tag(cur, "artist");
+                       LOG_INFO("[%p] fell back to artist: %s", ctx, metadata->artist);
+               }
+
                if ((p = cli_find_tag(cur, "duration")) != NULL) {
                        /* when it's a repeating track, duration must hold the full block length while
                         * live_duration will hold the segment duration */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant