From c9d2527a98f38991c23d2fb3b9947910c978d6ca Mon Sep 17 00:00:00 2001 From: krateng Date: Sun, 17 Apr 2022 15:37:48 +0200 Subject: [PATCH 1/6] Added changelog --- dev/releases/branch.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 dev/releases/branch.yml diff --git a/dev/releases/branch.yml b/dev/releases/branch.yml new file mode 100644 index 0000000..a90bbc2 --- /dev/null +++ b/dev/releases/branch.yml @@ -0,0 +1 @@ +- "[Architecture] Cleaned up legacy process control" From 80ba4550c7d3aba2c5f4e370c810085e831789d3 Mon Sep 17 00:00:00 2001 From: northys Date: Mon, 18 Apr 2022 22:37:27 +0200 Subject: [PATCH 2/6] README.md: fix docker image name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae4c17c..1ba0d76 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ You must publish a port on your host machine to bind to the container's web port An example of a minimum run configuration to access maloja via `localhost:42010`: ```console - docker run -p 42010:42010 -v $PWD/malojadata:/mljdata -e MALOJA_DATA_DIRECTORY=/mljdata maloja + docker run -p 42010:42010 -v $PWD/malojadata:/mljdata -e MALOJA_DATA_DIRECTORY=/mljdata krateng/maloja ``` ### Extras From 32a900cf3700f1aed86b0615b8f18fcf53ef7954 Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 19 Apr 2022 00:11:40 +0200 Subject: [PATCH 3/6] Fixed error for Lastfm import and added feedback, fix GH-118 --- maloja/proccontrol/tasks/import_scrobbles.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/maloja/proccontrol/tasks/import_scrobbles.py b/maloja/proccontrol/tasks/import_scrobbles.py index fec1f83..c9d98a6 100644 --- a/maloja/proccontrol/tasks/import_scrobbles.py +++ b/maloja/proccontrol/tasks/import_scrobbles.py @@ -268,11 +268,17 @@ def parse_lastfm(inputf): with open(inputf,'r',newline='') as inputfd: reader = csv.reader(inputfd) + line = 0 for row in reader: + line += 1 try: artist,album,title,time = row except ValueError: - yield ('FAIL',None,f"{row} does not look like a valid entry. Scrobble not imported.") + yield ('FAIL',None,f"{row} (Line {line}) does not look like a valid entry. Scrobble not imported.") + continue + + if time == '': + yield ('FAIL',None,f"{row} (Line {line}) is missing a timestamp.") continue try: @@ -287,7 +293,7 @@ def parse_lastfm(inputf): 'scrobble_duration':None },'') except Exception as e: - yield ('FAIL',None,f"{entry} could not be parsed. Scrobble not imported. ({repr(e)})") + yield ('FAIL',None,f"{row} (Line {line}) could not be parsed. Scrobble not imported. ({repr(e)})") continue From fe21894c5ecf3a53c9c5c00453abfc7f41c6a83e Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 19 Apr 2022 02:41:39 +0200 Subject: [PATCH 4/6] Version bump --- dev/releases/3.0.yml | 4 ++++ maloja/__pkginfo__.py | 2 +- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dev/releases/3.0.yml b/dev/releases/3.0.yml index 4452a12..1c59d2d 100644 --- a/dev/releases/3.0.yml +++ b/dev/releases/3.0.yml @@ -28,3 +28,7 @@ minor_release_name: "Yeonhee" - "[Feature] Added better feedback to native API endpoints" - "[Bugfix] Fixed native API receiving superfluous keywords" - "[Bugfix] Fixed crash when importing scrobbles with artists with similar names" +3.0.5: + notes: + - "[Feature] Added notification system for web interface" + - "[Bugfix] Fixed crash when encountering error in Lastfm import" diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 38f9714..ecf899c 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -4,7 +4,7 @@ # you know what f*ck it # this is hardcoded for now because of that damn project / package name discrepancy # i'll fix it one day -VERSION = "3.0.4" +VERSION = "3.0.5" HOMEPAGE = "https://github.com/krateng/maloja" diff --git a/pyproject.toml b/pyproject.toml index 7696274..ea61747 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "malojaserver" -version = "3.0.4" +version = "3.0.5" description = "Self-hosted music scrobble database" readme = "./README.md" requires-python = ">=3.6" From 17be00f7945d0078988a79a178546f6c4023a7ea Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 19 Apr 2022 15:22:42 +0200 Subject: [PATCH 5/6] Improved parsing of featuring artists in square brackets, fix GH-121 --- dev/releases/3.0.yml | 4 ++++ maloja/cleanup.py | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/dev/releases/3.0.yml b/dev/releases/3.0.yml index 1c59d2d..3cb6289 100644 --- a/dev/releases/3.0.yml +++ b/dev/releases/3.0.yml @@ -29,6 +29,10 @@ minor_release_name: "Yeonhee" - "[Bugfix] Fixed native API receiving superfluous keywords" - "[Bugfix] Fixed crash when importing scrobbles with artists with similar names" 3.0.5: + commit: "fe21894c5ecf3a53c9c5c00453abfc7f41c6a83e" notes: - "[Feature] Added notification system for web interface" - "[Bugfix] Fixed crash when encountering error in Lastfm import" +3.0.6: + notes: + - "[Bugfix] Better parsing of featuring artists" diff --git a/maloja/cleanup.py b/maloja/cleanup.py index e94fdae..73bf56a 100644 --- a/maloja/cleanup.py +++ b/maloja/cleanup.py @@ -109,9 +109,9 @@ class CleanerAgent: for d in self.delimiters_feat: - if re.match(r"(.*) \(" + d + " (.*)\)",a) is not None: - return self.parseArtists(re.sub(r"(.*) \(" + d + " (.*)\)",r"\1",a)) + \ - self.parseArtists(re.sub(r"(.*) \(" + d + " (.*)\)",r"\2",a)) + if re.match(r"(.*) [\(\[]" + d + " (.*)[\)\]]",a) is not None: + return self.parseArtists(re.sub(r"(.*) [\(\[]" + d + " (.*)[\)\]]",r"\1",a)) + \ + self.parseArtists(re.sub(r"(.*) [\(\[]" + d + " (.*)[\)\]]",r"\2",a)) @@ -139,11 +139,11 @@ class CleanerAgent: if t.strip().lower() in self.rules_replacetitle: return self.rules_replacetitle[t.strip().lower()] - t = t.replace("[","(").replace("]",")") + #t = t.replace("[","(").replace("]",")") - t = re.sub(r" \(as made famous by .*?\)","",t) - t = re.sub(r" \(originally by .*?\)","",t) - t = re.sub(r" \(.*?Remaster.*?\)","",t) + t = re.sub(r" [\(\[]as made famous by .*?[\)\]]","",t) + t = re.sub(r" [\(\[]originally by .*?[\)\]]","",t) + t = re.sub(r" [\(\[].*?Remaster.*?[\)\]]","",t) for s in malojaconfig["REMOVE_FROM_TITLE"]: if s in t: @@ -156,9 +156,9 @@ class CleanerAgent: def parseTitleForArtists(self,t): for d in self.delimiters_feat: - if re.match(r"(.*) \(" + d + " (.*?)\)",t) is not None: - (title,artists) = self.parseTitleForArtists(re.sub(r"(.*) \(" + d + " (.*?)\)",r"\1",t)) - artists += self.parseArtists(re.sub(r"(.*) \(" + d + " (.*?)\).*",r"\2",t)) + if re.match(r"(.*) [\(\[]" + d + " (.*?)[\)\]]",t) is not None: + (title,artists) = self.parseTitleForArtists(re.sub(r"(.*) [\(\[]" + d + " (.*?)[\)\]]",r"\1",t)) + artists += self.parseArtists(re.sub(r"(.*) [\(\[]" + d + " (.*?)[\)\]].*",r"\2",t)) return (title,artists) if re.match(r"(.*) - " + d + " (.*)",t) is not None: (title,artists) = self.parseTitleForArtists(re.sub(r"(.*) - " + d + " (.*)",r"\1",t)) From 43ec4c2c9e79d4c8be24d590d14edf87f8c2a12f Mon Sep 17 00:00:00 2001 From: krateng Date: Tue, 19 Apr 2022 22:13:51 +0200 Subject: [PATCH 6/6] Reenabled bracket normalization for titles, GH-121 --- maloja/cleanup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maloja/cleanup.py b/maloja/cleanup.py index 73bf56a..de47920 100644 --- a/maloja/cleanup.py +++ b/maloja/cleanup.py @@ -139,8 +139,10 @@ class CleanerAgent: if t.strip().lower() in self.rules_replacetitle: return self.rules_replacetitle[t.strip().lower()] - #t = t.replace("[","(").replace("]",")") + t = t.replace("[","(").replace("]",")") + # we'll leave these matching all bracket types so future changes + # won't require readaption t = re.sub(r" [\(\[]as made famous by .*?[\)\]]","",t) t = re.sub(r" [\(\[]originally by .*?[\)\]]","",t) t = re.sub(r" [\(\[].*?Remaster.*?[\)\]]","",t)