From a6724b9455c89973b0d30a7e4f8e348057990480 Mon Sep 17 00:00:00 2001 From: Krateng Date: Sun, 29 Dec 2019 19:31:05 +0100 Subject: [PATCH] Added fixartists rule --- maloja/cleanup.py | 7 ++++- .../rules/predefined/krateng_masseffect.tsv | 29 +++++++++++++++++++ maloja/data_files/rules/rules.info | 3 ++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 maloja/data_files/rules/predefined/krateng_masseffect.tsv diff --git a/maloja/cleanup.py b/maloja/cleanup.py index 7d435fd..6145fdb 100644 --- a/maloja/cleanup.py +++ b/maloja/cleanup.py @@ -20,6 +20,7 @@ class CleanerAgent: self.rules_replaceartist = {b.lower():c for [a,b,c,d] in raw if a=="replaceartist"} self.rules_ignoreartist = [b.lower() for [a,b,c,d] in raw if a=="ignoreartist"] self.rules_addartists = {c.lower():(b.lower(),d) for [a,b,c,d] in raw if a=="addartists"} + self.rules_fixartists = {c.lower():b for [a,b,c,d] in raw if a=="fixartists"} self.rules_artistintitle = {b.lower():c for [a,b,c,d] in raw if a=="artistintitle"} #self.rules_regexartist = [[b,c] for [a,b,c,d] in raw if a=="regexartist"] #self.rules_regextitle = [[b,c] for [a,b,c,d] in raw if a=="regextitle"] @@ -38,7 +39,6 @@ class CleanerAgent: self.checksums = utilities.checksumTSV(datadir("rules")) - def fullclean(self,artist,title): artists = self.parseArtists(self.removespecial(artist)) title = self.parseTitle(self.removespecial(title)) @@ -50,6 +50,11 @@ class CleanerAgent: allartists = allartists.split("␟") if set(reqartists).issubset(set(a.lower() for a in artists)): artists += allartists + elif title.lower() in self.rules_fixartists: + allartists = self.rules_fixartists[title.lower()] + allartists = allartists.split("␟") + if len(set(a.lower() for a in allartists) & set(a.lower() for a in artists)) > 0: + artists = allartists artists = list(set(artists)) artists.sort() diff --git a/maloja/data_files/rules/predefined/krateng_masseffect.tsv b/maloja/data_files/rules/predefined/krateng_masseffect.tsv new file mode 100644 index 0000000..fbcc2e8 --- /dev/null +++ b/maloja/data_files/rules/predefined/krateng_masseffect.tsv @@ -0,0 +1,29 @@ +# NAME: Mass Effect Soundtrack +# DESC: Sets correct artists for the Mass Effect soundtracks + +# 1 +fixartists Jack Wall␟Sam Hulick Mass Effect Theme +fixartists Richard Jacques␟Jack Wall␟Sam Hulick Spectre Induction +fixartists Richard Jacques␟Jack Wall␟Sam Hulick The Citadel +fixartists Richard Jacques␟Jack Wall The Thorian +fixartists Richard Jacques␟Jack Wall␟Sam Hulick The Alien Queen +fixartists Jack Wall␟Sam Hulick Breeding Ground +fixartists Jack Wall␟Sam Hulick In Pursuit of Saren +fixartists David Kates␟Jack Wall␟Sam Hulick Infusion +fixartists David Kates␟Jack Wall␟Sam Hulick Final Assault + +# 2 +fixartists Jack Wall␟David Kates Thane +fixartists Jack Wall␟Sam Hulick The Normandy Attacked +fixartists Jack Wall␟Brian DiDomenico The Collector Base +fixartists Jack Wall␟Sam Hulick New Worlds + +# 3 +fixartists Sascha Dikiciyan␟Cris Velasco The Ardat-Yakshi +fixartists Sascha Dikiciyan␟Cris Velasco Rannoch +fixartists Sascha Dikiciyan␟Cris Velasco I'm Sorry +fixartists Sascha Dikiciyan␟Cris Velasco The Scientists +fixartists Sascha Dikiciyan␟Cris Velasco Aralakh Company +fixartists Sascha Dikiciyan␟Cris Velasco Prothean Beacon +fixartists Sascha Dikiciyan␟Cris Velasco Reaper Chase +fixartists Clint Mansell␟Sam Hulick An End, Once and For All diff --git a/maloja/data_files/rules/rules.info b/maloja/data_files/rules/rules.info index 239837c..46fc7d3 100644 --- a/maloja/data_files/rules/rules.info +++ b/maloja/data_files/rules/rules.info @@ -20,6 +20,9 @@ The first column defines the type of the rule: Second column is artists that need to be already present for this rule to apply Third column is the song title Fourth column are artists that shoud be added, separated by ␟ + fixartists Similar as above, but simply specifies that if any of the given artists is present, all (and no others) should be present + Second column is correct artists + Third column is the song title artistintitle Defines title strings that imply the presence of another artist. Second column is the string Third column is the artist or artists