summaryrefslogtreecommitdiff
path: root/muggle-plugin/mugglei.c
diff options
context:
space:
mode:
authorlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-09-28 13:08:14 +0000
committerlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-09-28 13:08:14 +0000
commite26a817c9cd81e767dd5e34417921e11c274f723 (patch)
treeacff6def065f6e42ebcf633eb521f4d89c2d0d46 /muggle-plugin/mugglei.c
parentc4d2c11bf9a89765d252d2851059610e858aa640 (diff)
downloadvdr-plugin-muggle-e26a817c9cd81e767dd5e34417921e11c274f723.tar.gz
vdr-plugin-muggle-e26a817c9cd81e767dd5e34417921e11c274f723.tar.bz2
Formatting and documentation issues
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk@190 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/mugglei.c')
-rwxr-xr-xmuggle-plugin/mugglei.c63
1 files changed, 39 insertions, 24 deletions
diff --git a/muggle-plugin/mugglei.c b/muggle-plugin/mugglei.c
index c7206bd..4d8477b 100755
--- a/muggle-plugin/mugglei.c
+++ b/muggle-plugin/mugglei.c
@@ -1,3 +1,9 @@
+/*!
+ * \file mugglei.c
+ * \brief implement a small utility for importing files
+ *
+ * \author Lars von Wedel
+ */
#include <string>
using namespace std;
@@ -176,10 +182,18 @@ void update_db( long uid, string filename )
if( import_assorted )
{ // in this case, the album author is "Various Artists"
- mgSqlWriteQuery( db, "INSERT INTO album (artist,title,cddbid) VALUES (\"Various Artists\", \"%s\", \"%s\")", album.toCString(), cddbid.toCString() ); }
+ mgSqlWriteQuery( db,
+ "INSERT INTO album (artist,title,cddbid) "
+ "VALUES (\"Various Artists\", \"%s\", \"%s\")",
+ album.toCString(), cddbid.toCString() );
+ }
else
{
- mgSqlWriteQuery( db, "INSERT INTO album (artist,title,cddbid) VALUES (\"%s\", \"%s\", \"%s\")", artist.toCString(), album.toCString(), cddbid.toCString() ); }
+ mgSqlWriteQuery( db,
+ "INSERT INTO album (artist,title,cddbid) "
+ "VALUES (\"%s\", \"%s\", \"%s\")",
+ artist.toCString(), album.toCString(), cddbid.toCString() );
+ }
}
else
{ // use first album found as source id for the track
@@ -187,34 +201,35 @@ void update_db( long uid, string filename )
}
}
- // update tracks table
+ // update tracks table
if( uid > 0 )
{ // the entry is known to exist already, hence update it
-
+
mgSqlWriteQuery( db, "UPDATE tracks SET artist=\"%s\", title=\"%s\", year=\"%s\","
- "sourceid=\"%s\", mp3file=\"%s\", length=%d, bitrate=\"%d\","
- "samplerate=%d, channels=%d WHERE id=%d",
- artist.toCString(), title.toCString(), year,
- cddbid.toCString(), filename.c_str(), len, bitrate,
- sample, channels, uid );
+ "sourceid=\"%s\", mp3file=\"%s\", length=%d, bitrate=\"%d\","
+ "samplerate=%d, channels=%d WHERE id=%d",
+ artist.toCString(), title.toCString(), year,
+ cddbid.toCString(), filename.c_str(), len, bitrate,
+ sample, channels, uid );
}
else
{ // the entry does not exist, create it
- mgSqlWriteQuery( db,"INSERT INTO tracks (artist,title,genre1,genre2,year,"
- "sourceid,tracknb,mp3file,length,bitrate,samplerate,channels)"
- " VALUES (\"%s\", \"%s\", \"\", \"\", %d, \"%s\", %d, \"%s\", %d, \"%d\", %d, %d)",
- artist.toCString(), title.toCString(), year, cddbid.toCString(),
- trackno, filename.c_str(), len, bitrate, sample, channels );
- /*
- cout << "-- TAG --" << endl;
- cout << "title - \"" << tag->title() << "\"" << endl;
- cout << "artist - \"" << tag->artist() << "\"" << endl;
- cout << "album - \"" << tag->album() << "\"" << endl;
- cout << "year - \"" << tag->year() << "\"" << endl;
- cout << "comment - \"" << tag->comment() << "\"" << endl;
- cout << "track - \"" << tag->track() << "\"" << endl;
- cout << "genre - \"" << tag->genre() << "\"" << endl;
- */
+ mgSqlWriteQuery( db,"INSERT INTO tracks (artist,title,genre1,genre2,year,"
+ "sourceid,tracknb,mp3file,length,bitrate,samplerate,channels)"
+ " VALUES (\"%s\", \"%s\", \"\", \"\", %d, \"%s\", %d, \"%s\", %d, \"%d\", %d, %d)",
+ artist.toCString(), title.toCString(), year, cddbid.toCString(),
+ trackno, filename.c_str(), len, bitrate, sample, channels );
+
+#ifdef VERBOSE
+ cout << "-- TAG --" << endl;
+ cout << "title - \"" << tag->title() << "\"" << endl;
+ cout << "artist - \"" << tag->artist() << "\"" << endl;
+ cout << "album - \"" << tag->album() << "\"" << endl;
+ cout << "year - \"" << tag->year() << "\"" << endl;
+ cout << "comment - \"" << tag->comment() << "\"" << endl;
+ cout << "track - \"" << tag->track() << "\"" << endl;
+ cout << "genre - \"" << tag->genre() << "\"" << endl;
+#endif
}
}
}