Commit 02868598ec

02868598ece56a83966ad1b3e7b7a16c322244ce

parent: 510721859d

Unsigned

justchokingaround <ivanonarch@tutanota.com> · 2025-02-09 12:01 UTC

chore: Sprintf -> Errorf

Layout: unified · split

internal/anilist.go +1 −1
@@ -59,7 +59,7 @@ func GetAnimeMapPreview(animeList AnimeList) map[string]RofiSelectPreview {
59 populateMap := func(entries []Entry) { 59 populateMap := func(entries []Entry) {
60 for _, entry := range entries { 60 for _, entry := range entries {
61 // Only include entries with a non-empty English title 61 // Only include entries with a non-empty English title
62 Log(fmt.Sprintf("AnimeNameLanguage: ", userCurdConfig.AnimeNameLanguage), logFile) 62 Log(fmt.Errorf("AnimeNameLanguage: %v", userCurdConfig.AnimeNameLanguage), logFile)
63 if entry.Media.Title.English != "" && userCurdConfig.AnimeNameLanguage == "english" { 63 if entry.Media.Title.English != "" && userCurdConfig.AnimeNameLanguage == "english" {
64 animeMap[strconv.Itoa(entry.Media.ID)] = RofiSelectPreview{ 64 animeMap[strconv.Itoa(entry.Media.ID)] = RofiSelectPreview{
65 Title: entry.Media.Title.English, 65 Title: entry.Media.Title.English,
internal/aniskip.go +5 −5
@@ -10,8 +10,8 @@ import (
10 10
11// skipTimesResponse struct to hold the response from the AniSkip API 11// skipTimesResponse struct to hold the response from the AniSkip API
12type skipTimesResponse struct { 12type skipTimesResponse struct {
13 Found bool `json:"found"` 13 Found bool `json:"found"`
14 Results []skipResult `json:"results"` 14 Results []skipResult `json:"results"`
15} 15}
16 16
17// skipResult struct to hold individual skip result data 17// skipResult struct to hold individual skip result data
@@ -32,7 +32,7 @@ func GetAniSkipData(animeMalId int, episode int) (string, error) {
32 32
33 resp, err := http.Get(url) 33 resp, err := http.Get(url)
34 if err != nil { 34 if err != nil {
35 Log(fmt.Sprintf("error fetching data from AniSkip API: %w", err), logFile) 35 Log(fmt.Errorf("error fetching data from AniSkip API: %w", err), logFile)
36 return "", fmt.Errorf("error fetching data from AniSkip API: %w", err) 36 return "", fmt.Errorf("error fetching data from AniSkip API: %w", err)
37 } 37 }
38 defer resp.Body.Close() 38 defer resp.Body.Close()
@@ -44,7 +44,7 @@ func GetAniSkipData(animeMalId int, episode int) (string, error) {
44 44
45 body, err := io.ReadAll(resp.Body) 45 body, err := io.ReadAll(resp.Body)
46 if err != nil { 46 if err != nil {
47 Log(fmt.Sprintf("failed to read response body: %w", err), logFile) 47 Log(fmt.Errorf("failed to read response body %w", err), logFile)
48 return "", fmt.Errorf("failed to read response body %w", err) 48 return "", fmt.Errorf("failed to read response body %w", err)
49 } 49 }
50 50
@@ -100,4 +100,4 @@ func GetAndParseAniSkipData(animeMalId int, episode int, timePrecision int, anim
100 return err 100 return err
101 } 101 }
102 return ParseAniSkipResponse(responseText, anime, timePrecision) 102 return ParseAniSkipResponse(responseText, anime, timePrecision)
103}\ No newline at end of file 103}
internal/localTracking.go +6 −6
@@ -234,7 +234,7 @@ func LocalUpdateAnime(databaseFile string, anilistID int, allanimeID string, wat
234 CurdOut(fmt.Sprintf("Error writing record: %v", err)) 234 CurdOut(fmt.Sprintf("Error writing record: %v", err))
235 } 235 }
236 } 236 }
237 237
238 return nil 238 return nil
239} 239}
240 240
@@ -259,7 +259,7 @@ func WatchUntracked(userCurdConfig *CurdConfig, logFile string) {
259 userInput, err := GetUserInputFromRofi("Enter the anime name") 259 userInput, err := GetUserInputFromRofi("Enter the anime name")
260 if err != nil { 260 if err != nil {
261 Log("Error getting user input: "+err.Error(), logFile) 261 Log("Error getting user input: "+err.Error(), logFile)
262 ExitCurd(fmt.Errorf("Error getting user input: "+err.Error())) 262 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
263 } 263 }
264 query = userInput 264 query = userInput
265 } else { 265 } else {
@@ -298,7 +298,7 @@ func WatchUntracked(userCurdConfig *CurdConfig, logFile string) {
298 userInput, err := GetUserInputFromRofi("Enter the episode number") 298 userInput, err := GetUserInputFromRofi("Enter the episode number")
299 if err != nil { 299 if err != nil {
300 Log("Error getting episode number: "+err.Error(), logFile) 300 Log("Error getting episode number: "+err.Error(), logFile)
301 ExitCurd(fmt.Errorf("Error getting episode number: "+err.Error())) 301 ExitCurd(fmt.Errorf("Error getting episode number: " + err.Error()))
302 } 302 }
303 episodeNumber, err = strconv.Atoi(userInput) 303 episodeNumber, err = strconv.Atoi(userInput)
304 if err != nil { 304 if err != nil {
@@ -311,7 +311,7 @@ func WatchUntracked(userCurdConfig *CurdConfig, logFile string) {
311 } 311 }
312 312
313 anime.Ep.Number = episodeNumber 313 anime.Ep.Number = episodeNumber
314 314
315 for { 315 for {
316 // Get episode link 316 // Get episode link
317 link, err := GetEpisodeURL(*userCurdConfig, anime.AllanimeId, anime.Ep.Number) 317 link, err := GetEpisodeURL(*userCurdConfig, anime.AllanimeId, anime.Ep.Number)
@@ -335,8 +335,8 @@ func WatchUntracked(userCurdConfig *CurdConfig, logFile string) {
335 335
336 anime.Ep.Player.SocketPath = mpvSocketPath 336 anime.Ep.Player.SocketPath = mpvSocketPath
337 anime.Ep.Started = false 337 anime.Ep.Started = false
338 338
339 Log(fmt.Sprintf("Started mpvsocketpath ", anime.Ep.Player.SocketPath), logFile) 339 Log(fmt.Sprintf("Started mpv with socket path: %s", anime.Ep.Player.SocketPath), logFile)
340 340
341 // Get video duration 341 // Get video duration
342 go func() { 342 go func() {