diff options
author | Wolfgang Rohdewald <wr@server.rohdewald.de> | 2008-12-24 12:06:21 +0100 |
---|---|---|
committer | Wolfgang Rohdewald <wr@server.rohdewald.de> | 2008-12-24 12:06:21 +0100 |
commit | 3f5ef98dd912a699d41c573951c62a7861ad6d37 (patch) | |
tree | 5456cc6f8dd2d2eec587ed0cb6266145401270a2 | |
parent | 0b68925ab45a20055c575540f35ae8df32b4e69d (diff) | |
download | vdr-plugin-muggle-3f5ef98dd912a699d41c573951c62a7861ad6d37.tar.gz vdr-plugin-muggle-3f5ef98dd912a699d41c573951c62a7861ad6d37.tar.bz2 |
add debugging code, activated with DEBUGSEL. if a track is
missing on file system, add it. Content: spoken missing
filename
-rw-r--r-- | mg_item.c | 14 | ||||
-rw-r--r-- | mg_item_gd.c | 13 |
2 files changed, 24 insertions, 3 deletions
@@ -12,6 +12,7 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> +#include <stdlib.h> #include <cstring> #include "mg_item.h" @@ -59,6 +60,19 @@ mgItem::analyze_failure(string filename) const { readable(filename); // sets errno int err = errno; +#ifdef DEBUGSEL + if (err==ENOENT) { + char *command; + msprintf(&command,"cd '%s';%s/scripts/speak.sh '%s'>/dev/null 2>&1", + the_setup.ToplevelDir, + the_setup.ConfigDirectory.c_str(), + filename.c_str()); + system(command); + free(command); + readable(filename); // sets errno + err = errno; + } +#endif int nsize = filename.size(); const char *p; if (err==123456) diff --git a/mg_item_gd.c b/mg_item_gd.c index 83fe4ee..e6160c8 100644 --- a/mg_item_gd.c +++ b/mg_item_gd.c @@ -222,8 +222,9 @@ mgItemGd::getSourceFile(bool AbsolutePath,bool Silent) const continue; char *file; msprintf(&file,"%02d/%s",i,m_mp3file.c_str()); - if (readable(file)) { - m_mp3file = file; + string fstr = string(file); + if (readable(fstr)) { + m_mp3file = fstr; result = m_mp3file; } free(file); @@ -233,8 +234,14 @@ mgItemGd::getSourceFile(bool AbsolutePath,bool Silent) const } m_validated=true; if (result.empty()) { - if (!Silent) + if (!Silent) { analyze_failure(m_mp3file); + // in debug mode, analyze_failure might replace + // the missing file by a file which speaks the + // name of the missing file + if (readable(m_mp3file)) + return m_mp3file; + } m_valid = false; return m_mp3file; } |