summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--menu.c29
-rw-r--r--tools/playlist.c36
2 files changed, 63 insertions, 2 deletions
diff --git a/menu.c b/menu.c
index 20260130..896d2897 100644
--- a/menu.c
+++ b/menu.c
@@ -4,12 +4,16 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c,v 1.52 2008-03-16 22:53:23 phintuka Exp $
+ * $Id: menu.c,v 1.53 2008-04-03 15:11:25 phelin Exp $
*
*/
#include <dirent.h>
+#ifdef HAVE_EXTRACTOR_H
+# include <extractor.h>
+#endif
+
#include <vdr/config.h>
#include <vdr/interface.h>
#include <vdr/menu.h>
@@ -329,6 +333,28 @@ eOSState cMenuBrowseFiles::Open(bool ForceOpen, bool Parent, bool Queue)
eOSState cMenuBrowseFiles::Info(void)
{
if(GetCurrent() && !GetCurrent()->IsDir()) {
+#ifdef HAVE_EXTRACTOR_H
+ cString filename = cString::sprintf("%s/%s", m_CurrentDir, GetCurrent()->Name());
+ EXTRACTOR_ExtractorList * plugins;
+ EXTRACTOR_KeywordList * md_list;
+ plugins = EXTRACTOR_loadDefaultLibraries();
+ md_list = EXTRACTOR_getKeywords(plugins, *filename);
+ const char *key;
+ char * buf;
+ char metadata[4096];
+ strcpy(metadata, "");
+ while(md_list) {
+ if((key=EXTRACTOR_getKeywordTypeAsString(md_list->keywordType))) {
+ buf = strdup(md_list->keyword);
+ sprintf(metadata, "%s%s: %s\n", metadata, key, buf);
+ free(buf);
+ }
+ md_list=md_list->next;
+ }
+ EXTRACTOR_freeKeywords(md_list);
+ EXTRACTOR_removeAll(plugins); /* unload plugins */
+ return AddSubMenu(new cMenuText(GetCurrent()->Name(), metadata));
+#else
cString cmd = cString::sprintf("'%s/%s'", m_CurrentDir, GetCurrent()->Name());
if(xc.IsPlaylistFile(GetCurrent()->Name()))
cmd = cString::sprintf("file -b %s; cat %s", *cmd, *cmd);
@@ -351,6 +377,7 @@ eOSState cMenuBrowseFiles::Info(void)
return AddSubMenu(new cMenuText(GetCurrent()->Name(), buf));
}
}
+#endif
}
return osContinue;
diff --git a/tools/playlist.c b/tools/playlist.c
index bba19a82..9f4c85c3 100644
--- a/tools/playlist.c
+++ b/tools/playlist.c
@@ -4,12 +4,21 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: playlist.c,v 1.16 2008-02-19 04:51:18 phintuka Exp $
+ * $Id: playlist.c,v 1.17 2008-04-03 15:11:26 phelin Exp $
*
*/
#include <stdlib.h>
+#ifdef HAVE_EXTRACTOR_H
+# include <extractor.h>
+ // libextractor 0.5.20 (2008-03-20) adds support for track numbers
+# if EXTRACTOR_VERSION < 0x00052000
+# warning libextractor version too old (0.5.20 required for track numbers)
+# undef HAVE_EXTRACTOR_H
+# endif
+#endif
+
#include <vdr/config.h>
#include <vdr/tools.h>
#include <vdr/thread.h>
@@ -98,6 +107,7 @@ int cPlaylistItem::Compare(const cListObject &ListObject) const
// cID3Scanner
//
+#ifndef HAVE_EXTRACTOR_H
static const char *shell_escape(char *buf, int buflen, const cString& src, char ch)
{
const char *pt = *src;
@@ -115,6 +125,7 @@ static const char *shell_escape(char *buf, int buflen, const cString& src, char
}
return "";
}
+#endif
class cID3Scanner : public cThread
{
@@ -150,6 +161,28 @@ class cID3Scanner : public cThread
if(xc.IsAudioFile(Item->Filename)) {
LOGDBG("Scanning metainfo for file %s", *Item->Filename);
+#ifdef HAVE_EXTRACTOR_H
+ EXTRACTOR_ExtractorList * plugins;
+ EXTRACTOR_KeywordList * md_list;
+ plugins = EXTRACTOR_loadDefaultLibraries();
+ md_list = EXTRACTOR_getKeywords(plugins, *Item->Filename);
+ const char *key;
+ while(md_list) {
+ if ((key=EXTRACTOR_getKeywordTypeAsString(md_list->keywordType))) {
+ if (!strcasecmp(key,"title"))
+ Item->Title = strdup(md_list->keyword);
+ else if (!strcasecmp(key,"artist"))
+ Item->Artist = strdup(md_list->keyword);
+ else if (!strcasecmp(key,"album"))
+ Item->Album = strdup(md_list->keyword);
+ else if (!strcasecmp(key,"track number"))
+ Item->Tracknumber = cString::sprintf("%s%s", strlen(md_list->keyword) == 1 ? "0" : "", md_list->keyword);
+ md_list=md_list->next;
+ }
+ }
+ EXTRACTOR_freeKeywords(md_list);
+ EXTRACTOR_removeAll(plugins); /* unload plugins */
+#else
char buf[4096];
cString Cmd = "";
if(!strcasecmp((Item->Filename) + strlen(Item->Filename) - 5, ".flac"))
@@ -184,6 +217,7 @@ class cID3Scanner : public cThread
Item->Tracknumber = cString::sprintf("%s%s", strlen(pt) == 13 ? "0" : "", (pt+12));
}
}
+#endif
}
}
LOGDBG("ID3Scanner Done.");