soundkonverter
soundkonverter copied to clipboard
Convertion fails if there is a '?' or '#' character in filename or path
Whenever there is a hash sign ( # ) or question mark ( ? ) the conversion from flac to MP3 fails.
By looking at the log, it seems that when building the command to execute in the first step, SoundKonverter ignores the rest of the filename or path where it finds the '?' character. So, later, it cant find the file name.
Here is the start of the related log:
Identifier: file:///home/user/cds/MyRecordings/2015 - Might/01 - What’s the Frequency?.flac
/bin/flac -d "/home/user/cds/MyRecordings/2015 - Might/01 - What’s the Frequency" -o "/tmp/soundkonverter_temp_convert_521782835_0.wav"
flac 1.3.3
Copyright (C) 2000-2009 Josh Coalson, 2011-2016 Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.
01 - What’s the Frequency: ERROR initializing decoder
init status = FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE
An error occurred opening the input file; it is likely that it does not exist
or is not readable.
Conversion failed. Exit code: 1
```
You will notice that the first command truncates the filename:
/bin/flac -d "/home/user/cds/MyRecordings/2015 - Might/01 - What’s the Frequency"
It should be:
/bin/flac -d "/home/user/cds/MyRecordings/2015 - Might/01 - What’s the Frequency?.flac"
This seems related to #63. I noticed that it only occurs when adding files using the batch feature ("Add folder..."). Adding a single file with a # or ? in its filename does not cause any issues, however when the folder importer stumbles upon such files, it acts weird:
- The path gets prefixed with
file://
. This should be removed. - If there's a
#
with a space in front of it, the space gets replaced with%20
. This should be replaced with a regular whitespace. - If there's more than one
#
, the rest of them - but not the first one - will be encoded as%23
. These should be replaced with#
. - If there's a
?
in the filename, all spaces in the file path will be replaced with%20
. These should be replaced with regular whitespaces.
Knowing this, I was able to make soundKonverter work with my music collection by doing the following:
- Add the desired files to soundKonverter's queue.
- Click
File
->Save file list
. - Close soundKonverter.
- Perform the mentioned replacements in the saved XML file list using sed:
sed -i 's/file:\/\///; s/%20/ /g; s/%23/#/g' ~/.local/share/soundkonverter/filelist.xml
- Restart soundKonverter and re-import the file list using
File
->Load file list
.