Added popup on import where the user can configure how the tracks get imported.

This commit is contained in:
The Wobbler 2025-03-08 17:50:45 +01:00
parent 31b2e3bf41
commit fd34476d00
12 changed files with 289 additions and 28 deletions

View file

@ -1,11 +1,15 @@
#!/usr/bin/python3
import os
import shutil
from pydub import AudioSegment
from pygame.mixer import Sound
from tinytag import TinyTag
from tinytag.tinytag import Images as TTImages
from dataclasses import dataclass
from ..types import Types
@dataclass
class TrackMetadata:
@ -163,3 +167,18 @@ class Track:
self.items.remove(item)
self.occurrences.pop(playlist)
def copy(self, dest: str, copy_type: int=Types.CopyType.symlink, moved: bool=True):
match copy_type:
case Types.CopyType.symlink:
os.symlink(self.path, dest)
case Types.CopyType.copy:
shutil.copyfile(self.path, dest)
case Types.CopyType.move:
shutil.move(self.path, dest)
if moved: # update path variables
self.path = dest
self.metadata.path = dest