Merge pull request #155 from blha303/patch-8
p2sounds - Lyrics formatting
This commit is contained in:
commit
2ef0579fe6
1 changed files with 15 additions and 4 deletions
|
@ -10,10 +10,21 @@ def getSoundInfo(game, search):
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
return "Error: " + json.loads(e.read())["error"]
|
return "Error: " + json.loads(e.read())["error"]
|
||||||
items = []
|
items = []
|
||||||
for i in data:
|
for item in data:
|
||||||
items.append("{} - {} {}".format(i["who"],
|
if "music" in game:
|
||||||
i["text"] if len(i["text"]) < 325 else i["text"][:325] + "...",
|
textsplit = item["text"].split('"')
|
||||||
i["listen"] ) )
|
text = ""
|
||||||
|
for i in xrange(len(textsplit)):
|
||||||
|
if i % 2 != 0 and i < 6:
|
||||||
|
if text:
|
||||||
|
text += " / " + textsplit[i]
|
||||||
|
else:
|
||||||
|
text = textsplit[i]
|
||||||
|
else:
|
||||||
|
text = item["text"]
|
||||||
|
items.append("{} - {} {}".format(item["who"],
|
||||||
|
text if len(text) < 325 else text[:325] + "...",
|
||||||
|
item["listen"] ) )
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
return items[0]
|
return items[0]
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue