diff --git a/cleanup.py b/cleanup.py index 91acdde..7961940 100644 --- a/cleanup.py +++ b/cleanup.py @@ -11,12 +11,16 @@ class CleanerAgent: self.updateRules() def updateRules(self): - raw = tsv.parse_all("rules","string","string","string") - self.rules_belongtogether = [b for [a,b,c] in raw if a=="belongtogether"] - self.rules_notanartist = [b for [a,b,c] in raw if a=="notanartist"] - self.rules_replacetitle = {b.lower():c for [a,b,c] in raw if a=="replacetitle"} - self.rules_replaceartist = {b.lower():c for [a,b,c] in raw if a=="replaceartist"} - self.rules_ignoreartist = [b.lower() for [a,b,c] in raw if a=="ignoreartist"] + raw = tsv.parse_all("rules","string","string","string","string") + self.rules_belongtogether = [b for [a,b,c,d] in raw if a=="belongtogether"] + self.rules_notanartist = [b for [a,b,c,d] in raw if a=="notanartist"] + self.rules_replacetitle = {b.lower():c for [a,b,c,d] in raw if a=="replacetitle"} + 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_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"] + # TODO # we always need to be able to tell if our current database is made with the current rules self.checksums = utilities.checksumTSV("rules") @@ -28,6 +32,12 @@ class CleanerAgent: title = self.parseTitle(self.removespecial(title)) (title,moreartists) = self.parseTitleForArtists(title) artists += moreartists + if title.lower() in self.rules_addartists: + reqartists, allartists = self.rules_addartists[title.lower()] + reqartists = reqartists.split("␟") + allartists = allartists.split("␟") + if set(reqartists).issubset(set(a.lower() for a in artists)): + artists += allartists artists = list(set(artists)) artists.sort() diff --git a/maloja b/maloja index 774ea71..8019e20 100755 --- a/maloja +++ b/maloja @@ -302,7 +302,7 @@ def update(): returnval = os.system("./update_requirements.sh") assert returnval == 0 except: - print("Make sure to update required modules! (" + yellow("bash update_requirements.sh") + ")") + print("Make sure to update required modules! (" + yellow("./update_requirements.sh") + ")") if stop(): start() #stop returns whether it was running before, in which case we restart it diff --git a/requirements.txt b/requirements.txt index 6cfecc9..b5aa9c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ bottle>=0.12.16 waitress>=1.3 -doreah>=1.0 +doreah>=1.1.7 nimrodel>=0.4.9 setproctitle>=1.1.10 wand>=0.5.4 diff --git a/rules/predefined/krateng_kpopgirlgroups.tsv b/rules/predefined/krateng_kpopgirlgroups.tsv index e80f90e..e4d3c1d 100644 --- a/rules/predefined/krateng_kpopgirlgroups.tsv +++ b/rules/predefined/krateng_kpopgirlgroups.tsv @@ -16,6 +16,7 @@ replacetitle Cause I'm God Girl Roll Deep countas 2Yoon 4Minute replaceartist 4minute 4Minute replacetitle 미쳐 Crazy +addartists HyunA Change Jun Hyung # BLACKPINK countas Jennie BLACKPINK diff --git a/rules/rules.info b/rules/rules.info index b28e612..c016d07 100644 --- a/rules/rules.info +++ b/rules/rules.info @@ -16,6 +16,10 @@ The first column defines the type of the rule: This will not change the separation in the database and all effects of this rule will disappear as soon as it is no longer active. Second column is the artist Third column the replacement artist / grouping label + addartists Defines a certain combination of artists and song title that should always have other artists added. + 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 ␟ Rules in non-tsv files are ignored. '#' is used for comments. Additional columns are ignored. To have a '#' in a name, use '\num' Comments are not supported in scrobble lists, but you probably never edit these manually anyway. @@ -30,3 +34,4 @@ replacetitle 첫 사랑니 (Rum Pum Pum Pum) Rum Pum Pum Pum replaceartist Dal Shabet Dal★Shabet replaceartist Mr FijiWiji, AgNO3 Mr FijiWiji␟AgNO3 # one artist is replaced by two artists countas Trouble Maker HyunA +addartists HyunA Change Jun Hyung