Skip to content

Commit

Permalink
feat: added the '--mark-watched' flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pspiagicw committed Jun 3, 2024
1 parent 688fc33 commit 4c66416
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions bugs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [ ] When `selectFormats` return 0 entries. The entire program crashes.
5 changes: 3 additions & 2 deletions pkg/argparse/argparse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ type Opts struct {
NoSpinner bool

// Auto fields
Days int
NoSync bool
Days int
NoSync bool
MarkWatched bool
}

func Parse(version string) *Opts {
Expand Down
4 changes: 2 additions & 2 deletions pkg/help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func HelpAuto() {

pelp.Flags(
"flag",
[]string{"days", "no-sync"},
[]string{"Maximum number of days to download", "Don't sync"})
[]string{"days", "no-sync", "mark-watched"},
[]string{"Maximum number of days to download", "Don't sync", "Mark videos as watched when rejected"})
}
func HelpBinge() {
pelp.Print("Select a bunch of videos to download.")
Expand Down
6 changes: 5 additions & 1 deletion pkg/tui/auto.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func parseAutoOpts(opts *argparse.Opts) {
flag := flag.NewFlagSet("sinister auto", flag.ExitOnError)
flag.IntVar(&opts.Days, "days", 0, "Maximum number of days to download")
flag.BoolVar(&opts.NoSync, "no-sync", false, "Disable spinner")
flag.BoolVar(&opts.MarkWatched, "mark-watched", false, "Mark videos as watched when rejected")
flag.Usage = help.HelpAuto
flag.Parse(opts.Args[1:])
}
Expand Down Expand Up @@ -44,8 +45,11 @@ func Auto(opts *argparse.Opts) {

if softConfirm(fmt.Sprintf("Download %s by %s ?", entry.Title, entry.Author.Name)) {
performDownload(opts, &entry)
} else {
if opts.MarkWatched {
database.UpdateWatched(&entry)
}
}

}

goreland.LogSuccess("All downloads completed!")
Expand Down

0 comments on commit 4c66416

Please sign in to comment.