Ticket #939: svn.diff
File svn.diff, 4.9 KB (added by , 18 years ago) |
---|
-
mythmusic/mythmusic/cdrip.h
44 44 static QString fixFileToken(QString token); 45 45 void handleFileTokens(QString &filename, Metadata *track); 46 46 void ejectCD(QString &cddev); 47 47 bool isTuneInDB(QString &artist, QString &album, QString &title); 48 48 QVBoxLayout *bigvb; 49 49 QFrame *firstdiag; 50 50 -
mythmusic/mythmusic/globalsettings.cpp
107 107 return gc; 108 108 }; 109 109 110 static HostCheckBox *OnlyImportNewMusic() 111 { 112 HostCheckBox *gc = new HostCheckBox("OnlyImportNewMusic"); 113 gc->setLabel(QObject::tr("Only Import new music.")); 114 gc->setValue(true); 115 gc->setHelpText(QObject::tr("Checks the databasse for duplicates when importing/riping CDs.")); 116 return gc; 117 }; 118 110 119 static HostCheckBox *AutoLookupCD() 111 120 { 112 121 HostCheckBox *gc = new HostCheckBox("AutoLookupCD"); … … 592 601 rippersettings->addChild(NoWhitespace()); 593 602 rippersettings->addChild(PostCDRipScript()); 594 603 rippersettings->addChild(EjectCD()); 604 rippersettings->addChild(OnlyImportNewMusic()); 595 605 addChild(rippersettings); 596 606 597 607 VerticalConfigurationGroup* encodersettings = new VerticalConfigurationGroup(false); -
mythmusic/mythmusic/cdrip.cpp
161 161 bool iscompilation = false; 162 162 163 163 CdDecoder *decoder = new CdDecoder("cda", NULL, NULL, NULL); 164 164 bool newTune = true; 165 int row = 0; 165 166 if (decoder) 166 167 { 167 168 168 int row = 0;169 169 QString label; 170 170 int length, min, sec; 171 171 Metadata *track; … … 195 195 } 196 196 197 197 length = track->Length() / 1000; 198 min = length / 60; 199 sec = length % 60; 198 199 QString title = track->Title(); 200 newTune = isTuneInDB(artistname, albumname, title); 201 202 if (newTune) 203 { 204 min = length / 60; 205 sec = length % 60; 206 207 table->setNumRows(row + 1); 200 208 201 table->setNumRows(row + 1); 209 table->setRowHeight(row, (int)(30 * hmult)); 210 211 label.sprintf("%d", trackno + 1); 212 table->setText(row, 0, label); 213 214 table->setText(row, 1, track->Title()); 215 216 table->setText(row, 2, track->Artist()); 217 218 label.sprintf("%02d:%02d", min, sec); 219 table->setText(row, 3, label); 202 220 203 table->setRowHeight(row, (int)(30 * hmult)); 204 205 label.sprintf("%d", trackno + 1); 206 table->setText(row, 0, label); 207 208 table->setText(row, 1, track->Title()); 209 210 table->setText(row, 2, track->Artist()); 211 212 label.sprintf("%02d:%02d", min, sec); 213 table->setText(row, 3, label); 214 215 row++; 221 row++; 222 } 216 223 delete track; 217 224 } 218 225 } … … 262 269 MythPushButton *ripit = new MythPushButton(tr("Import this CD"), firstdiag); 263 270 ripit->setFocus (); 264 271 vbox->addWidget(ripit); 265 266 connect(ripit, SIGNAL(clicked()), this, SLOT(ripthedisc())); 272 if (row != 0) 273 { 274 connect(ripit, SIGNAL(clicked()), this, SLOT(ripthedisc())); 275 } 267 276 } 268 277 269 278 Ripper::~Ripper(void) 270 279 { 271 280 } 272 281 282 bool Ripper::isTuneInDB(QString& artist, QString& album, QString& title) 283 { 284 if (gContext->GetNumSetting("OnlyImportNewMusic",1)) 285 { 286 MSqlQuery query(MSqlQuery::InitCon()); 287 QString queryString("SELECT filename, artist, album, title, intid " 288 "FROM musicmetadata WHERE artist REGEXP \'"); 289 QString token = artist; 290 token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"), QString(".")); 291 292 queryString += token + "\' AND " + "album REGEXP \'"; 293 token = album; 294 token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"), QString(".")); 295 queryString += token + "\' AND " + "title REGEXP \'"; 296 token = title; 297 token.replace(QRegExp("(/|\\\\|:|\'|\\,|\\!|\\(|\\)|\"|\\?|\\|)"), QString(".")); 298 queryString += token + "\' ORDER BY artist, album, title, intid, filename"; 299 query.prepare(queryString); 300 301 bool has_entries = true; 302 if (!query.exec() || !query.isActive()) 303 { 304 MythContext::DBError("Search music database", query); 305 has_entries = false; 306 } 307 if (query.numRowsAffected() > 0) 308 { 309 return false; 310 } 311 } 312 return true; 313 } 314 315 273 316 QSizePolicy Ripper::sizePolicy(void) 274 317 { 275 318 return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);