music: add demo release type

This is part of the MusicBrainz spec, but I didn't think of implementing
it. Turns out it's stupidly common among music releases, so may as well.

Resolves #590.
This commit is contained in:
Alexander Capehart 2023-11-12 11:11:50 -07:00
parent b4b830fbf4
commit bf3c30e8af
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 21 additions and 0 deletions

View file

@ -4,6 +4,7 @@
#### What's New
- Added ability to rewind/skip tracks by swiping back/forward
- Added support for demo release type
## 3.2.1

View file

@ -607,6 +607,7 @@ constructor(
is ReleaseType.Soundtrack -> AlbumGrouping.SOUNDTRACKS
is ReleaseType.Mix -> AlbumGrouping.DJMIXES
is ReleaseType.Mixtape -> AlbumGrouping.MIXTAPES
is ReleaseType.Demo -> AlbumGrouping.DEMOS
}
}
}
@ -709,6 +710,7 @@ constructor(
SOUNDTRACKS(R.string.lbl_soundtracks),
DJMIXES(R.string.lbl_mixes),
MIXTAPES(R.string.lbl_mixtapes),
DEMOS(R.string.lbl_demos),
APPEARANCES(R.string.lbl_appears_on),
LIVE(R.string.lbl_live_group),
REMIXES(R.string.lbl_remix_group),

View file

@ -143,6 +143,18 @@ sealed interface ReleaseType {
get() = R.string.lbl_mixtape
}
/**
* A demo. These are usually [EP]-sized releases of music made to promote an Artist or a future
* release.
*/
data object Demo : ReleaseType {
override val refinement: Refinement?
get() = null
override val stringRes: Int
get() = R.string.lbl_demo
}
/** A specification of what kind of performance a particular release is. */
enum class Refinement {
/** A release consisting of a live performance */
@ -220,6 +232,7 @@ sealed interface ReleaseType {
type.equals("dj-mix", true) -> Mix
type.equals("live", true) -> convertRefinement(Refinement.LIVE)
type.equals("remix", true) -> convertRefinement(Refinement.REMIX)
type.equals("demo", true) -> Demo
else -> convertRefinement(null)
}
}

View file

@ -63,6 +63,10 @@
<string name="lbl_mixtapes">Mixtapes</string>
<!-- As in the collection of music -->
<string name="lbl_mixtape">Mixtape</string>
<!-- As in the collection of music -->
<string name="lbl_demo">Demo</string>
<!-- AS in the collection of music -->
<string name="lbl_demos">Demos</string>
<!-- As in a compilation of several performances that blend into a single continuous flow of music (Also known as DJ Mixes) -->
<string name="lbl_mixes">DJ Mixes</string>
<!-- As in a compilation of several performances that blend into a single continuous flow of music (Also known as DJ Mixes) -->

View file

@ -36,6 +36,7 @@ class ReleaseTypeTest {
assertEquals(ReleaseType.Soundtrack, ReleaseType.parse(listOf("album", "soundtrack")))
assertEquals(ReleaseType.Mix, ReleaseType.parse(listOf("album", "dj-mix")))
assertEquals(ReleaseType.Mixtape, ReleaseType.parse(listOf("album", "mixtape/street")))
assertEquals(ReleaseType.Demo, ReleaseType.parse(listOf("album", "demo")))
}
@Test