Compare commits
No commits in common. "189645254b6bdf6c3db4f5d54c5a03662399d2ed" and "1f83bb8517e49a92062315684c03a4740cba9acd" have entirely different histories.
189645254b
...
1f83bb8517
1
.gitignore
vendored
1
.gitignore
vendored
@ -182,4 +182,3 @@ cython_debug/
|
||||
|
||||
# ed1337x
|
||||
config.ini
|
||||
Run.ps1
|
||||
|
25
Run.cmd
25
Run.cmd
@ -1,25 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
REM Define paths
|
||||
set VENV_DIR=venv
|
||||
set APP_DIR=Program
|
||||
set PYTHON=%VENV_DIR%\Scripts\python.exe
|
||||
|
||||
REM Check for venv
|
||||
if not exist %VENV_DIR% (
|
||||
echo Creating virtual environment...
|
||||
python -m venv %VENV_DIR%
|
||||
echo Installing dependencies...
|
||||
%PYTHON% -m pip install --upgrade pip
|
||||
%PYTHON% -m pip install -r requirements.txt
|
||||
) else (
|
||||
echo Virtual environment found, assuming dependencies are satisfied.
|
||||
)
|
||||
|
||||
REM Run the app
|
||||
cd /d %~dp0%APP_DIR%
|
||||
..\%VENV_DIR%\Scripts\python.exe app.py
|
||||
|
||||
endlocal
|
||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@ -38,7 +38,7 @@ def analyze_bpm_librosa(file_path):
|
||||
try:
|
||||
y, sr = librosa.load(file_path, mono=True)
|
||||
tempo, _ = librosa.beat.beat_track(y=y, sr=sr)
|
||||
return int(round(float(tempo)))
|
||||
return int(round(float(tempo[0])))
|
||||
except Exception as e:
|
||||
print(f"Error analyzing BPM for {file_path.name}: {e}")
|
||||
return None
|
||||
@ -87,6 +87,11 @@ def main():
|
||||
print(f"Error: {source_media_path} is not a valid directory.")
|
||||
sys.exit(1)
|
||||
|
||||
parent = source_media_path.parent
|
||||
folder_name = source_media_path.name
|
||||
dest_media_path = parent / f"[CDs-{run_date}]{folder_name}"
|
||||
dest_media_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
all_tracks = []
|
||||
for file in source_media_path.rglob("*.mp3"):
|
||||
bpm = get_bpm(file)
|
||||
@ -113,11 +118,6 @@ def main():
|
||||
print("No MP3 files found.")
|
||||
sys.exit(0)
|
||||
|
||||
parent = source_media_path.parent
|
||||
folder_name = source_media_path.name
|
||||
dest_media_path = parent / f"[CDs-{run_date}]{folder_name}"
|
||||
dest_media_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
total_size = sum(t["size"] for t in all_tracks)
|
||||
num_cds = max(1, (total_size + CD_SIZE - 1) // CD_SIZE)
|
||||
|
13
src/setup_venv.cmd
Normal file
13
src/setup_venv.cmd
Normal file
@ -0,0 +1,13 @@
|
||||
@echo off
|
||||
REM Create Python virtual environment named "venv"
|
||||
python -m venv venv
|
||||
|
||||
REM Activate the virtual environment
|
||||
call venv\Scripts\activate.bat
|
||||
|
||||
REM Upgrade pip
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
REM Install dependencies
|
||||
pip install mutagen
|
||||
|
12
src/setup_venv.ps1
Normal file
12
src/setup_venv.ps1
Normal file
@ -0,0 +1,12 @@
|
||||
# Create Python virtual environment named "venv"
|
||||
python -m venv venv
|
||||
|
||||
# Activate the virtual environment
|
||||
& .\venv\Scripts\Activate.ps1
|
||||
|
||||
# Upgrade pip
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
# Install dependencies
|
||||
pip install mutagen
|
||||
|
Loading…
x
Reference in New Issue
Block a user