stash icon indicating copy to clipboard operation
stash copied to clipboard

Track watch activity for scenes.

Open cj12312021 opened this issue 2 years ago • 12 comments

This pull request adds activity-tracking support for videos. Stash will now remember where you left off in a video and will resume from that position when you return to the video. Scene cards will now include a progress bar to show users how far into each video they are. Users can also now sort scenes by recently played to see what video they last watched.

Screenshot 2022-10-26 085006

I added a config option to tell Stash to always start a video from the beginning for users who might not want resume functionality.

Screenshot 2022-10-26 085401

Fixes #2769 Fixes #633

cj12312021 avatar Oct 26 '22 14:10 cj12312021

My latest push contains changes to address feature #633. This pull request now tracks watchTime and viewCount and provides options to filter and sort by those new fields. A config option was also created to allow users to set an ignore interval to delay tracking until a set amount of time has passed.

Screenshot 2022-10-27 005432

There is still a bug with sorting by View Count that I need to address which I will look into tomorrow. Some debug code also needs to be cleaned out in typescript files.

cj12312021 avatar Oct 27 '22 05:10 cj12312021

If I interpret your Code correctly, this would make it relatively easy to add a filter for already started videos, as well as a sorting by 'last watched'. I think both would be a great addition to the project, so I'd be thankful if you consider adding those to the request (or create a separate one of course).

Sorry about the duplicates. Github just broke for some reason, gave me back timeouts but obviously still posted them after...

yoshnopa avatar Oct 27 '22 12:10 yoshnopa

I see you asked the same comment 3 times. Can you please remove 2 of them to remove unnecessary bloat from this pull request?

To answer the question, this change already has a sort option to sort by recently viewed scenes. I didn’t add a filter for filtering on watch progress but that should be painless to do so I can include it.

cj12312021 avatar Oct 27 '22 14:10 cj12312021

Awesome, thank you!

yoshnopa avatar Oct 27 '22 15:10 yoshnopa

Hey, this looks great! Sorry, I'm new to Stash but will it be possible with this addition of this recently played data for me to import the played data I have stored in a different organizing program? I'm still working on the necessary plugin but I would like to transfer data such as Scene X - played 21.34 Aug 12 2022, 17.59 Feb 14 2022, 18.43 Dec 25 2021 etc. Or at least could this pull be set up to enable such info (I guess it's multiple dates played attached to a scene) to be included and open to plugins in the future? Thanks much!

randemgame avatar Oct 30 '22 20:10 randemgame

You should be able to update the activity data via graphql mutations so a script can be written to import your data. However, to keep things simple, this change does not track all the dates an event occurred on. It only keeps track of the date of the most recent activity and increments the play count and duration accordingly. Storing this info by the date of each occurrence is something I'm looking into, but I likely won't have time to get in with this change since it would touch code that I need more time to become more familiar with.

cj12312021 avatar Oct 30 '22 20:10 cj12312021

I'm just now seeing your feedback. Thanks for going through this. I'll start working my way through your comments soon.

cj12312021 avatar Nov 05 '22 14:11 cj12312021

there's a stale cache issue when clicking the scenes button from the player. I had to refresh before the scene displayed the correct resume time in the scenes list

I don't think the caching issue you're seeing is new to this change. I've been noticing that Stash doesn't always properly refresh when navigating to a page that has been visited earlier. I'm not yet clear on how this is handled in React/Stash.

cj12312021 avatar Nov 07 '22 04:11 cj12312021

Can you please merge or rebase against the develop branch. I've tried to do it, but haven't been able to restore functionality.

WithoutPants avatar Nov 09 '22 03:11 WithoutPants

I should be able to do this tomorrow. I’ve been busier than usual lately, but things should start to slow down tomorrow.

cj12312021 avatar Nov 09 '22 04:11 cj12312021

I've taken care of the merge.

cj12312021 avatar Nov 10 '22 00:11 cj12312021

Currently missing code to export the new fields.

The export logic is there. I just ran the function now to be sure it works. Here is a snapshot of the output: Screenshot 2022-11-15 230735

I'm finding that the resume time gets reset when I navigate to a scene page without playing. I assume this is not expected behaviour?

This should be fixed now.

I cleaned up the backend code a bit and added unit tests.

Thanks!

cj12312021 avatar Nov 16 '22 05:11 cj12312021