import sys
import os

# Add current dir to sys path so we can import config
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import config
from scratch_test_assets import get_asset_map

def run_all_channels():
    asset_map = get_asset_map()
    all_channels = []
    all_channels.extend(list(config.RAI_CHANNELS.values()))
    all_channels.extend(list(config.MEDIASET_CHANNELS.values()))
    all_channels.extend(list(config.SKY_CHANNELS.values()))
    
    missing = []
    
    for chan in all_channels:
        fmt = chan.lower().replace(" ", "_").replace("+", "plus")
        if "sky_sport_25" in fmt:
            fmt = "sky_sport"
        elif fmt == "sky_tv8" or fmt == "sky_tv8_hd":
            fmt = "tv8"
        
        if fmt in asset_map:
            img = asset_map[fmt]
        elif fmt.replace("_", "") in asset_map:
            img = asset_map[fmt.replace("_", "")]
        elif fmt == "italia_1" and "italia_uno" in asset_map:
            img = asset_map["italia_uno"]
        elif fmt == "rete_4" and "rete_4" in asset_map:
            img = asset_map["rete_4"]
        else:
            # Let's try to find partial matches just for reporting
            img = "NOT FOUND"
            missing.append(chan)
            
        # print(f"{chan:25} -> {img}")
        
    print("\n--- MISSING ---")
    for m in missing:
        print(m)

run_all_channels()
