bugfix when reorganizing to same reorganize directory
This commit is contained in:
parent
645c67dd37
commit
f371960746
25
README.md
25
README.md
@ -34,15 +34,16 @@ python3 main.py
|
||||
|
||||
## Todo:
|
||||
|
||||
- [x] right-click menu
|
||||
- [x] editable lyrics window
|
||||
- [x] batch metadata changer (red highlight fields that have differing info)
|
||||
- [x] playlists
|
||||
- [ ] delete songs from library (del key || right-click delete)
|
||||
- [ ] .wav, .ogg, .flac convertor
|
||||
- [ ] FIXME: dbaccess is instantiated for every track being reorganized
|
||||
- [ ] automatic "radio" based on artist or genre
|
||||
- [ ] search bar, full text search on song, artist, album
|
||||
- [ ] when table is focused, start typing to match against the primary sort column
|
||||
- [ ] "installer" - put files in /opt? script to install and uninstall
|
||||
- [ ] .deb package?
|
||||
- ~~right-click menu~~
|
||||
- ~~editable lyrics window~~
|
||||
- ~~batch metadata changer (red highlight fields that have differing info)~~
|
||||
- ~~playlists~~
|
||||
- playlist autoexporting
|
||||
- delete songs from library (del key || right-click delete)
|
||||
- .wav, .ogg, .flac convertor
|
||||
- FIXME: dbaccess is instantiated for every track being reorganized
|
||||
- automatic "radio" based on artist or genre
|
||||
- search bar, full text search on song, artist, album
|
||||
- when table is focused, start typing to match against the primary sort column
|
||||
- "installer" - put files in /opt? script to install and uninstall
|
||||
- .deb package?
|
||||
|
||||
@ -494,23 +494,27 @@ class MusicTable(QTableView):
|
||||
Reorganizes files into Artist/Album/Song,
|
||||
based on self.config['directories'][reorganize_destination']
|
||||
"""
|
||||
debug('reorganizing files')
|
||||
# Get target directory
|
||||
target_dir = str(self.config["directories"]["reorganize_destination"])
|
||||
for filepath in filepaths:
|
||||
if str(filepath).startswith((target_dir)):
|
||||
continue
|
||||
try:
|
||||
if progress_callback:
|
||||
progress_callback.emit(f"Organizing: {filepath}")
|
||||
# Read file metadata
|
||||
artist, album = get_reorganize_vars(filepath)
|
||||
# Determine the new path that needs to be made
|
||||
new_path = os.path.join(
|
||||
target_dir, artist, album, os.path.basename(filepath)
|
||||
)
|
||||
# Need to determine if filepath is equal
|
||||
if new_path == filepath:
|
||||
continue
|
||||
try:
|
||||
if progress_callback:
|
||||
progress_callback.emit(f"Organizing: {filepath}")
|
||||
# Create the directories if they dont exist
|
||||
debug('make dirs')
|
||||
os.makedirs(os.path.dirname(new_path), exist_ok=True)
|
||||
# Move the file to the new directory
|
||||
debug(f'{filepath} > {new_path}')
|
||||
shutil.move(filepath, new_path)
|
||||
# Update the db
|
||||
with DBA.DBAccess() as db:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user