Register PlayCount/Date in the DB, if DevUseFolderScanner is true

This commit is contained in:
Deluan
2020-01-18 20:59:20 -05:00
parent 3c66da0b17
commit 938a92eded
8 changed files with 39 additions and 6 deletions
+8
View File
@@ -190,6 +190,14 @@ func (r *albumRepository) SetStar(starred bool, ids ...string) error {
return err
}
func (r *albumRepository) MarkAsPlayed(id string, playDate time.Time) error {
_, err := r.newQuery(Db()).Filter("id", id).Update(orm.Params{
"play_count": orm.ColValue(orm.ColAdd, 1),
"play_date": playDate,
})
return err
}
func (r *albumRepository) Search(q string, offset int, size int) (model.Albums, error) {
if len(q) <= 2 {
return nil, nil
+8
View File
@@ -158,6 +158,14 @@ func (r *mediaFileRepository) SetRating(rating int, ids ...string) error {
return err
}
func (r *mediaFileRepository) MarkAsPlayed(id string, playDate time.Time) error {
_, err := r.newQuery(Db()).Filter("id", id).Update(orm.Params{
"play_count": orm.ColValue(orm.ColAdd, 1),
"play_date": playDate,
})
return err
}
func (r *mediaFileRepository) PurgeInactive(activeList model.MediaFiles) error {
return withTx(func(o orm.Ormer) error {
_, err := r.purgeInactive(o, activeList, func(item interface{}) string {