diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 5397f1b4..a2de87c4 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -3031,72 +3031,72 @@ - + The source audio file could not be found: - + The source audio file could not be opened for reading: - + The target output directory doesn't exist and could NOT be created: - + The target output directory is NOT writable: - + Failed to generate non-existing target file name! - + Unknown File Name - + Unknown Title - + Unknown Artist - + Unknown Album - + Unknown Comment - + Target output file already exists, going to skip this file: - + If you don't want existing files to be skipped, please change the overwrite mode! - + Target output file already exists, going to delete existing file: - + Failed to delete existing target file, will save to another file name! diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index e9186b86..9ed6b296 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -3024,52 +3024,52 @@ Dekodiere - + The source audio file could not be found: Die Quell-Audiodatei konnte nicht gefunden werden: - + The source audio file could not be opened for reading: Die Quell-Audiodatei konnte nicht zum Lesen geöffnet werden: - + The target output directory doesn't exist and could NOT be created: Das Zielverzeichnis existiert nicht und konnte nicht erstellt werden: - + The target output directory is NOT writable: In das Zielverzeichnis kann nicht geschrieben werden: - + Failed to generate non-existing target file name! Ausgabe-Dateiname konnte nicht generiert werden! - + Unknown File Name Unbekannter Dateiname - + Unknown Title Unbekannter Titel - + Unknown Artist Unbekannter Künstler - + Unknown Album Unbekanntes Album - + Unknown Comment Unbekannter Kommentar @@ -3090,22 +3090,22 @@ Übersprungen. - + Target output file already exists, going to skip this file: Zieldatei existiert bereits, die Datei wird übersprungen: - + If you don't want existing files to be skipped, please change the overwrite mode! Wenn existierende Dateien nicht übersprungen werden sollen, ändern Sie bitte den Überschreiben-Modus! - + Target output file already exists, going to delete existing file: Zieldatei existiert bereits, die Datei wird gelöscht und überschrieben: - + Failed to delete existing target file, will save to another file name! Die existierende Datei konnte nicht gelöscht werden, ein anderer Dateiname wird gewählt! diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index e05902f5..81e5028c 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -3024,52 +3024,52 @@ Decodificando - + The source audio file could not be found: No se encuentra el archivo de entrada: - + The source audio file could not be opened for reading: No se puede abrir el archivo de entrada para su lectura: - + The target output directory doesn't exist and could NOT be created: La carpeta de salida no existe y NO puede ser creada: - + The target output directory is NOT writable: NO se puede escribir en la carpeta de salida: - + Failed to generate non-existing target file name! - + Unknown File Name Nombre de archivo desconocido - + Unknown Title Título desconocido - + Unknown Artist Artista desconocido - + Unknown Album Álbum desconocido - + Unknown Comment Comentario desconocido @@ -3090,22 +3090,22 @@ Omitidos. - + Target output file already exists, going to skip this file: El archivo de destino ya existe, se omitirá este archivo: - + If you don't want existing files to be skipped, please change the overwrite mode! ¡Si no quiere sobreescribir los archivos existentes, cambie el modo sobreescritura por favor! - + Target output file already exists, going to delete existing file: El archivo de destino ya existe, se eliminará este archivo: - + Failed to delete existing target file, will save to another file name! ¡Error al eliminar el archivo de destino existente, se guardará con otro nombre! diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index 4b229d3f..9866f4f2 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -3031,52 +3031,52 @@ Sélection automatique (par défaut) Décodage - + The source audio file could not be found: Le fichier audio source n'a pas pu être trouvé: - + The source audio file could not be opened for reading: Le fichier audio source n'a pas pu être ouvert pour la lecture: - + The target output directory doesn't exist and could NOT be created: Le répertoire de sortie cible n'existe pas et ne peut PAS être créé: - + The target output directory is NOT writable: Le répertoire de sortie cible n'est pas accessible en écriture: - + Failed to generate non-existing target file name! - + Unknown File Name Nom de fichier inconnu - + Unknown Title Titre inconnu - + Unknown Artist Artiste inconnu - + Unknown Album Album inconnu - + Unknown Comment Commentaire inconnu @@ -3098,22 +3098,22 @@ Sélection automatique (par défaut) Ignoré. - + Target output file already exists, going to skip this file: Le fichier de sortie existe déjà, il sera ignoré : - + If you don't want existing files to be skipped, please change the overwrite mode! Si vous ne voulez pas ignorer les fichiers existants, veuillez changer le mode de remplacement ! - + Target output file already exists, going to delete existing file: Le fichier de sortie existe déjà, il sera supprimé : - + Failed to delete existing target file, will save to another file name! Impossible de supprimer le fichier cible existant, il sera enregistré sous un autre nom ! diff --git a/etc/Translation/LameXP_HU.ts b/etc/Translation/LameXP_HU.ts index 3ce4f379..c69bdb65 100644 --- a/etc/Translation/LameXP_HU.ts +++ b/etc/Translation/LameXP_HU.ts @@ -3031,72 +3031,72 @@ Dekódolás - + The source audio file could not be found: A forrás hangfájl nem található: - + The source audio file could not be opened for reading: A forrás hangfájl nem nyitható meg olvasásra: - + The target output directory doesn't exist and could NOT be created: A cél kimeneti könyvtár nem létezik, és NEM hozható létre: - + The target output directory is NOT writable: A cél kimeneti könyvtár NEM írható: - + Failed to generate non-existing target file name! - + Unknown File Name Ismeretlen fájlnév - + Unknown Title Ismeretlen cím - + Unknown Artist Ismeretlen előadó - + Unknown Album Ismeretlen album - + Unknown Comment Ismeretlen hozzászólás - + Target output file already exists, going to skip this file: A cél kimeneti fájl már létezik, ez a fájl ki lesz hagyva: - + If you don't want existing files to be skipped, please change the overwrite mode! Ha nem szeretné a meglévő fájlokat kihagyni, kérjük, változtassa meg a felülírási módot! - + Target output file already exists, going to delete existing file: A cél kimeneti fájl már létezik, a meglévő fájl törlésre kerül: - + Failed to delete existing target file, will save to another file name! Nem sikerült törölni a meglévő cél fájlt. Az állomány másik fájlnéven lesz elmentve! diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index b0de5534..fcd49553 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -3090,53 +3090,53 @@ Decodifica in corso - + The source audio file could not be found: Il file audio sorgente non può essere trovato: - + The source audio file could not be opened for reading: Il file audio sorgente non può essere aperto per la lettura: - + The target output directory doesn't exist and could NOT be created: La cartella di destinazione assegnata non esiste e NON può essere creata: - + The target output directory is NOT writable: La directory di destinazione assegnata è di SOLA LETTURA: La directory di destinazione assegnata NON è scrivibile: - + Failed to generate non-existing target file name! - + Unknown File Name Nome File Sconosciuto - + Unknown Title Titolo Sconosciuto - + Unknown Artist Artista Sconosciuto - + Unknown Album Album Sconosciuto - + Unknown Comment Commento Sconosciuto @@ -3157,22 +3157,22 @@ Saltato. - + Target output file already exists, going to skip this file: Il file di destinazione esiste già, questo file verrà saltato: - + If you don't want existing files to be skipped, please change the overwrite mode! Se non vuoi saltare i file esistenti, cambia la modalità di sovrascrittura! - + Target output file already exists, going to delete existing file: Il file di destinazione esiste già, il file esistente verrà eliminato: - + Failed to delete existing target file, will save to another file name! Impossibile eliminare il file di destinazione esistente, il file verrà salvato con un altro nome! diff --git a/etc/Translation/LameXP_KR.ts b/etc/Translation/LameXP_KR.ts index e4691f3f..0c8108de 100644 --- a/etc/Translation/LameXP_KR.ts +++ b/etc/Translation/LameXP_KR.ts @@ -3015,52 +3015,52 @@ 디코딩 - + The source audio file could not be found: 원본 오디오 파일을 찾을 수 없음: - + The source audio file could not be opened for reading: 원본 오디오 파일을 열 수 없음: - + The target output directory doesn't exist and could NOT be created: 대상 출력 디렉터리가 존재하지 않으며, 만들 수 없습니다: - + The target output directory is NOT writable: 대상 출력 디렉터리에 쓰기 불가: - + Failed to generate non-existing target file name! 존재하지 않는 대상 파일 이름을 생성하지 못했습니다! - + Unknown File Name 알수 없는 파일명 - + Unknown Title 알수 없는 제목 - + Unknown Artist 알수 없는 가수 - + Unknown Album 알수 없는 앨범 - + Unknown Comment 알수 없는 설명 @@ -3082,22 +3082,22 @@ 건너뜀. - + Target output file already exists, going to skip this file: 대상 출력 파일이 이미 존재합니다. 건너뛰기할 파일: - + If you don't want existing files to be skipped, please change the overwrite mode! 기존 파일을 건너뛰기하지 않으려면, 덮어쓰기 방식을 변경하시기 바랍니다! - + Target output file already exists, going to delete existing file: 대상 출력 파일이 이미 존재합니다. 건너뛰기할 파일: - + Failed to delete existing target file, will save to another file name! 기존 대상 파일 삭제 실패. 다른 파일명으로 저장됩니다! diff --git a/etc/Translation/LameXP_PL.ts b/etc/Translation/LameXP_PL.ts index cf31cad3..59cde1bc 100644 --- a/etc/Translation/LameXP_PL.ts +++ b/etc/Translation/LameXP_PL.ts @@ -3048,72 +3048,72 @@ Dekodowanie - + The source audio file could not be found: Źródłowy plik dźwiękowy nie został odnaleziony: - + The source audio file could not be opened for reading: Źródłowy plik dźwiękowy nie mógł zostać otworzony: - + The target output directory doesn't exist and could NOT be created: Lokalizacja docelowa nie istnieje lu NIE mogła zostać utworzona: - + The target output directory is NOT writable: Nie można zapisać do lokalizacji docelowej: - + Failed to generate non-existing target file name! Nie można utworzyć pliku bez nazwy! - + Unknown File Name Nieznana nazwa pliku - + Unknown Title Nieznany Tytuł - + Unknown Artist Nieznany Artysta - + Unknown Album Nieznany Album - + Unknown Comment Nieznany Komentarz - + Target output file already exists, going to skip this file: Plik wynikowy już istnieje, zostanie pominięty plik: - + If you don't want existing files to be skipped, please change the overwrite mode! Jeśli nie chcesz aby istniejące pliki były pomijane, zmień tryb nadpisywania! - + Target output file already exists, going to delete existing file: Plik wynikowy już istnieje, zostanie usunięty plik: - + Failed to delete existing target file, will save to another file name! Usuwanie istniejącego pliku zakończone niepowodzeniem, nowy plik zostanie zapisany pod inną nazwą! diff --git a/etc/Translation/LameXP_RU.ts b/etc/Translation/LameXP_RU.ts index a003be91..6b68fca5 100644 --- a/etc/Translation/LameXP_RU.ts +++ b/etc/Translation/LameXP_RU.ts @@ -3039,52 +3039,52 @@ Декодирование - + The source audio file could not be found: Исходный аудио файл не найден: - + The source audio file could not be opened for reading: Исходный аудио файл не может быть открыт: - + The target output directory doesn't exist and could NOT be created: Папка для выходных файлов не существует и не может быть создана: - + The target output directory is NOT writable: Папка для выходных файлов недоступна для записи: - + Failed to generate non-existing target file name! - + Unknown File Name Неизвестное имя файла - + Unknown Title Неизвестное Название - + Unknown Artist Неизвестный Артист - + Unknown Album Неизвестный Альбом - + Unknown Comment Неизвестный Комментарий @@ -3105,22 +3105,22 @@ Пропущен. - + Target output file already exists, going to skip this file: Файл уже существует, будет пропущен: - + If you don't want existing files to be skipped, please change the overwrite mode! Если Вы не хотите пропускать уже существующие файлы, пожалуйста, измените режим перезаписи! - + Target output file already exists, going to delete existing file: Файл уже существует, будет удалён: - + Failed to delete existing target file, will save to another file name! Ошибка удаления существующего файла, будет сохранение с другим именем! diff --git a/etc/Translation/LameXP_SV.ts b/etc/Translation/LameXP_SV.ts index 44676e18..098fedcf 100644 --- a/etc/Translation/LameXP_SV.ts +++ b/etc/Translation/LameXP_SV.ts @@ -3041,72 +3041,72 @@ Avkodar - + The source audio file could not be found: Källfilen kan inte hittas: - + The source audio file could not be opened for reading: Källfilen kan inte öppnas för läsning: - + The target output directory doesn't exist and could NOT be created: Målmappen finns inte och kan inte skapas: - + The target output directory is NOT writable: Målmappen är INTE skrivbar: - + Failed to generate non-existing target file name! - + Unknown File Name Okänt filnamn - + Unknown Title Okänd titel - + Unknown Artist Okänd artist - + Unknown Album Okänt album - + Unknown Comment Okänd kommentar - + Target output file already exists, going to skip this file: Målfilen finns redan! Den här filen hoppas över: - + If you don't want existing files to be skipped, please change the overwrite mode! Om du inte vill att befintliga filer hoppas över, måste du ändra överskrivningsläge! - + Target output file already exists, going to delete existing file: Målfilen finns redan! Befintlig fil kommer att tas bort: - + Failed to delete existing target file, will save to another file name! Kunde inte ta bort befintlig målfil. Sparar med annat filnamn! diff --git a/etc/Translation/LameXP_TW.ts b/etc/Translation/LameXP_TW.ts index 3134e306..9f375e80 100644 --- a/etc/Translation/LameXP_TW.ts +++ b/etc/Translation/LameXP_TW.ts @@ -3015,52 +3015,52 @@ 解碼 - + The source audio file could not be found: 找不到源音頻文件: - + The source audio file could not be opened for reading: 無法打開源音頻文件進行讀取: - + The target output directory doesn't exist and could NOT be created: 目標輸出目錄不存在,無法創建: - + The target output directory is NOT writable: 目標輸出目錄不是可寫: - + Failed to generate non-existing target file name! - + Unknown File Name 未知文件名稱 - + Unknown Title 未知標題 - + Unknown Artist 未知藝術家 - + Unknown Album 未知專輯 - + Unknown Comment 未知評論 @@ -3081,22 +3081,22 @@ 跳過. - + Target output file already exists, going to skip this file: 目標輸出文件已經存在, 將跳過此文件: - + If you don't want existing files to be skipped, please change the overwrite mode! 如果你不希望被跳過已存在的文件, 請更改覆蓋模式! - + Target output file already exists, going to delete existing file: 目標輸出文件已經存在, 要刪除現有的文件: - + Failed to delete existing target file, will save to another file name! 無法刪除現有目標文件, 將保存到另一個文件名! diff --git a/etc/Translation/LameXP_UK.ts b/etc/Translation/LameXP_UK.ts index dc06146d..c6c48615 100644 --- a/etc/Translation/LameXP_UK.ts +++ b/etc/Translation/LameXP_UK.ts @@ -3032,52 +3032,52 @@ Декодування - + The source audio file could not be found: Неможливо знайти вхідний файл аудіо: - + The source audio file could not be opened for reading: Неможливо відкрити для читання вхідний файл аудіо: - + The target output directory doesn't exist and could NOT be created: Вихідної теки не існує і її неможливо створити: - + The target output directory is NOT writable: До вихідної теки неможливо проводити запис: - + Failed to generate non-existing target file name! Неможливо згенерувати назву неіснуючого вихідного файла! - + Unknown File Name Невідома назва файла - + Unknown Title Невідомий заголовок - + Unknown Artist Невідомий виконавець - + Unknown Album Невідомий альбом - + Unknown Comment Невідомий коментар @@ -3099,22 +3099,22 @@ Пропущено. - + Target output file already exists, going to skip this file: Вихідний цільовий файл вже існує, спроба пропустити цей файл: - + If you don't want existing files to be skipped, please change the overwrite mode! Якщо ви не хочете, щоб існуючі файли були пропущені, будь ласка, змініть режим перезапису! - + Target output file already exists, going to delete existing file: Вихідний цільовий файл вже існує, спроба видалити існуючий файл: - + Failed to delete existing target file, will save to another file name! Неможливо видалити існуючий файл, збереження буде проведено до файла з іншою назвою! diff --git a/etc/Translation/LameXP_ZH.ts b/etc/Translation/LameXP_ZH.ts index 63693167..bc5c98e6 100644 --- a/etc/Translation/LameXP_ZH.ts +++ b/etc/Translation/LameXP_ZH.ts @@ -3015,52 +3015,52 @@ 解码 - + The source audio file could not be found: 找不到源音频文件: - + The source audio file could not be opened for reading: 无法打开源音频文件进行读取: - + The target output directory doesn't exist and could NOT be created: 目标输出目录不存在且无法创建: - + The target output directory is NOT writable: 目标输出目录不可写: - + Failed to generate non-existing target file name! 无法为不存在的目标文件命名! - + Unknown File Name 未知文件名称 - + Unknown Title 未知标题 - + Unknown Artist 未知艺术家 - + Unknown Album 未知专辑 - + Unknown Comment 未知注释 @@ -3081,22 +3081,22 @@ 跳过。 - + Target output file already exists, going to skip this file: 目标输出文件已经存在, 将跳过此文件: - + If you don't want existing files to be skipped, please change the overwrite mode! 如果你不希望跳过已存在的文件, 请更改覆盖模式! - + Target output file already exists, going to delete existing file: 目标输出文件已经存在, 将删除现有的文件: - + Failed to delete existing target file, will save to another file name! 无法删除现有目标文件, 将保存为另一个文件名! diff --git a/src/Config.h b/src/Config.h index 04967e87..8c8b3486 100644 --- a/src/Config.h +++ b/src/Config.h @@ -35,7 +35,7 @@ #define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_TYPE RC #define VER_LAMEXP_PATCH 6 -#define VER_LAMEXP_BUILD 2130 +#define VER_LAMEXP_BUILD 2134 #define VER_LAMEXP_CONFG 2002 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index 032d6943..4830a4b3 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -390,6 +390,8 @@ int ProcessThread::generateOutFileName(QString &outFileName) { outFileName.clear(); + /* -------- Check source file -------- */ + //Make sure the source file exists const QFileInfo sourceFile(m_audioFile.filePath()); if(!(sourceFile.exists() && sourceFile.isFile())) @@ -410,6 +412,8 @@ int ProcessThread::generateOutFileName(QString &outFileName) readTest.close(); } + /* -------- Determine target directory -------- */ + QDir targetDir(MUtils::clean_file_path(m_outputDirectory.isEmpty() ? sourceFile.canonicalPath() : m_outputDirectory, false)); //Prepend relative source file path? @@ -440,7 +444,7 @@ int ProcessThread::generateOutFileName(QString &outFileName) } //Make sure that the output dir is writable - QFile writeTest(QString("%1/.%2").arg(targetDir.canonicalPath(), MUtils::next_rand_str())); + QFile writeTest(MUtils::make_temp_file(targetDir, "~rw")); if(!writeTest.open(QIODevice::ReadWrite)) { handleMessage(QString("%1\n%2").arg(tr("The target output directory is NOT writable:"), QDir::toNativeSeparators(targetDir.absolutePath()))); @@ -448,9 +452,11 @@ int ProcessThread::generateOutFileName(QString &outFileName) } else { - writeTest.remove(); + writeTest.remove(); /*clean-up*/ } + /* -------- Generate initial file name and check -------- */ + //File extension const QString fileExt = m_renameFileExt.isEmpty() ? QString::fromUtf8(m_encoder->toEncoderInfo()->extension()) : m_renameFileExt; @@ -458,7 +464,7 @@ int ProcessThread::generateOutFileName(QString &outFileName) const QString fileName = MUtils::clean_file_name(QString("%1.%2").arg(applyRegularExpression(applyRenamePattern(sourceFile.completeBaseName(), m_audioFile.metaInfo())), fileExt), true); //Generate full output path - outFileName = QString("%1/%2").arg(targetDir.canonicalPath(), fileName); + outFileName = targetDir.absoluteFilePath(fileName); //Skip file, if target file exists (optional!) if((m_overwriteMode == OverwriteMode_SkipExisting) && QFileInfo(outFileName).exists()) @@ -469,21 +475,14 @@ int ProcessThread::generateOutFileName(QString &outFileName) } //Delete file, if target file exists (optional!) - if((m_overwriteMode == OverwriteMode_Overwrite) && QFileInfo(outFileName).exists() && QFileInfo(outFileName).isFile()) + const QFileInfo origFileName(outFileName); + if((m_overwriteMode == OverwriteMode_Overwrite) && origFileName.exists() && origFileName.isFile()) { handleMessage(QString("%1\n%2\n").arg(tr("Target output file already exists, going to delete existing file:"), QDir::toNativeSeparators(outFileName))); bool removed = false; - if(sourceFile.canonicalFilePath().compare(QFileInfo(outFileName).absoluteFilePath(), Qt::CaseInsensitive) != 0) + if(sourceFile.canonicalFilePath().compare(origFileName.absoluteFilePath(), Qt::CaseInsensitive) != 0) { - for(int i = 0; i < 16; i++) - { - if(QFile::remove(outFileName)) - { - removed = true; - break; - } - MUtils::OS::sleep_ms(1); - } + removed = MUtils::remove_file(outFileName); } if(!removed) { @@ -491,26 +490,16 @@ int ProcessThread::generateOutFileName(QString &outFileName) } } - //Generate final name - const QFileInfo origFileName(outFileName); - for (int n = 2; n <= 65534; ++n) - { - //Check file existence - if (QFileInfo(outFileName).exists()) - { - outFileName = origFileName.absoluteDir().filePath(QString("%1 (%2).%3").arg(origFileName.completeBaseName(), QString::number(n), origFileName.suffix())); - continue; - } + /* -------- Generate final non-existing file name -------- */ - //Create placeholder - QFile placeholder(outFileName); - if (placeholder.open(QIODevice::WriteOnly)) - { - placeholder.close(); - return 1; - } + //Generate final name + outFileName = MUtils::make_unique_file(origFileName.absoluteDir(), origFileName.completeBaseName(), origFileName.suffix(), true, true); + if(!outFileName.isEmpty()) + { + return 1; } + //Failed to generate handleMessage(QString("%1\n").arg(tr("Failed to generate non-existing target file name!"))); return 0; }