20 lines
573 B
Python
20 lines
573 B
Python
from pathlib import Path
|
|
from os.path import relpath
|
|
|
|
from ..types import File
|
|
from ..meta import supported_formats
|
|
|
|
|
|
def scan_for_music(src: str) -> list[File]:
|
|
files: list[File] = []
|
|
for format in supported_formats:
|
|
for path in Path(src).rglob("*." + format):
|
|
file = File()
|
|
file.path_to = str(path.parent)
|
|
file.path_from_src = relpath(
|
|
str(path.parent), src)
|
|
file.filename = path.stem
|
|
file.extension = path.suffix.replace(".", "")
|
|
files.append(file)
|
|
return files
|