Mercurial > hg > audiodb
comparison 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 |
comparison
equal
deleted
inserted
replaced
333:cc3f9d1ca2cd | 334:100cf66a5825 |
---|---|
84 else if(O2_ACTION(COM_POWER)) | 84 else if(O2_ACTION(COM_POWER)) |
85 power_flag(dbName); | 85 power_flag(dbName); |
86 | 86 |
87 else if(O2_ACTION(COM_DUMP)) | 87 else if(O2_ACTION(COM_DUMP)) |
88 dump(dbName); | 88 dump(dbName); |
89 | |
90 else if(O2_ACTION(COM_LISZT)) | |
91 if(isClient) | |
92 ws_liszt(dbName, (char*) hostport); | |
93 else | |
94 liszt(dbName, lisztOffset, lisztLength); | |
89 | 95 |
90 else if(O2_ACTION(COM_INDEX)) | 96 else if(O2_ACTION(COM_INDEX)) |
91 index_index_db(dbName); | 97 index_index_db(dbName); |
92 | 98 |
93 else | 99 else |
122 prefix_name((char** const)&dbName, adb_root); | 128 prefix_name((char** const)&dbName, adb_root); |
123 if(inFile && adb_feature_root) | 129 if(inFile && adb_feature_root) |
124 prefix_name((char** const)&inFile, adb_feature_root); | 130 prefix_name((char** const)&inFile, adb_feature_root); |
125 assert(O2_ACTION(COM_STATUS)); | 131 assert(O2_ACTION(COM_STATUS)); |
126 status(dbName, adbStatusResponse); | 132 status(dbName, adbStatusResponse); |
133 } catch(char *err) { | |
134 cleanup(); | |
135 throw(err); | |
136 } | |
137 } | |
138 | |
139 audioDB::audioDB(const unsigned argc, char* const argv[], adb__lisztResponse *adbLisztResponse): O2_AUDIODB_INITIALIZERS | |
140 { | |
141 try { | |
142 isServer = 1; // FIXME: Hack | |
143 processArgs(argc, argv); | |
144 // Perform database prefix substitution | |
145 if(dbName && adb_root) | |
146 prefix_name((char** const)&dbName, adb_root); | |
147 assert(O2_ACTION(COM_LISZT)); | |
148 liszt(dbName, lisztOffset, lisztLength, adbLisztResponse); | |
127 } catch(char *err) { | 149 } catch(char *err) { |
128 cleanup(); | 150 cleanup(); |
129 throw(err); | 151 throw(err); |
130 } | 152 } |
131 } | 153 } |
544 if(trackNN < 1 || trackNN > O2_MAXNN) { | 566 if(trackNN < 1 || trackNN > O2_MAXNN) { |
545 error("resultlength out of range: 1 <= resultlength <= 1000000"); | 567 error("resultlength out of range: 1 <= resultlength <= 1000000"); |
546 } | 568 } |
547 return 0; | 569 return 0; |
548 } | 570 } |
571 | |
572 if(args_info.LISZT_given){ | |
573 command = COM_LISZT; | |
574 dbName=args_info.database_arg; | |
575 lisztOffset = args_info.lisztOffset_arg; | |
576 lisztLength = args_info.lisztLength_arg; | |
577 if(args_info.lisztOffset_arg<0) // check upper bound later when database is opened | |
578 error("lisztOffset cannot be negative"); | |
579 if(args_info.lisztLength_arg<0) | |
580 error("lisztLength cannot be negative"); | |
581 if(lisztLength >1000000) | |
582 error("lisztLength too large (>1000000)"); | |
583 return 0; | |
584 } | |
585 | |
549 return -1; // no command found | 586 return -1; // no command found |
550 } | 587 } |
551 | 588 |
552 void audioDB::status(const char* dbName, adb__statusResponse *adbStatusResponse){ | 589 void audioDB::status(const char* dbName, adb__statusResponse *adbStatusResponse){ |
553 if(!dbH) | 590 if(!dbH) |