mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Added album title rule
This commit is contained in:
parent
0bdcb94f5b
commit
feaccf1259
@ -26,6 +26,7 @@ class CleanerAgent:
|
||||
self.rules_belongtogether = [r[1] for r in rawrules if r[0]=="belongtogether"]
|
||||
self.rules_notanartist = [r[1] for r in rawrules if r[0]=="notanartist"]
|
||||
self.rules_replacetitle = {r[1].lower():r[2] for r in rawrules if r[0]=="replacetitle"}
|
||||
self.rules_replacealbumtitle = {r[1].lower():r[2] for r in rawrules if r[0]=="replacealbumtitle"}
|
||||
self.rules_replaceartist = {r[1].lower():r[2] for r in rawrules if r[0]=="replaceartist"}
|
||||
self.rules_ignoreartist = [r[1].lower() for r in rawrules if r[0]=="ignoreartist"]
|
||||
self.rules_addartists = {r[2].lower():(r[1].lower(),r[3]) for r in rawrules if r[0]=="addartists"}
|
||||
@ -188,9 +189,14 @@ class CleanerAgent:
|
||||
if st in title.lower(): artists += self.rules_artistintitle[st].split("␟")
|
||||
return (title,artists)
|
||||
|
||||
def parseAlbumtitle(self,t):
|
||||
if t.strip().lower() in self.rules_replacealbumtitle:
|
||||
return self.rules_replacealbumtitle[t.strip().lower()]
|
||||
|
||||
t = t.replace("[","(").replace("]",")")
|
||||
|
||||
|
||||
t = t.strip()
|
||||
return t
|
||||
|
||||
|
||||
def flatten(lis):
|
||||
|
@ -144,6 +144,8 @@ def rawscrobble_to_scrobbledict(rawscrobble, fix=True, client=None):
|
||||
scrobbleinfo['track_artists'],scrobbleinfo['track_title'] = cla.fullclean(scrobbleinfo['track_artists'],scrobbleinfo['track_title'])
|
||||
if scrobbleinfo.get('album_artists'):
|
||||
scrobbleinfo['album_artists'] = cla.parseArtists(scrobbleinfo['album_artists'])
|
||||
if scrobbleinfo.get("album_title"):
|
||||
scrobbleinfo['album_title'] = cla.parseAlbumtitle(scrobbleinfo['album_title'])
|
||||
scrobbleinfo['scrobble_time'] = scrobbleinfo.get('scrobble_time') or int(datetime.datetime.now(tz=datetime.timezone.utc).timestamp())
|
||||
|
||||
|
||||
|
@ -309,6 +309,8 @@ def parse_lastfm(inputf):
|
||||
'scrobble_time': int(datetime.datetime.strptime(
|
||||
time + '+0000',
|
||||
"%d %b %Y %H:%M%z"
|
||||
# lastfm exports have time in UTC
|
||||
# some old imports might have the wrong time here!
|
||||
).timestamp()),
|
||||
'scrobble_duration':None
|
||||
},'')
|
||||
|
Loading…
Reference in New Issue
Block a user