Add a config for isort (https://github.com/timothycrosley/isort)
Run isort -rc . and make import style consistent across files
Add a note about `isort` in CONTRIBUTING.md
This commit implements an algorithm to fetch a release
that matches the preferred release types outlined in the
settings page. Further testing is required.
Handle FileNotFoundError exceptions raised from os.path.abspath and
os.path.realpath used by the options dialog for the examples in the
file naming tab.
Fixes PICARD-1306
When moving additional files, the call to encode_filename encodes the
path to the original filename converting the variable from str to bytes,
provoking the next exception when calling shutil, which only accepts
strings (the documentation don't specifically mention that for shutil.move,
but it does for copy, copyfile, copymode, etc.)
Traceback (most recent call last):
File "./picard/util/thread.py", line 47, in run
result = self.func()
File "./picard/file.py", line 222, in _save_and_rename
self._move_additional_files(old_filename, new_filename)
File "./picard/file.py", line 435, in _move_additional_files
shutil.move(old_file, new_file)
File "/usr/x86_64-pc-linux-gnu/lib/python3.6/shutil.py", line 551, in move
if _destinsrc(src, dst):
File "/usr/x86_64-pc-linux-gnu/lib/python3.6/shutil.py", line 565, in _destinsrc
if not src.endswith(os.path.sep):
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
Also, other functions like os.path.dirname, os.path.isdir, os.stat,
os.utime ... allow to be passed a string, instead of the encoded path in
a bytes variable. So I removed the use of encode_filename for all cases
that either require or allow a string to be passed so we don't do
unnecessary processing neither.
I checked this fixes PICARD-1207.
If the file doesn't belong to an album, we have to load a NAT and then
move the file there. Also fix the call to self.tagger.move_file_to_nat
which was missing a parameter (the file to move)
item.tracknumber can be a number (3), a string containing a number ('3')
or a string containing a number and a total ('3/10'), so we now parse
all cases correctly and just fallback to return 0 in all other cases
int('') generates an exception, but in that case we don't want to return
'' but 0, since otherwise we may end comparing an int and a str.
Fixes PICARD-1304
It seems these lines were forgotten and not ported from Qt4 to Qt5,
which made picard crash when dragging an image from a google images'
search result and dropping it into the coverartbox widget.