def __getRegExForSearchString(self, searchString):
        ts = TrackedSeries(name=searchString, slug=searchString, quality="HD", active=True, requester=users.get_current_user(),
            addDate=datetime.now(), minimumSeason=None)

        regexIfied = ts.getRegExSearchString()
        print regexIfied
        return re.compile(regexIfied, re.I)
    def __getRegExForSearchString(self, searchString):
        ts = TrackedSeries(name=searchString, slug=searchString, quality="HD", active=True, requester=users.get_current_user(),
            addDate=datetime.now(), minimumSeason=None)

        regexIfied = ts.getRegExSearchString()
        print regexIfied
        return re.compile(regexIfied, re.I)
Example #3
0
    def post(self):
        """
            name        -- string: The name of this tv series
            slug        -- stirng: URL friendly version of the name
            quality     -- string: The quality of the tv series to watch for
            requester   -- user: The user who first asked to track the show
            addDate     -- datetime: When this show started being tracked
            active      -- boolean: Is Active?
            minimumSeason -- integer: Lowest season number to care about
        """
        name = self.request.get("name", default_value=None)
        quality = self.request.get("quality", default_value=None)
        active = self.request.get("active", default_value=True) == "true"
        minimumSeasonTxt = self.request.get("minimumSeason", default_value=None)
        authUsername = self.request.get("authUsername", default_value=None)
        authPassword = self.request.get("authPassword", default_value=None)

        if not name or not quality:
            self.error(400, "Bad Data: Name: %s, quality: %s" % (name, quality))
            return

        name = string.replace(name, ".", " ")

        slug = slugify.slugify(name)
        existing_s = TrackedSeries.get_by_slug(slug)

        if existing_s:
            self.error(400, "A TV show with this name already exists")
            return

        minimumSeason = None
        if minimumSeasonTxt:
            minimumSeason = int(minimumSeasonTxt)

        s = TrackedSeries(
            name=name,
            slug=slug,
            quality=quality,
            active=active,
            requester=users.get_current_user(),
            addDate=datetime.now(),
            minimumSeason=minimumSeason,
        )
        s.put()

        invalidate_cache("shows")

        self.redirect("/admin/shows/" + slug)
Example #4
0
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()
Example #5
0
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()
Example #6
0
    def post(self):
        """
            name        -- string: The name of this tv series
            slug        -- stirng: URL friendly version of the name
            quality     -- string: The quality of the tv series to watch for
            requester   -- user: The user who first asked to track the show
            addDate     -- datetime: When this show started being tracked
            active      -- boolean: Is Active?
            minimumSeason -- integer: Lowest season number to care about
        """
        name = self.request.get('name', default_value=None)
        quality = self.request.get('quality', default_value=None)
        active = self.request.get('active', default_value=True) == "true"
        minimumSeasonTxt = self.request.get('minimumSeason', default_value=None)
        authUsername = self.request.get('authUsername', default_value=None)
        authPassword = self.request.get('authPassword', default_value=None)

        if not name or not quality:
            self.error(400, "Bad Data: Name: %s, quality: %s" % (name, quality))
            return

        name = string.replace(name, ".", " ")

        slug = slugify.slugify(name)
        existing_s = TrackedSeries.get_by_slug(slug)

        if existing_s:
            self.error(400, "A TV show with this name already exists")
            return

        minimumSeason = None
        if minimumSeasonTxt:
            minimumSeason = int(minimumSeasonTxt)

        s = TrackedSeries(name=name, slug=slug, quality=quality, active=active, requester=users.get_current_user(),
            addDate=datetime.now(), minimumSeason=minimumSeason)
        s.put()

        invalidate_cache("shows")

        self.redirect("/admin/shows/"+slug)
Example #7
0
    def get(self, slug):
        existing = TrackedSeries.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("shows")

        self.redirect("/admin/shows")
Example #8
0
    def get(self, slug):
        existing = TrackedSeries.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("shows")

        self.redirect("/admin/shows")
