Skip to content

Commit

Permalink
add originalyear, secondarygenres, descriptors, and edition tags (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline authored Apr 26, 2024
1 parent c1c25fb commit 7086c33
Show file tree
Hide file tree
Showing 27 changed files with 928 additions and 133 deletions.
30 changes: 26 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,29 @@ def seeded_cache(config: Config) -> None:
conn.executescript(
f"""\
INSERT INTO releases
(id , source_path , cover_image_path , added_at , datafile_mtime, title , releasetype, releaseyear, compositionyear, catalognumber, disctotal, new , metahash)
VALUES ('r1', '{dirpaths[0]}', null , '0000-01-01T00:00:00+00:00', '999' , 'Release 1', 'album' , 2023 , null , null , 1 , false, '1')
, ('r2', '{dirpaths[1]}', '{imagepaths[0]}', '0000-01-01T00:00:00+00:00', '999' , 'Release 2', 'album' , 2021 , null , 'DG-001' , 1 , false, '2')
, ('r3', '{dirpaths[2]}', null , '0000-01-01T00:00:00+00:00', '999' , 'Release 3', 'album' , 2021 , 1780 , 'DG-002' , 1 , true , '3');
(id , source_path , cover_image_path , added_at , datafile_mtime, title , releasetype, releaseyear, originalyear, compositionyear, catalognumber, edition , disctotal, new , metahash)
VALUES ('r1', '{dirpaths[0]}', null , '0000-01-01T00:00:00+00:00', '999' , 'Release 1', 'album' , 2023 , null , null , null , null , 1 , false, '1')
, ('r2', '{dirpaths[1]}', '{imagepaths[0]}', '0000-01-01T00:00:00+00:00', '999' , 'Release 2', 'album' , 2021 , 2019 , null , 'DG-001' , 'Deluxe', 1 , false, '2')
, ('r3', '{dirpaths[2]}', null , '0000-01-01T00:00:00+00:00', '999' , 'Release 3', 'album' , 2021 , null , 1780 , 'DG-002' , null , 1 , true , '3');
INSERT INTO releases_genres
(release_id, genre , position)
VALUES ('r1' , 'Techno' , 1)
, ('r1' , 'Deep House', 2)
, ('r2' , 'Classical' , 1);
INSERT INTO releases_secondary_genres
(release_id, genre , position)
VALUES ('r1' , 'Rominimal' , 1)
, ('r1' , 'Ambient' , 2)
, ('r2' , 'Orchestral', 1);
INSERT INTO releases_descriptors
(release_id, descriptor, position)
VALUES ('r1' , 'Warm' , 1)
, ('r1' , 'Hot' , 2)
, ('r2' , 'Wet' , 1);
INSERT INTO releases_labels
(release_id, label , position)
VALUES ('r1' , 'Silk Music' , 1)
Expand Down Expand Up @@ -185,10 +197,14 @@ def seeded_cache(config: Config) -> None:
, discnumber
, releasetitle
, releaseyear
, originalyear
, compositionyear
, catalognumber
, edition
, releasetype
, genre
, secondarygenre
, descriptor
, label
, releaseartist
, trackartist
Expand All @@ -200,16 +216,22 @@ def seeded_cache(config: Config) -> None:
, process_string_for_fts(t.discnumber) AS discnumber
, process_string_for_fts(r.title) AS releasetitle
, process_string_for_fts(r.releaseyear) AS releaseyear
, process_string_for_fts(r.originalyear) AS originalyear
, process_string_for_fts(r.compositionyear) AS compositionyear
, process_string_for_fts(r.catalognumber) AS catalognumber
, process_string_for_fts(r.edition) AS edition
, process_string_for_fts(r.releasetype) AS releasetype
, process_string_for_fts(COALESCE(GROUP_CONCAT(rg.genre, ' '), '')) AS genre
, process_string_for_fts(COALESCE(GROUP_CONCAT(rs.genre, ' '), '')) AS secondarygenre
, process_string_for_fts(COALESCE(GROUP_CONCAT(rd.descriptor, ' '), '')) AS descriptor
, process_string_for_fts(COALESCE(GROUP_CONCAT(rl.label, ' '), '')) AS label
, process_string_for_fts(COALESCE(GROUP_CONCAT(ra.artist, ' '), '')) AS releaseartist
, process_string_for_fts(COALESCE(GROUP_CONCAT(ta.artist, ' '), '')) AS trackartist
FROM tracks t
JOIN releases r ON r.id = t.release_id
LEFT JOIN releases_genres rg ON rg.release_id = r.id
LEFT JOIN releases_secondary_genres rs ON rs.release_id = r.id
LEFT JOIN releases_descriptors rd ON rd.release_id = r.id
LEFT JOIN releases_labels rl ON rl.release_id = r.id
LEFT JOIN releases_artists ra ON ra.release_id = r.id
LEFT JOIN tracks_artists ta ON ta.track_id = t.id
Expand Down
40 changes: 35 additions & 5 deletions docs/METADATA_TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,38 @@ title = "Mix & Match"
new = false
releasetype = "ep"
releaseyear = 2017
originalyear = 2017
compositionyear = -9999
genres = [
"K-Pop",
"Dance-Pop",
"Future Bass",
"K-Pop",
]
secondarygenres = [
"Electropop",
"Alternative R&B",
"Synthpop",
]
descriptors = [
"melodic",
"energetic",
"female vocalist",
"sensual",
"love",
"playful",
"romantic",
"eclectic",
"lush",
"rhythmic",
"optimistic",
"warm",
"urban",
"uplifting",
]
labels = [
"BlockBerry Creative",
"BlockBerryCreative",
]
edition = ""
catalognumber = "WMED0709"
artists = [
{ name = "LOOΠΔ ODD EYE CIRCLE", role = "main" },
Expand Down Expand Up @@ -294,14 +317,21 @@ The rules engine supports matching and acting on the following tags:
- `releaseartist[djmixer]`
- `releasetype`
- `releaseyear`
- `originalyear`
- `compositionyear`
- `genre`
- `parentgenre`
- `secondarygenre`
- `parentsecondarygenre`
- `descriptor`
- `label`
- `catalognumber`
- `edition`

The `trackartist[*]`, `releaseartist[*]`, `genre`, and `label` tags are _multi-value_ tags, which
have a slightly different behavior from single-value tags for some of the actions. We'll explore
this difference in the [Actions](#actions) section.
The `trackartist[*]`, `releaseartist[*]`, `genre` (& parents), `secondarygenre` (& parents),
`descriptor`, and `label` tags are _multi-value_ tags, which have a slightly different behavior from
single-value tags for some of the actions. We'll explore this difference in the [Actions](#actions)
section.

For convenience, the rules parser also allows you to specify _tag aliases_ in
place of the above tags, which expand to multiple tags when matching. The
Expand Down
27 changes: 21 additions & 6 deletions docs/TAGGING_CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,20 @@ world, Rosé will support reading from additional fields.
| ---------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Release Title | `TALB` | |
| Release Artists | `TPE2` | |
| Release Year | `TDRC` | `TYER`, `TDAT` |
| Release Type | `TXXX:RELEASETYPE` | `TXXX:MusicBrainz Album Type` |
| Release Year | `TDRC` | `TYER`, `TDAT` |
| Original Year | `TDOR` | `TORY` |
| Composition Year | `TXXX:COMPOSITIONDATE ` | |
| Genre | `TCON` | |
| Secondary Genre | `TXXX:SECONDARYGENRE` | |
| Descriptor | `TXXX:DESCRIPTOR` | |
| Label | `TPUB` | |
| Catalog Number | `TXXX:CATALOGNUMBER` | |
| Edition | `TXXX:EDITION` | |
| Track Title | `TIT2` | |
| Track Artists | `TPE1` | `TPE4` (Remixer), `TCOM` (Composer), `TPE3` (Conductor), `TIPL,IPLS/producer` (producer), `TIPL,IPLS/DJ-mix` (djmixer) |
| Track Number | `TRCK` | |
| Disc Number | `TPOS` | |
| Composition Year | `TXXX:COMPOSITIONYEAR ` | |
| Rosé ID | `TXXX:ROSEID` | |
| Rosé Release ID | `TXXX:ROSERELEASEID` | |

Expand All @@ -128,15 +133,20 @@ world, Rosé will support reading from additional fields.
| ---------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Release Title | `\xa9alb` | |
| Release Artists | `aART` | |
| Release Year | `\xa9day` | |
| Release Type | `----:com.apple.iTunes:RELEASETYPE` | `----:com.apple.iTunes:MusicBrainz Album Type` |
| Release Year | `\xa9day` | |
| Original Year | `----:net.sunsetglow.rose:ORIGINALDATE` | `----:com.apple.iTunes:ORIGINALDATE`, `----:com.apple.iTunes:ORIGINALYEAR` |
| Composition Year | `----:net.sunsetglow.rose:COMPOSITIONDATE` | |
| Genre | `\xa9gen` | |
| Secondary Genre | `----:net.sunsetglow.rose:SECONDARYGENRE` | |
| Descriptor | `----:net.sunsetglow.rose:DESCRIPTOR` | |
| Label | `----:com.apple.iTunes:LABEL` | |
| Catalog Number | `----:com.apple.iTunes:CATALOGNUMBER` | |
| Edition | `----:net.sunsetglow.rose:EDITION` | |
| Track Title | `\xa9nam` | |
| Track Artists | `\xa9ART` | `----:com.apple.iTunes:REMIXER` (Remixer), `\xa9wrt` (Composer), `----:com.apple.iTunes:CONDUCTOR` (Conductor), `----:com.apple.iTunes:PRODUCER` (producer), `----:com.apple.iTunes:DJMIXER` (djmixer) |
| Track Number | `trkn` | |
| Disc Number | `disk` | |
| Composition Year | `----:net.sunsetglow.rose:COMPOSITIONYEAR` | |
| Rosé ID | `----:net.sunsetglow.rose:ID` | |
| Rosé Release ID | `----:net.sunsetglow.rose:RELEASEID` | |

Expand All @@ -146,14 +156,19 @@ world, Rosé will support reading from additional fields.
| ---------------- | ----------------- | --------------------------------------------------------------------------------------------------------------- |
| Release Title | `release` | |
| Release Artists | `albumartist` | |
| Release Year | `date` | `year` |
| Release Type | `releasetype` | |
| Release Year | `date` | `year` |
| Original Year | `originaldate` | `originalyear` |
| Composition Year | `compositiondate` | |
| Genre | `genre` | |
| Secondary Genre | `secondarygenre` | |
| Descriptor | `descriptor` | |
| Label | `label` | `organization`, `recordlabel` |
| Catalog Number | `catalognumber` | |
| Edition | `edition` | |
| Track Title | `title` | |
| Track Artists | `artist` | `remixer` (Remixer), `composer` (Composer), `conductor` (Conductor), `producer` (producer), `djmixer` (djmixer) |
| Track Number | `tracknumber` | |
| Disc Number | `discnumber` | |
| Composition Year | `compositionyear` | |
| Rosé ID | `roseid` | |
| Rosé Release ID | `rosereleaseid` | |
Loading

0 comments on commit 7086c33

Please sign in to comment.