mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added predefined rule modules
This commit is contained in:
parent
2246efb4b4
commit
3f22d6bc75
18
database.py
18
database.py
@ -666,6 +666,24 @@ def issues():
|
|||||||
|
|
||||||
return {"duplicates":duplicates,"combined":combined,"newartists":newartists,"inconsistent":inconsistent}
|
return {"duplicates":duplicates,"combined":combined,"newartists":newartists,"inconsistent":inconsistent}
|
||||||
|
|
||||||
|
|
||||||
|
@dbserver.post("/importrules")
|
||||||
|
def import_rulemodule():
|
||||||
|
keys = FormsDict.decode(request.forms)
|
||||||
|
filename = keys.get("filename")
|
||||||
|
remove = keys.get("remove") is not None
|
||||||
|
validchars = "'-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
|
filename = "".join(c for c in filename if c in validchars)
|
||||||
|
|
||||||
|
if remove:
|
||||||
|
log("Deactivating predefined rulefile " + filename)
|
||||||
|
os.remove("rules/" + filename + ".tsv")
|
||||||
|
else:
|
||||||
|
log("Importing predefined rulefile " + filename)
|
||||||
|
os.symlink("predefined/" + filename + ".tsv","rules/" + filename + ".tsv")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@dbserver.post("/rebuild")
|
@dbserver.post("/rebuild")
|
||||||
def rebuild():
|
def rebuild():
|
||||||
|
|
||||||
|
2
rules/.gitignore
vendored
2
rules/.gitignore
vendored
@ -1 +1 @@
|
|||||||
*.tsv
|
/*.tsv
|
||||||
|
15
rules/predefined/krateng_artistsingroups.tsv
Normal file
15
rules/predefined/krateng_artistsingroups.tsv
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# NAME: Artists and Groups
|
||||||
|
# DESC: Combines artists that also performed as part of a group
|
||||||
|
|
||||||
|
# single artist more famous than group
|
||||||
|
countas Selena Gomez & The Scene Selena Gomez
|
||||||
|
countas The Police Sting
|
||||||
|
countas Trouble Maker HyunA
|
||||||
|
# Group more famous than single artist
|
||||||
|
countas RenoakRhythm Approaching Nirvana
|
||||||
|
countas Shirley Manson Garbage
|
||||||
|
countas Lewis Brindley The Yogscast
|
||||||
|
countas Sips The Yogscast
|
||||||
|
countas Jennie BLACKPINK
|
||||||
|
countas Junghwa EXID
|
||||||
|
countas Hwasa Mamamoo
|
Can't render this file because it has a wrong number of fields in line 5.
|
89
rules/predefined/krateng_kpopgirlgroups.tsv
Normal file
89
rules/predefined/krateng_kpopgirlgroups.tsv
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# NAME: K-Pop Girl Groups
|
||||||
|
# DESC: Fixes various different spellings and romanizes artist names and track titles for some K-Pop Girl Groups
|
||||||
|
|
||||||
|
# HyunA
|
||||||
|
replaceartist Kim Hyun-a HyunA
|
||||||
|
replaceartist 현아 HyunA
|
||||||
|
replacetitle 빨개요 Red
|
||||||
|
replacetitle RED Red
|
||||||
|
replacetitle Bubble Pop Bubble Pop!
|
||||||
|
replacetitle Do it Do It!
|
||||||
|
replacetitle How's This How's This?
|
||||||
|
replacetitle How's this How's This?
|
||||||
|
replaceartist HyunA(현아) HyunA
|
||||||
|
replacetitle Cause I'm God Girl Roll Deep
|
||||||
|
|
||||||
|
# 4Minute
|
||||||
|
replaceartist 4minute 4Minute
|
||||||
|
replacetitle 미쳐 Crazy
|
||||||
|
|
||||||
|
# BLACKPINK
|
||||||
|
replacetitle AS IF IT'S YOUR LAST As If It's Your Last
|
||||||
|
replacetitle BOOMBAYAH Boombayah
|
||||||
|
replacetitle WHISTLE Whistle
|
||||||
|
replacetitle DDU-DU DDU-DU Ddu-Du Ddu-Du
|
||||||
|
replacetitle PLAYING WITH FIRE Playing With Fire
|
||||||
|
replaceartist BLΛƆKPIИK BLACKPINK
|
||||||
|
|
||||||
|
# Dal Shabet
|
||||||
|
replaceartist Dal Shabet Dal★Shabet
|
||||||
|
replaceartist Dal shabet Dal★Shabet
|
||||||
|
replaceartist Dalshabet Dal★Shabet
|
||||||
|
replaceartist Dalshabet(달샤벳) Dal★Shabet
|
||||||
|
replaceartist 달샤벳(Dal★shabet) (Dalshabet) Dal★Shabet
|
||||||
|
replacetitle JOKER (Inst.) Joker (Instrumental)
|
||||||
|
replacetitle JOKER (Instrumental) Joker (Instrumental)
|
||||||
|
replacetitle Joker (inst.) Joker (Instrumental)
|
||||||
|
replacetitle Someone like U Someone Like U
|
||||||
|
replacetitle Be Ambitious(내 다리를 봐) Be Ambitious
|
||||||
|
|
||||||
|
# f(x)
|
||||||
|
replacetitle When I’m Alone When I'm Alone
|
||||||
|
replacetitle 첫 사랑니 (Rum Pum Pum Pum) Rum Pum Pum Pum
|
||||||
|
replacetitle 종이 심장 (Paper Heart) Paper Heart
|
||||||
|
replacetitle 나비 (Butterfly) Butterfly
|
||||||
|
replacetitle Déjà vu Déjà Vu
|
||||||
|
replacetitle 라차타 (LA chA TA) LA chA TA
|
||||||
|
|
||||||
|
# Stellar
|
||||||
|
replaceartist STELLAR Stellar
|
||||||
|
replaceartist 스텔라 Stellar Stellar
|
||||||
|
replaceartist 스텔라(Stellar) (Stellar) Stellar
|
||||||
|
replacetitle 찔려 Sting Sting
|
||||||
|
|
||||||
|
# Red Velvet
|
||||||
|
replacetitle 러시안 룰렛 Russian Roulette Russian Roulette
|
||||||
|
replacetitle 피카부 Peek-a-Boo Peek-A-Boo
|
||||||
|
replacetitle 빨간 맛 Red Flavor Red Flavor
|
||||||
|
replacetitle 행복 (Happiness) Happiness
|
||||||
|
replacetitle 봐 Look Look
|
||||||
|
replacetitle RBB (Really Bad Boy) Really Bad Boy
|
||||||
|
|
||||||
|
# EXID
|
||||||
|
replacetitle HOT PINK Hot Pink
|
||||||
|
replacetitle AH YEAH Ah Yeah
|
||||||
|
|
||||||
|
# TWICE
|
||||||
|
replacetitle CHEER UP Cheer Up
|
||||||
|
replacetitle OOH-AHH하게 Like OOH-AHH Like Ooh-Ahh
|
||||||
|
replacetitle OOH-AHH Like Ooh-Ahh
|
||||||
|
replacetitle LIKEY Likey
|
||||||
|
|
||||||
|
# AOA
|
||||||
|
replacetitle 사뿐사뿐 (Like a Cat) Like a Cat
|
||||||
|
replacetitle Like A Cat (Japanese Version) Like a Cat (Japanese Version)
|
||||||
|
|
||||||
|
# Girl's Day
|
||||||
|
replaceartist Girl's Day(걸스데이) Girl's Day
|
||||||
|
replacetitle DON'T FOR GET ME(나를 잊지마요) Don't forget me
|
||||||
|
replacetitle Expect(기대해) Expect
|
||||||
|
replacetitle EXPECT Expect
|
||||||
|
replacetitle I'll be yours I'll Be Yours
|
||||||
|
replacetitle FEMALE PRESIDENT(여자 대통령) Female President
|
||||||
|
|
||||||
|
# Mamamoo
|
||||||
|
replaceartist Hwa Sa Hwasa
|
||||||
|
replaceartist MAMAMOO Mamamoo
|
||||||
|
|
||||||
|
# Hello Venus
|
||||||
|
replaceartist Hello/Venus Hello Venus
|
Can't render this file because it has a wrong number of fields in line 5.
|
19
rules/predefined/krateng_lotr-soundtrack.tsv
Normal file
19
rules/predefined/krateng_lotr-soundtrack.tsv
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# NAME: Lord of the Rings Soundtrack
|
||||||
|
# DESC: Fixes tracks and artists from Howard Shore's soundtrack on different releases
|
||||||
|
|
||||||
|
replaceartist Howard Shore/Mabel Faletolu Howard Shore␟Mabel Faletolu
|
||||||
|
replaceartist Sir James Galway Viggo Mortensen And Renee Fleming Sir James Galway␟Viggo Mortensen␟Renée Fleming
|
||||||
|
replaceartist Sir James Galway Viggo Mortensen And Renée Fleming Sir James Galway␟Viggo Mortensen␟Renée Fleming
|
||||||
|
replaceartist Billy Boyd And Dominic Monaghan Billy Boyd␟Dominic Monaghan
|
||||||
|
replaceartist Billy Boyd and Dominic Monaghan Billy Boyd␟Dominic Monaghan
|
||||||
|
replaceartist Billy Boyd And Dominic Monaghan Album Version Billy Boyd␟Dominic Monaghan
|
||||||
|
replaceartist Sissel Performing Asëa Aranion Sissel
|
||||||
|
replaceartist Annie Lennox Performing Into The West Annie Lennox
|
||||||
|
replaceartist Billy Boyd Performing The Edge Of Night Billy Boyd
|
||||||
|
replaceartist Liv Tyler Album Version Liv Tyler
|
||||||
|
replaceartist Renée Fleming Album Version Renée Fleming
|
||||||
|
replaceartist Ben del Maestro Album Version Ben Del Maestro
|
||||||
|
replaceartist Sir James Galway Album Version Sir James Galway
|
||||||
|
replaceartist Sir James Galway Viggo Mortensen And Renée Fleming Album Version Sir James Galway␟Viggo Mortensen␟Renée Fleming
|
||||||
|
notanartist In Dreams
|
||||||
|
notanartist Aniron Theme For Aragorn And Arwen
|
Can't render this file because it has a wrong number of fields in line 4.
|
10
rules/predefined/krateng_monstercat.tsv
Normal file
10
rules/predefined/krateng_monstercat.tsv
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# NAME: Monstercat EDM
|
||||||
|
# DESC: Fixes parsing of some Monstercat releases
|
||||||
|
|
||||||
|
belongtogether Darth & Vader
|
||||||
|
belongtogether Case & Point
|
||||||
|
replaceartist Mr FijiWiji, AgNO3 Mr FijiWiji␟AgNO3
|
||||||
|
replaceartist Danilo Garcia, Laura Brehm Danilo Garcia␟Laura Brehm
|
||||||
|
replaceartist Two Thirds Laura Brehm Two Thirds␟Laura Brehm
|
||||||
|
replaceartist Approaching Nirvana Laura Brehm Approaching Nirvana␟Laura Brehm
|
||||||
|
replaceartist Mr FijiWiji AgNO3 Mr FijiWiji␟AgNO3
|
Can't render this file because it has a wrong number of fields in line 4.
|
6
rules/predefined/predefined.info
Normal file
6
rules/predefined/predefined.info
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
These are some files to get you started if you don't want to create your own rules.
|
||||||
|
They are concerned with specific artists / genres and are not complete by any means,
|
||||||
|
but may help you have a clean database from the start if your music taste happens
|
||||||
|
to be met by them. If you would like to curate your own ruleset, create a pull request
|
||||||
|
on GitHub. Please do not simply contribute your complete rule file, but a selection
|
||||||
|
concerned with a specific genre / category / group of music.
|
@ -305,6 +305,14 @@ table.list td.artists,td.artist,td.title {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
table th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
table td.interaction {
|
||||||
|
width:65px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
table td.artists div {
|
table td.artists div {
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
|
@ -18,6 +18,29 @@
|
|||||||
function replace() {
|
function replace() {
|
||||||
replaceurls();
|
replaceurls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function activateRuleModule(e,filename) {
|
||||||
|
keys = "filename=" + encodeURIComponent(filename)
|
||||||
|
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.open("POST","/db/importrules", true);
|
||||||
|
xhttp.send(keys);
|
||||||
|
|
||||||
|
e.innerHTML = e.innerHTML.replace("Add","Remove")
|
||||||
|
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("activate","deactivate")
|
||||||
|
/* Nobody ever look at this code please */
|
||||||
|
}
|
||||||
|
|
||||||
|
function deactivateRuleModule(e,filename) {
|
||||||
|
keys = "remove&filename=" + encodeURIComponent(filename)
|
||||||
|
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.open("POST","/db/importrules", true);
|
||||||
|
xhttp.send(keys);
|
||||||
|
|
||||||
|
e.innerHTML = e.innerHTML.replace("Remove","Add")
|
||||||
|
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("deactivate","activate")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -46,7 +69,7 @@
|
|||||||
|
|
||||||
<h2>Start Scrobbling</h2>
|
<h2>Start Scrobbling</h2>
|
||||||
|
|
||||||
If you use Vivaldi, Brave, Iridium or any other Chromium-based browser and listen to music on Plex, download the extension and simply enter the server URL as well as your API key in the relevant fields. They will turn green if the server is accessible.
|
If you use Vivaldi, Brave, Iridium or any other Chromium-based browser and listen to music on Plex or YouTube Music, download the extension and simply enter the server URL as well as your API key in the relevant fields. They will turn green if the server is accessible.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
If you use another browser or another music player, you could try to code your own extension. The API is super simple! Just send a POST HTTP request to
|
If you use another browser or another music player, you could try to code your own extension. The API is super simple! Just send a POST HTTP request to
|
||||||
|
|
||||||
@ -76,6 +99,12 @@
|
|||||||
After you've scrobbled for a bit, you might want to check the <a class="textlink" href="/issues">Issues page</a> to see if you need to set up some rules. You can also manually add rules in your server's "rules" directory - just add your own .tsv file and read the instructions on how to declare a rule.
|
After you've scrobbled for a bit, you might want to check the <a class="textlink" href="/issues">Issues page</a> to see if you need to set up some rules. You can also manually add rules in your server's "rules" directory - just add your own .tsv file and read the instructions on how to declare a rule.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|
||||||
|
You can also set up some predefined rulesets right away!
|
||||||
|
<br/><br/>
|
||||||
|
KEY_PREDEFINED_RULESETS
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
<h2>Say thanks</h2>
|
<h2>Say thanks</h2>
|
||||||
|
|
||||||
Coding open source projects is fun, but not really monetizable. If you like Maloja, I would appreciate a small donation via
|
Coding open source projects is fun, but not really monetizable. If you like Maloja, I would appreciate a small donation via
|
||||||
|
44
website/setup.py
Normal file
44
website/setup.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
def instructions(keys):
|
||||||
|
|
||||||
|
html = "<table>"
|
||||||
|
|
||||||
|
html += "<tr><th></th><th>Module</th><th>Author</th><th>Description</th></tr>"
|
||||||
|
|
||||||
|
for f in os.listdir("rules/predefined"):
|
||||||
|
if f.endswith(".tsv"):
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open("rules/predefined/" + f) as tsvfile:
|
||||||
|
line1 = tsvfile.readline()
|
||||||
|
line2 = tsvfile.readline()
|
||||||
|
|
||||||
|
if "# NAME: " in line1:
|
||||||
|
name = line1.replace("# NAME: ","")
|
||||||
|
else: name = f
|
||||||
|
if "# DESC: " in line2:
|
||||||
|
desc = line2.replace("# DESC: ","")
|
||||||
|
else: desc = ""
|
||||||
|
|
||||||
|
author = f.split("_")[0]
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
|
||||||
|
html += "<tr>"
|
||||||
|
|
||||||
|
if os.path.exists("rules/" + f):
|
||||||
|
html += "<td class='interaction' onclick=deactivateRuleModule(this,'" + f.replace(".tsv","") + "')><a class='textlink'>Remove:</a></td>"
|
||||||
|
else:
|
||||||
|
html += "<td class='interaction' onclick=activateRuleModule(this,'" + f.replace(".tsv","") + "')><a class='textlink'>Add:</a></td>"
|
||||||
|
html += "<td>" + name + "</td>"
|
||||||
|
html += "<td>" + author + "</td>"
|
||||||
|
html += "<td>" + desc + "</td>"
|
||||||
|
|
||||||
|
html += "</tr>"
|
||||||
|
html += "</table>"
|
||||||
|
|
||||||
|
|
||||||
|
pushresources = []
|
||||||
|
replace = {"KEY_PREDEFINED_RULESETS":html}
|
||||||
|
return (replace,pushresources)
|
Loading…
Reference in New Issue
Block a user