Compare commits

..

No commits in common. "2385c8a548f6d71e8b1acba503ae0161a9ddcc1e" and "131c0c565cfd2f5c11939e05621cd4a671ec7ecb" have entirely different histories.

9 changed files with 39 additions and 54 deletions

View File

@ -23,7 +23,7 @@ func legacyTrackID(mf model.MediaFile, prependLibId bool) string {
} }
func legacyAlbumID(mf model.MediaFile, md Metadata, 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))) albumPath := strings.ToLower(fmt.Sprintf("%s\\%s", legacyMapAlbumArtistName(md), legacyMapAlbumName(md)))
if !conf.Server.Scanner.GroupAlbumReleases { if !conf.Server.Scanner.GroupAlbumReleases {
if len(releaseDate) != 0 { if len(releaseDate) != 0 {
@ -55,3 +55,9 @@ func legacyMapAlbumName(md Metadata) string {
consts.UnknownAlbum, consts.UnknownAlbum,
) )
} }
// Keep the TaggedLikePicard logic for backwards compatibility
func legacyReleaseDate(md Metadata) string {
_, _, releaseDate := md.mapDates()
return string(releaseDate)
}

View 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"),
)
})

View File

@ -75,23 +75,6 @@ var _ = Describe("ToMediaFile", func() {
Expect(mf.OriginalYear).To(Equal(1966)) Expect(mf.OriginalYear).To(Equal(1966))
Expect(mf.ReleaseYear).To(Equal(2014)) 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() { Describe("Lyrics", func() {

View File

@ -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('Details component', () => {
describe('Desktop view', () => { describe('Desktop view', () => {
beforeEach(() => { beforeEach(() => {

View File

@ -169,7 +169,7 @@ const LibraryEdit = (props) => {
resource={'library'} resource={'library'}
source={'totalSize'} source={'totalSize'}
label={translate('resources.library.fields.totalSize')} label={translate('resources.library.fields.totalSize')}
format={(v) => formatBytes(v, 2)} format={formatBytes}
fullWidth fullWidth
variant="outlined" variant="outlined"
/> />

View File

@ -9,7 +9,7 @@ import {
BooleanField, BooleanField,
} from 'react-admin' } from 'react-admin'
import { useMediaQuery } from '@material-ui/core' import { useMediaQuery } from '@material-ui/core'
import { List, DateField, useResourceRefresh, SizeField } from '../common' import { List, DateField, useResourceRefresh } from '../common'
const LibraryFilter = (props) => ( const LibraryFilter = (props) => (
<Filter {...props} variant={'outlined'}> <Filter {...props} variant={'outlined'}>
@ -42,7 +42,6 @@ const LibraryList = (props) => {
<NumberField source="totalSongs" label="Songs" /> <NumberField source="totalSongs" label="Songs" />
<NumberField source="totalAlbums" label="Albums" /> <NumberField source="totalAlbums" label="Albums" />
<NumberField source="totalMissingFiles" label="Missing Files" /> <NumberField source="totalMissingFiles" label="Missing Files" />
<SizeField source="totalSize" />
<DateField <DateField
source="lastScanAt" source="lastScanAt"
label="Last Scan" label="Last Scan"

View File

@ -16,11 +16,6 @@ export default {
color: 'white', color: 'white',
}, },
}, },
MuiButton: {
textPrimary: {
color: '#fff',
},
},
NDLogin: { NDLogin: {
systemNameLink: { systemNameLink: {
color: '#0085ff', color: '#0085ff',

View File

@ -448,11 +448,6 @@ export default {
backgroundColor: bLight['500'], backgroundColor: bLight['500'],
}, },
}, },
RaButton: {
button: {
margin: '0 5px 0 5px',
},
},
RaPaginationActions: { RaPaginationActions: {
button: { button: {
backgroundColor: '#fff', backgroundColor: '#fff',

View File

@ -389,11 +389,6 @@ export default {
marginRight: '1rem', marginRight: '1rem',
}, },
}, },
RaButton: {
button: {
margin: '0 5px 0 5px',
},
},
RaPaginationActions: { RaPaginationActions: {
currentPageButton: { currentPageButton: {
border: '1px solid #b3b3b3', border: '1px solid #b3b3b3',