allow multiple files to be processed
This commit is contained in:
@@ -8,66 +8,71 @@ import (
|
||||
type Config struct {
|
||||
}
|
||||
|
||||
func Scan(file string, config Config) {
|
||||
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)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
gameName := gameList[gameID]
|
||||
fmt.Printf("Found game name: %s\n", gameName)
|
||||
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(file string, config Config) {
|
||||
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)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
gameName := gameList[gameID]
|
||||
fmt.Printf("Found game name: %s\n", gameName)
|
||||
for _, file := range files {
|
||||
fmt.Printf("Scanning file: %s\n", file)
|
||||
|
||||
newPath, err := renameGameFile(file, gameName)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to rename file: %v", err)
|
||||
os.Exit(1)
|
||||
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)
|
||||
}
|
||||
|
||||
fmt.Printf("Renamed %s to %s", file, newPath)
|
||||
}
|
||||
|
||||
func DownloadGameArt(file string, config Config) {
|
||||
fmt.Printf("Scanning file: %s\n", file)
|
||||
func DownloadGameArt(files []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)
|
||||
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, "./ignore")
|
||||
}
|
||||
|
||||
fmt.Printf("Found game ID: %s\n", gameID)
|
||||
|
||||
downloadArtForGame(gameID, "./art")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user