Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scene play and o-counter history view and editing #4532

Merged
merged 60 commits into from
Feb 22, 2024

Conversation

WithoutPants
Copy link
Collaborator

@WithoutPants WithoutPants commented Feb 8, 2024

Supercedes #3922
Resolves #3392
Resolves #3607
Resolves #3680
Closes #1026

This branch reimplements the #3922 changes. Adds graphql interfaces to remove and clear the play history, and adds an optional times parameter to the increment/decrement view count and o-count interfaces. This allows adding and removing multiple dates to/from the view/o-count history.

Unlike #3922, this transitions to using two tables for view and o histories, and removes the play_count, o_count, and last_played fields from the scenes table. These values are now derived from the applicable tables.

From the other PR, I have removed the views button in favour of putting all of the info and manipulation into the History tab.
The History tab allows for adding to the view/o-counts, deleting specific entries, clearing the entire date history, and entering specific dates.

image

The UI should be considered the minimum viable for now. I have focused on functionality - further refinements can be done in future PRs. Minor changes will be considered, but I won't be spending much more time on the UI.

Like the previous PR, the migration uses the last played date value to populate the latest play time, with the rest populated with the created time of the scene. All o-count entries use the created time when migrated.

@randemgame: I'd appreciate if you could test this. Timely testing will dictate if this goes into 0.25 or the following release.

Affected areas will be:

  • history tab (obvs)
  • o-counter button
  • play/o-count sorting and filtering
  • performer o-count sorting and filtering (known issue discovered while typing this fixed)
  • scene merging (play/o history merging)
  • import/export

randemgame and others added 30 commits June 18, 2023 14:16
Allows user to manually increment/decrement or reset the play counter, based on the O-Counter functionality. Decrementing also clears the last played at date/resume time/Resetting also clears play duration. Moved the existing IncrementPlayCount from scene.go to common.go for parity with new functions but this has not affected existing automatic play tracking.
Added a custom graphic of an eyeball for the play counter UI.
Added a History panel in the UI for storing all date information.
…pulate them

