Sort KP
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
# roblox-assets
|
# roblox-assets
|
||||||
|
|
||||||
Companion repo to
|
Companion repo to
|
||||||
Hazzy/rbxl-files and includes ripped assets from the saveinstance games
|
Hazzy/rbxl-files and includes ripped assets from the saveinstance games
|
||||||
|
|
||||||
|
Scanner.py is just the sorter i use for sorting out long audio (>30s) out of the normal audio_files folder
|
||||||
|
|||||||
44
scanner.py
Normal file
44
scanner.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
source_folder = "audio_files"
|
||||||
|
destination_folder = "music_prolly"
|
||||||
|
|
||||||
|
# Ensure destination folder exists
|
||||||
|
os.makedirs(destination_folder, exist_ok=True)
|
||||||
|
|
||||||
|
def get_audio_duration(file_path):
|
||||||
|
"""Returns duration of audio file in seconds using ffprobe."""
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
[
|
||||||
|
"ffprobe",
|
||||||
|
"-v", "error",
|
||||||
|
"-show_entries", "format=duration",
|
||||||
|
"-of", "default=noprint_wrappers=1:nokey=1",
|
||||||
|
file_path
|
||||||
|
],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
return float(result.stdout)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error reading duration for '{file_path}': {e}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Process files
|
||||||
|
for filename in os.listdir(source_folder):
|
||||||
|
file_path = os.path.join(source_folder, filename)
|
||||||
|
|
||||||
|
if not os.path.isfile(file_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
duration = get_audio_duration(file_path)
|
||||||
|
|
||||||
|
if duration > 30:
|
||||||
|
shutil.move(file_path, os.path.join(destination_folder, filename))
|
||||||
|
print(f"Moved '{filename}' ({duration:.2f}s) → '{destination_folder}'")
|
||||||
|
else:
|
||||||
|
print(f"Kept '{filename}' ({duration:.2f}s)")
|
||||||
Reference in New Issue
Block a user