New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Cleaning and Invalid Audiofiles Handling #27
Conversation
Gonna add a menu entry to the dropdown to open the list of the broken files later on, for the user to see more easily what was broken |
added the described feature: clear list also clears the list of invalid files. The displayed list is a TextView, so that the list can be easily copied and saved elsewhere if desired. |
soundconverter/ui.py
Outdated
s = '' | ||
if broken_audiofiles > 1: | ||
s = 's' | ||
show_error('{} audiofile{} could not be read by gstreamer!'.format(broken_audiofiles, s), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be very problematic to translate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to use ngettext() for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in fd17384
Well done. Thank you! |
Code Cleaning and Invalid Audiofiles Handling
1. gtk tool, add folder and broken/non audiofiles
When I put a text file into the sound source directory and renamed it to foobar.flac, no other flac files from other subdirectories were added if this textfile was the first .flac file seen. This was caused, because the TypeFinder only looked at one single sample of .flac files to detect the mime type. Hence the .flac type was not added to the list of accepted file extensions.
This change checks the mime type of all the sound files instead in order to find out which ones are broken. After this fix, all the .flac files are added to the list for conversion except those that don't contain sound (those for which gstreamer throws errors)
This increases the time to read in large folders, but it is the way for integrity, which is the first priority when handling files. Also, reading in the files is still fast compared to the conversion. Because of this longer required time for reading in files, the statusbar now also shows the progress of reading in the files.
An Error message appears to show how many files (only those with audio extensions) failed. The ErrorDialog apperance was also fixed.
old:
new:
After reading this message, the user can decide whether or not to start the conversion.
2. Cleanup Changelog
3. soundconverter.py
from soundconverter.ui import gui_main
fails, it would switch to batch mode. However, this would start conversion immediatelly, either with no command line arguments at all or some files, which would convert all the files into their folders without further user configuration. This is sudden unexpected behaviour and therefore I would rather go a different way. The import of gui_main will fail if there is an e.g. syntax error in that file. So the proper way would be not make sure gui_main doesn't throw errors upon importing. I moved this import to the top.