woefe / ytcc

Command line tool to keep track of your favorite playlists on YouTube and many other places.
GNU General Public License v3.0
180 stars 20 forks source link

Mark as not watched #69

Closed Glandos closed 3 years ago

Glandos commented 3 years ago

Is your feature request related to a problem? Please describe. When playing a video by mistake, it is mark as watched, even when exiting mpv after a few seconds.

Describe the solution you'd like Add a feature to mark video as not watched

Additional context In TUI, recently watched video can still be listed, with a different markup, to be able to unwatch them.

It can be also a good thing to monitor elapsed time in player, and ask the user if the video should be marked as watched whenever there is not enough elapsed time (half? 80%?).

woefe commented 3 years ago

If you accidentally start a video, you can quit the mpv player with ctrl+c. The player will be closed with a non-zero exit status and ytcc will not mark the video as watched.

Does that solve your use-case?

EmRowlands commented 3 years ago

Maybe a quick option to "mark last video as unwatched" might be useful.

Glandos commented 3 years ago

@woefe I wasn't aware of that, thanks. This seems to be more of a workaround than a real feature, but I'll use it for now.

wavexx commented 3 years ago

I'm using mpv, I'm aware about ctrl+c, and I'm also already using a custom exit code for quit-watch-later for this reason. However I'd vouch for both features:

For the last to make sense, it would be nice to save the last video id which has been either played or marked (or more generally, operated on), so that ytccf could reference it later using the first cli command.

woefe commented 3 years ago

I agree, an unmark feature definitely makes sense. Additionally, I was thinking to implement some history functionality. Ytcc will record when a video was watched the last time (was marked as watched or player exited with a zero exit status).

This will also make the undo feature pretty straight forward. Something like ytcc ls --watched-only --order-by last_watched:desc --limit 1 | ytcc unmark.

Internally, I would change the datatype of the watched column of the video table from bool to float/timestamp. A video that is unwatched will have a null value in that column.

EmRowlands commented 3 years ago

This would break database compatibility again, but in a much less severe way to v1->v2. Is it possible to do the change on startup? Or maybe on ytcc update?

woefe commented 3 years ago

This database migration can be applied when starting ytcc in the new version. There was actually a migration mechanism some years ago: https://github.com/woefe/ytcc/blob/8480914da649438f526a3e4d3a38480026a2086e/ytcc/updater.py I will implement something similar again.

woefe commented 3 years ago

Can someone try out #72? Make a backup of your database file before testing it! The changes that will be made to the database are not backwards compatible to the current stable release.

If you find issues, comment on #72.