"""
Created by: Jap-Slappa 
Make A List from folders-v1.0
"""

from pathlib import Path
import PySimpleGUI as sg


Discovered_folder_path = r'\\192.168.4.212\web\00.My_Watclists_4_Kodi\Discovered-NEW-Anime_TV--2026'

Currently_Watching_folder_path = r'\\192.168.4.212\web\00.My_Watclists_4_Kodi\Currently-Watching-Anime_TV--2025+'

Old_Fav_Anime_folder_path = r'\\192.168.4.212\web\00.My_Watclists_4_Kodi\__Old_Fav_Anime'

# My_default_folder_path = r'\\192.168.4.212\web\00.My_Watclists_4_Kodi\Anime-TV-(Blank-nfos)'
# selected_folder = sg.popup_get_folder('Get Folder Path', default_path=My_default_folder_path)
# print('selected_folder: \n', selected_folder)

folders_in_Path = []
def get_all_folders_in_path(folder_path):
    # folders = Path(folder_path).iterdir()
    # Filter directories only
    for folder in Path(folder_path).iterdir():
        if folder.is_dir():
            folders_in_Path.append(folder.name)
#? === End Of Function ==

def my_pretty_print(a_list:list[str]):
    # pretty_list = []
    print()
    print('=== pretty_list : Function ===')
    print()
    for idx, list_item in enumerate(a_list, start=1):
        idx_str = str(idx).zfill(2)
        # print(f'{idx_str}: {list_item}')
        print(list_item)
    
    print()
    print('my_pretty_print... Completed!')
#? === End Of Function ==

def make_check_list_4_Joplin(a_list:list[str]):
    # pretty_list = []
    print()
    print('=== pretty_list : Function ===')
    print()
    for idx, list_item in enumerate(a_list, start=1):
        idx_str = str(idx).zfill(2)
        # print(f'{idx_str}: {list_item}')
        print(f'- [ ] {idx_str}: {list_item}')
        # print(list_item)
    
    print()
    print('my_pretty_print... Completed!')
#? === End Of Function ==

# get_all_folders_in_path(Discovered_folder_path)
get_all_folders_in_path(Currently_Watching_folder_path)
# get_all_folders_in_path(Old_Fav_Anime_folder_path)

# get_all_folders_in_path(selected_folder)  # OG Code
# list_comp = '\n'.join(folder for folder in folders_in_Path)
print()
print()

print('folders_in_Path...')
# my_pretty_print(folders_in_Path)
make_check_list_4_Joplin(folders_in_Path)

# print(list_comp)
# print(*folders_in_Path, end='\n')
print()

