dfaust / soundkonverter

soundKonverter is in maintenance mode, PRs are welcome.
https://github.com/dfaust/soundkonverter/wiki
98 stars 26 forks source link

Convertion fails if there is a '?' or '#' character in filename or path #96

Open fossman opened 3 years ago

fossman commented 3 years ago

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"
fjerhammer commented 2 years ago

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:

Knowing this, I was able to make soundKonverter work with my music collection by doing the following:

  1. Add the desired files to soundKonverter's queue.
  2. Click File -> Save file list.
  3. Close soundKonverter.
  4. 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
  5. Restart soundKonverter and re-import the file list using File -> Load file list.