Mercurial > hg > audiodb
diff audioDB.cpp @ 334:100cf66a5825
Added command-line and WS methods to (LI)st key-(S)trings and si(Z)es of (T)racks --LISZT --lisztOffset offset --lisztLength len
author | mas01mc |
---|---|
date | Tue, 02 Sep 2008 16:16:59 +0000 |
parents | a0493f861531 |
children | ccf15a8c3e46 |
line wrap: on
line diff
--- a/audioDB.cpp Mon Sep 01 15:35:05 2008 +0000 +++ b/audioDB.cpp Tue Sep 02 16:16:59 2008 +0000 @@ -87,6 +87,12 @@ else if(O2_ACTION(COM_DUMP)) dump(dbName); + else if(O2_ACTION(COM_LISZT)) + if(isClient) + ws_liszt(dbName, (char*) hostport); + else + liszt(dbName, lisztOffset, lisztLength); + else if(O2_ACTION(COM_INDEX)) index_index_db(dbName); @@ -130,6 +136,22 @@ } } +audioDB::audioDB(const unsigned argc, char* const argv[], adb__lisztResponse *adbLisztResponse): O2_AUDIODB_INITIALIZERS +{ + try { + isServer = 1; // FIXME: Hack + processArgs(argc, argv); + // Perform database prefix substitution + if(dbName && adb_root) + prefix_name((char** const)&dbName, adb_root); + assert(O2_ACTION(COM_LISZT)); + liszt(dbName, lisztOffset, lisztLength, adbLisztResponse); + } catch(char *err) { + cleanup(); + throw(err); + } +} + void audioDB::cleanup() { cmdline_parser_free(&args_info); if(indata) @@ -546,6 +568,21 @@ } return 0; } + + if(args_info.LISZT_given){ + command = COM_LISZT; + dbName=args_info.database_arg; + lisztOffset = args_info.lisztOffset_arg; + lisztLength = args_info.lisztLength_arg; + if(args_info.lisztOffset_arg<0) // check upper bound later when database is opened + error("lisztOffset cannot be negative"); + if(args_info.lisztLength_arg<0) + error("lisztLength cannot be negative"); + if(lisztLength >1000000) + error("lisztLength too large (>1000000)"); + return 0; + } + return -1; // no command found }