"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "utils.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.

utils.c  (minidlna-1.2.0):utils.c  (minidlna-1.2.1)
skipping to change at line 252 skipping to change at line 252
(msec % 1000)); (msec % 1000));
return str; return str;
} }
char * char *
strip_ext(char *name) strip_ext(char *name)
{ {
char *period; char *period;
if (!name)
return NULL;
period = strrchr(name, '.'); period = strrchr(name, '.');
if (period) if (period)
*period = '\0'; *period = '\0';
return period; return period;
} }
/* Code basically stolen from busybox */ /* Code basically stolen from busybox */
int int
make_dir(char * path, mode_t mode) make_dir(char * path, mode_t mode)
skipping to change at line 436 skipping to change at line 438
{ {
return (ends_with(file, ".m3u") || ends_with(file, ".pls")); return (ends_with(file, ".m3u") || ends_with(file, ".pls"));
} }
int int
is_caption(const char * file) is_caption(const char * file)
{ {
return (ends_with(file, ".srt") || ends_with(file, ".smi")); return (ends_with(file, ".srt") || ends_with(file, ".smi"));
} }
media_types
get_media_type(const char *file)
{
const char *ext = strrchr(file, '.');
if (!ext)
return NO_MEDIA;
if (is_image(ext))
return TYPE_IMAGE;
if (is_video(ext))
return TYPE_VIDEO;
if (is_audio(ext))
return TYPE_AUDIO;
if (is_playlist(ext))
return TYPE_PLAYLIST;
if (is_caption(ext))
return TYPE_CAPTION;
if (is_nfo(ext))
return TYPE_NFO;
return NO_MEDIA;
}
int int
is_album_art(const char * name) is_album_art(const char * name)
{ {
struct album_art_name_s * album_art_name; struct album_art_name_s * album_art_name;
/* 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 */
for( album_art_name = album_art_names; album_art_name; album_art_name = a lbum_art_name->next ) for( album_art_name = album_art_names; album_art_name; album_art_name = a lbum_art_name->next )
{ {
if( album_art_name->wildcard ) if( album_art_name->wildcard )
{ {
skipping to change at line 463 skipping to change at line 486
} }
} }
return (album_art_name ? 1 : 0); return (album_art_name ? 1 : 0);
} }
int int
resolve_unknown_type(const char * path, media_types dir_type) resolve_unknown_type(const char * path, media_types dir_type)
{ {
struct stat entry; struct stat entry;
unsigned char type = TYPE_UNKNOWN; enum file_types type = TYPE_UNKNOWN;
char str_buf[PATH_MAX]; char str_buf[PATH_MAX];
ssize_t len; ssize_t len;
if( lstat(path, &entry) == 0 ) if( lstat(path, &entry) == 0 )
{ {
if( S_ISLNK(entry.st_mode) ) if( S_ISLNK(entry.st_mode) )
{ {
if( (len = readlink(path, str_buf, PATH_MAX-1)) > 0 ) if( (len = readlink(path, str_buf, PATH_MAX-1)) > 0 )
{ {
str_buf[len] = '\0'; str_buf[len] = '\0';
skipping to change at line 490 skipping to change at line 513
} }
stat(path, &entry); stat(path, &entry);
} }
if( S_ISDIR(entry.st_mode) ) if( S_ISDIR(entry.st_mode) )
{ {
type = TYPE_DIR; type = TYPE_DIR;
} }
else if( S_ISREG(entry.st_mode) ) else if( S_ISREG(entry.st_mode) )
{ {
switch( dir_type ) media_types mtype = get_media_type(path);
{ if (dir_type & mtype)
case ALL_MEDIA: type = TYPE_FILE;
if( is_image(path) ||
is_audio(path) ||
is_video(path) ||
is_playlist(path) )
type = TYPE_FILE;
break;
case TYPE_AUDIO:
if( is_audio(path) ||
is_playlist(path) )
type = TYPE_FILE;
break;
case TYPE_VIDEO:
if( is_video(path) )
type = TYPE_FILE;
break;
case TYPE_IMAGES:
if( is_image(path) )
type = TYPE_FILE;
break;
default:
break;
}
} }
} }
return type; return type;
} }
media_types
valid_media_types(const char *path)
{
struct media_dir_s *media_dir;
for (media_dir = media_dirs; media_dir; media_dir = media_dir->next)
{
if (strncmp(path, media_dir->path, strlen(media_dir->path)) == 0)
return media_dir->types;
}
return ALL_MEDIA;
}
 End of changes. 5 change blocks. 
26 lines changed or deleted 27 lines changed or added

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