Skip to content

Instantly share code, notes, and snippets.

@spikeh
Last active January 2, 2019 12:36
Show Gist options
  • Save spikeh/df8f7b190ac461ffa7299bbd8b29f991 to your computer and use it in GitHub Desktop.
Save spikeh/df8f7b190ac461ffa7299bbd8b29f991 to your computer and use it in GitHub Desktop.
Custom last.fm plugin for deadbeef that scrobbles album artist if the artist field contains "feat." or "featuring". Useful for those that use MusicBrainz.
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 5d0a008ca..5b8c99627 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -479,6 +479,11 @@ lfm_format_uri (int subm, DB_playItem_t *song, char *out, int outl, time_t start
return -1;
}
+ char *feat = NULL;
+ if ((feat = strstr(a, " feat.")) || (feat = strstr(a, " featuring")) || (feat = strstr(a, " ft."))) {
+ *feat = '\0';
+ }
+
if (lfm_add_keyvalue_uri_encoded (&out, &outl, ka, a) < 0) {
// trace ("failed to add %s=%s\n", ka, a);
return -1;
@@ -905,7 +910,7 @@ static DB_misc_t plugin = {
.plugin.version_minor = 0,
.plugin.type = DB_PLUGIN_MISC,
// .plugin.flags = DDB_PLUGIN_FLAG_LOGGING,
- .plugin.name = "last.fm scrobbler",
+ .plugin.name = "last.fm scrobbler (custom)",
.plugin.descr = "Sends played songs information to your last.fm account, or other service that use AudioScrobbler protocol",
.plugin.copyright =
"Last.fm scrobbler plugin for DeaDBeeF Player\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment