def formatShowText(channel, show, currentTime, formatString):
language = ""
when = ""
if " - " in channel.name:
chanName = channel.name.split(" - ")[1]
else:
chanName = channel.name
if show is None:
retVal = formatString.replace("{ch}", channel.channel_id).replace("{chname}", chanName)
else:
if "language" in show and show['language'].upper() != "US":
language = show['language'].upper()
if "720p" in chanName.lower():
chanName = chanName.replace(" 720P", "HD")
showTime = SmoothUtils.GetDateTimeNative(show['time'])
if showTime > currentTime:
if showTime.date() == currentTime.date():
when = "LATER"
else:
when = calendar.day_name[showTime.weekday()][:3].upper()
if "category" in show and show["name"].startswith(show["category"] + ":") and show["category"] != "News":
show["name"] = show["name"].replace(show["category"] + ":", "").strip()
retVal = formatString.replace("{ch}", channel.channel_id).replace("{chname}", chanName).replace("{title}", show['name']).replace("{qual}", show["quality"].replace("hqlq", "").replace("unk", "")).replace("{time}", SmoothUtils.GetShowTimeText(show)).replace("{lang}", language).replace("{when}", when).replace("{cat}", show['category'])
return retVal.replace("()", "").replace(" ", " ").strip()
评论列表
文章目录