bool NARWorker::renameDirectory(QString &path, QString &baseWorkingDir) { if (!QFileInfo(path).isDir()) { log(QString("ERROR: the given string is not a dir: %1").arg(path)); return false; } QDir directory(path); QFileInfoList list = directory.entryInfoList(); foreach (QFileInfo fInfo, list) { if (fInfo.isDir()) { if (fInfo.fileName().startsWith(".")) continue; else { // if extracted dir starts with www.new..., rename! QString albumDirName = fInfo.fileName(); albumDirName.replace("www.NewAlbumReleases.net ","", Qt::CaseInsensitive); albumDirName.replace("www.NewAlbumReleases.net_","", Qt::CaseInsensitive); albumDirName.replace(QRegExp("\\(([0-9]{4})\\)"), "- \\1"); QString albumPath(fInfo.path() + "/" + albumDirName); directory.rename(fInfo.absoluteFilePath(), albumPath); renameDirectoryContent(albumPath); directory.rename(albumDirName, baseWorkingDir + albumDirName); } } } log("Finished <b>rename</b>"); return true; }
QString PAlbum::prettyUrl() const { QString u = i18n("My Albums") + albumPath(); return u; }
DatabaseUrl PAlbum::databaseUrl() const { return DatabaseUrl::fromAlbumAndName(QString(), albumPath(), albumRootPath(), m_albumRootId); }