Re: Pyglet help

Actually, just storing the full filename would probably work. So something like:

import os.path
import glob

types = [".mp3", ".wav", ".flac", ".mp4", ".mpg", ".avi", ".m4a"]
types = str(types)

playlist = []

path = input("Enter the path to your music folder.")
letter = input("Name of the song? ")
print(os.getcwd())

#list directories
with os.scandir(path) as it:
    for entry in it:
        if not entry.name.startswith('.') and entry.is_file():
            name = os.path.splitext(str(os.path.split(entry)[1]))
            if letter in name[0].lower():
                if name[1].lower() in types:
                    playlist += [name[0]+name[1]]

You could split the text again when displaying it if you don't want to list the extension, or shuffle the list to randomize playback.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Turkce_Rap via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector

Reply via email to