"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "metadata.c" between
minidlna-1.2.1.tar.gz and minidlna-1.3.0.tar.gz

About: ReadyMedia (formerly known as MiniDLNA) is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.

metadata.c  (minidlna-1.2.1):metadata.c  (minidlna-1.3.0)
skipping to change at line 159 skipping to change at line 159
if (ret == 0) if (ret == 0)
{ {
sql_exec(db, "INSERT OR REPLACE into CAPTIONS" sql_exec(db, "INSERT OR REPLACE into CAPTIONS"
" (ID, PATH) " " (ID, PATH) "
"VALUES" "VALUES"
" (%lld, %Q)", detailID, file); " (%lld, %Q)", detailID, file);
} }
} }
void static void
parse_nfo(const char *path, metadata_t *m) parse_nfo(const char *path, metadata_t *m)
{ {
FILE *nfo; FILE *nfo;
char *buf; char *buf;
struct NameValueParserData xml; struct NameValueParserData xml;
struct stat file; struct stat file;
size_t nread; size_t nread;
char *val, *val2; char *val, *val2;
if (stat(path, &file) != 0 || if (stat(path, &file) != 0 ||
skipping to change at line 240 skipping to change at line 240
val = GetValueFromNameValueList(&xml, "mime"); val = GetValueFromNameValueList(&xml, "mime");
if (val) if (val)
{ {
char *esc_tag = unescape_tag(val, 1); char *esc_tag = unescape_tag(val, 1);
free(m->mime); free(m->mime);
m->mime = escape_tag(esc_tag, 1); m->mime = escape_tag(esc_tag, 1);
free(esc_tag); free(esc_tag);
} }
val = GetValueFromNameValueList(&xml, "season");
if (val)
m->disc = atoi(val);
val = GetValueFromNameValueList(&xml, "episode");
if (val)
m->track = atoi(val);
ClearNameValueList(&xml); ClearNameValueList(&xml);
free(buf); free(buf);
} }
void void
free_metadata(metadata_t *m, uint32_t flags) free_metadata(metadata_t *m, uint32_t flags)
{ {
if( flags & FLAG_TITLE ) if( flags & FLAG_TITLE )
free(m->title); free(m->title);
if( flags & FLAG_ARTIST ) if( flags & FLAG_ARTIST )
skipping to change at line 348 skipping to change at line 356
else if( ends_with(path, ".ogg") || ends_with(path, ".oga") ) else if( ends_with(path, ".ogg") || ends_with(path, ".oga") )
{ {
strcpy(type, "ogg"); strcpy(type, "ogg");
m.mime = strdup("audio/ogg"); m.mime = strdup("audio/ogg");
} }
else if( ends_with(path, ".pcm") ) else if( ends_with(path, ".pcm") )
{ {
strcpy(type, "pcm"); strcpy(type, "pcm");
m.mime = strdup("audio/L16"); m.mime = strdup("audio/L16");
} }
else if( ends_with(path, ".dsf") )
{
strcpy(type, "dsf");
m.mime = strdup("audio/x-dsd");
}
else if( ends_with(path, ".dff") )
{
strcpy(type, "dff");
m.mime = strdup("audio/x-dsd");
}
else else
{ {
DPRINTF(E_WARN, L_METADATA, "Unhandled file extension on %s\n", p ath); DPRINTF(E_WARN, L_METADATA, "Unhandled file extension on %s\n", p ath);
return 0; return 0;
} }
if( !(*lang) ) if( !(*lang) )
{ {
if( !getenv("LANG") ) if( !getenv("LANG") )
strcpy(lang, "en_US"); strcpy(lang, "en_US");
skipping to change at line 487 skipping to change at line 505
{ {
ret = sqlite3_last_insert_rowid(db); ret = sqlite3_last_insert_rowid(db);
} }
freetags(&song); freetags(&song);
free_metadata(&m, free_flags); free_metadata(&m, free_flags);
return ret; return ret;
} }
/* For libjpeg error handling */ /* For libjpeg error handling */
jmp_buf setjmp_buffer; static jmp_buf setjmp_buffer;
static void static void
libjpeg_error_handler(j_common_ptr cinfo) libjpeg_error_handler(j_common_ptr cinfo)
{ {
cinfo->err->output_message (cinfo); cinfo->err->output_message (cinfo);
longjmp(setjmp_buffer, 1); longjmp(setjmp_buffer, 1);
return; return;
} }
int64_t int64_t
GetImageMetadata(const char *path, const char *name) GetImageMetadata(const char *path, const char *name)
skipping to change at line 1502 skipping to change at line 1520
m.mime = realloc(m.mime, 21); m.mime = realloc(m.mime, 21);
strcpy(m.mime, "video/x-tivo-mpeg"); strcpy(m.mime, "video/x-tivo-mpeg");
} }
#endif #endif
strcpy(nfo, path); strcpy(nfo, path);
ext = strrchr(nfo, '.'); ext = strrchr(nfo, '.');
if( ext ) if( ext )
{ {
strcpy(ext+1, "nfo"); strcpy(ext+1, "nfo");
if( access(nfo, F_OK) == 0 ) if( access(nfo, R_OK) == 0 )
{
parse_nfo(nfo, &m); parse_nfo(nfo, &m);
}
} }
if( !m.mime ) if( !m.mime )
{ {
if( strcmp(ctx->iformat->name, "avi") == 0 ) if( strcmp(ctx->iformat->name, "avi") == 0 )
xasprintf(&m.mime, "video/x-msvideo"); xasprintf(&m.mime, "video/x-msvideo");
else if( strncmp(ctx->iformat->name, "mpeg", 4) == 0 ) else if( strncmp(ctx->iformat->name, "mpeg", 4) == 0 )
xasprintf(&m.mime, "video/mpeg"); xasprintf(&m.mime, "video/mpeg");
else if( strcmp(ctx->iformat->name, "asf") == 0 ) else if( strcmp(ctx->iformat->name, "asf") == 0 )
xasprintf(&m.mime, "video/x-ms-wmv"); xasprintf(&m.mime, "video/x-ms-wmv");
skipping to change at line 1542 skipping to change at line 1558
modtime = localtime(&file.st_mtime); modtime = localtime(&file.st_mtime);
strftime(m.date, 20, "%FT%T", modtime); strftime(m.date, 20, "%FT%T", modtime);
} }
if( !m.title ) if( !m.title )
{ {
m.title = strdup(name); m.title = strdup(name);
strip_ext(m.title); strip_ext(m.title);
} }
if (!m.disc && !m.track)
{
/* Search for Season and Episode in the filename */
char *p = (char*)name, *s;
while ((s = strpbrk(p, "Ss")))
{
unsigned season = strtoul(s+1, &p, 10);
unsigned episode = 0;
if (season > 0 && p)
{
while (isblank(*p) || ispunct(*p))
p++;
if (*p == 'E' || *p == 'e')
episode = strtoul(p+1, NULL, 10);
}
if (season && episode)
{
m.disc = season;
m.track = episode;
}
p = s + 1;
}
}
album_art = find_album_art(path, m.thumb_data, m.thumb_size); album_art = find_album_art(path, m.thumb_data, m.thumb_size);
freetags(&video); freetags(&video);
lav_close(ctx); lav_close(ctx);
ret = sql_exec(db, "INSERT into DETAILS" ret = sql_exec(db, "INSERT into DETAILS"
" (PATH, SIZE, TIMESTAMP, DURATION, DATE, CHANNELS, BI TRATE, SAMPLERATE, RESOLUTION," " (PATH, SIZE, TIMESTAMP, DURATION, DATE, CHANNELS, BI TRATE, SAMPLERATE, RESOLUTION,"
" TITLE, CREATOR, ARTIST, GENRE, COMMENT, DLNA_PN, MI ME, ALBUM_ART) " " TITLE, CREATOR, ARTIST, GENRE, COMMENT, DLNA_PN, MI ME, ALBUM_ART, DISC, TRACK) "
"VALUES" "VALUES"
" (%Q, %lld, %lld, %Q, %Q, %u, %u, %u, %Q, '%q', %Q, % Q, %Q, %Q, %Q, '%q', %lld);", " (%Q, %lld, %lld, %Q, %Q, %u, %u, %u, %Q, '%q', %Q, % Q, %Q, %Q, %Q, '%q', %lld, %u, %u);",
path, (long long)file.st_size, (long long)file.st_mtim e, m.duration, path, (long long)file.st_size, (long long)file.st_mtim e, m.duration,
m.date, m.channels, m.bitrate, m.frequency, m.resoluti on, m.date, m.channels, m.bitrate, m.frequency, m.resoluti on,
m.title, m.creator, m.artist, m.genre, m.comment, m.dl na_pn, m.title, m.creator, m.artist, m.genre, m.comment, m.dl na_pn,
m.mime, album_art); m.mime, album_art, m.disc, m.track);
if( ret != SQLITE_OK ) if( ret != SQLITE_OK )
{ {
DPRINTF(E_ERROR, L_METADATA, "Error inserting details for '%s'!\n ", path); DPRINTF(E_ERROR, L_METADATA, "Error inserting details for '%s'!\n ", path);
ret = 0; ret = 0;
} }
else else
{ {
ret = sqlite3_last_insert_rowid(db); ret = sqlite3_last_insert_rowid(db);
check_for_captions(path, ret); check_for_captions(path, ret);
} }
 End of changes. 10 change blocks. 
8 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)