Example #9
0
    def get(self,slug):
        show = TrackedSeries.get_by_slug(slug)
        if show:
            td = default_template_data()
            td["shows_selected"] = True
            td["show"] = show
            td["minimumSeasonTxt"] = ""
            if show.minimumSeason != None:
                td["minimumSeasonTxt"] = show.minimumSeason

            td["qualities"] = ["SD","HD"]
            td["searchStrings"] = show.getRegExSearchString()

            self.render(td, 'admin/shows_instance.html')
        else:
            self.not_found()
Example #10
0
    def get(self, slug):
        show = TrackedSeries.get_by_slug(slug)
        if show:
            td = default_template_data()
            td["shows_selected"] = True
            td["show"] = show
            td["minimumSeasonTxt"] = ""
            if show.minimumSeason != None:
                td["minimumSeasonTxt"] = show.minimumSeason

            td["qualities"] = ["SD", "HD"]
            td["searchStrings"] = show.getRegExSearchString()

            self.render(td, "admin/shows_instance.html")
        else:
            self.not_found()
Example #11
0
    def post(self,slug):
        """
            name        -- string: The name of this tv series
            slug        -- stirng: URL friendly version of the name
            quality     -- string: The quality of the tv series to watch for
            requester   -- user: The user who first asked to track the show
            addDate     -- datetime: When this show started being tracked
            active      -- boolean: Is Active?
            minimumSeason -- integer: Lowest season number to care about
        """

        existing_s = TrackedSeries.get_by_slug(slug)
        if not existing_s:
            self.error(400, "Cannot find an existing TV show to edit")
            return

        name = self.request.get('name', default_value=None)
        quality = self.request.get('quality', default_value=None)
        active = self.request.get('active', default_value=True) == "true"
        minimumSeasonTxt = self.request.get('minimumSeason', default_value=None)
        authUsername = self.request.get('authUsername', default_value=None)
        authPassword = self.request.get('authPassword', default_value=None)

        if not name or not quality:
            self.error(400, "Bad Data: Name: %s, quality: %s" % (name, quality))
            return

        minimumSeason = None
        if minimumSeasonTxt:
            minimumSeason = int(minimumSeasonTxt)

        existing_s.name = name
        existing_s.slug = slugify.slugify(name)
        existing_s.quality = quality
        existing_s.active = active
        existing_s.minimumSeason = minimumSeason
        existing_s.put()

        invalidate_cache("shows")

        self.redirect("/admin/shows/"+existing_s.slug)
Example #12
0
    def post(self, slug):
        """
            name        -- string: The name of this tv series
            slug        -- stirng: URL friendly version of the name
            quality     -- string: The quality of the tv series to watch for
            requester   -- user: The user who first asked to track the show
            addDate     -- datetime: When this show started being tracked
            active      -- boolean: Is Active?
            minimumSeason -- integer: Lowest season number to care about
        """

        existing_s = TrackedSeries.get_by_slug(slug)
        if not existing_s:
            self.error(400, "Cannot find an existing TV show to edit")
            return

        name = self.request.get("name", default_value=None)
        quality = self.request.get("quality", default_value=None)
        active = self.request.get("active", default_value=True) == "true"
        minimumSeasonTxt = self.request.get("minimumSeason", default_value=None)
        authUsername = self.request.get("authUsername", default_value=None)
        authPassword = self.request.get("authPassword", default_value=None)

        if not name or not quality:
            self.error(400, "Bad Data: Name: %s, quality: %s" % (name, quality))
            return

        minimumSeason = None
        if minimumSeasonTxt:
            minimumSeason = int(minimumSeasonTxt)

        existing_s.name = name
        existing_s.slug = slugify.slugify(name)
        existing_s.quality = quality
        existing_s.active = active
        existing_s.minimumSeason = minimumSeason
        existing_s.put()

        invalidate_cache("shows")

        self.redirect("/admin/shows/" + existing_s.slug)
Example #13
0
 def data(self):
     return TrackedSeries.all().order("name").fetch(1000)
Example #14
0
 def data(self):
     return TrackedSeries.all().order("name").fetch(1000)