Register PlayCount/Date in the DB, if DevUseFolderScanner is true
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user