0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 13:52:00 +01:00

since the player now parses the main files, we don't need to add every file one by one

This commit is contained in:
2025-09-29 18:05:39 +02:00
parent 978cdd4ed5
commit 4e5e828d96
2 changed files with 29 additions and 1 deletions

26
convert_folder.py Normal file
View File

@@ -0,0 +1,26 @@
import os
import glob
# Base directory where your playlists live
BASE_DIR = os.path.expanduser("~/playlists")
FORMATS = ('.mp3', '.m4a', '.flac', '.wav')
# Collect all playlist files (recursively all subfolders)
playlist_files = glob.glob(os.path.join(BASE_DIR, "*", "*"))
for plist in playlist_files:
with open(plist, "r") as f:
lines = [line.strip() for line in f if line.strip()]
dirs = []
files = []
for line in lines:
dir = os.path.basename(os.path.dirname(line))
if dir not in dirs and dir != "mixes": dirs.append(dir)
if dir == "mixes": files.append(line)
with open(plist, "w") as f:
f.writelines(files)
for dir in dirs:
base = f"/home/user/mixes/{dir}/*."
for format in FORMATS:
f.write(base + format)

View File

@@ -92,9 +92,11 @@ class FileManager:
if file.lower().endswith(FORMATS): audio_files.append(file)
except (PermissionError, FileNotFoundError): continue
fake_files = [f"*.{i}" for i in FORMATS]
if audio_files:
# Folder contains audio files
items.append(FileItem(name=entry, is_folder=True, files=sorted(audio_files)))
items.append(FileItem(name=entry, is_folder=True, files=fake_files))
return items
except FileNotFoundError: