forked from len0rd/rockbox
FS#9139 - support for ver 1.1 scrobbler log files. Upload any old files first - uploading software may need updating, see the LastFMLog wiki page
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18732 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7eb194477a
commit
2c170356f3
6 changed files with 52 additions and 6 deletions
|
|
@ -465,6 +465,9 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
|
||||||
id3buf = value;
|
id3buf = value;
|
||||||
id3buf_remaining = buf_len;
|
id3buf_remaining = buf_len;
|
||||||
}
|
}
|
||||||
|
} else if (!strcmp("MusicBrainz/Track Id", utf8buf)) {
|
||||||
|
id3->mb_track_id = id3buf;
|
||||||
|
asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
|
||||||
} else {
|
} else {
|
||||||
lseek(fd, length, SEEK_CUR);
|
lseek(fd, length, SEEK_CUR);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,11 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
|
||||||
{
|
{
|
||||||
p = &(id3->grouping);
|
p = &(id3->grouping);
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp(name, "musicbrainz_trackid") == 0
|
||||||
|
|| strcasecmp(name, "http://musicbrainz.org") == 0 )
|
||||||
|
{
|
||||||
|
p = &(id3->mb_track_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = parse_replaygain(name, value, id3, buf, buf_remaining);
|
len = parse_replaygain(name, value, id3, buf, buf_remaining);
|
||||||
|
|
|
||||||
|
|
@ -498,6 +498,11 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
|
||||||
DEBUGF("AAC: lead_trim %d, tail_trim %d\n",
|
DEBUGF("AAC: lead_trim %d, tail_trim %d\n",
|
||||||
id3->lead_trim, id3->tail_trim);
|
id3->lead_trim, id3->tail_trim);
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp(tag_name, "musicbrainz track id") == 0)
|
||||||
|
{
|
||||||
|
read_mp4_tag_string(fd, size, &buffer, &buffer_left,
|
||||||
|
&id3->mb_track_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* any;
|
char* any;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Robert Keevil
|
* Copyright (C) 2006-2008 Robert Keevil
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
|
@ -42,7 +42,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging
|
||||||
|
|
||||||
#include "scrobbler.h"
|
#include "scrobbler.h"
|
||||||
|
|
||||||
#define SCROBBLER_VERSION "1.0"
|
#define SCROBBLER_VERSION "1.1"
|
||||||
|
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
#define SCROBBLER_FILE "/.scrobbler.log"
|
#define SCROBBLER_FILE "/.scrobbler.log"
|
||||||
|
|
@ -151,24 +151,26 @@ static void add_to_cache(unsigned long play_length)
|
||||||
{
|
{
|
||||||
ret = snprintf(scrobbler_cache+(SCROBBLER_CACHE_LEN*cache_pos),
|
ret = snprintf(scrobbler_cache+(SCROBBLER_CACHE_LEN*cache_pos),
|
||||||
SCROBBLER_CACHE_LEN,
|
SCROBBLER_CACHE_LEN,
|
||||||
"%s\t%s\t%s\t%d\t%d\t%c\t%ld\n",
|
"%s\t%s\t%s\t%d\t%d\t%c\t%ld\t%s\n",
|
||||||
scrobbler_entry.artist,
|
scrobbler_entry.artist,
|
||||||
scrobbler_entry.album?scrobbler_entry.album:"",
|
scrobbler_entry.album?scrobbler_entry.album:"",
|
||||||
scrobbler_entry.title,
|
scrobbler_entry.title,
|
||||||
scrobbler_entry.tracknum,
|
scrobbler_entry.tracknum,
|
||||||
(int)scrobbler_entry.length/1000,
|
(int)scrobbler_entry.length/1000,
|
||||||
rating,
|
rating,
|
||||||
(long)timestamp);
|
(long)timestamp,
|
||||||
|
scrobbler_entry.mb_track_id?scrobbler_entry.mb_track_id:"");
|
||||||
} else {
|
} else {
|
||||||
ret = snprintf(scrobbler_cache+(SCROBBLER_CACHE_LEN*cache_pos),
|
ret = snprintf(scrobbler_cache+(SCROBBLER_CACHE_LEN*cache_pos),
|
||||||
SCROBBLER_CACHE_LEN,
|
SCROBBLER_CACHE_LEN,
|
||||||
"%s\t%s\t%s\t\t%d\t%c\t%ld\n",
|
"%s\t%s\t%s\t\t%d\t%c\t%ld\t%s\n",
|
||||||
scrobbler_entry.artist,
|
scrobbler_entry.artist,
|
||||||
scrobbler_entry.album?scrobbler_entry.album:"",
|
scrobbler_entry.album?scrobbler_entry.album:"",
|
||||||
scrobbler_entry.title,
|
scrobbler_entry.title,
|
||||||
(int)scrobbler_entry.length/1000,
|
(int)scrobbler_entry.length/1000,
|
||||||
rating,
|
rating,
|
||||||
(long)timestamp);
|
(long)timestamp,
|
||||||
|
scrobbler_entry.mb_track_id?scrobbler_entry.mb_track_id:"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret >= SCROBBLER_CACHE_LEN )
|
if ( ret >= SCROBBLER_CACHE_LEN )
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,9 @@ struct mp3entry {
|
||||||
|
|
||||||
/* Cuesheet support */
|
/* Cuesheet support */
|
||||||
int cuesheet_type; /* 0: none, 1: external, 2: embedded */
|
int cuesheet_type; /* 0: none, 1: external, 2: embedded */
|
||||||
|
|
||||||
|
/* Musicbrainz Track ID */
|
||||||
|
char* mb_track_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
||||||
|
|
@ -486,6 +486,31 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos )
|
||||||
|
{
|
||||||
|
char* value = NULL;
|
||||||
|
int desc_len = strlen(tag);
|
||||||
|
/*DEBUGF("MBID len: %d\n", desc_len);*/
|
||||||
|
int value_len = 0;
|
||||||
|
|
||||||
|
if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos)
|
||||||
|
{
|
||||||
|
value = tag + desc_len + 1;
|
||||||
|
|
||||||
|
if (strcasecmp(tag, "http://musicbrainz.org") == 0)
|
||||||
|
{
|
||||||
|
/* Musicbrainz track IDs are always 36 chars long plus null */
|
||||||
|
value_len = 37;
|
||||||
|
|
||||||
|
entry->mb_track_id = value;
|
||||||
|
|
||||||
|
/*DEBUGF("ENTRY: %s LEN: %d\n", entry->mb_track_id, strlen(entry->mb_track_id));*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag - entry->id3v2buf + value_len;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct tag_resolver taglist[] = {
|
static const struct tag_resolver taglist[] = {
|
||||||
{ "TPE1", 4, offsetof(struct mp3entry, artist), NULL, false },
|
{ "TPE1", 4, offsetof(struct mp3entry, artist), NULL, false },
|
||||||
{ "TP1", 3, offsetof(struct mp3entry, artist), NULL, false },
|
{ "TP1", 3, offsetof(struct mp3entry, artist), NULL, false },
|
||||||
|
|
@ -511,6 +536,7 @@ static const struct tag_resolver taglist[] = {
|
||||||
{ "TXXX", 4, 0, &parseuser, false },
|
{ "TXXX", 4, 0, &parseuser, false },
|
||||||
{ "RVA2", 4, 0, &parserva2, true },
|
{ "RVA2", 4, 0, &parserva2, true },
|
||||||
#endif
|
#endif
|
||||||
|
{ "UFID", 4, 0, &parsembtid, false },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0])))
|
#define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0])))
|
||||||
|
|
@ -1261,6 +1287,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
|
||||||
if (entry->album_gain_string)
|
if (entry->album_gain_string)
|
||||||
entry->album_gain_string += offset;
|
entry->album_gain_string += offset;
|
||||||
#endif
|
#endif
|
||||||
|
if (entry->mb_track_id)
|
||||||
|
entry->mb_track_id += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig)
|
void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue