mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-21 11:43:17 -05:00
commit tri's concatination stuff
This commit is contained in:
parent
75868e50aa
commit
7fe019693b
@ -545,6 +545,8 @@ void scan_music_file(char *path, struct dirent *pde,
|
|||||||
|
|
||||||
/* Do the tag lookup here */
|
/* Do the tag lookup here */
|
||||||
if(scan_get_info(mp3file.path,&mp3file)) {
|
if(scan_get_info(mp3file.path,&mp3file)) {
|
||||||
|
if(is_compdir)
|
||||||
|
mp3file.compilation = 1;
|
||||||
make_composite_tags(&mp3file);
|
make_composite_tags(&mp3file);
|
||||||
/* fill in the time_added. I'm not sure of the logic in this.
|
/* fill in the time_added. I'm not sure of the logic in this.
|
||||||
My thinking is to use time created, but what is that? Best
|
My thinking is to use time created, but what is that? Best
|
||||||
@ -559,9 +561,6 @@ void scan_music_file(char *path, struct dirent *pde,
|
|||||||
|
|
||||||
DPRINTF(E_DBG,L_SCAN," Codec: %s\n",mp3file.codectype);
|
DPRINTF(E_DBG,L_SCAN," Codec: %s\n",mp3file.codectype);
|
||||||
|
|
||||||
if(is_compdir)
|
|
||||||
mp3file.compilation = 1;
|
|
||||||
|
|
||||||
/* FIXME: error handling */
|
/* FIXME: error handling */
|
||||||
db_add(NULL,&mp3file,NULL);
|
db_add(NULL,&mp3file,NULL);
|
||||||
} else {
|
} else {
|
||||||
@ -645,8 +644,6 @@ int scan_get_info(char *file, MP3FILE *pmp3) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manually build tags. Set artist to computer/orchestra
|
* Manually build tags. Set artist to computer/orchestra
|
||||||
* if there is already no artist. Perhaps this could be
|
* if there is already no artist. Perhaps this could be
|
||||||
@ -657,47 +654,51 @@ int scan_get_info(char *file, MP3FILE *pmp3) {
|
|||||||
void make_composite_tags(MP3FILE *song) {
|
void make_composite_tags(MP3FILE *song) {
|
||||||
int len;
|
int len;
|
||||||
char *ptmp;
|
char *ptmp;
|
||||||
|
char *sep = " - ";
|
||||||
|
char *va_artist = "Various Artists";
|
||||||
|
|
||||||
len=0;
|
if(!song->artist) {
|
||||||
|
if (song->orchestra && song->conductor) {
|
||||||
if(!song->artist && (song->orchestra || song->conductor)) {
|
len = (int)strlen(song->orchestra) +
|
||||||
if(song->orchestra)
|
(int)strlen(sep) +
|
||||||
len += (int) strlen(song->orchestra);
|
(int)strlen(song->conductor);
|
||||||
if(song->conductor)
|
ptmp = (char*)malloc(len + 1);
|
||||||
len += (int) strlen(song->conductor);
|
|
||||||
|
|
||||||
len += 3;
|
|
||||||
|
|
||||||
song->artist=(char*)calloc(len, 1);
|
|
||||||
if(song->artist) {
|
|
||||||
if(song->orchestra)
|
|
||||||
strcat(song->artist,song->orchestra);
|
|
||||||
|
|
||||||
if(song->orchestra && song->conductor)
|
|
||||||
strcat(song->artist," - ");
|
|
||||||
|
|
||||||
if(song->conductor)
|
|
||||||
strcat(song->artist,song->conductor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((conf_get_int("scanning","concat compilations",0)) &&
|
|
||||||
song->artist &&
|
|
||||||
song->title) {
|
|
||||||
len = (int)strlen(song->artist) + (int)strlen(song->title);
|
|
||||||
ptmp = (char*)malloc(len + 4);
|
|
||||||
if(ptmp) {
|
if(ptmp) {
|
||||||
sprintf(ptmp,"%s - %s",song->artist, song->title);
|
sprintf(ptmp,"%s%s%s",song->orchestra, sep, song->conductor);
|
||||||
|
song->artist = ptmp;
|
||||||
|
}
|
||||||
|
} else if(song->orchestra) {
|
||||||
|
song->artist = strdup(song->orchestra);
|
||||||
|
} else if (song->conductor) {
|
||||||
|
song->artist = strdup(song->conductor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(song->compilation && song->artist && song->title &&
|
||||||
|
(conf_get_int("scanning","concat compilations",0))) {
|
||||||
|
len = (int)strlen(song->artist) +
|
||||||
|
(int)strlen(sep) +
|
||||||
|
(int)strlen(song->title);
|
||||||
|
ptmp = (char*)malloc(len + 1);
|
||||||
|
if(ptmp) {
|
||||||
|
sprintf(ptmp,"%s%s%s",song->artist, sep, song->title);
|
||||||
free(song->title);
|
free(song->title);
|
||||||
song->title = ptmp;
|
song->title = ptmp;
|
||||||
|
|
||||||
|
if(va_artist) {
|
||||||
|
ptmp = strdup(va_artist);
|
||||||
|
if(ptmp) {
|
||||||
|
free(song->artist);
|
||||||
|
song->artist = ptmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(song->url) {
|
if(song->url)
|
||||||
song->data_kind=1;
|
song->data_kind=1;
|
||||||
} else {
|
else
|
||||||
song->data_kind=0;
|
song->data_kind=0;
|
||||||
}
|
|
||||||
|
|
||||||
if(!song->title)
|
if(!song->title)
|
||||||
song->title = strdup(song->fname);
|
song->title = strdup(song->fname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user