def find_subtitle(self): self.info["realtitle"] = self.info["title"] if "subtitle" not in self.info: title, subtitle = util.find_subtitle(self.info["title"]) if subtitle: self.info["title"] = title.strip() self.info["subtitle"] = subtitle.strip()
def generate_songlist(self, recordkeys, game): i = 1 for name, diff, mods in self.course.songs: if "*" in name: name, subtitle = "??????????", "" elif name[0] == _("BEST"): song = recordkeys.get(records.best(name[1], diff, game)) if song: subtitle = (song.info["subtitle"] or "") + (_(" (Best #%d)") % name[1]) name = song.info["title"] else: name = _("Player's Best Unavailable") subtitle = _("(You need to play more songs!)") elif name[0] == _("WORST"): song = recordkeys.get(records.worst(name[1], diff, game)) if song: subtitle = (song.info["subtitle"] or "") + (_(" (Worst #%d)") % name[1]) name = song.info["title"] else: name = _("Player's Worst Unavailable") subtitle = _("(You need to play more songs!)") elif name[0] == _("LIKES"): song = recordkeys.get(records.like(name[1], diff, game)) if song: subtitle = (song.info["subtitle"] or "") + (" (Likes #%d)" % name[1]) name = song.info["title"] else: name = _("Player's Likes Unavailable") subtitle = _("(You need to play more songs!)") elif name[0] == _("DISLIKES"): song = recordkeys.get(records.dislike(name[1], diff, game)) if song: subtitle = ((song.info["subtitle"] or "") + (_(" (Dislikes #%d)") % name[1])) name = song.info["title"] else: name = _("Player's Dislikes Unavailable") subtitle = _("(You need to play more songs!)") else: name, subtitle = util.find_subtitle(name.split("/")[-1]) if "." in diff: diff = "?" name = ("%d. " % i) + name self._songs.append([name, subtitle, diff]) i += 1