From 6fc880a25db140532e0fab154e76ebdd54d55f94 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Sat, 18 Apr 2009 02:23:06 +0000 Subject: [PATCH] * Fix issues with album art linking if the link target is in a different directory than the previous file. --- albumart.c | 11 ++++++++++- minidlna.c | 14 +++++++++----- tagutils/tagutils-mp3.c | 6 +++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/albumart.c b/albumart.c index a797fd1..db2086b 100644 --- a/albumart.c +++ b/albumart.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -119,7 +120,15 @@ check_embedded_art(const char * path, const char * image_data, int image_size) } else { - DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed\n", art_path, last_path); + if( errno == ENOENT ) + { + cache_dir = strdup(art_path); + make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); + free(cache_dir); + if( link(last_path, art_path) == 0 ) + return(art_path); + } + DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed [%s]\n", art_path, last_path, strerror(errno)); free(art_path); art_path = NULL; } diff --git a/minidlna.c b/minidlna.c index 16e280a..0670c87 100644 --- a/minidlna.c +++ b/minidlna.c @@ -594,19 +594,23 @@ main(int argc, char * * argv) struct timeval timeout, timeofday, lasttimeofday = {0, 0}, lastupdatetime = {0, 0}; int max_fd = -1; int last_changecnt = 0; - #ifdef TIVO_SUPPORT - unsigned short int loop_cnt = 0; - int sbeacon = -1; - struct sockaddr_in tivo_bcast; - #endif char * sql; short int new_db = 0; pthread_t thread[2]; +#ifdef TIVO_SUPPORT + unsigned short int loop_cnt = 0; + int sbeacon = -1; + struct sockaddr_in tivo_bcast; +#endif if(init(argc, argv) != 0) return 1; +#ifdef READYNAS + DPRINTF(E_WARN, L_GENERAL, "Starting ReadyDLNA...\n"); +#else DPRINTF(E_WARN, L_GENERAL, "Starting MiniDLNA...\n"); +#endif LIST_INIT(&upnphttphead); if( access(DB_PATH, F_OK) != 0 ) diff --git a/tagutils/tagutils-mp3.c b/tagutils/tagutils-mp3.c index 46d0ca6..28af80b 100644 --- a/tagutils/tagutils-mp3.c +++ b/tagutils/tagutils-mp3.c @@ -75,7 +75,7 @@ _get_mp3tags(char *file, struct song_metadata *psong) if(!strcmp(pid3frame->id, "YTCP")) /* for id3v2.2 */ { psong->compilation = 1; - DPRINTF(E_DEBUG, L_SCANNER, "Compilation: %d\n", psong->compilation); + DPRINTF(E_DEBUG, L_SCANNER, "Compilation: %d [%s]\n", psong->compilation, basename(file)); } else if(!strcmp(pid3frame->id, "APIC") && !image_size) { @@ -580,11 +580,11 @@ _get_mp3fileinfo(char *file, struct song_metadata *psong) { if(ferror(infile)) { - DPRINTF(E_ERROR, L_SCANNER, "Error reading: %s\n", strerror(errno)); + DPRINTF(E_ERROR, L_SCANNER, "Error reading: %s [%s]\n", strerror(errno), file); } else { - DPRINTF(E_ERROR, L_SCANNER, "File too small. Probably corrupted.\n"); + DPRINTF(E_WARN, L_SCANNER, "File too small. Probably corrupted. [%s]\n", file); } fclose(infile); return -1;