summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames D. Smith <smithjd15@gmail.com>2022-03-29 12:39:29 -0600
committerWilliam Wilgus <me.theuser@yahoo.com>2022-04-01 06:11:42 -0400
commit6e3937e8366a906b58d61890c0c9165c700563bd (patch)
treed953d77752a9c1c1283c16e1f685f4101fbb5c55
parent412dbaeffe1bf864ff3f2c8bba9312bb034fa126 (diff)
downloadrockbox-6e3937e836.tar.gz
rockbox-6e3937e836.zip
lastfm Scrobbler: Substitute album artist for empty artist.
Change-Id: I66dda13ec2cbb592ebe0d269f0c7eff749bc737a
-rw-r--r--apps/plugins/lastfm_scrobbler.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c
index 4beef53913..02a6bedd9f 100644
--- a/apps/plugins/lastfm_scrobbler.c
+++ b/apps/plugins/lastfm_scrobbler.c
@@ -49,7 +49,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
/* longest entry I've had is 323, add a safety margin */
#define SCROBBLER_CACHE_LEN 512
-#define ITEM_HDR "#ARTIST #ALBUM #TITLE #TRACKNUM #LENGTH #RATING #TIMESTAMMP #MUSICBRAINZ_TRACKID\n"
+#define ITEM_HDR "#ARTIST #ALBUM #TITLE #TRACKNUM #LENGTH #RATING #TIMESTAMP #MUSICBRAINZ_TRACKID\n"
#if CONFIG_RTC
static time_t timestamp;
@@ -338,14 +338,14 @@ static void scrobbler_add_to_cache(const struct mp3entry *id)
int ret = rb->snprintf(&scrobbler_buf[(SCROBBLER_CACHE_LEN*gCache.pos)],
SCROBBLER_CACHE_LEN,
"%s\t%s\t%s\t%s\t%d\t%c\t%ld\t%s\n",
- id->artist,
- id->album ?: "",
+ id->artist ? id->artist : id->albumartist,
+ id->album,
id->title,
tracknum,
(int)(id->length / 1000),
rating,
get_timestamp(),
- id->mb_track_id ?id->mb_track_id: "");
+ id->mb_track_id);
if ( ret >= SCROBBLER_CACHE_LEN )
{
@@ -389,7 +389,8 @@ static void scrobbler_change_event(unsigned short id, void *ev_data)
/* check if track was resumed > %50 played ( likely got saved )
check for blank artist or track name */
- if ((id3->elapsed > id3->length / 2) || !id3->artist || !id3->title)
+ if ((id3->elapsed > id3->length / 2)
+ || (!id3->artist && !id3->albumartist) || !id3->title)
{
gCache.pending = false;
logf("SCROBBLER: skipping file %s", id3->path);