Commit cca04b2507

cca04b25079e747527e746ad388546248f349eaa

parent: 8fc395ab26

Unsigned

Wraient <wraient.911@gmail.com> · 2025-02-22 19:31 UTC

Chore: Spacing uwu

Layout: unified · split

internal/curd.go +12 −12
@@ -142,7 +142,7 @@ func ExitCurd(err error) {
142 if anime != nil && anime.Ep.Player.SocketPath != "" { 142 if anime != nil && anime.Ep.Player.SocketPath != "" {
143 _, err = MPVSendCommand(anime.Ep.Player.SocketPath, []interface{}{"quit"}) 143 _, err = MPVSendCommand(anime.Ep.Player.SocketPath, []interface{}{"quit"})
144 if err != nil { 144 if err != nil {
145 Log("Error closing MPV: "+err.Error()) 145 Log("Error closing MPV: " + err.Error())
146 } 146 }
147 } 147 }
148 148
@@ -537,7 +537,7 @@ func AddNewAnime(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseA
537 if userCurdConfig.RofiSelection { 537 if userCurdConfig.RofiSelection {
538 userInput, err := GetUserInputFromRofi("Enter the anime name") 538 userInput, err := GetUserInputFromRofi("Enter the anime name")
539 if err != nil { 539 if err != nil {
540 Log("Error getting user input: "+err.Error()) 540 Log("Error getting user input: " + err.Error())
541 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error())) 541 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
542 } 542 }
543 query = userInput 543 query = userInput
@@ -642,13 +642,13 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
642 idFilePath := filepath.Join(os.ExpandEnv(userCurdConfig.StoragePath), "curd_id") 642 idFilePath := filepath.Join(os.ExpandEnv(userCurdConfig.StoragePath), "curd_id")
643 idBytes, err := os.ReadFile(idFilePath) 643 idBytes, err := os.ReadFile(idFilePath)
644 if err != nil { 644 if err != nil {
645 Log("Error reading curd_id file: "+err.Error()) 645 Log("Error reading curd_id file: " + err.Error())
646 ExitCurd(fmt.Errorf("No last watched anime found")) 646 ExitCurd(fmt.Errorf("No last watched anime found"))
647 } 647 }
648 648
649 anilistID, err := strconv.Atoi(string(idBytes)) 649 anilistID, err := strconv.Atoi(string(idBytes))
650 if err != nil { 650 if err != nil {
651 Log("Error converting anilist ID: "+err.Error()) 651 Log("Error converting anilist ID: " + err.Error())
652 ExitCurd(fmt.Errorf("Invalid anime ID in curd_id file")) 652 ExitCurd(fmt.Errorf("Invalid anime ID in curd_id file"))
653 } 653 }
654 654
@@ -874,28 +874,28 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
874 // Use rofi for selection 874 // Use rofi for selection
875 selectedOption, err = DynamicSelect(options, false) 875 selectedOption, err = DynamicSelect(options, false)
876 if err != nil { 876 if err != nil {
877 Log("Error in selection: "+err.Error()) 877 Log("Error in selection: " + err.Error())
878 ExitCurd(err) 878 ExitCurd(err)
879 } 879 }
880 880
881 if selectedOption.Key == "yes" { 881 if selectedOption.Key == "yes" {
882 err = AddAnimeToWatchingList(anime.AnilistId, user.Token) 882 err = AddAnimeToWatchingList(anime.AnilistId, user.Token)
883 if err != nil { 883 if err != nil {
884 Log("Error adding anime to watching list: "+err.Error()) 884 Log("Error adding anime to watching list: " + err.Error())
885 ExitCurd(err) 885 ExitCurd(err)
886 } 886 }
887 // Refresh user's anime list after adding 887 // Refresh user's anime list after adding
888 if userCurdConfig.RofiSelection && userCurdConfig.ImagePreview { 888 if userCurdConfig.RofiSelection && userCurdConfig.ImagePreview {
889 anilistUserDataPreview, err := GetUserDataPreview(user.Token, user.Id) 889 anilistUserDataPreview, err := GetUserDataPreview(user.Token, user.Id)
890 if err != nil { 890 if err != nil {
891 Log("Error refreshing anime list: "+err.Error()) 891 Log("Error refreshing anime list: " + err.Error())
892 ExitCurd(err) 892 ExitCurd(err)
893 } 893 }
894 user.AnimeList = ParseAnimeList(anilistUserDataPreview) 894 user.AnimeList = ParseAnimeList(anilistUserDataPreview)
895 } else { 895 } else {
896 anilistUserData, err := GetUserData(user.Token, user.Id) 896 anilistUserData, err := GetUserData(user.Token, user.Id)
897 if err != nil { 897 if err != nil {
898 Log("Error refreshing anime list: "+err.Error()) 898 Log("Error refreshing anime list: " + err.Error())
899 ExitCurd(err) 899 ExitCurd(err)
900 } 900 }
901 user.AnimeList = ParseAnimeList(anilistUserData) 901 user.AnimeList = ParseAnimeList(anilistUserData)
@@ -952,7 +952,7 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
952 if userCurdConfig.RofiSelection { 952 if userCurdConfig.RofiSelection {
953 userInput, err := GetUserInputFromRofi("Enter the episode you want to start from") 953 userInput, err := GetUserInputFromRofi("Enter the episode you want to start from")
954 if err != nil { 954 if err != nil {
955 Log("Error getting user input: "+err.Error()) 955 Log("Error getting user input: " + err.Error())
956 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error())) 956 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
957 } 957 }
958 episodeNumber, err = strconv.Atoi(userInput) 958 episodeNumber, err = strconv.Atoi(userInput)
@@ -970,7 +970,7 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
970 if userCurdConfig.RofiSelection { 970 if userCurdConfig.RofiSelection {
971 userInput, err := GetUserInputFromRofi("Would like to start the anime from beginning? (y/n)") 971 userInput, err := GetUserInputFromRofi("Would like to start the anime from beginning? (y/n)")
972 if err != nil { 972 if err != nil {
973 Log("Error getting user input: "+err.Error()) 973 Log("Error getting user input: " + err.Error())
974 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error())) 974 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
975 } 975 }
976 answer = userInput 976 answer = userInput
@@ -1025,7 +1025,7 @@ func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string {
1025 if userCurdConfig.RofiSelection { 1025 if userCurdConfig.RofiSelection {
1026 userInput, err := GetUserInputFromRofi(fmt.Sprintf("Enter the episode (%v episodes)", episodeList[len(episodeList)-1])) 1026 userInput, err := GetUserInputFromRofi(fmt.Sprintf("Enter the episode (%v episodes)", episodeList[len(episodeList)-1]))
1027 if err != nil { 1027 if err != nil {
1028 Log("Error getting user input: "+err.Error()) 1028 Log("Error getting user input: " + err.Error())
1029 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error())) 1029 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
1030 } 1030 }
1031 anime.Ep.Number, err = strconv.Atoi(userInput) 1031 anime.Ep.Number, err = strconv.Atoi(userInput)
@@ -1061,7 +1061,7 @@ func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string {
1061 } 1061 }
1062 nextLinks, err := GetEpisodeURL(*userCurdConfig, anime.AllanimeId, nextEpNum) 1062 nextLinks, err := GetEpisodeURL(*userCurdConfig, anime.AllanimeId, nextEpNum)
1063 if err != nil { 1063 if err != nil {
1064 Log("Error getting next episode link: "+err.Error()) 1064 Log("Error getting next episode link: " + err.Error())
1065 } else { 1065 } else {
1066 anime.Ep.NextEpisode = NextEpisode{ 1066 anime.Ep.NextEpisode = NextEpisode{
1067 Number: nextEpNum, 1067 Number: nextEpNum,