def findCertainShow(showList, tvdbid): results = filter(lambda x: x.tvdbid == tvdbid, showList) if len(results) == 0: return None elif len(results) > 1: raise MultipleShowObjectsException() else: return results[0]
def findCertainShow(showList, indexerid): results = [] if showList and indexerid: results = filter(lambda x: int(x.indexerid) == int(indexerid), showList) if len(results) == 1: return results[0] elif len(results) > 1: raise MultipleShowObjectsException()
def findCertainShow(showList, indexerid=None): if indexerid: results = filter(lambda x: x.indexerid == indexerid, showList) else: results = filter(lambda x: x.indexerid == indexerid, showList) if len(results) == 0: return None elif len(results) > 1: raise MultipleShowObjectsException() else: return results[0]
def findCertainShowFromIMDB(showList, imdbid): results = [] if showList and imdbid: results = filter(lambda x: str(x.imdbid) == str(imdbid), showList) if len(results) == 0: return None elif len(results) > 1: raise MultipleShowObjectsException() else: return results[0]
def findCertainShow(showList, indexerid): results = [] if not isinstance(indexerid, list): indexerid = [indexerid] if showList and len(indexerid): results = filter(lambda x: int(x.indexerid) in indexerid, showList) if len(results) == 1: return results[0] elif len(results) > 1: raise MultipleShowObjectsException()