本文整理汇总了Python中Song.removeSongOrderPrefixFromName方法的典型用法代码示例。如果您正苦于以下问题:Python Song.removeSongOrderPrefixFromName方法的具体用法?Python Song.removeSongOrderPrefixFromName怎么用?Python Song.removeSongOrderPrefixFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song.removeSongOrderPrefixFromName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkCmdPlay
# 需要导入模块: import Song [as 别名]
# 或者: from Song import removeSongOrderPrefixFromName [as 别名]
def checkCmdPlay(self):
info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName)
guitars = []
drums = []
vocals = []
autoPart = None
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
else:
guitars.append(part)
if self.engine.cmdPlay == 2 and self.engine.cmdPart is not None and len(self.playerList) == 1:
if self.engine.cmdPart == part.id:
Log.debug("Command-line mode: Part found!")
if part.id == 4 and self.engine.input.gameDrums > 0:
autoPart = part.id
elif part.id == 5 and self.engine.input.gameMics > 0:
autoPart = part.id
elif self.engine.input.gameGuitars > 0:
autoPart = part.id
if autoPart is None:
if len(drums) == 0 and self.engine.input.gameDrums > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no drum parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no guitar parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
if len(vocals) == 0 and self.engine.input.gameMics > 0:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
Dialogs.showMessage(
self.engine, _("There are no vocal parts in this song. Change your controllers to play.")
)
if self.engine.cmdPlay == 2:
self.engine.cmdPlay = 0
return False
# Make sure the difficulty we chose is available
p = self.playerList[0].part
player = self.playerList[0]
if self.engine.cmdDiff is not None:
diff = Song.difficulties[self.engine.cmdDiff]
if diff in info.partDifficulties[p.id]:
self.playerList[0].difficulty = diff
else:
self.playerList[0].difficulty = info.partDifficulties[p.id][0]
else:
if self.splash:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
self.playerList[0].difficulty = Dialogs.chooseItem(
self.engine,
info.partDifficulties[p.id],
"%s \n %s"
% (Song.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name),
selected=player.difficulty,
)
return True
示例2: prepareSetlist
# 需要导入模块: import Song [as 别名]
# 或者: from Song import removeSongOrderPrefixFromName [as 别名]
def prepareSetlist(self, songs):
if self.songLoader:
self.songLoader.stop()
msg = self.engine.setlistMsg
self.engine.setlistMsg = None
self.selectedIndex = 0
if self.listingMode == 0 or self.careerMode:
self.items = self.libraries + self.songs
else:
self.items = self.songs
self.itemRenderAngles = [0.0] * len(self.items)
self.itemLabels = [None] * len(self.items)
self.searching = False
self.searchText = ""
shownItems = []
for item in self.items: # remove things we don't want to see. Some redundancy, but that's okay.
if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo):
if self.showCareerTiers == 2:
if isinstance(item, Song.TitleInfo):
if len(shownItems) > 0:
if isinstance(shownItems[-1], Song.TitleInfo):
shownItems.pop()
shownItems.append(item)
elif isinstance(item, Song.SortTitleInfo):
continue
else:
if isinstance(item, Song.TitleInfo):
continue
elif isinstance(item, Song.SortTitleInfo):
if not self.showSortTiers:
continue
if len(shownItems) > 0:
if isinstance(shownItems[-1], Song.SortTitleInfo):
shownItems.pop()
shownItems.append(item)
elif isinstance(item, Song.SongInfo):
if self.careerMode and (not self.showLockedSongs) and item.getLocked():
continue
else:
shownItems.append(item)
else:
shownItems.append(item)
if len(shownItems) > 0:
if isinstance(shownItems[-1], Song.TitleInfo) or isinstance(shownItems[-1], Song.SortTitleInfo):
shownItems.pop()
if len(self.items) > 0 and len(shownItems) == 0:
msg = _("No songs in this setlist are available to play!")
if self.careerMode:
msg = msg + " " + _("Make sure you have a working career pack!")
Dialogs.showMessage(self.engine, msg)
elif len(shownItems) > 0:
for item in shownItems:
if isinstance(item, Song.SongInfo) or isinstance(item, Song.LibraryInfo):
self.items = shownItems # make sure at least one item is selectable
break
else:
msg = _("No songs in this setlist are available to play!")
if self.careerMode:
msg = msg + " " + _("Make sure you have a working career pack!")
Dialogs.showMessage(self.engine, msg)
self.items = []
if self.items == []: # MFH: Catch when there ain't a damn thing in the current folder - back out!
if self.library != Song.DEFAULT_LIBRARY:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
self.startingSelected = self.library
self.library = os.path.dirname(self.library)
self.selectedItem = None
self.loadLibrary()
return
Log.debug("Setlist loaded.")
self.loaded = True
if self.setlistStyle == 1:
for i in range(self.headerSkip):
self.items.insert(0, Song.BlankSpaceInfo())
for i in range(self.footerSkip):
self.items.append(Song.BlankSpaceInfo())
if self.startingSelected is not None:
for i, item in enumerate(self.items):
if isinstance(item, Song.SongInfo) and self.startingSelected == item.songName: # TODO: SongDB
self.selectedIndex = i
break
elif isinstance(item, Song.LibraryInfo) and self.startingSelected == item.libraryName:
self.selectedIndex = i
break
for item in self.items:
if isinstance(item, Song.SongInfo):
item.name = Song.removeSongOrderPrefixFromName(item.name) # TODO: I don't like this.
elif not self.tiersPresent and (isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo)):
self.tiersPresent = True
while isinstance(self.items[self.selectedIndex], Song.BlankSpaceInfo) or (
#.........这里部分代码省略.........