Migration creates two new tables in the SQL to track the dates of plays and o's and then populates them with info from the 'o_counter', 'play_count' and 'last_played_at' columns from 'scenes'. The most recent playdate utilises the 'last_played_at' date, all other dates default to 2020-02-24 (the first release of Stash v0.1.0)
Increment/Decrement.Resetting the O-Counter or Play Counter update the associated scenes_playdates and scenes_odates tables in the SQL
the sqlite\scene_odate.go and sqlite\scene_playdate.go were based on the sqlite\scene_marker.go and i'm not sure how to read most of the code there, but i assume a lot more of it could still be deleted?
placed translatable phrases in the correct place and added scene-history-panel tab pane
…added Temp SceneHistoryPanel.tsx

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? Check the render method of `a3`. ShowPickerButton@http://localhost:3000/src/components/Shared/DateInput.tsx:40:32
Fixed by applying React.forwardRef to the ShowPickerButton
also added missing temporary SceneHistoryPanel.tsx in order to make ui compile correctly!
previous code had stopped working but now decrementing the counters removes the most recent id associated with a scene_id and playdate
Moved (Commented out original) two dates from SceneDetailPanel.tsx that I think are more suitable in a History panel.
Fixed Time Formatting of playdate/odate as RFC3339 for parity with other dates in SQL
Moved (Commented out original) the File Modification Date, Play Count & Play Duration from File Info to History and added relevant localisation strings
still need to remove more i am sure but these were caught as problems in vs code
commit 67d4f97
Author: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
Date:   Wed Jul 12 11:51:52 2023 +1000

    Multiple scene URLs (stashapp#3852)

    * Add URLs scene relationship
    * Update unit tests
    * Update scene edit and details pages
    * Update scrapers to use urls
    * Post-process scenes during query scrape
    * Update UI for URLs
    * Change urls label

commit 76a4bfa
Author: chickenwingavalanche <138962341+chickenwingavalanche@users.noreply.github.com>
Date:   Tue Jul 11 19:25:24 2023 -0600

    Add keyboard shortcut to toggle video looping in scene player (stashapp#3902)

    * Use shift+L to toggle video looping in scene player

commit 3e810cf
Author: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
Date:   Wed Jul 12 10:53:46 2023 +1000

    Add nil checks in identify (stashapp#3905)

commit c1352f9
Author: NodudeWasTaken <75137537+NodudeWasTaken@users.noreply.github.com>
Date:   Wed Jul 12 02:45:33 2023 +0200

    Safari video height css fix (stashapp#3882)

commit f665aa8
Author: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
Date:   Wed Jul 12 10:38:52 2023 +1000

    Update make target in Dockerfile-CUDA

commit b2b52bc
Author: chickenwingavalanche <138962341+chickenwingavalanche@users.noreply.github.com>
Date:   Tue Jul 11 18:37:46 2023 -0600

    Add missing scene player shortcuts to Help -> Keyboard Shortcuts (stashapp#3903)

    Co-authored-by: chickenwingavalanche <chickenwingavalanche@example.com>

commit 96f2229
Author: DingDongSoLong4 <99329275+DingDongSoLong4@users.noreply.github.com>
Date:   Wed Jul 12 02:05:35 2023 +0200

    Improve Makefile (stashapp#3901)

    * Improve Makefile
    * Make ui targets consistent
    ---------
    Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>

commit 278a064
Author: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
Date:   Tue Jul 11 19:16:22 2023 +1000

    Revert "Add AirPlay and Chromecast support (stashapp#2872)" (stashapp#3898)

    This reverts commit 8e235a2.

commit 0c0ba19
Author: Csaba Maulis <hello@senki.xyz>
Date:   Tue Jul 11 13:54:42 2023 +0800

    Add `-v/--version` flag to print version string (stashapp#3883)

    * Add `-v/--version` flag to print version string

    - Created a new flag `-v/--version` in the command-line interface to display the version number and exit.
    - Moved all version-related functions inside the config package to the new file `manager/config/version.go` to avoid circular dependencies.
    - Added a new `GetVersionString()` function to generate a formatted version string.
    - Updated references to the moved version functions.
    - Updated references in the `Makefile`.

    * Move version embeds to build package

    * Remove githash var

    ---------

    Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>

commit 969af2a
Author: A Ghoul Coder <aghouleditor@protonmail.com>
Date:   Tue Jul 11 07:53:53 2023 +0200

    add phasher (stashapp#3864)

    * add phasher

    A simple `phasher` program that accepts a video file as a command line
    argument and calculates and prints its PHASH.

    The goal of this separate executable is to have a simple way to
    calculate phashes that doesn't depend on a full stash instance so that
    third-party systems and tools can independently generate PHASHes which
    can be used for interacting with stash and stash-box APIs and data.

    Currently `phasher` is built in the default make target along with
    `stash` by simply running `make`.
    Cross-platform targets have not been considered.

    Concurrency is intentionally not implemented because it is simpler to
    use [GNU Parallel](https://www.gnu.org/software/parallel/).
    For example:
    ```
    parallel phasher {} ::: *.mp4
    ```

    * standard dir structure for phasher and separate make target

    The make target still needs to be integrated into the rest of the
    Makefile so it can be built as part of normal releases.

    * phasher: basic usage output and quiet option
    * phasher: allow and process multiple command line arguments
    * phasher: camelCase identifiers
    * phasher: initialize ffmpeg and ffprobe only once

commit cbdd4d3
Author: Flashy78 <90150289+Flashy78@users.noreply.github.com>
Date:   Mon Jul 10 21:37:00 2023 -0700

    Identify: Options to skip multiple results and single name performers (stashapp#3707)

    Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>

commit ff22577
Author: hontheinternet <121332499+hontheinternet@users.noreply.github.com>
Date:   Tue Jul 11 13:32:42 2023 +0900

    Add additional stats to the Stats page (stashapp#3812)

    * Add o_counter, play_duration, play_count, unique_play_count stats

commit 4f0e0e1
Author: hontheinternet <121332499+hontheinternet@users.noreply.github.com>
Date:   Tue Jul 11 13:02:09 2023 +0900

    Allow serving of interactive CSVs directly to Handy (stashapp#3756)

    * allow direct serve interactive CSVs to Handy
    ---------
    Co-authored-by: kermieisinthehouse <kermie@isinthe.house>

commit 8e235a2
Author: CJ <72030708+Teda1@users.noreply.github.com>
Date:   Mon Jul 10 22:47:11 2023 -0500

    Add AirPlay and Chromecast support (stashapp#2872)

    * dynamically load cast_sender.js
    * add https://www.gstatic.com to connectableOrigins
    * Add toggle for chromecast

commit c499c20
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Jul 11 13:40:29 2023 +1000

    Bump semver from 5.7.1 to 5.7.2 in /ui/v2.5 (stashapp#3896)

    Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
    - [Release notes](https://github.com/npm/node-semver/releases)
    - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
    - [Commits](npm/node-semver@v5.7.1...v5.7.2)

    ---
    updated-dependencies:
    - dependency-name: semver
      dependency-type: indirect
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit f0d901a
Author: plato178 <137155614+plato178@users.noreply.github.com>
Date:   Tue Jul 11 03:45:20 2023 +0100

    Add codec filters (stashapp#3843)

    * Add video_codec and audio_codec filter criteria
    * Add Audio Codec and Video Codec UI filters

commit 93b41fb
Author: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
Date:   Tue Jul 11 11:53:49 2023 +1000

    Add folder rename detection (stashapp#3817)

commit 5c38836
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Jul 11 11:40:49 2023 +1000

    Bump stylelint from 15.1.0 to 15.10.1 in /ui/v2.5 (stashapp#3889)

    Bumps [stylelint](https://github.com/stylelint/stylelint) from 15.1.0 to 15.10.1.
    - [Release notes](https://github.com/stylelint/stylelint/releases)
    - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
    - [Commits](stylelint/stylelint@15.1.0...15.10.1)

    ---
    updated-dependencies:
    - dependency-name: stylelint
      dependency-type: direct:development
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit cec9195
Author: DingDongSoLong4 <99329275+DingDongSoLong4@users.noreply.github.com>
Date:   Tue Jul 11 03:40:20 2023 +0200

    Fix scene missing flicker on scene page (stashapp#3857)

    * use useLayoutEffect
    * Remove unnecessary nullability in ScenePlayer

commit 0268565
Author: DingDongSoLong4 <99329275+DingDongSoLong4@users.noreply.github.com>
Date:   Tue Jul 11 03:36:57 2023 +0200

    Makefile cleanup (stashapp#3876)
moving IncrementWatchCount and getPlayCount (had renamed this to Counter by error) from scene.go to common.go is necessary for the add and remove to modify the sql table
moving IncrementWatchCount and getPlayCount (had renamed this to Counter by error) from scene.go to common.go is necessary for the add and remove to modify the sql table
I can not understand the code necessary for testing, hopefully someone could help here. Have been trying to debug an error relating to the SceneReaderWriter testing for days now until I realised where to add them and how to generate mocks.
the ResetWatchCount and DecrementWatchCount now just return, rather than return nil - I don't know how the actual test code is made so can't progress on this. Some imports have been removed owing to moving date information to the History panel.
New DB version from 48 > 49
the functions for AddODate/DeleteODate/ResetODate within Increment/Decrement.Reset OCounter are only triggered if the bool isScene is true, which is set in the resolver_mutation_image.go and resolver_mutation_scene.go
Replaced the Best Estimated Date for Unrecorded Plays from Stash Release Date (cute, but confusing) to the Scene Created Date. Also swapped the order of the insertion so that the most recent playdate would be the most recent recorded value
had moved them earlier by accident. common.go is now just about o management, but maybe inner funcs about scenes should be moved
removed seemingly unnecessary code for this pull request that was part of copypasta development
expanded the display of the play/o dates in the history panel to use data from the play counter and last_played date. it is a slight temporary measure, as i am not able to access the playdate odate tables due to lacking the necessary graphql skills.
also reverted changing the spaces in 3 random files i had not meant to push.
swapped accidentally hardcoded text for en-GB values
removing a temporary fix where I used a bool. i tried to move the AddODate/DeleteODate/ResetODate out from the Increment/Decrement/ResetOCounter func but could not work it out.this does mean the funcs in common.go are now specific to Image however
deleting some unused code and passing lint / format and integration tests
@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Feb 8, 2024
@jpnsfw
Copy link
Contributor

jpnsfw commented Feb 14, 2024

@WithoutPants huge thank you for working on this one!!! I tried out your branch locally and just had two comments:

  • The Stats page gives an error:
querying `SELECT COALESCE(SUM(`play_count`), 0) FROM `scenes`` [[]]: error executing `SELECT COALESCE(SUM(`play_count`), 0) FROM `scenes`` [[]]: no such column: play_count"`
  • Looks like old plays and O's show up with date "December 12, 2022 11:18 PM" (at least on my end), would it make sense to instead set these as NULL and render text like "Unknown" in the UI?

@WithoutPants
Copy link
Collaborator Author

WithoutPants commented Feb 16, 2024

  • The Stats page gives an error:
querying `SELECT COALESCE(SUM(`play_count`), 0) FROM `scenes`` [[]]: error executing `SELECT COALESCE(SUM(`play_count`), 0) FROM `scenes`` [[]]: no such column: play_count"`
  • Looks like old plays and O's show up with date "December 12, 2022 11:18 PM" (at least on my end), would it make sense to instead set these as NULL and render text like "Unknown" in the UI?

Thanks for testing and the feedback. Both these issues should now be addressed.

@WithoutPants
Copy link
Collaborator Author

From Discord:

I just noticed something - the red trash can for 'Remove date' did not work for either the o_date or the view_date (although Clear date data worked fine). I could probably have imported the data better, for now the dates all had the +00:00 ending, e.g. 2017-11-08T19:49:57+00:00. If I change the timezone to +01:00 or even some nonsense like +00:01 in the SQL database then they can be deleted again (I wouldn't care much about the data being a minute off perfect accuracy). Anyway not sure if this is an actual thing or not that would effect users in the +00:00 UTC or a quirk of my data transferring.

@forsexonly93
Copy link

Thanks a lot for working on this @WithoutPants!! Could we add this to next version 0.25.0? Much needed actually to make sure we're not missing data till this is released...

@WithoutPants WithoutPants added this to the Version 0.25.0 milestone Feb 17, 2024
@randemgame
Copy link
Contributor

randemgame commented Feb 17, 2024

EDIT: You can safely ignore this, there's a ton of quirks in Stash when using such a low resolution phone I have since discovered, but the most important use case for it, in searching for and playing videos, works amazing so it doesn't bother me in the least!

Not a huge deal at all, but something I just remembered from this was that when viewing Stash on my mobile iPhone SE3 2022 (likely the smallest res phone available at 750 x 1334), it was no longer possible to select 'Edit' when viewing the scene page in a vertical orientation, the bar with 'Details', 'Queue' etc does not slide, and the new History option pushes Edit out the way. But then you can flip the phone horizontal and see Edit anyway, so who cares, and who is doing much editing at such a small res anyway. Thought you'd like to know regardless.
IMG_0535
IMG_0536

@WithoutPants
Copy link
Collaborator Author

@randemgame I have changed the migration and storage to always use UTC dates. This should address the delete issue you encountered, provided that all dates are imported as UTC dates.

@WithoutPants WithoutPants merged commit a303446 into stashapp:develop Feb 22, 2024
2 checks passed
DogmaDragon added a commit to stashapp/Stash-Docs that referenced this pull request Feb 24, 2024
damontecres added a commit to damontecres/StashAppAndroidTV that referenced this pull request Mar 6, 2024
This PR tracks the updates needed to support the future Stash `v0.25.0`.

Includes graphql updates for:
- [x] stashapp/stash#4419
- [x] stashapp/stash#4532
- [x] stashapp/stash#4479

Deferring updates for:
- stashapp/stash#4602
- stashapp/stash#4563

Closes #44
halkeye pushed a commit to halkeye/stash that referenced this pull request Sep 1, 2024
Co-authored-by: randemgame <61895715+randemgame@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
4 participants