24 lines
813 B
Python
24 lines
813 B
Python
import os
|
|
|
|
playlist_map = {
|
|
"Worship": "/home/media/Scripts/BGMusic/Playlists/Worship.txt",
|
|
"Praise": "/home/media/Scripts/BGMusic/Playlists/Praise.txt",
|
|
"Instrumental": "/home/media/Scripts/BGMusic/Playlists/Instrumental.txt"
|
|
}
|
|
|
|
music_base = "/home/media/Scripts/BGMusic/Music"
|
|
|
|
for folder, playlist_path in playlist_map.items():
|
|
folder_path = os.path.join(music_base, folder)
|
|
song_paths = []
|
|
|
|
for file in sorted(os.listdir(folder_path)):
|
|
if file.lower().endswith((".mp3",".wav",".flac","m4a")):
|
|
full_path = os.path.join(folder_path, file)
|
|
song_paths.append(full_path)
|
|
|
|
with open(playlist_path, "w") as f:
|
|
for song in song_paths:
|
|
f.write(song + "\n")
|
|
|
|
print(f"✅ Updated playlist: {playlist_path} with {len(song_paths)} songs") |