def create(self): name = self.item.title slug = slugify.slugify(name) existing = MatchedFile.get_by_slug(slug) if existing: logging.debug("the file " + name + " already exists") return False url = None content = None if self.source.zipped == False and self.source.authorizationRequired == False: url = self.item.url else: content = self.getContentForFile() if content is None: logging.warn("no content found when looking for " + name + ", no matching file will be created") return False url = settings.SITE_URL + MatchedFile.get_url_for_slug( slug) + "/content" logging.info("Adding the new matched file " + name) newFile = MatchedFile(name=name, slug=slug, date=datetime.now(), fileUrl=url, content=content, source=self.source, series=self.show) newFile.put() return True
def create(self): name = self.item.title slug = slugify.slugify(name) existing = MatchedFile.get_by_slug(slug) if existing: logging.debug("the file " + name + " already exists") return False url = None content = None if self.source.zipped == False and self.source.authorizationRequired == False: url = self.item.url else: content = self.getContentForFile() if content is None: logging.warn("no content found when looking for " + name + ", no matching file will be created") return False url = settings.SITE_URL + MatchedFile.get_url_for_slug(slug) + "/content" logging.info("Adding the new matched file " + name) newFile = MatchedFile( name=name, slug=slug, date=datetime.now(), fileUrl=url, content=content, source=self.source, series=self.show ) newFile.put() return True
def get(self,slug): existing = MatchedFile.get_by_slug(slug) if existing: self.response.headers['Content-Type'] = 'application/x-nzb' self.response.headers['Content-Disposition'] = 'attachment; filename=' + slug + ".nzb" self.response.out.write(existing.content) else: self.not_found()
def get(self,slug): existing = MatchedFile.get_by_slug(slug) if existing: td = default_template_data() td["file"] = existing self.render(td, "file.html") else: self.not_found()
def get(self, slug): existing = MatchedFile.get_by_slug(slug) if not existing: self.not_found() return existing.delete() invalidate_cache("matchedfiles") self.redirect("/admin/files")
def get(self,slug): existing = MatchedFile.get_by_slug(slug) if existing: td = default_template_data() td["files_selected"] = True td["mf"] = existing td["hasContent"] = (existing.content is not None) self.render(td, 'admin/files_instance.html') else: self.not_found()
def get(self, slug): existing = MatchedFile.get_by_slug(slug) if existing: td = default_template_data() td["files_selected"] = True td["mf"] = existing td["hasContent"] = existing.content is not None self.render(td, "admin/files_instance.html") else: self.not_found()