diff --git a/cleanup.py b/cleanup.py index c467191..b587e4a 100644 --- a/cleanup.py +++ b/cleanup.py @@ -41,7 +41,7 @@ class CleanerAgent: if a.strip() in self.rules_belongtogether: return [a.strip()] if a.strip() in self.rules_replaceartist: - return [self.rules_replaceartist[a.strip()]] + return self.rules_replaceartist[a.strip()].split("␟") diff --git a/rules/dummy b/rules/dummy deleted file mode 100644 index e69de29..0000000 diff --git a/rules/examplerules.tsv b/rules/examplerules.tsv deleted file mode 100644 index f0b35d9..0000000 --- a/rules/examplerules.tsv +++ /dev/null @@ -1,14 +0,0 @@ -### This folder can have any number of csv files to group your rules -### the first column defines the type of the rule: -### notanartist: Defines strings that can appear behind "feat" in a song title, but denote additional information about the track instead of another artist. Second column is the string -### belongtogether: defines an artist with an ampersand in their name. Otherwise, amerpsands are interpreted as denoting two different artists (except when there are no spaces). Second column is the full name of the artist -### replacetitle: defines an alternative spelling of a track title that should be replaced. Second column is the 'wrong' spelling, third column the correct spelling -### replaceartist: defines and alternative spelling of an artist that should be replaced. Second column is the 'wrong' spelling, third column the correct spelling -### countas: defines an artist that should be counted together with another artist for chart statistics etc. 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 -### -### THE RULES IN THIS EXAMPLE FILE ARE IGNORED -#notanartist In Dreams -#belongtogether Darth & Vader -#replacetitle 첫 사랑니 (Rum Pum Pum Pum) Rum Pum Pum Pum -#replaceartist Dal Shabet Dal★Shabet -#countas Trouble Maker HyunA diff --git a/rules/rules.info b/rules/rules.info new file mode 100644 index 0000000..678467d --- /dev/null +++ b/rules/rules.info @@ -0,0 +1,29 @@ +This folder can have any number of tsv files to group your rules + +The first column defines the type of the rule: + notanartist Defines strings that can appear behind "feat" in a song title, but denote additional information about the track instead of another artist. + Second column is the string + belongtogether Defines an artist with an ampersand in their name. Otherwise, amerpsands are interpreted as denoting two different artists (except when there are no spaces). + Second column is the full name of the artist + replacetitle Defines an alternative spelling of a track title that should be replaced. + Second column is the 'wrong' spelling + Third column the correct spelling + replaceartist Defines and alternative spelling of an artist that should be replaced + Second column is the 'wrong' spelling + Third column the correct spelling. Use ␟ if the spelling should correct to a several artists + countas Defines an artist that should be counted together with another artist for chart statistics etc. + 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 + +Rules in non-tsv files are ignored. '#' is used for comments. + +An example file could look like this: + + +notanartist In Dreams +belongtogether Darth & Vader +replacetitle 첫 사랑니 (Rum Pum Pum Pum) Rum Pum Pum Pum +replaceartist Dal Shabet Dal★Shabet +replaceartist Stephen Rippy/Kevin McMullan Stephen Rippy␟Kevin McMullan +countas Trouble Maker HyunA diff --git a/scrobbler-vivaldi-plex/background.js b/scrobbler-vivaldi-plex/background.js index c244320..24faa14 100644 --- a/scrobbler-vivaldi-plex/background.js +++ b/scrobbler-vivaldi-plex/background.js @@ -125,6 +125,12 @@ function stopPlayback(artist,title) { } } + +// One problem here: Closing the player while it's paused does not cause an event, so the track will only be scrobbled the next time we play something. +// Also potentially problematic: Pausing a track and just leaving it should probably trigger a scrobble after some time because we can assume the user just stopped listening but didn't bother to press the X +// We could simply check for scrobblability when the track is paused, but this would remove the ability to send listening time with the scrobble + + function ostopPlayback(artist,title) { currentlyPlaying = false console.log("Playback stopped!") @@ -205,7 +211,7 @@ function scrobble(artist,title,seconds) { artiststring = encodeURIComponent(artist) titlestring = encodeURIComponent(title) var xhttp = new XMLHttpRequest(); - xhttp.open("GET","http://localhost:42010/db/newscrobble?artist=" + artiststring + "&title=" + titlestring,true); + xhttp.open("GET","http://localhost:42010/db/newscrobble?artist=" + artiststring + "&title=" + titlestring + "&duration=" + seconds,true); xhttp.send() }