mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Improved custom rules slightly
This commit is contained in:
parent
9bcd701287
commit
08caeec8e0
@ -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("␟")
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
Can't render this file because it contains an unexpected character in line 3 and column 58.
|
29
rules/rules.info
Normal file
29
rules/rules.info
Normal file
@ -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
|
@ -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()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user