summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-02 06:17:30 +0000
committerwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-02 06:17:30 +0000
commitc6f362cb7a66b20568ad0758b584c714174eeee5 (patch)
treeab0b91bee83d1f251143bc899cba80934ebd01e0
parent6e5ad94a123ba5441270b62e3f34677f61e65253 (diff)
downloadvdr-plugin-muggle-c6f362cb7a66b20568ad0758b584c714174eeee5.tar.gz
vdr-plugin-muggle-c6f362cb7a66b20568ad0758b584c714174eeee5.tar.bz2
mugglei -c also fills tables genre, language, musictype, source
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/branches/0.1.3-wr@527 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--Makefile3
-rw-r--r--mg_mysql.c62
-rw-r--r--mg_mysql.h1
-rwxr-xr-xscripts/languages.txt2
4 files changed, 66 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 9f0c401..79d5ac7 100644
--- a/Makefile
+++ b/Makefile
@@ -92,6 +92,9 @@ $(DEPFILE): Makefile
%.o: %.c %.h
$(CXX) $(CXXFLAGS) $(DEFINES) $(INCLUDES) -c $<
+mg_tables.h: scripts/genres.txt scripts/languages.txt scripts/musictypes.txt scripts/sources.txt
+ scripts/gentables
+
libvdr-$(PLUGIN).so: $(OBJS)
$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
@cp $@ $(LIBDIR)/$@.$(VDRVERSION)
diff --git a/mg_mysql.c b/mg_mysql.c
index 7664a8d..c21bb1d 100644
--- a/mg_mysql.c
+++ b/mg_mysql.c
@@ -246,6 +246,67 @@ mgmySql::exec_count( const string query)
return atol (get_col0 ( query).c_str ());
}
+struct genres_t {
+ char *id;
+ int id3genre;
+ char *name;
+};
+
+struct lang_t {
+ char *id;
+ char *name;
+};
+
+struct musictypes_t {
+ char *name;
+};
+
+struct sources_t {
+ char *name;
+};
+
+#include "mg_tables.h"
+void mgmySql::FillTables()
+{
+ int len = sizeof( genres ) / sizeof( genres_t );
+ for( int i=0; i < len; i ++ )
+ {
+ char b[600];
+ char id3genre[5];
+ if (genres[i].id3genre>=0)
+ sprintf(id3genre,"%d",genres[i].id3genre);
+ else
+ strcpy(id3genre,"NULL");
+ string genre = sql_string(genres[i].name);
+ sprintf(b,"INSERT INTO genre SET id='%s', id3genre=%s, genre=%s",
+ genres[i].id,id3genre,genre.c_str());
+ exec_sql(b);
+ }
+ len = sizeof( languages ) / sizeof( lang_t );
+ for( int i=0; i < len; i ++ )
+ {
+ char b[600];
+ sprintf(b,"INSERT INTO language SET id='%s', language='%s'",
+ languages[i].id,languages[i].name);
+ exec_sql(b);
+ }
+ len = sizeof( musictypes ) / sizeof( musictypes_t );
+ for( int i=0; i < len; i ++ )
+ {
+ char b[600];
+ sprintf(b,"INSERT INTO musictype SET musictype='%s'",
+ musictypes[i].name);
+ exec_sql(b);
+ }
+ len = sizeof( sources ) / sizeof( sources_t );
+ for( int i=0; i < len; i ++ )
+ {
+ char b[600];
+ sprintf(b,"INSERT INTO source SET source='%s'",
+ sources[i].name);
+ exec_sql(b);
+ }
+}
void mgmySql::Create()
{
@@ -258,6 +319,7 @@ void mgmySql::Create()
}
m_database_found=true;
Use();
+ FillTables();
}
string
diff --git a/mg_mysql.h b/mg_mysql.h
index de9eaf6..b5e5dec 100644
--- a/mg_mysql.h
+++ b/mg_mysql.h
@@ -61,6 +61,7 @@ class mgmySql
void Use();
//! \brief create database and tables
void Create();
+ void FillTables();
void CreateFolderFields();
private:
diff --git a/scripts/languages.txt b/scripts/languages.txt
index d623f6c..69ab08c 100755
--- a/scripts/languages.txt
+++ b/scripts/languages.txt
@@ -95,7 +95,6 @@ crh Crimean Turkish; Crimean Tatar
crp Creoles and pidgins (Other)
csb Kashubian
cus Cushitic (Other)
-cus Portuguese-based (Other)
cze Czech
dak Dakota
dan Danish
@@ -262,7 +261,6 @@ mao Maori
map Austronesian (Other)
mar Marathi
mas Masai
-mal Malay
mdf Moksha
mdr Mandar
men Mende