def init(self, profileName: str) -> bool:
# "-n" to prevent overwriting any existing file.
# "-ar 44100" for 44.1 kHz audio output.
- # "-fps_mode vfr" to drop frames which cannot be
- # properly contained in the output file.
# "-codec:v copy" to copy the integrated image from source
# instead of converting it to png (default encoder).
- commonFlags: list[str] = ["-hide_banner", "-loglevel", "error",
- "-n", "-ar", "44100", "-fps_mode", "vfr",
- "-codec:v", "copy"]
+ commonFlags: list[str] = ["-loglevel", "error", "-n",
+ "-ar", "44100", "-codec:v", "copy"]
# "-sample_fmt s16" for 16 bits audio output.
# "-write_id3v2 1" to write metadata in aiff files.
self.convertExtensions = [".aiff", ".flac", ".wav"]
self.copyExtensions = [".mp3"]
self.converterArgs = (commonFlags
- + ["-f", "aiff", "-sample_fmt", "s16",
- "-write_id3v2", "1"])
+ + ["-f", "aiff", "-sample_fmt", "s16", "-write_id3v2", "1"])
return True
# "-sample_fmt s16" for 16 bits audio output.
elif profileName == "flac":
return
# Playlists generated from playlist files.
- libPlaylists: dict[str, LibraryPlaylist] = self._createLibraryPlaylists(convertParams.playlistDir)
+ libPlaylists: dict[str, LibraryPlaylist] = self._createLibraryPlaylists(
+ convertParams.playlistDir)
if len(libPlaylists) == 0:
self._log("Error: No playlist found.")
return
if task.taskType == "copy":
- self._log(str(task.taskId) + "/" + str(totalTasks) + ": Copying '" + task.inputFilePath
+ self._log(str(task.taskId) + "/" + str(totalTasks)
+ + ": Copying '" + task.inputFilePath
+ "' into '" + task.outputFilePath + "'.")
self.copyFile(task.inputFilePath, outputFilePathWip)
os.rename(outputFilePathWip, task.outputFilePath)
command: list[str] = ([converterPath] + [self._CONVERTER_IN]
+ [task.inputFilePath] + task.converterArgs
+ [outputFilePathWip])
- self._log(str(task.taskId) + "/" + str(totalTasks) + ": Converting '" + task.inputFilePath + "' to '"
- + task.outputFilePath + "'.")
- result: subprocess.CompletedProcess = subprocess.run(command, capture_output=True, text=True)
+ self._log(str(task.taskId) + "/" + str(totalTasks)
+ + ": Converting '" + task.inputFilePath
+ + "' to '" + task.outputFilePath + "'.")
+ result: subprocess.CompletedProcess = subprocess.run(
+ command, capture_output=True, text=True)
if result.returncode == 0:
os.rename(outputFilePathWip, task.outputFilePath)
# Create a library playlist from a playlist file.
def _createLibraryPlaylistFromFile(self, filePath: str) -> LibraryPlaylist:
- playlist: LibraryPlaylist = LibraryPlaylist(self.trimFileExtension(os.path.basename(filePath)))
+ playlist: LibraryPlaylist = LibraryPlaylist(
+ self.trimFileExtension(os.path.basename(filePath)))
if (self.getFileExtension(filePath).lower() == ".m3u"
or self.getFileExtension(filePath).lower() == ".m3u8"):