Fix: priting errors

This commit is contained in:
Óscar M. Lage 2024-10-11 21:24:46 +02:00
parent 6f7a5c9b74
commit 78f919158e
5 changed files with 12 additions and 12 deletions

View File

@ -35,7 +35,7 @@ func ProcessBooks(books []Book) error {
if book.ID == "" { if book.ID == "" {
err := SearchBookByTitle(book.Title, &book) err := SearchBookByTitle(book.Title, &book)
if err != nil { if err != nil {
fmt.Printf("Error searching book by title %s: %s\n", book.Title, err) fmt.Printf(" ! Error searching book by title %s: %s\n", book.Title, err)
continue continue
} }
} }
@ -46,7 +46,7 @@ func ProcessBooks(books []Book) error {
if imageURL != "" { if imageURL != "" {
err := DownloadImage(imageURL, book.Slug) err := DownloadImage(imageURL, book.Slug)
if err != nil { if err != nil {
fmt.Printf("Error downloading %s: %s\n", imageURL, err) fmt.Printf(" ! Error downloading %s: %s\n", imageURL, err)
} }
} }
book.Image = fmt.Sprintf("%s.jpg", book.Slug) book.Image = fmt.Sprintf("%s.jpg", book.Slug)

View File

@ -35,7 +35,7 @@ func ProcessGames(games []Game) error {
if game.ID == 0 { if game.ID == 0 {
err := SearchGameByTitle(game.Title, &game) err := SearchGameByTitle(game.Title, &game)
if err != nil { if err != nil {
fmt.Printf("Error searching game by title %s: %s\n", game.Title, err) fmt.Printf(" ! Error searching game by title %s: %s\n", game.Title, err)
continue continue
} }
} }
@ -46,7 +46,7 @@ func ProcessGames(games []Game) error {
suffix := "" suffix := ""
err := DownloadImage(game.Image, game.Slug, suffix) err := DownloadImage(game.Image, game.Slug, suffix)
if err != nil { if err != nil {
fmt.Printf("Error downloading %s: %s\n", game.Image, err) fmt.Printf(" ! Error downloading %s: %s\n", game.Image, err)
} }
game.Image = fmt.Sprintf("%s.jpg", game.Slug) game.Image = fmt.Sprintf("%s.jpg", game.Slug)
} }

View File

@ -37,7 +37,7 @@ func ProcessMovies(movies []Movie) error {
if movie.IDs.Trakt == 0 { if movie.IDs.Trakt == 0 {
err := SearchMovieByTitle(movie.Title, &movie) err := SearchMovieByTitle(movie.Title, &movie)
if err != nil { if err != nil {
fmt.Printf("Error searching movie by title %s: %s\n", movie.Title, err) fmt.Printf(" ! Error searching movie by title %s: %s\n", movie.Title, err)
continue continue
} }
} }
@ -45,7 +45,7 @@ func ProcessMovies(movies []Movie) error {
// Now we need to get the images from fanart // Now we need to get the images from fanart
posterURL, backgroundURL, logoURL, err := FetchImagesFromFanart(movie.IDs.TMDB) posterURL, backgroundURL, logoURL, err := FetchImagesFromFanart(movie.IDs.TMDB)
if err != nil { if err != nil {
fmt.Printf("Error fetching images from Fanart.tv for %s: %s\n", movie.Title, err) fmt.Printf(" ! Error fetching images from Fanart.tv for %s: %s\n", movie.Title, err)
continue continue
} }
@ -75,7 +75,7 @@ func ProcessMovies(movies []Movie) error {
if image.URL != "" { if image.URL != "" {
err := DownloadImage(image.URL, movie.IDs.Slug, image.ImageType) err := DownloadImage(image.URL, movie.IDs.Slug, image.ImageType)
if err != nil { if err != nil {
fmt.Printf("Error downloading %s for %s: %s\n", image.ImageType, movie.Title, err) fmt.Printf(" ! Error downloading %s for %s: %s\n", image.ImageType, movie.Title, err)
} else { } else {
image.SetField(fmt.Sprintf("%s-%s.jpg", movie.IDs.Slug, image.ImageType)) image.SetField(fmt.Sprintf("%s-%s.jpg", movie.IDs.Slug, image.ImageType))
} }

View File

@ -35,7 +35,7 @@ func ProcessAlbum(albumList []Album) error {
if album.ID == "" { if album.ID == "" {
err := SearchAlbumByTitle(album.Title, &album) err := SearchAlbumByTitle(album.Title, &album)
if err != nil { if err != nil {
fmt.Printf("Error searching album by title %s: %s\n", album.Title, err) fmt.Printf(" ! Error searching album by title %s: %s\n", album.Title, err)
continue continue
} }
} }
@ -45,7 +45,7 @@ func ProcessAlbum(albumList []Album) error {
if album.Image != "" { if album.Image != "" {
err := DownloadImage(album.Image, album.Slug) err := DownloadImage(album.Image, album.Slug)
if err != nil { if err != nil {
fmt.Printf("Error downloading %s: %s\n", album.Image, err) fmt.Printf(" ! Error downloading %s: %s\n", album.Image, err)
} }
} }
album.Image = fmt.Sprintf("%s.jpg", album.Slug) album.Image = fmt.Sprintf("%s.jpg", album.Slug)

View File

@ -37,7 +37,7 @@ func ProcessSeries(series []Serie) error {
if serie.IDs.Trakt == 0 { if serie.IDs.Trakt == 0 {
err := SearchSerieByTitle(serie.Title, &serie) err := SearchSerieByTitle(serie.Title, &serie)
if err != nil { if err != nil {
fmt.Printf("Error searching serie by title %s: %s\n", serie.Title, err) fmt.Printf(" ! Error searching serie by title %s: %s\n", serie.Title, err)
continue continue
} }
} }
@ -45,7 +45,7 @@ func ProcessSeries(series []Serie) error {
// Now we need to get the images from fanart // Now we need to get the images from fanart
posterURL, backgroundURL, logoURL, err := FetchImagesFromFanart(serie.IDs.TVDB) posterURL, backgroundURL, logoURL, err := FetchImagesFromFanart(serie.IDs.TVDB)
if err != nil { if err != nil {
fmt.Printf("Error fetching images from Fanart.tv for %s: %s\n", serie.Title, err) fmt.Printf(" ! Error fetching images from Fanart.tv for %s: %s\n", serie.Title, err)
continue continue
} }
@ -75,7 +75,7 @@ func ProcessSeries(series []Serie) error {
if image.URL != "" { if image.URL != "" {
err := DownloadImage(image.URL, serie.IDs.Slug, image.ImageType) err := DownloadImage(image.URL, serie.IDs.Slug, image.ImageType)
if err != nil { if err != nil {
fmt.Printf("Error downloading %s for %s: %s\n", image.ImageType, serie.Title, err) fmt.Printf(" ! Error downloading %s for %s: %s\n", image.ImageType, serie.Title, err)
} else { } else {
image.SetField(fmt.Sprintf("%s-%s.jpg", serie.IDs.Slug, image.ImageType)) image.SetField(fmt.Sprintf("%s-%s.jpg", serie.IDs.Slug, image.ImageType))
} }