Commit 4c0962cb42

4c0962cb4259320fb7e660217e5dd57e50f7f0ce

parent: 5a9b0a04b4

Unsigned

Wraient <wraient.911@gmail.com> · 2026-05-23 00:35 UTC

Track MAL import dismissal

Layout: unified · split

internal/config.go +59 −57
@@ -38,35 +38,36 @@ type AnilistToken struct {
3838
3939// CurdConfig struct with field names that match the config keys
4040type CurdConfig struct {
41 Player string `config:"Player"`
42 MpvArgs []string `config:"MpvArgs"`
43 SubsLanguage string `config:"SubsLanguage"`
44 SubOrDub string `config:"SubOrDub"`
45 StoragePath string `config:"StoragePath"`
46 AnimeNameLanguage string `config:"AnimeNameLanguage"`
47 MenuOrder string `config:"MenuOrder"`
48 PercentageToMarkComplete int `config:"PercentageToMarkComplete"`
49 NextEpisodePrompt bool `config:"NextEpisodePrompt"`
50 SkipOp bool `config:"SkipOp"`
51 SkipEd bool `config:"SkipEd"`
52 SkipFiller bool `config:"SkipFiller"`
53 ImagePreview bool `config:"ImagePreview"`
54 SkipRecap bool `config:"SkipRecap"`
55 RofiSelection bool `config:"RofiSelection"`
56 CurrentCategory bool `config:"CurrentCategory"`
57 ScoreOnCompletion bool `config:"ScoreOnCompletion"`
58 SaveMpvSpeed bool `config:"SaveMpvSpeed"`
59 AddMissingOptions bool `config:"AddMissingOptions"`
60 AlternateScreen bool `config:"AlternateScreen"`
61 DiscordPresence bool `config:"DiscordPresence"`
62 DiscordClientId string `config:"DiscordClientId"`
63 Provider string `config:"Provider"`
64 TrackingLocal bool `config:"TrackingLocal"`
65 TrackingRemote string `config:"TrackingRemote"`
66 TrackingConfigured bool `config:"TrackingConfigured"`
67 MyAnimeListClientID string `config:"MyAnimeListClientID"`
68 MyAnimeListClientSecret string `config:"MyAnimeListClientSecret"`
69 MyAnimeListImported bool `config:"MyAnimeListImported"`
41 Player string `config:"Player"`
42 MpvArgs []string `config:"MpvArgs"`
43 SubsLanguage string `config:"SubsLanguage"`
44 SubOrDub string `config:"SubOrDub"`
45 StoragePath string `config:"StoragePath"`
46 AnimeNameLanguage string `config:"AnimeNameLanguage"`
47 MenuOrder string `config:"MenuOrder"`
48 PercentageToMarkComplete int `config:"PercentageToMarkComplete"`
49 NextEpisodePrompt bool `config:"NextEpisodePrompt"`
50 SkipOp bool `config:"SkipOp"`
51 SkipEd bool `config:"SkipEd"`
52 SkipFiller bool `config:"SkipFiller"`
53 ImagePreview bool `config:"ImagePreview"`
54 SkipRecap bool `config:"SkipRecap"`
55 RofiSelection bool `config:"RofiSelection"`
56 CurrentCategory bool `config:"CurrentCategory"`
57 ScoreOnCompletion bool `config:"ScoreOnCompletion"`
58 SaveMpvSpeed bool `config:"SaveMpvSpeed"`
59 AddMissingOptions bool `config:"AddMissingOptions"`
60 AlternateScreen bool `config:"AlternateScreen"`
61 DiscordPresence bool `config:"DiscordPresence"`
62 DiscordClientId string `config:"DiscordClientId"`
63 Provider string `config:"Provider"`
64 TrackingLocal bool `config:"TrackingLocal"`
65 TrackingRemote string `config:"TrackingRemote"`
66 TrackingConfigured bool `config:"TrackingConfigured"`
67 MyAnimeListClientID string `config:"MyAnimeListClientID"`
68 MyAnimeListClientSecret string `config:"MyAnimeListClientSecret"`
69 MyAnimeListImported bool `config:"MyAnimeListImported"`
70 MyAnimeListImportDismissed bool `config:"MyAnimeListImportDismissed"`
7071}
7172
7273func GetStoragePath() string {
@@ -79,34 +80,35 @@ func GetStoragePath() string {
7980// Default configuration values as a map
8081func defaultConfigMap() map[string]string {
8182 return map[string]string{
82 "Player": "mpv",
83 "MpvArgs": "[]",
84 "StoragePath": "$HOME/.local/share/curd",
85 "AnimeNameLanguage": "english",
86 "SubsLanguage": "english",
87 "MenuOrder": "CURRENT,ALL,UNTRACKED,UPDATE,CONTINUE_LAST,TRACKER,PROVIDER",
88 "SubOrDub": "sub",
89 "PercentageToMarkComplete": "85",
90 "NextEpisodePrompt": "false",
91 "SkipOp": "true",
92 "SkipEd": "true",
93 "SkipFiller": "true",
94 "SkipRecap": "true",
95 "RofiSelection": "false",
96 "ImagePreview": "false",
97 "ScoreOnCompletion": "true",
98 "SaveMpvSpeed": "true",
99 "AddMissingOptions": "true",
100 "AlternateScreen": "true",
101 "DiscordPresence": "true",
102 "DiscordClientId": "1287457464148820089",
103 "Provider": "allanime",
104 "TrackingLocal": "true",
105 "TrackingRemote": "anilist",
106 "TrackingConfigured": "false",
107 "MyAnimeListClientID": "f76d4c827152327b60654285d221222c",
108 "MyAnimeListClientSecret": "",
109 "MyAnimeListImported": "false",
83 "Player": "mpv",
84 "MpvArgs": "[]",
85 "StoragePath": "$HOME/.local/share/curd",
86 "AnimeNameLanguage": "english",
87 "SubsLanguage": "english",
88 "MenuOrder": "CURRENT,ALL,UNTRACKED,UPDATE,CONTINUE_LAST,TRACKER,PROVIDER",
89 "SubOrDub": "sub",
90 "PercentageToMarkComplete": "85",
91 "NextEpisodePrompt": "false",
92 "SkipOp": "true",
93 "SkipEd": "true",
94 "SkipFiller": "true",
95 "SkipRecap": "true",
96 "RofiSelection": "false",
97 "ImagePreview": "false",
98 "ScoreOnCompletion": "true",
99 "SaveMpvSpeed": "true",
100 "AddMissingOptions": "true",
101 "AlternateScreen": "true",
102 "DiscordPresence": "true",
103 "DiscordClientId": "1287457464148820089",
104 "Provider": "allanime",
105 "TrackingLocal": "true",
106 "TrackingRemote": "anilist",
107 "TrackingConfigured": "false",
108 "MyAnimeListClientID": "f76d4c827152327b60654285d221222c",
109 "MyAnimeListClientSecret": "",
110 "MyAnimeListImported": "false",
111 "MyAnimeListImportDismissed": "false",
110112 }
111113}
112114
internal/tracking.go +7 −4
@@ -142,6 +142,7 @@ func persistTrackingConfig(config *CurdConfig) error {
142142 configMap["MyAnimeListClientID"] = config.MyAnimeListClientID
143143 configMap["MyAnimeListClientSecret"] = config.MyAnimeListClientSecret
144144 configMap["MyAnimeListImported"] = strconv.FormatBool(config.MyAnimeListImported)
145 configMap["MyAnimeListImportDismissed"] = strconv.FormatBool(config.MyAnimeListImportDismissed)
145146
146147 return SaveConfigToFile(GlobalConfigPath, configMap)
147148}
@@ -1128,14 +1129,13 @@ func AddAnimeToList(animeID int, status string, token string) error {
11281129}
11291130
11301131func maybeImportAniListToMyAnimeList(config *CurdConfig, user *User) error {
1131 if config == nil || user == nil || !UsesMyAnimeListTracking(config) || config.MyAnimeListImported || hasAnyEntries(user.AnimeList) {
1132 if config == nil || user == nil || !UsesMyAnimeListTracking(config) || config.MyAnimeListImported || config.MyAnimeListImportDismissed || hasAnyEntries(user.AnimeList) {
11321133 return nil
11331134 }
11341135
11351136 legacyTokenPath := filepath.Join(os.ExpandEnv(config.StoragePath), "anilist_token.json")
11361137 if _, err := os.Stat(legacyTokenPath); err != nil {
1137 config.MyAnimeListImported = true
1138 return persistTrackingConfig(config)
1138 return nil
11391139 }
11401140
11411141 options := []SelectionOption{
@@ -1156,9 +1156,12 @@ func maybeImportAniListToMyAnimeList(config *CurdConfig, user *User) error {
11561156 if err := RefreshMyAnimeListUserAnimeList(config, user); err != nil {
11571157 return err
11581158 }
1159 config.MyAnimeListImported = true
1160 config.MyAnimeListImportDismissed = false
1161 return persistTrackingConfig(config)
11591162 }
11601163
1161 config.MyAnimeListImported = true
1164 config.MyAnimeListImportDismissed = true
11621165 return persistTrackingConfig(config)
11631166}
11641167