Commit f7879bc013
Unsigned
Layout: unified · split
internal/curd.go +13 −15
| @@ -3,26 +3,24 @@ package internal | |||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/json" | 4 | "encoding/json" |
| 5 | "fmt" | 5 | "fmt" |
| 6 | "io/ioutil" | ||
| 6 | "os" | 7 | "os" |
| 7 | "runtime" | 8 | "runtime" |
| 9 | "strings" | ||
| 8 | "time" | 10 | "time" |
| 9 | // "log" | ||
| 10 | ) | 11 | ) |
| 11 | 12 | ||
| 12 | type curdConfig struct { | 13 | func GetTokenFromFile(filePath string) (string, error) { |
| 13 | player string | 14 | // Read the token from the file |
| 14 | historyFile string | 15 | data, err := ioutil.ReadFile(filePath) |
| 15 | subs_language string | 16 | if err != nil { |
| 16 | sub_or_dub string | 17 | return "", fmt.Errorf("failed to read token from file: %w", err) |
| 17 | percentageToMarkComplete int | 18 | } |
| 18 | nextEpisodePrompt bool | 19 | |
| 19 | skipOp bool | 20 | // Convert the byte slice to a string and remove any surrounding whitespace or newlines |
| 20 | skipEd bool | 21 | token := strings.TrimSpace(string(data)) |
| 21 | skipFiller bool | 22 | |
| 22 | skipRecap bool | 23 | return token, nil |
| 23 | scoreOnCompletion bool | ||
| 24 | saveMpvSpeed bool | ||
| 25 | discordPresence bool | ||
| 26 | } | 24 | } |
| 27 | 25 | ||
| 28 | // LogData logs the input data into a specified log file with the format [LOG] time lineNumber: logData | 26 | // LogData logs the input data into a specified log file with the format [LOG] time lineNumber: logData |