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