mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +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 {
|
type MediaFileRepository interface {
|
||||||
CountAll() (int64, error)
|
CountAll() (int64, error)
|
||||||
Exists(id string) (bool, error)
|
Exists(id string) (bool, error)
|
||||||
Put(m *MediaFile, overrideAnnotation bool) error
|
Put(m *MediaFile) error
|
||||||
Get(id string) (*MediaFile, error)
|
Get(id string) (*MediaFile, error)
|
||||||
FindByAlbum(albumId string) (MediaFiles, error)
|
FindByAlbum(albumId string) (MediaFiles, error)
|
||||||
FindByPath(path string) (MediaFiles, error)
|
FindByPath(path string) (MediaFiles, error)
|
||||||
|
|
|
@ -48,15 +48,12 @@ func NewMediaFileRepository(o orm.Ormer) model.MediaFileRepository {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *mediaFileRepository) Put(m *model.MediaFile, overrideAnnotation bool) error {
|
func (r *mediaFileRepository) Put(m *model.MediaFile) error {
|
||||||
tm := mediaFile(*m)
|
tm := mediaFile(*m)
|
||||||
if !overrideAnnotation {
|
// Don't update media annotation fields (playcount, starred, etc..)
|
||||||
// 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",
|
||||||
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",
|
||||||
"album_id", "has_cover_art", "track_number", "disc_number", "year", "size", "suffix", "duration",
|
"bit_rate", "genre", "compilation", "updated_at")
|
||||||
"bit_rate", "genre", "compilation", "updated_at")
|
|
||||||
}
|
|
||||||
return r.put(m.ID, m.Title, &tm)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *mediaFileRepository) Get(id string) (*model.MediaFile, error) {
|
func (r *mediaFileRepository) Get(id string) (*model.MediaFile, error) {
|
||||||
|
|
|
@ -71,7 +71,7 @@ var _ = Describe("Initialize test DB", func() {
|
||||||
}
|
}
|
||||||
mediaFileRepository := ds.MediaFile()
|
mediaFileRepository := ds.MediaFile()
|
||||||
for _, s := range testSongs {
|
for _, s := range testSongs {
|
||||||
err := mediaFileRepository.Put(&s, true)
|
err := mediaFileRepository.Put(&s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ func (s *TagScanner) processChangedDir(dir string, updatedArtists map[string]boo
|
||||||
for _, n := range newTracks {
|
for _, n := range newTracks {
|
||||||
c, ok := currentTracks[n.ID]
|
c, ok := currentTracks[n.ID]
|
||||||
if !ok || (ok && n.UpdatedAt.After(c.UpdatedAt)) {
|
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
|
updatedArtists[n.ArtistID] = true
|
||||||
updatedAlbums[n.AlbumID] = true
|
updatedAlbums[n.AlbumID] = true
|
||||||
numUpdatedTracks++
|
numUpdatedTracks++
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue