Füge Unterstützung für die Verarbeitung von einzelnen CUE-Dateien hinzu und verbessere die Fehlerbehandlung
This commit is contained in:
26
README.md
26
README.md
@ -38,15 +38,35 @@ Oder einfach die Dateien herunterladen:
|
||||
|
||||
## Verwendung
|
||||
|
||||
Das Script unterstützt zwei Modi:
|
||||
|
||||
### 1. Verzeichnis verarbeiten (alle CUE-Dateien)
|
||||
|
||||
```bash
|
||||
python cue2auda.py /pfad/zu/ihren/cue/dateien
|
||||
```
|
||||
|
||||
### Beispiel
|
||||
### 2. Einzelne CUE-Datei verarbeiten
|
||||
|
||||
```bash
|
||||
python cue2auda.py .
|
||||
python cue2auda.py /pfad/zur/datei.cue
|
||||
```
|
||||
|
||||
### Beispiele
|
||||
|
||||
```bash
|
||||
# Alle CUE-Dateien im aktuellen Verzeichnis verarbeiten
|
||||
python cue2auda.py .
|
||||
|
||||
# Alle CUE-Dateien in einem spezifischen Verzeichnis
|
||||
python cue2auda.py /Users/manuel/Music/DJ-Sets/
|
||||
|
||||
# Nur eine spezifische CUE-Datei verarbeiten
|
||||
python cue2auda.py "01 REC-2025-07-02.cue"
|
||||
|
||||
# Absolute Pfad zu einer einzelnen Datei
|
||||
python cue2auda.py /Users/manuel/Music/mix.cue
|
||||
```
|
||||
Verarbeitet alle `.cue` Dateien im aktuellen Verzeichnis.
|
||||
|
||||
## Ein- und Ausgabeformat
|
||||
|
||||
|
21
cue2auda.py
Normal file → Executable file
21
cue2auda.py
Normal file → Executable file
@ -12,11 +12,22 @@ import os
|
||||
|
||||
# Get argument on command line
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("thePathOfCueFiles", help="The path of the directory with the CUE files to process")
|
||||
parser.add_argument("thePathOfCueFiles", help="The path of the directory with CUE files or a single CUE file to process")
|
||||
thePath = parser.parse_args().thePathOfCueFiles
|
||||
|
||||
# Read *.cue files in specified directory
|
||||
for cueFileName in glob.glob(os.path.join(thePath, "*.cue")):
|
||||
# Determine if input is a directory or a single file
|
||||
if os.path.isfile(thePath) and thePath.lower().endswith('.cue'):
|
||||
# Single CUE file
|
||||
cueFiles = [thePath]
|
||||
elif os.path.isdir(thePath):
|
||||
# Directory - find all CUE files
|
||||
cueFiles = glob.glob(os.path.join(thePath, "*.cue"))
|
||||
else:
|
||||
print(f"Error: '{thePath}' is neither a valid CUE file nor a directory containing CUE files.")
|
||||
exit(1)
|
||||
|
||||
# Process each CUE file
|
||||
for cueFileName in cueFiles:
|
||||
#print(cueFileName)
|
||||
with open(cueFileName, "r", encoding="utf-8") as cueFile:
|
||||
cueFileContent = cueFile.readlines()
|
||||
@ -86,12 +97,10 @@ for cueFileName in glob.glob(os.path.join(thePath, "*.cue")):
|
||||
|
||||
# Add to title history
|
||||
lastTitles.append(theTitle)
|
||||
else:
|
||||
print(f"Skipping duplicate: '{theTitle}' at {theHours:02d}:{theMinutes:02d}:{theSeconds:02d} (appeared within last {maxTrackDistance} tracks)")
|
||||
|
||||
print(f"Created {trackCount} labels in {labelFileName}")
|
||||
print(f"Created tracklist in {tracklistFileName}")
|
||||
|
||||
# end for line in cueFileContent
|
||||
|
||||
# end for cueFileName in glob.glob(thePath + "\\*.cue")
|
||||
# end for cueFileName in cueFiles
|
||||
|
Reference in New Issue
Block a user