FXint GMTagUpdateTask::run() { try { GMTrack info; GMTaskTransaction transaction(database); for (FXival i=0;i<tracks.no() && processing;i++) { if (database->interrupt) transaction.pause(); if (!database->getTrack(tracks[i],info)) { break; } taskmanager->setStatus(FXString::value("Writing Tags %ld/%ld..",i+1,tracks.no())); info.saveTag(info.url); database->setTrackImported(tracks[i],FXThread::time()); } transaction.commit(); } catch(GMDatabaseException&) { return 1; } return 0; }
FXint GMUpdateTask::run() { try { for (FXival i=0;i<tracks.no() && processing;i++) { taskmanager->setStatus(FXString::value("Writing Tags %ld/%ld..",i+1,tracks.no())); tracks[i].saveTag(tracks[i].url); database->beginTask(); database->setTrackImported(ids[i],FXThread::time()); database->commitTask(); } } catch(GMDatabaseException&) { database->rollbackTask(); return 1; } return 0; }
FXint GMRenameTask::run() { try { for (FXint i=0;i<from.no() && processing;i++) { if (to[i].empty()) continue; if (!FXDir::createDirectories(FXPath::directory(to[i]))) continue; if (FXStat::exists(to[i])) continue; if (FXFile::moveFiles(from[i],to[i])){ database->setTrackFilename(tracks[i],to[i]); } } } catch(GMDatabaseException&) { GM_DEBUG_PRINT("Database Exception\n"); } return 0; }