diff options
author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-04 07:30:45 +0000 |
---|---|---|
committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-04 07:30:45 +0000 |
commit | 50075887187e1801f3d3425f20a6b6127ffd7ff8 (patch) | |
tree | 3a562e2df3d9abdc76587dbb2acf2314c918deb8 | |
parent | 885c894656d26c246cc7757f3a29bf237b129227 (diff) | |
download | vdr-plugin-muggle-50075887187e1801f3d3425f20a6b6127ffd7ff8.tar.gz vdr-plugin-muggle-50075887187e1801f3d3425f20a6b6127ffd7ff8.tar.bz2 |
Added patch for using sockets and improved menu translations
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@199 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | TODO | 93 | ||||
-rw-r--r-- | gd_content_interface.c | 44 | ||||
-rw-r--r-- | i18n.c | 130 | ||||
-rw-r--r-- | mg_tools.h | 2 | ||||
-rw-r--r-- | muggle.c | 9 | ||||
-rw-r--r-- | muggle.doxygen | 2 | ||||
-rwxr-xr-x | mugglei.c | 40 | ||||
-rw-r--r-- | vdr_menu.c | 16 | ||||
-rw-r--r-- | vdr_setup.h | 7 |
11 files changed, 269 insertions, 81 deletions
@@ -56,8 +56,7 @@ LIBS = -lmad -lmysqlclient -lvorbisfile -lvorbis ### Targets: -all: libvdr-$(PLUGIN).so -# mugglei +all: libvdr-$(PLUGIN).so mugglei # Dependencies: @@ -78,7 +77,7 @@ libvdr-$(PLUGIN).so: $(OBJS) @cp $@ $(LIBDIR)/$@.$(VDRVERSION) mugglei: mg_tools.o mugglei.o - $(CXX) $(CXXFLAGS) $(LIBS) -ltag -o $@ $^ + $(CXX) $(CXXFLAGS) $^ $(LIBS) -ltag -o $@ dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @@ -122,7 +122,7 @@ Execute these commands on a single line, the \ for the linebreak ist just for pr echo "use GiantDisc; load data local infile 'musictypes.txt' into table language;" | \ mysql -u root --local-infile=1 - echo "use GiantDisc; load data local infile '$SCRIPTDIR/sources.txt' into table language;" | \ + echo "use GiantDisc; load data local infile 'sources.txt' into table language;" | \ mysql -u root --local-infile=1 \endverbatim @@ -11,55 +11,40 @@ \subsection bugs Bugs and testing needed - - Test execution of playlist commands - - Attach to graphlcd plugin via replay string - - Plugin crashes when selecting entries with special characters - - Escape query strings correctly - - Possible to resume play instead of restarting list from the beginning? - - Keep this? Test mgPCMPlayer::getSourceFile() for GD case (find) + - Test execution of playlist commands + - Attach to graphlcd plugin via replay string + - Possible to resume play instead of restarting list from the beginning? + - Keep this? Test mgPCMPlayer::getSourceFile() for GD case (find) + - Crashes in filter selections? + - Save on exit \subsection urgentosd OSD-related Issues - - Add play indicators - - mgPCMPlayer::GetIndex: obtain total length from database (DONE) - - Toggle display with Ok (off -> track info -> album info -> playlist info -> off) - - Display track info (use vdr 1.3.12 progress display) - - Song title - - Artist - - Genre - - Album - - Bitrate, channels, samplerate, format, ... - - Progress display - - Display album info - - Album name - - Artist - - Year - - No. Tracks - - Track names? - - Display playlist info - - Overall progress - - Next track(s) + - Instant play \subsection urgentcode Code polishing - - Clean up coding style and documentation in general - - Check for unnecessary log commands - - Generate HTML documentation using doxygen, - - use dotty/gv for state machines of player - - make available online - - Clean up mugglei (abstract code where possible) - - Check for memory leaks - - Why do filters use pointers? - - Check for (reasonably) consistent usage of char pointers and strings - - - mgDatabase is not used? - - should handle a static object with a MySQL connection - - execute queries? + - Clean up coding style and documentation in general + - Logging + - extend mgLog with static logging methods + - in DEBUG mode, issue logs, warnings, errors to stderr + - otherwise issue errors only to syslog + - Check for unnecessary log commands + - Generate HTML documentation using doxygen, + - use dotty/gv for state machines of player + - make available online + - Clean up mugglei (abstract code where possible) + - Check for memory leaks + - Why do filters use pointers? + - Check for (reasonably) consistent usage of char pointers and strings + - mgDatabase class is not used + - should handle a static object with a MySQL connection + - execute queries + - escape query strings - mgPlayer used what for? - - Could save IP/host name and associate last playlist loaded + - Could save IP/host name and associate last playlist/index loaded - \subsection urgentcontent Content handling - + \subsection urgentcontent Content handling - Think, whether type (mp3, ogg, flac) should be stored in database - could be used in searching/structuring as well - Handle loop mode in mgPlaylist (already done?) @@ -157,6 +142,25 @@ - Type numbers to enter characters and jump to first title accordingly - Check whether submenus (as implemented in VDR) are more suitable - do not permit jumping to arbitrary menus though + - Add play indicators + - mgPCMPlayer::GetIndex: obtain total length from database (DONE) + - Toggle display with Ok (off -> track info -> album info -> playlist info -> off) + - Display track info (use vdr 1.3.12 progress display) + - Song title + - Artist + - Genre + - Album + - Bitrate, channels, samplerate, format, ... + - Progress display + - Display album info + - Album name + - Artist + - Year + - No. Tracks + - Track names? + - Display playlist info + - Overall progress + - Next track(s) \subsection midcontent Content issues @@ -231,7 +235,7 @@ - mgPCMPlayer::getSourceFile moved to abstract data layer (mgContentItem) and made concrete in subclasses (mgGdTrack) - mgDecoders::findDecoder: extend decoder detection - - Check compatibility for 1.3.12 (DONE) + - Check compatibility for 1.3.12 (DONE) - Test Save/Rename/Load of playlist (DONE) - Plugin crashes when deleting playlist while playing - should stop playing immediately @@ -241,5 +245,8 @@ - Playlist indexing not correct - Player jumps e.g. from track 1 to track 3 - Make sure jumping beyond the end of the list is not permitted - + - Plugin crashes when selecting entries with special characters + - Escape query strings correctly + - should go into gd_content_interface.c (row[] in lines 1175,1179,1882)? + - Simple progress indicator for 1.3.12 */
\ No newline at end of file diff --git a/gd_content_interface.c b/gd_content_interface.c index f609990..4537b21 100644 --- a/gd_content_interface.c +++ b/gd_content_interface.c @@ -45,17 +45,41 @@ int GdInitDatabase( MYSQL *db ) { return -1; } - - if( mysql_real_connect( db, - the_setup.DbHost, - the_setup.DbUser, - the_setup.DbPass, - the_setup.DbName, - the_setup.DbPort, - NULL, 0 ) == NULL ) + + if (the_setup.DbSocket != NULL) { - return -2; - } + mgDebug(1,"Using sockets for connecting to Database."); + + //mgDebug(3,"Socket is: '%s'",the_setup.DbSocket); + //mgDebug(3,"DbUser is: '%s'",the_setup.DbUser); + //mgDebug(3,"DbPassword is: '%s'",the_setup.DbPass); + + if( mysql_real_connect( db, + "", + the_setup.DbUser, + the_setup.DbPass, + the_setup.DbName, + 0, + the_setup.DbSocket, 0 ) == NULL ) + { + return -2; + } // if mysql_real_connect + } //if DbSocket + else + { + mgDebug(1,"Using TCP-host for connecting to Database."); + if( mysql_real_connect( db, + the_setup.DbHost, + the_setup.DbUser, + the_setup.DbPass, + the_setup.DbName, + the_setup.DbPort, + "", 0 ) == NULL ) + { + return -2; + } // if mysql_real_connect + } // else (if DbSocket) + return 0; } @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: i18n.c,v 1.6 2004/05/28 15:29:18 lvw Exp $ + * $Id$ */ #include "i18n.h" @@ -618,5 +618,133 @@ const tI18nPhrase Phrases[] = { "",// TODO "",// TODO }, + { "%d tracks sent to current playlist", + "%d Titel in aktuelle Playlist?", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Load playlist", + "Playliste laden", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Save playlist", + "Playliste speichern", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Rename playlist", + "Playliste umbenennen", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Clear playlist", + "Playliste leeren", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Remove entry from list", + "Eintrag aus der Playliste entfernen", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "Export playlist", + "Playliste exportieren", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, + { "External playlist commands", + "Externe Playlist-Kommandos", + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + "",// TODO + }, { NULL } }; @@ -15,7 +15,7 @@ #include <iostream> #include <string> -#include <mysql/mysql.h> +#include <mysql.h> #define STANDALONE 1 // what's this? @@ -49,6 +49,7 @@ mgMuggle::mgMuggle(void) { // defaults for database arguments the_setup.DbHost = strdup ("localhost"); + the_setup.DbSocket = NULL; the_setup.DbPort = 0; the_setup.DbName = strdup ("GiantDisc"); the_setup.DbUser = strdup (""); @@ -67,6 +68,7 @@ const char *mgMuggle::CommandLineHelp(void) // Return a string that describes all known command line options. return " -h HHHH, --host=HHHH specify database host (default is localhost)\n" + " -s SSSS --socket=PATH specify database socket (default is TCP connection)\n" " -n NNNN, --name=NNNN specify database name (overridden by -g)\n" " -p PPPP, --port=PPPP specify port of database server (default is )\n" " -u UUUU, --user=UUUU specify database user (default is )\n" @@ -83,6 +85,7 @@ bool mgMuggle::ProcessArgs(int argc, char *argv[]) static struct option long_options[] = { { "host", required_argument, NULL, 'h' }, + { "socket", required_argument, NULL, 's' }, { "name", required_argument, NULL, 'n' }, { "port", required_argument, NULL, 'p' }, { "user", required_argument, NULL, 'u' }, @@ -93,7 +96,7 @@ bool mgMuggle::ProcessArgs(int argc, char *argv[]) }; int c, option_index = 0; - while( ( c = getopt_long( argc, argv, "gh:n:p:t:u:w:", long_options, &option_index ) ) != -1 ) + while( ( c = getopt_long( argc, argv, "gh:s:n:p:t:u:w:", long_options, &option_index ) ) != -1 ) { switch (c) { @@ -101,6 +104,10 @@ bool mgMuggle::ProcessArgs(int argc, char *argv[]) { the_setup.DbHost = strcpyrealloc (the_setup.DbHost, optarg); } break; + case 's': + { + the_setup.DbSocket = strcpyrealloc (the_setup.DbSocket, optarg); + } break; case 'n': { the_setup.DbName = strcpyrealloc (the_setup.DbName, optarg); diff --git a/muggle.doxygen b/muggle.doxygen index c5796c6..3459584 100644 --- a/muggle.doxygen +++ b/muggle.doxygen @@ -23,7 +23,7 @@ PROJECT_NAME = Muggle media plugin # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.0.2 +PROJECT_NUMBER = 0.0.4 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -12,9 +12,7 @@ using namespace std; #include <stdio.h> #include <sys/stat.h> #include <sys/time.h> - #include <mysql/mysql.h> - #include <getopt.h> #include <tag.h> @@ -24,21 +22,38 @@ using namespace std; MYSQL *db; -string host, user, pass, dbname; +string host, user, pass, dbname, socket; bool import_assorted; int init_database() { - db = mysql_init(NULL); + db = mysql_init(0); // NULL? + if( db == NULL ) { + cout << "mysql_init failed." << endl; return -1; } - - if( mysql_real_connect( db, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), - 0, NULL, 0 ) == NULL ) + + // check for use of sockets + if( socket != "" ) + { + if( mysql_real_connect( db, NULL, user.c_str(), pass.c_str(), dbname.c_str(), + 0, socket.c_str(), 0 ) == NULL ) + + { + cout << "mysql_real_connect using sockets failed." << endl; + return -2; + } + } + else { - return -2; + if( mysql_real_connect( db, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), + 0, NULL, 0 ) == NULL ) + { + cout << "mysql_real_connect via TCP failed." << endl; + return -2; + } } return 0; @@ -288,6 +303,7 @@ int main( int argc, char *argv[] ) cout << "" << endl; cout << "Options:" << endl; cout << " -h <hostname> - specify host of mySql database server (default is 'localhost')" << endl; + cout << " -s <socket> - specify a socket for mySQL communication (default is TCP)" << endl; cout << " -n <database> - specify database name (default is 'GiantDisc')" << endl; cout << " -u <username> - specify user of mySql database (default is empty)" << endl; cout << " -p <password> - specify password of user (default is empty password)" << endl; @@ -302,12 +318,13 @@ int main( int argc, char *argv[] ) dbname = "GiantDisc"; user = ""; pass = ""; + socket = ""; import_assorted = false; // parse command line options while( 1 ) { - int c = getopt(argc, argv, "h:u:p:n:af:"); + int c = getopt(argc, argv, "h:u:p:n:af:s:"); if (c == -1) break; @@ -342,6 +359,10 @@ int main( int argc, char *argv[] ) { filename = optarg; } break; + case 's': + { + socket = optarg; + } break; } } @@ -353,6 +374,7 @@ int main( int argc, char *argv[] ) int res = init_database(); + if( !res ) { update_db( 0, filename ); @@ -161,7 +161,7 @@ eOSState mgMainMenu::ProcessKey(eKeys key) { char *buffer = 0; - asprintf( &buffer, "%d tracks sent to current playlist", (int) tracks->size() ); + asprintf( &buffer, tr("%d tracks sent to current playlist"), (int) tracks->size() ); m_current_playlist->appendList(tracks); #if VDRVERSNUM >= 10307 Skins.Message(mtInfo,buffer); @@ -668,16 +668,16 @@ void mgMainMenu::DisplayPlaylistSubmenu() SetTitle( "Muggle - Playlist View Commands" ); // Add items - Add( new cOsdItem( "Load playlist" ) ); - Add( new cOsdItem( "Save playlist" ) ); - Add( new cOsdItem( "Rename playlist" ) ); - Add( new cOsdItem( "Clear playlist" ) ); - Add( new cOsdItem( "Remove entry from list" ) ); - Add( new cOsdItem( "Export playlist" ) ); + Add( new cOsdItem( tr("Load playlist" ) ) ); + Add( new cOsdItem( tr("Save playlist" ) ) ); + Add( new cOsdItem( tr("Rename playlist" ) ) ); + Add( new cOsdItem( tr("Clear playlist" ) ) ); + Add( new cOsdItem( tr("Remove entry from list" ) ) ); + Add( new cOsdItem( tr("Export playlist" ) ) ); if( m_playlist_commands ) { - Add( new cOsdItem( "External playlist commands" ) ); + Add( new cOsdItem( tr("External playlist commands" ) ) ); } Display(); diff --git a/vdr_setup.h b/vdr_setup.h index a77cf75..5750146 100644 --- a/vdr_setup.h +++ b/vdr_setup.h @@ -3,11 +3,11 @@ * \brief A setup class for a VDR media plugin (muggle) * * \version $Revision: 1.2 $ - * \date $Date: 2004/05/28 15:29:19 $ + * \date $Date$ * \author Ralf Klueber, Lars von Wedel, Andreas Kellner - * \author Responsible author: $Author: lvw $ + * \author Responsible author: $Author$ * - * $Id: vdr_setup.h,v 1.2 2004/05/28 15:29:19 lvw Exp $ + * $Id$ * * Adapted from * MP3/MPlayer plugin to VDR (C++) @@ -44,6 +44,7 @@ public: int Only48kHz; char *DbHost; + char *DbSocket; char *DbName; char *DbUser; char *DbPass; |