Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if k in song.meta:
v = song.meta[k]
search.add(normalize(v[request.lc]))
search.add(normalize(v["k"]))
search.add(normalize(v["l"]))
search.add(normalize(jaconv.kana2alphabet(jaconv.kata2hira(v["k"]))).replace("ー",""))
for k in ("genre",):
if k in song.meta:
v = song.meta[k]
search.add(normalize(v[request.lc]))
d["search"] = list(search)
if request.latin:
d["sort"] = song.meta["title"][(request.lc, "l")]
if ord(d["sort"][0:1]) > 0x100:
# Try again with kana-to-romaji, might help manufacture some sensible sort order
d["sort"] = jaconv.kana2alphabet(jaconv.kata2hira(song.meta["title"][(request.lc, "l", "k")]))
else:
d["sort"] = song.meta["title"][(request.lc, "k")]
return d
def get_song_meta(song):
d = {}
search = set()
for k, v in song.meta.items():
if request.latin:
d[k] = v[(request.lc, "l")]
else:
d[k] = v[request.lc]
for k in ("title", "artist", "seenon", "album"):
if k in song.meta:
v = song.meta[k]
search.add(normalize(v[request.lc]))
search.add(normalize(v["k"]))
search.add(normalize(v["l"]))
search.add(normalize(jaconv.kana2alphabet(jaconv.kata2hira(v["k"]))).replace("ー",""))
for k in ("genre",):
if k in song.meta:
v = song.meta[k]
search.add(normalize(v[request.lc]))
d["search"] = list(search)
if request.latin:
d["sort"] = song.meta["title"][(request.lc, "l")]
if ord(d["sort"][0:1]) > 0x100:
# Try again with kana-to-romaji, might help manufacture some sensible sort order
d["sort"] = jaconv.kana2alphabet(jaconv.kata2hira(song.meta["title"][(request.lc, "l", "k")]))
else:
d["sort"] = song.meta["title"][(request.lc, "k")]
return d