# Path: media_manager.py
# def valid_file(file_path):
#     invalid_file_extensions = [".json", ".ini", ".zip"]
#     invalid_names = [".ds_store"]
#     return (
#         file_path.exists()
#         and not file_path.is_dir()
#         and file_path.suffix.lower() not in invalid_file_extensions
#         and file_path.name.lower() not in invalid_names
#     )


from pathlib import Path
from typing import List
from media_manager import valid_file
import fire
#!/usr/bin/env python3
"""
Count number of files by type in a directory

input:
    - directory
    - file extensions

output:
    - total number of files
"""




def main(source_directory: str, extensions: List[str]):
    print(f"Source directory: {source_directory}, extensions: {extensions}")
    source_directory = Path(source_directory).expanduser()
    if not source_directory.is_dir():
        raise ValueError(f"{source_directory} is not a directory")

    files_in_directory = [
        p.resolve()
        for p in source_directory.glob("**/*")

# Path: media_manager.py
# def valid_file(file_path):
#     invalid_file_extensions = [".json", ".ini", ".zip"]
#     invalid_names = [".ds_store"]
#     return (
#         file_path.exists()
#         and not file_path.is_dir()
#         and file_path.suffix.lower() not in invalid_file_extensions
#         and file_path.name.lower() not in invalid_names
#     )


# Path: file_counter.py
from pathlib import Path
from typing import List
from media_manager import valid_file
import fire

#!/usr/bin/env python3
"""
Count number of files by type in a directory

input:
    - directory
    - file extensions

output:
    - total number of files
"""




def main(source_directory: str, extensions: List[str]):
    print(f"Source directory: {source_directory}, extensions: {extensions}")
    source_directory = Path(source_directory).expanduser()
    if not source_directory.is_dir():
        raise ValueError(f"{source_directory} is not a directory")

    files_in_directory = [
        p.resolve()
        for p in source_directory.glob("**/*")

        if p.is_file() and p.suffix.lower() in extensions and valid_file(p)