def testConvertToAny(self): canConvert, toType, id = infos.convertIdToAny("tvmaze", ["rid", "tvdb"], "3036") self.assertTrue(canConvert) self.assertEqual(toType, "tvrage") self.assertEqual("47566", id) canConvert, toType, id = infos.convertIdToAny("tvrage", ["tvmaze", "tvdb"], "47566") self.assertTrue(canConvert) self.assertEqual(toType, "tvmaze") self.assertEqual("3036", id) canConvert, toType, id = infos.convertIdToAny("tvrage", ["tvdbid", "tvmazeid"], "47566") self.assertTrue(canConvert) self.assertEqual(toType, "tvdb") self.assertEqual("299350", id) canConvert, toType, id = infos.convertIdToAny("tvmaze", ["imdbid", "tmdb"], "3036") self.assertFalse(canConvert)
def testConvertToAny(self): canConvert, toType, id = infos.convertIdToAny("imdb", ["tmdbid"], "0169547") self.assertTrue(canConvert) self.assertEqual("tmdb", toType) canConvert, toType, id = infos.convertIdToAny("imdb", ["imdb"], "0169547") self.assertTrue(canConvert) self.assertEqual(toType, "imdb") self.assertEqual(id, "0169547") canConvert, toType, id = infos.convertIdToAny("imdb", "imdb", "0169547") # Single ID instead of list self.assertTrue(canConvert) self.assertEqual(toType, "imdb") self.assertEqual(id, "0169547")
def get_showsearch_urls(self, search_request): if search_request.category is None: search_request.category = getCategoryByAnyInput("tv") url = self.build_base_url("tvsearch", search_request.category, offset=search_request.offset) if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny( search_request.identifier_key, self.search_ids, search_request.identifier_value) if canBeConverted: search_request.identifier_key = toType.replace( "tvrage", "rid").replace("tvdb", "tvdbid") search_request.identifier_value = id else: self.info("Unable to search using ID type %s" % search_request.identifier_key) return [] url.add({ search_request.identifier_key: search_request.identifier_value }) if search_request.episode: url.add({"ep": search_request.episode}) if search_request.season: url.add({"season": search_request.season}) if search_request.query: url.add({"q": search_request.query.replace(":", "")}) if search_request.maxage: url.add({"maxage": search_request.maxage}) return [url.url]
def get_moviesearch_urls(self, search_request): if search_request.category is None: search_request.category = "Movies" #A lot of indexers seem to disregard the "q" parameter for "movie" search, so if we have a query use regular search instead if search_request.query: url = self.build_base_url("search", search_request.category, offset=search_request.offset) url.add({"q": search_request.query}) else: url = self.build_base_url("movie", search_request.category, offset=search_request.offset) if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny( search_request.identifier_key, self.search_ids, search_request.identifier_value) if canBeConverted: search_request.identifier_key = toType.replace( "tvrage", "rid").replace("tvdb", "tvdbid").replace("imdb", "imdbid") search_request.identifier_value = id else: self.info("Unable to search using ID type %s" % search_request.identifier_key) return [] url.add({ search_request.identifier_key: search_request.identifier_value }) return [url.url]
def get_showsearch_urls(self, search_request): if search_request.category is None: search_request.category = getCategoryByAnyInput("tv") url = self.build_base_url("tvsearch", search_request.category, offset=search_request.offset) if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny(search_request.identifier_key, self.search_ids, search_request.identifier_value) if canBeConverted: search_request.identifier_key = toType.replace("tvrage", "rid").replace("tvdb", "tvdbid") search_request.identifier_value = id else: self.info("Unable to search using ID type %s" % search_request.identifier_key) return [] url.add({search_request.identifier_key: search_request.identifier_value}) if search_request.episode: url.add({"ep": search_request.episode}) if search_request.season: url.add({"season": search_request.season}) if search_request.query: url.add({"q": search_request.query}) if search_request.maxage: url.add({"maxage": search_request.maxage}) return [url.url]
def testConvertToAny(self): canConvert, toType, id = infos.convertIdToAny("imdb", ["tmdbid"], "0169547") self.assertTrue(canConvert) self.assertEqual("tmdb", toType) canConvert, toType, id = infos.convertIdToAny("imdb", ["imdb"], "0169547") self.assertTrue(canConvert) self.assertEqual(toType, "imdb") self.assertEqual(id, "0169547") canConvert, toType, id = infos.convertIdToAny( "imdb", "imdb", "0169547") #Single ID instead of list self.assertTrue(canConvert) self.assertEqual(toType, "imdb") self.assertEqual(id, "0169547")
def get_moviesearch_urls(self, search_request): if search_request.category is None: search_request.category = getCategoryByAnyInput("movies") if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny(search_request.identifier_key, ["imdb"], search_request.identifier_value) if canBeConverted: search_request.query = "tt%s" % id return self.get_search_urls(search_request)
def get_moviesearch_urls(self, search_request): if search_request.category is None: search_request.category = "Movies" if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny(search_request.identifier_key, ["imdb"], search_request.identifier_value) if canBeConverted: search_request.query = "tt%s" % id return self.get_search_urls(search_request)
def get_moviesearch_urls(self, search_request): if search_request.category is None: search_request.category = "Movies" #A lot of indexers seem to disregard the "q" parameter for "movie" search, so if we have a query use regular search instead if search_request.query: url = self.build_base_url("search", search_request.category, offset=search_request.offset) url.add({"q": search_request.query}) else: url = self.build_base_url("movie", search_request.category, offset=search_request.offset) if search_request.identifier_key: canBeConverted, toType, id = infos.convertIdToAny(search_request.identifier_key, self.search_ids, search_request.identifier_value) if canBeConverted: search_request.identifier_key = toType.replace("tvrage", "rid").replace("tvdb", "tvdbid").replace("imdb", "imdbid") search_request.identifier_value = id else: self.info("Unable to search using ID type %s" % search_request.identifier_key) return [] url.add({search_request.identifier_key: search_request.identifier_value}) return [url.url]