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}
|
||||
|
||||
|
||||
@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")
|
||||
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.
|
@ -40,9 +40,9 @@ div.header {
|
||||
left:0px;
|
||||
padding:10px;
|
||||
opacity:1;
|
||||
|
||||
|
||||
color:black;
|
||||
|
||||
|
||||
z-index:5;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ div.footer input {
|
||||
div.footer input:focus {
|
||||
outline:none;
|
||||
/**background-color:rgba(245,245,220,0.05);**/
|
||||
|
||||
|
||||
}
|
||||
|
||||
div.searchresults {
|
||||
@ -139,7 +139,7 @@ div.searchresults tr {
|
||||
margin-bottom:5px;
|
||||
height:50px;
|
||||
cursor:pointer;
|
||||
|
||||
|
||||
}
|
||||
div.searchresults tr:hover {
|
||||
background-color:rgba(35,35,35,1);
|
||||
@ -253,7 +253,7 @@ span.stat_selector_pulse,span.stat_selector_topartists,span.stat_selector_toptra
|
||||
|
||||
table.list {
|
||||
border-collapse:collapse;
|
||||
|
||||
|
||||
}
|
||||
|
||||
table.list tr td {
|
||||
@ -263,7 +263,7 @@ table.list tr td {
|
||||
overflow:hidden;
|
||||
text-overflow:ellipsis;
|
||||
padding-right:15px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
table.list tr:nth-child(even) {
|
||||
@ -272,7 +272,7 @@ table.list tr:nth-child(even) {
|
||||
|
||||
table.list tr:nth-child(5n) td {
|
||||
border-color:rgba(120,120,120,0.2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
table.list tr:hover {
|
||||
@ -281,7 +281,7 @@ table.list tr:hover {
|
||||
|
||||
table.list td.time {
|
||||
width:11%;
|
||||
color:gray;
|
||||
color:gray;
|
||||
}
|
||||
|
||||
|
||||
@ -300,8 +300,16 @@ table.list td.icon div {
|
||||
|
||||
table.list td.artists,td.artist,td.title {
|
||||
min-width:100px;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
table th {
|
||||
text-align: left;
|
||||
}
|
||||
table td.interaction {
|
||||
width:65px;
|
||||
}
|
||||
|
||||
|
||||
@ -317,14 +325,14 @@ table tr td.artists div span {
|
||||
z-index:-2;
|
||||
position:relative;
|
||||
white-space:nowrap;
|
||||
|
||||
|
||||
}
|
||||
table tr:hover td.artists div span {
|
||||
animation: bounce 3s linear infinite alternate;
|
||||
}
|
||||
@keyframes bounce {
|
||||
0% {
|
||||
|
||||
|
||||
}
|
||||
100% {
|
||||
//transform: translateX(-60px);
|
||||
@ -479,5 +487,5 @@ div.sidelist table {
|
||||
}
|
||||
|
||||
div.sidelist table.list td.time {
|
||||
width:17%;
|
||||
width:17%;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Maloja - Setup</title>
|
||||
|
||||
|
||||
<script>
|
||||
function replaceurls() {
|
||||
url = window.location.origin
|
||||
@ -13,23 +13,46 @@
|
||||
s[i].innerHTML = url
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function replace() {
|
||||
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>
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
|
||||
td {
|
||||
padding-right:20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<body onload="replace()">
|
||||
<table class="top_info">
|
||||
<tr>
|
||||
@ -38,18 +61,18 @@
|
||||
</td>
|
||||
<td class="text">
|
||||
<h1>Maloja</h1><br/>
|
||||
|
||||
|
||||
<p class="desc">Welcome to your own Maloja server!</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<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/>
|
||||
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
|
||||
|
||||
|
||||
<span class="stats"><span name="serverurl">yourserver.tld</span>/db/newscrobble</span>
|
||||
|
||||
(make sure to use the public URL) with the key-value-pairs
|
||||
@ -63,29 +86,35 @@
|
||||
<tr> <td>seconds</td> <td><i>Duration of Scrobble - optional and currently not used</i></td> </tr>
|
||||
</table>
|
||||
</span>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
|
||||
|
||||
<h2>Import your Last.FM data</h2>
|
||||
|
||||
|
||||
Switching from Last.fm? <a class="textlink" href="https://benjaminbenben.com/lastfm-to-csv/">Download all your data</a> and place the resulting file in your Maloja main folder. Run the command <span class="stats">./lastfmconverter.py <i>(the file you just downloaded)</i> lastfmimport.tsv</span>.
|
||||
<br/><br/>
|
||||
|
||||
|
||||
<h2>Set up some rules</h2>
|
||||
|
||||
|
||||
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/>
|
||||
|
||||
<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
|
||||
<a class="textlink" target="_blank" rel="noopener noreferrer" href="https://paypal.me/krateng">PayPal</a> or <a class="textlink" href="bitcoin:1krat8JMniJBTiHftMfR1LtF3Y1w5DAxx">Bitcoin</a>.
|
||||
|
||||
|
||||
You can also set up some predefined rulesets right away!
|
||||
<br/><br/>
|
||||
|
||||
KEY_PREDEFINED_RULESETS
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<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
|
||||
<a class="textlink" target="_blank" rel="noopener noreferrer" href="https://paypal.me/krateng">PayPal</a> or <a class="textlink" href="bitcoin:1krat8JMniJBTiHftMfR1LtF3Y1w5DAxx">Bitcoin</a>.
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<h2>View your stats</h2>
|
||||
|
||||
|
||||
Done! Visit <a class="textlink" href="/"><span name="serverurl">yourserver.tld</span></a> (or your public / proxy URL) to look at your overview page. Almost everything is clickable!
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
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