mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Track watch activity for scenes. (#3055)
* track watchtime and view time * add view count sorting, added continue position filter * display metrics in file info * add toggle for tracking activity * save activity every 10 seconds * reset resume when video is nearly complete * start from beginning when playing scene in queue Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -944,6 +944,35 @@ func makeSceneFile(i int) *file.VideoFile {
|
||||
}
|
||||
}
|
||||
|
||||
func getScenePlayCount(index int) int {
|
||||
return index % 5
|
||||
}
|
||||
|
||||
func getScenePlayDuration(index int) float64 {
|
||||
if index%5 == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return float64(index%5) * 123.4
|
||||
}
|
||||
|
||||
func getSceneResumeTime(index int) float64 {
|
||||
if index%5 == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return float64(index%5) * 1.2
|
||||
}
|
||||
|
||||
func getSceneLastPlayed(index int) *time.Time {
|
||||
if index%5 == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
t := time.Date(2020, 1, index%5, 1, 2, 3, 0, time.UTC)
|
||||
return &t
|
||||
}
|
||||
|
||||
func makeScene(i int) *models.Scene {
|
||||
title := getSceneTitle(i)
|
||||
details := getSceneStringValue(i, "Details")
|
||||
@@ -984,6 +1013,10 @@ func makeScene(i int) *models.Scene {
|
||||
StashIDs: models.NewRelatedStashIDs([]models.StashID{
|
||||
sceneStashID(i),
|
||||
}),
|
||||
PlayCount: getScenePlayCount(i),
|
||||
PlayDuration: getScenePlayDuration(i),
|
||||
LastPlayedAt: getSceneLastPlayed(i),
|
||||
ResumeTime: getSceneResumeTime(i),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user