"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "albumart.c" between
minidlna-1.2.0.tar.gz and minidlna-1.2.1.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.

albumart.c  (minidlna-1.2.0):albumart.c  (minidlna-1.2.1)
skipping to change at line 107 skipping to change at line 107
char *dir; char *dir;
char *match; char *match;
char file[MAXPATHLEN]; char file[MAXPATHLEN];
char fpath[MAXPATHLEN]; char fpath[MAXPATHLEN];
char dpath[MAXPATHLEN]; char dpath[MAXPATHLEN];
int ncmp = 0; int ncmp = 0;
int album_art; int album_art;
DIR *dh; DIR *dh;
struct dirent *dp; struct dirent *dp;
enum file_types type = TYPE_UNKNOWN; enum file_types type = TYPE_UNKNOWN;
media_types dir_type;
int64_t art_id = 0; int64_t art_id = 0;
int ret; int ret;
strncpyt(fpath, path, sizeof(fpath)); strncpyt(fpath, path, sizeof(fpath));
match = basename(fpath); match = basename(fpath);
/* Check if this file name matches a specific audio or video file */ /* Check if this file name matches a specific audio or video file */
if( ends_with(match, ".cover.jpg") ) if( ends_with(match, ".cover.jpg") )
{ {
ncmp = strlen(match)-10; ncmp = strlen(match)-10;
} }
else else
{ {
ncmp = strrchr(match, '.') - match; ncmp = strrchr(match, '.') - match;
} }
/* Check if this file name matches one of the default album art names */ /* Check if this file name matches one of the default album art names */
album_art = is_album_art(match); album_art = is_album_art(match);
strncpyt(dpath, path, sizeof(dpath)); strncpyt(dpath, path, sizeof(dpath));
dir_type = valid_media_types(dpath);
if (!(dir_type & (TYPE_VIDEO|TYPE_AUDIO)))
return;
dir = dirname(dpath); dir = dirname(dpath);
dh = opendir(dir); dh = opendir(dir);
if( !dh ) if( !dh )
return; return;
while ((dp = readdir(dh)) != NULL) while ((dp = readdir(dh)) != NULL)
{ {
if (is_reg(dp) == 1) if (is_reg(dp) == 1)
{
type = TYPE_FILE; type = TYPE_FILE;
}
else if (is_dir(dp) == 1) else if (is_dir(dp) == 1)
{
type = TYPE_DIR; type = TYPE_DIR;
}
else else
{ {
snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name); snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name);
type = resolve_unknown_type(file, ALL_MEDIA); type = resolve_unknown_type(file, dir_type);
} }
if( type != TYPE_FILE )
if (type != TYPE_FILE || dp->d_name[0] == '.')
continue; continue;
if( (dp->d_name[0] != '.') &&
(is_video(dp->d_name) || is_audio(dp->d_name)) && if(((is_video(dp->d_name) && (dir_type & TYPE_VIDEO)) ||
(is_audio(dp->d_name) && (dir_type & TYPE_AUDIO))) &&
(album_art || strncmp(dp->d_name, match, ncmp) == 0) ) (album_art || strncmp(dp->d_name, match, ncmp) == 0) )
{ {
DPRINTF(E_DEBUG, L_METADATA, "New file %s looks like cove r art for %s\n", path, dp->d_name);
snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name); snprintf(file, sizeof(file), "%s/%s", dir, dp->d_name);
art_id = find_album_art(file, NULL, 0); art_id = find_album_art(file, NULL, 0);
ret = sql_exec(db, "UPDATE DETAILS set ALBUM_ART = %lld w ret = sql_exec(db, "UPDATE DETAILS set ALBUM_ART = %lld w
here PATH = '%q'", (long long)art_id, file); here PATH = '%q' and ALBUM_ART != %lld", (long long)art_id, file, (long long)art
if( ret != SQLITE_OK ) _id);
if( ret == SQLITE_OK )
DPRINTF(E_DEBUG, L_METADATA, "Updated cover art f
or %s to %s\n", dp->d_name, path);
else
DPRINTF(E_WARN, L_METADATA, "Error setting %s as cover art for %s\n", match, dp->d_name); DPRINTF(E_WARN, L_METADATA, "Error setting %s as cover art for %s\n", match, dp->d_name);
} }
} }
closedir(dh); closedir(dh);
} }
char * char *
check_embedded_art(const char *path, uint8_t *image_data, int image_size) check_embedded_art(const char *path, uint8_t *image_data, int image_size)
{ {
int width = 0, height = 0; int width = 0, height = 0;
 End of changes. 11 change blocks. 
12 lines changed or deleted 17 lines changed or added

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