mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Remove flag to allow override media annotation
This commit is contained in:
parent
2cc983638c
commit
c6ed0d5377
5 changed files with 8 additions and 11 deletions
|
@ -42,7 +42,7 @@ type MediaFiles []MediaFile
|
|||
type MediaFileRepository interface {
|
||||
CountAll() (int64, error)
|
||||
Exists(id string) (bool, error)
|
||||
Put(m *MediaFile, overrideAnnotation bool) error
|
||||
Put(m *MediaFile) error
|
||||
Get(id string) (*MediaFile, error)
|
||||
FindByAlbum(albumId string) (MediaFiles, error)
|
||||
FindByPath(path string) (MediaFiles, error)
|
||||
|
|
|
@ -48,15 +48,12 @@ func NewMediaFileRepository(o orm.Ormer) model.MediaFileRepository {
|
|||
return r
|
||||
}
|
||||
|
||||
func (r *mediaFileRepository) Put(m *model.MediaFile, overrideAnnotation bool) error {
|
||||
func (r *mediaFileRepository) Put(m *model.MediaFile) error {
|
||||
tm := mediaFile(*m)
|
||||
if !overrideAnnotation {
|
||||
// Don't update media annotation fields (playcount, starred, etc..)
|
||||
return r.put(m.ID, m.Title, &tm, "path", "title", "album", "artist", "artist_id", "album_artist",
|
||||
"album_id", "has_cover_art", "track_number", "disc_number", "year", "size", "suffix", "duration",
|
||||
"bit_rate", "genre", "compilation", "updated_at")
|
||||
}
|
||||
return r.put(m.ID, m.Title, &tm)
|
||||
// Don't update media annotation fields (playcount, starred, etc..)
|
||||
return r.put(m.ID, m.Title, &tm, "path", "title", "album", "artist", "artist_id", "album_artist",
|
||||
"album_id", "has_cover_art", "track_number", "disc_number", "year", "size", "suffix", "duration",
|
||||
"bit_rate", "genre", "compilation", "updated_at")
|
||||
}
|
||||
|
||||
func (r *mediaFileRepository) Get(id string) (*model.MediaFile, error) {
|
||||
|
|
|
@ -71,7 +71,7 @@ var _ = Describe("Initialize test DB", func() {
|
|||
}
|
||||
mediaFileRepository := ds.MediaFile()
|
||||
for _, s := range testSongs {
|
||||
err := mediaFileRepository.Put(&s, true)
|
||||
err := mediaFileRepository.Put(&s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ func (s *TagScanner) processChangedDir(dir string, updatedArtists map[string]boo
|
|||
for _, n := range newTracks {
|
||||
c, ok := currentTracks[n.ID]
|
||||
if !ok || (ok && n.UpdatedAt.After(c.UpdatedAt)) {
|
||||
err := s.ds.MediaFile().Put(&n, false)
|
||||
err := s.ds.MediaFile().Put(&n)
|
||||
updatedArtists[n.ArtistID] = true
|
||||
updatedAlbums[n.AlbumID] = true
|
||||
numUpdatedTracks++
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue