def searchTvShowsDeferred(activeShowKeys): if activeShowKeys is None: logging.info("No activeShowKeys found, exiting searchTvShowsDeferred") return if len(activeShowKeys) == 0: logging.info("0 activeShowKeys found, exiting searchTvShowsDeferred") return activeShows = [] for key in activeShowKeys: show = TrackedSeries.get(key) if show is not None: activeShows.append(show) if len(activeShows) == 0: logging.info( "0 activeShows found from the keys, exiting searchTvShowsDeferred") return allSources = memcache.get("sources") if allSources is None: allSources = FileSource.all().order("name").fetch(1000) if allSources is not None: memcache.add("sources", allSources) else: return if filesourceparsing.ParseAndSearch.go(activeShows, allSources): invalidate_cache()
def searchTvShowsDeferred(activeShowKeys): if activeShowKeys is None: logging.info("No activeShowKeys found, exiting searchTvShowsDeferred") return if len(activeShowKeys) == 0: logging.info("0 activeShowKeys found, exiting searchTvShowsDeferred") return activeShows = [] for key in activeShowKeys: show = TrackedSeries.get(key) if show is not None: activeShows.append(show) if len(activeShows) == 0: logging.info("0 activeShows found from the keys, exiting searchTvShowsDeferred") return allSources = memcache.get("sources") if allSources is None: allSources = FileSource.all().order("name").fetch(1000) if allSources is not None: memcache.add("sources", allSources) else: return if filesourceparsing.ParseAndSearch.go(activeShows, allSources): invalidate_cache()
def post(self): """ name -- string: The name of this file source slug -- stirng: URL friendly version of the name rssUrl -- string: The rss feed url quality -- string: The quality of the files in this source zipped -- boolean: Are the files from this source zip files? authorizationRequired -- boolean: When downloading the file, is authorization required? authUsername -- string: authorization username authPassword -- string: authorization password """ name = self.request.get("name", default_value=None) rssUrl = self.request.get("rssUrl", default_value=None) quality = self.request.get("quality", default_value=None) zipped = self.request.get("zipped", default_value=False) == "true" authorizationRequired = self.request.get("authorizationRequired", default_value=False) == "true" authUsername = self.request.get("authUsername", default_value=None) authPassword = self.request.get("authPassword", default_value=None) if not name or not rssUrl or not quality: self.error(400, "Bad Data: Name: %s, rssUrl: %s, quality: %s" % (name, rssUrl, quality)) return slug = slugify.slugify(name) existing_s = FileSource.get_by_slug(slug) if existing_s: self.error(400, "A source with this name already exists") return s = FileSource( name=name, slug=slug, rssUrl=rssUrl, quality=quality, zipped=zipped, authorizationRequired=authorizationRequired, authUsername=authUsername, authPassword=authPassword, ) s.put() invalidate_cache("sources") self.redirect("/admin/sources/" + slug)
def get(self, slug): source = FileSource.get_by_slug(slug) if source: td = default_template_data() td["sources_selected"] = True td["source"] = source td["qualities"] = ["HD","SD"] self.render(td, 'admin/sources_instance.html') else: self.not_found()
def get(self, slug): source = FileSource.get_by_slug(slug) if source: td = default_template_data() td["sources_selected"] = True td["source"] = source td["qualities"] = ["HD", "SD"] self.render(td, "admin/sources_instance.html") else: self.not_found()
def get(self, slug): existing = FileSource.get_by_slug(slug) if not existing: self.not_found() return if existing.files is not None: for mf in existing.files: mf.delete() existing.delete() invalidate_cache("sources") self.redirect("/admin/sources")
def post(self): """ name -- string: The name of this file source slug -- stirng: URL friendly version of the name rssUrl -- string: The rss feed url quality -- string: The quality of the files in this source zipped -- boolean: Are the files from this source zip files? authorizationRequired -- boolean: When downloading the file, is authorization required? authUsername -- string: authorization username authPassword -- string: authorization password """ name = self.request.get('name', default_value=None) rssUrl = self.request.get('rssUrl', default_value=None) quality = self.request.get('quality', default_value=None) zipped = self.request.get('zipped', default_value=False) == "true" authorizationRequired = self.request.get('authorizationRequired', default_value=False) == "true" authUsername = self.request.get('authUsername', default_value=None) authPassword = self.request.get('authPassword', default_value=None) if not name or not rssUrl or not quality: self.error(400, "Bad Data: Name: %s, rssUrl: %s, quality: %s" % (name, rssUrl, quality)) return slug = slugify.slugify(name) existing_s = FileSource.get_by_slug(slug) if existing_s: self.error(400, "A source with this name already exists") return s = FileSource(name=name, slug=slug, rssUrl=rssUrl, quality=quality, zipped=zipped, authorizationRequired=authorizationRequired, authUsername=authUsername, authPassword=authPassword) s.put() invalidate_cache("sources") self.redirect("/admin/sources/"+slug)
def data(self): return FileSource.all().order("name").fetch(1000)