def getStateList(self, torrentList): states = FilterList() if len(torrentList) > 0: states.append(Filter('All', len(torrentList))) for torrent in torrentList: states.append(Filter(torrent.state, 1)) finishedCount = torrentList.finishedCount() if finishedCount > 0: states.append(Filter('Finished', finishedCount)) unfinishedCount = torrentList.unfinishedCount() if unfinishedCount > 0: states.append(Filter('Unfinished', unfinishedCount)) unstartedCount = torrentList.unstartedCount() if unstartedCount > 0: states.append(Filter('Unstarted', unstartedCount)) return states
def getLabelList(self, torrentList): labels = FilterList() for torrent in torrentList: labels.append(Filter(torrent.label, 1)) return labels