mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-03 09:56:00 -05:00
utf8 comments
This commit is contained in:
parent
09e9f8c571
commit
9119ab738a
@ -399,6 +399,8 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
|
|||||||
unsigned char *utf8_text;
|
unsigned char *utf8_text;
|
||||||
int genre;
|
int genre;
|
||||||
int have_utf8;
|
int have_utf8;
|
||||||
|
int have_text;
|
||||||
|
unsigned char *native_text;
|
||||||
|
|
||||||
pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
|
pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
|
||||||
if(!pid3file) {
|
if(!pid3file) {
|
||||||
@ -419,15 +421,20 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
|
|||||||
index=0;
|
index=0;
|
||||||
while((pid3frame=id3_tag_findframe(pid3tag,"",index))) {
|
while((pid3frame=id3_tag_findframe(pid3tag,"",index))) {
|
||||||
used=0;
|
used=0;
|
||||||
utf8_text=NULL;
|
utf8_text=native_text=NULL;
|
||||||
have_utf8=0;
|
have_utf8=0;
|
||||||
|
have_text=0;
|
||||||
|
|
||||||
if((pid3frame->id[0] == 'T')&&(id3_field_getnstrings(&pid3frame->fields[1])))
|
if(((pid3frame->id[0] == 'T')||(strcmp(pid3frame->id,"COMM")==0)) &&
|
||||||
have_utf8=1;
|
(id3_field_getnstrings(&pid3frame->fields[1])))
|
||||||
|
have_text=1;
|
||||||
|
|
||||||
if(have_utf8) {
|
if(have_text) {
|
||||||
utf8_text=id3_ucs4_utf8duplicate(id3_field_getstrings(&pid3frame->fields[1],0));
|
native_text=id3_field_getstrings(&pid3frame->fields[1],0);
|
||||||
if(utf8_text) {
|
|
||||||
|
if(native_text) {
|
||||||
|
have_utf8=1;
|
||||||
|
utf8_text=id3_ucs4_utf8duplicate(native_text);
|
||||||
MEMNOTIFY(utf8_text);
|
MEMNOTIFY(utf8_text);
|
||||||
|
|
||||||
if(!strcmp(pid3frame->id,"TIT2")) { /* Title */
|
if(!strcmp(pid3frame->id,"TIT2")) { /* Title */
|
||||||
@ -451,6 +458,10 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
|
|||||||
free(pmp3->genre);
|
free(pmp3->genre);
|
||||||
pmp3->genre=strdup(scan_winamp_genre[genre]);
|
pmp3->genre=strdup(scan_winamp_genre[genre]);
|
||||||
}
|
}
|
||||||
|
} else if(!strcmp(pid3frame->id,"COMM")) {
|
||||||
|
used=1;
|
||||||
|
pmp3->comment = utf8_text;
|
||||||
|
DPRINTF(ERR_DEBUG," Comment: %s\n",pmp3->comment);
|
||||||
} else if(!strcmp(pid3frame->id,"TDRC")) {
|
} else if(!strcmp(pid3frame->id,"TDRC")) {
|
||||||
pmp3->year = atoi(utf8_text);
|
pmp3->year = atoi(utf8_text);
|
||||||
DPRINTF(ERR_DEBUG," Year: %d\n",pmp3->year);
|
DPRINTF(ERR_DEBUG," Year: %d\n",pmp3->year);
|
||||||
@ -458,14 +469,7 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* can check for non-text tags here */
|
||||||
if((!strcmp(pid3frame->id,"COMM"))&&(id3_field_getnstrings(&pid3frame->fields[1]))) {
|
|
||||||
pmp3->comment=strdup(id3_field_getstrings(&pid3frame->fields[1],0));
|
|
||||||
DPRINTF(ERR_DEBUG," Comment: %s\n",pmp3->comment);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* can check for non-utf tags here */
|
|
||||||
|
|
||||||
if((!used) && (have_utf8) && (utf8_text))
|
if((!used) && (have_utf8) && (utf8_text))
|
||||||
free(utf8_text);
|
free(utf8_text);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user