mirror of
https://github.com/navidrome/navidrome.git
synced 2026-05-03 06:51:16 +00:00
Compare commits
No commits in common. "2385c8a548f6d71e8b1acba503ae0161a9ddcc1e" and "131c0c565cfd2f5c11939e05621cd4a671ec7ecb" have entirely different histories.
2385c8a548
...
131c0c565c
@ -23,7 +23,7 @@ func legacyTrackID(mf model.MediaFile, prependLibId bool) string {
|
||||
}
|
||||
|
||||
func legacyAlbumID(mf model.MediaFile, md Metadata, prependLibId bool) string {
|
||||
_, _, releaseDate := md.mapDates()
|
||||
releaseDate := legacyReleaseDate(md)
|
||||
albumPath := strings.ToLower(fmt.Sprintf("%s\\%s", legacyMapAlbumArtistName(md), legacyMapAlbumName(md)))
|
||||
if !conf.Server.Scanner.GroupAlbumReleases {
|
||||
if len(releaseDate) != 0 {
|
||||
@ -55,3 +55,9 @@ func legacyMapAlbumName(md Metadata) string {
|
||||
consts.UnknownAlbum,
|
||||
)
|
||||
}
|
||||
|
||||
// Keep the TaggedLikePicard logic for backwards compatibility
|
||||
func legacyReleaseDate(md Metadata) string {
|
||||
_, _, releaseDate := md.mapDates()
|
||||
return string(releaseDate)
|
||||
}
|
||||
|
||||
30
model/metadata/legacy_ids_test.go
Normal file
30
model/metadata/legacy_ids_test.go
Normal file
@ -0,0 +1,30 @@
|
||||
package metadata
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("legacyReleaseDate", func() {
|
||||
|
||||
DescribeTable("legacyReleaseDate",
|
||||
func(recordingDate, originalDate, releaseDate, expected string) {
|
||||
md := New("", Info{
|
||||
Tags: map[string][]string{
|
||||
"DATE": {recordingDate},
|
||||
"ORIGINALDATE": {originalDate},
|
||||
"RELEASEDATE": {releaseDate},
|
||||
},
|
||||
})
|
||||
|
||||
result := legacyReleaseDate(md)
|
||||
Expect(result).To(Equal(expected))
|
||||
},
|
||||
Entry("regular mapping", "2020-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping", "2020-05-15", "2019-02-10", "", "2020-05-15"),
|
||||
Entry("legacy mapping, originalYear < year", "2018-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, originalYear empty", "2020-05-15", "", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, releaseYear", "2020-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, same dates", "2020-05-15", "2020-05-15", "", "2020-05-15"),
|
||||
)
|
||||
})
|
||||
@ -75,23 +75,6 @@ var _ = Describe("ToMediaFile", func() {
|
||||
Expect(mf.OriginalYear).To(Equal(1966))
|
||||
Expect(mf.ReleaseYear).To(Equal(2014))
|
||||
})
|
||||
DescribeTable("legacyReleaseDate (TaggedLikePicard old behavior)",
|
||||
func(recordingDate, originalDate, releaseDate, expected string) {
|
||||
mf := toMediaFile(model.RawTags{
|
||||
"DATE": {recordingDate},
|
||||
"ORIGINALDATE": {originalDate},
|
||||
"RELEASEDATE": {releaseDate},
|
||||
})
|
||||
|
||||
Expect(mf.ReleaseDate).To(Equal(expected))
|
||||
},
|
||||
Entry("regular mapping", "2020-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping", "2020-05-15", "2019-02-10", "", "2020-05-15"),
|
||||
Entry("legacy mapping, originalYear < year", "2018-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, originalYear empty", "2020-05-15", "", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, releaseYear", "2020-05-15", "2019-02-10", "2021-01-01", "2021-01-01"),
|
||||
Entry("legacy mapping, same dates", "2020-05-15", "2020-05-15", "", "2020-05-15"),
|
||||
)
|
||||
})
|
||||
|
||||
Describe("Lyrics", func() {
|
||||
|
||||
@ -14,24 +14,6 @@ vi.mock('@material-ui/core', async () => {
|
||||
}
|
||||
})
|
||||
|
||||
// Mock formatFullDate to return deterministic results
|
||||
vi.mock('../utils', async () => {
|
||||
const actual = await import('../utils')
|
||||
return {
|
||||
...actual,
|
||||
formatFullDate: (date) => {
|
||||
if (!date) return ''
|
||||
// Use en-CA locale for consistent test results
|
||||
return new Date(date).toLocaleDateString('en-CA', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
})
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
describe('Details component', () => {
|
||||
describe('Desktop view', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@ -169,7 +169,7 @@ const LibraryEdit = (props) => {
|
||||
resource={'library'}
|
||||
source={'totalSize'}
|
||||
label={translate('resources.library.fields.totalSize')}
|
||||
format={(v) => formatBytes(v, 2)}
|
||||
format={formatBytes}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
/>
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
BooleanField,
|
||||
} from 'react-admin'
|
||||
import { useMediaQuery } from '@material-ui/core'
|
||||
import { List, DateField, useResourceRefresh, SizeField } from '../common'
|
||||
import { List, DateField, useResourceRefresh } from '../common'
|
||||
|
||||
const LibraryFilter = (props) => (
|
||||
<Filter {...props} variant={'outlined'}>
|
||||
@ -42,7 +42,6 @@ const LibraryList = (props) => {
|
||||
<NumberField source="totalSongs" label="Songs" />
|
||||
<NumberField source="totalAlbums" label="Albums" />
|
||||
<NumberField source="totalMissingFiles" label="Missing Files" />
|
||||
<SizeField source="totalSize" />
|
||||
<DateField
|
||||
source="lastScanAt"
|
||||
label="Last Scan"
|
||||
|
||||
@ -16,11 +16,6 @@ export default {
|
||||
color: 'white',
|
||||
},
|
||||
},
|
||||
MuiButton: {
|
||||
textPrimary: {
|
||||
color: '#fff',
|
||||
},
|
||||
},
|
||||
NDLogin: {
|
||||
systemNameLink: {
|
||||
color: '#0085ff',
|
||||
|
||||
@ -448,11 +448,6 @@ export default {
|
||||
backgroundColor: bLight['500'],
|
||||
},
|
||||
},
|
||||
RaButton: {
|
||||
button: {
|
||||
margin: '0 5px 0 5px',
|
||||
},
|
||||
},
|
||||
RaPaginationActions: {
|
||||
button: {
|
||||
backgroundColor: '#fff',
|
||||
|
||||
@ -389,11 +389,6 @@ export default {
|
||||
marginRight: '1rem',
|
||||
},
|
||||
},
|
||||
RaButton: {
|
||||
button: {
|
||||
margin: '0 5px 0 5px',
|
||||
},
|
||||
},
|
||||
RaPaginationActions: {
|
||||
currentPageButton: {
|
||||
border: '1px solid #b3b3b3',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user