package oplcli import ( "fmt" "os" ) type Config struct { } func Scan(files []string, config Config) { gameList, err := loadGamelist("./ps2-gameslist.txt") if err != nil { fmt.Printf("Failed to load game list: %v", err) os.Exit(1) } for _, file := range files { fmt.Printf("Scanning file: %s\n", file) gameID, err := scanGameFileForID(file) if err != nil { fmt.Printf("Failed to scan game file: %s", err) os.Exit(1) } fmt.Printf("Found game ID: %s\n", gameID) gameName := gameList[gameID] fmt.Printf("Found game name: %s\n", gameName) } } func Rename(files []string, config Config) { gameList, err := loadGamelist("./ps2-gameslist.txt") if err != nil { fmt.Printf("Failed to load game list: %v", err) os.Exit(1) } for _, file := range files { fmt.Printf("Scanning file: %s\n", file) gameID, err := scanGameFileForID(file) if err != nil { fmt.Printf("Failed to scan game file: %s", err) os.Exit(1) } fmt.Printf("Found game ID: %s\n", gameID) gameName := gameList[gameID] fmt.Printf("Found game name: %s\n", gameName) newPath, err := renameGameFile(file, gameName) if err != nil { fmt.Printf("Failed to rename file: %v", err) os.Exit(1) } fmt.Printf("Renamed %s to %s", file, newPath) } } func DownloadGameArt(files []string, output string, config Config) { for _, file := range files { fmt.Printf("Scanning file: %s\n", file) gameID, err := scanGameFileForID(file) if err != nil { fmt.Printf("Failed to scan game file: %s", err) os.Exit(1) } fmt.Printf("Found game ID: %s\n", gameID) downloadArtForGame(gameID, output) } }