From 91a7aeb50d6f2ff80689dba45db8ad5b1988f9f0 Mon Sep 17 00:00:00 2001 From: alim4r <7687869+alim4r@users.noreply.github.com> Date: Wed, 27 Apr 2022 20:54:33 +0200 Subject: [PATCH] Add feature to parse remix artists --- maloja/cleanup.py | 12 ++++++++++++ maloja/pkg_global/conf.py | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/maloja/cleanup.py b/maloja/cleanup.py index eb97528..758ba31 100644 --- a/maloja/cleanup.py +++ b/maloja/cleanup.py @@ -172,6 +172,18 @@ class CleanerAgent: return (title,artists) artists = [] + + if malojaconfig["PARSE_REMIX_ARTISTS"]: + for filter in malojaconfig["FILTERS_REMIX"]: + # match remix in brackets + if re.match(r".*[\(\[](.*)" + filter + "[\)\]]", t): + artists += self.parseArtists(re.match(r".*[\(\[](.*)" + filter + "[\)\]]", t)[1]) + print("check") + + # match remix split with "-" + elif re.match(r".*-(.*)" + filter, t): + artists += self.parseArtists(re.match(r".*-(.*)" + filter, t)[1]) + for st in self.rules_artistintitle: if st in t.lower(): artists += self.rules_artistintitle[st].split("␟") return (t,artists) diff --git a/maloja/pkg_global/conf.py b/maloja/pkg_global/conf.py index 0e951e2..4497145 100644 --- a/maloja/pkg_global/conf.py +++ b/maloja/pkg_global/conf.py @@ -181,7 +181,9 @@ malojaconfig = Configuration( "remove_from_title":(tp.Set(tp.String()), "Remove from Title", ["(Original Mix)","(Radio Edit)","(Album Version)","(Explicit Version)","(Bonus Track)"], "Phrases that should be removed from song titles"), "delimiters_feat":(tp.Set(tp.String()), "Featuring Delimiters", ["ft.","ft","feat.","feat","featuring","Ft.","Ft","Feat.","Feat","Featuring"], "Delimiters used for extra artists, even when in the title field"), "delimiters_informal":(tp.Set(tp.String()), "Informal Delimiters", ["vs.","vs","&"], "Delimiters in informal artist strings with spaces expected around them"), - "delimiters_formal":(tp.Set(tp.String()), "Formal Delimiters", [";","/","|","␝","␞","␟"], "Delimiters used to tag multiple artists when only one tag field is available") + "delimiters_formal":(tp.Set(tp.String()), "Formal Delimiters", [";","/","|","␝","␞","␟"], "Delimiters used to tag multiple artists when only one tag field is available"), + "filters_remix":(tp.Set(tp.String()), "Remix Filters", ["remix", "Remix", "Remix Edit", "remix edit", "Short Mix", "short mix", "Extended Mix", "extended mix", "Soundtrack Version", "soundtrack version"], "Filters used to recognize the remix artists in the title"), + "parse_remix_artists":(tp.Boolean(), "Parse Remix Artists", True) }, "Web Interface":{ "default_range_charts_artists":(tp.Choice({'alltime':'All Time','year':'Year','month':"Month",'week':'Week'}), "Default Range Artist Charts", "year"),