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) {
142142 if anime != nil && anime.Ep.Player.SocketPath != "" {
143143 _, err = MPVSendCommand(anime.Ep.Player.SocketPath, []interface{}{"quit"})
144144 if err != nil {
145 Log("Error closing MPV: "+err.Error())
145 Log("Error closing MPV: " + err.Error())
146146 }
147147 }
148148
@@ -537,7 +537,7 @@ func AddNewAnime(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseA
537537 if userCurdConfig.RofiSelection {
538538 userInput, err := GetUserInputFromRofi("Enter the anime name")
539539 if err != nil {
540 Log("Error getting user input: "+err.Error())
540 Log("Error getting user input: " + err.Error())
541541 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
542542 }
543543 query = userInput
@@ -642,13 +642,13 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
642642 idFilePath := filepath.Join(os.ExpandEnv(userCurdConfig.StoragePath), "curd_id")
643643 idBytes, err := os.ReadFile(idFilePath)
644644 if err != nil {
645 Log("Error reading curd_id file: "+err.Error())
645 Log("Error reading curd_id file: " + err.Error())
646646 ExitCurd(fmt.Errorf("No last watched anime found"))
647647 }
648648
649649 anilistID, err := strconv.Atoi(string(idBytes))
650650 if err != nil {
651 Log("Error converting anilist ID: "+err.Error())
651 Log("Error converting anilist ID: " + err.Error())
652652 ExitCurd(fmt.Errorf("Invalid anime ID in curd_id file"))
653653 }
654654
@@ -874,28 +874,28 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
874874 // Use rofi for selection
875875 selectedOption, err = DynamicSelect(options, false)
876876 if err != nil {
877 Log("Error in selection: "+err.Error())
877 Log("Error in selection: " + err.Error())
878878 ExitCurd(err)
879879 }
880880
881881 if selectedOption.Key == "yes" {
882882 err = AddAnimeToWatchingList(anime.AnilistId, user.Token)
883883 if err != nil {
884 Log("Error adding anime to watching list: "+err.Error())
884 Log("Error adding anime to watching list: " + err.Error())
885885 ExitCurd(err)
886886 }
887887 // Refresh user's anime list after adding
888888 if userCurdConfig.RofiSelection && userCurdConfig.ImagePreview {
889889 anilistUserDataPreview, err := GetUserDataPreview(user.Token, user.Id)
890890 if err != nil {
891 Log("Error refreshing anime list: "+err.Error())
891 Log("Error refreshing anime list: " + err.Error())
892892 ExitCurd(err)
893893 }
894894 user.AnimeList = ParseAnimeList(anilistUserDataPreview)
895895 } else {
896896 anilistUserData, err := GetUserData(user.Token, user.Id)
897897 if err != nil {
898 Log("Error refreshing anime list: "+err.Error())
898 Log("Error refreshing anime list: " + err.Error())
899899 ExitCurd(err)
900900 }
901901 user.AnimeList = ParseAnimeList(anilistUserData)
@@ -952,7 +952,7 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
952952 if userCurdConfig.RofiSelection {
953953 userInput, err := GetUserInputFromRofi("Enter the episode you want to start from")
954954 if err != nil {
955 Log("Error getting user input: "+err.Error())
955 Log("Error getting user input: " + err.Error())
956956 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
957957 }
958958 episodeNumber, err = strconv.Atoi(userInput)
@@ -970,7 +970,7 @@ func SetupCurd(userCurdConfig *CurdConfig, anime *Anime, user *User, databaseAni
970970 if userCurdConfig.RofiSelection {
971971 userInput, err := GetUserInputFromRofi("Would like to start the anime from beginning? (y/n)")
972972 if err != nil {
973 Log("Error getting user input: "+err.Error())
973 Log("Error getting user input: " + err.Error())
974974 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
975975 }
976976 answer = userInput
@@ -1025,7 +1025,7 @@ func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string {
10251025 if userCurdConfig.RofiSelection {
10261026 userInput, err := GetUserInputFromRofi(fmt.Sprintf("Enter the episode (%v episodes)", episodeList[len(episodeList)-1]))
10271027 if err != nil {
1028 Log("Error getting user input: "+err.Error())
1028 Log("Error getting user input: " + err.Error())
10291029 ExitCurd(fmt.Errorf("Error getting user input: " + err.Error()))
10301030 }
10311031 anime.Ep.Number, err = strconv.Atoi(userInput)
@@ -1061,7 +1061,7 @@ func StartCurd(userCurdConfig *CurdConfig, anime *Anime) string {
10611061 }
10621062 nextLinks, err := GetEpisodeURL(*userCurdConfig, anime.AllanimeId, nextEpNum)
10631063 if err != nil {
1064 Log("Error getting next episode link: "+err.Error())
1064 Log("Error getting next episode link: " + err.Error())
10651065 } else {
10661066 anime.Ep.NextEpisode = NextEpisode{
10671067 Number: nextEpNum,