本文整理汇总了Python中Filter.Filter.getFilterValue方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.getFilterValue方法的具体用法?Python Filter.getFilterValue怎么用?Python Filter.getFilterValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filter.Filter
的用法示例。
在下文中一共展示了Filter.getFilterValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: added
# 需要导入模块: from Filter import Filter [as 别名]
# 或者: from Filter.Filter import getFilterValue [as 别名]
def added(self, id = None, page=0, play='false', f = None, date = None, dir = None):
try:
page = int(page)
except:
page = 0
limit = 17
if play == 'true' and id is not None:
if date is None:
id = None
play = 'false'
else:
try:
callingDate = datetime.strptime(date, "%a %b %d %H:%M:%S %Y %Z")
currentDate = datetime.utcnow() - timedelta(seconds = 60)
# Sat Feb 23 19:35:57 2013 GMT popcorn hour example call
#callingDate = datetime.utcfromtimestamp(date)
if callingDate < currentDate:
id = None
play = 'false'
logger.warn('added', 'Play request time < now - 60 (%s < %s).', str(callingDate), str(currentDate))
except:
id = None
play = 'false'
logger.error('added', 'Movie.py', 'Error converting UTC Javascript date for %s.', date)
if id is not None:
self.content.update_media_watched("movie",id)
filters = ()
if f is not None:
pFilter = Filter.ParseFilter(f)
if pFilter is not None:
filters += pFilter,
movies=self.content.get_movies(page, limit, filters, 'm.added DESC')
total = self.content.get_total_items("movie m", "m.id", None, Filter("movie", {"movie": "m"}, filters))
pPage = self.content.get_prev_page(page, limit, "movie", total)
nPage = self.content.get_next_page(page, limit, "movie", total)
filterLetters = self.content.get_available_letters("movie m", "m.file_name", None, None)
tmpl = lookup.get_template("movies/movies.html")
startOn = 'moviename_0'
if id is not None and play == 'true':
startOn = 'movieid_' + id
elif dir is not None:
startOn = 'moviename_' + str(len(movies)-1)
return tmpl.render(movies = movies
, prevPage = pPage
, nextPage = nPage
, totalPages = int(ceil(total/limit))
, page = page
, play = play
, selected = Filter.getFilterValue(Filter.FILTER_LETTER, filters)
, filterUrl = "f=" + (f if f is not None else '')
, filterLetters = filterLetters
, pageName = 'added'
, id = id
, startOn = startOn)
示例2: show
# 需要导入模块: from Filter import Filter [as 别名]
# 或者: from Filter.Filter import getFilterValue [as 别名]
def show(self, page=0, f = None):
limit = 17
try:
page = int(page)
except:
page = 0
filters = ()
if f is not None:
pFilter = Filter.ParseFilter(f)
if pFilter is not None:
filters += pFilter,
content = self.content.get_tv_shows_html(page, limit, filters)
total = self.content.get_total_items("show s", "s.id", None, Filter("tv", {"episode": "e", "show": "s"}, filters))
prev = self.content.get_prev_page(page, limit, "episode", total)
next = self.content.get_next_page(page, limit, "episode", total)
content["total"] = int(ceil(total/limit))
filterLetters = self.content.get_available_letters("show s", "s.title", None, None)
tmpl = lookup.get_template("tv/show.html")
return tmpl.render(content = content
, prev = prev
, next = next
, selected = Filter.getFilterValue(Filter.FILTER_LETTER_EPISODE, filters)
, filterUrl = "f=" + (f if f is not None else '')
, filterLetters = filterLetters)
示例3: watchme
# 需要导入模块: from Filter import Filter [as 别名]
# 或者: from Filter.Filter import getFilterValue [as 别名]
def watchme(self, page=0, f=None):
try:
page = int(page)
except:
page = 0
limit = 17
filter = ((Filter.FILTER_NOTSEEN, ),)
if f is not None:
pFilter = Filter.ParseFilter(f)
if pFilter is not None:
filter += pFilter,
episodes=self.content.get_latest_tv_html(page, limit, filter)
total = self.content.get_total_items("episode e", "e.id", [" inner join show s on s.id = e.show "], filter)
pPage = self.content.get_prev_page(page, limit, "episode", total)
nPage = self.content.get_next_page(page, limit, "episode", total)
filterLetters = self.content.get_available_letters("episode e", "s.title", [ " inner join show s on s.id = e.show "], filter)
tmpl = lookup.get_template("tv/watchme.html")
return tmpl.render(episodes=episodes
, prevPage = pPage
, nextPage = nPage
, totalPages = int(ceil(total/limit))
, page = page
, selected = Filter.getFilterValue(Filter.FILTER_LETTER_EPISODE, filter)
, filterUrl = "f=" + (f if f is not None else '')
, filterLetters = filterLetters)
示例4: episode
# 需要导入模块: from Filter import Filter [as 别名]
# 或者: from Filter.Filter import getFilterValue [as 别名]
def episode(self, show = None, season = None, id = None, page=0, play='false', f = None, date = None):
limit = 17
try:
page = int(page)
except:
page = 0
if (show is None or season is None) and id is None:
logger.error('episode', 'Tv.py', 'Call made to episode with no SHOW and SEASON and EPISODE')
raise cherrypy.HTTPRedirect('/tv/show')
elif (show is None or season is None) and id is not None:
foundShowAndSeason = self.content.get_tv_show_and_season(id)
if foundShowAndSeason and len(foundShowAndSeason) > 1:
show = foundShowAndSeason[0]
season = foundShowAndSeason[1]
else:
logger.error('episode', 'Tv.py', 'Call made to episode with no SHOW or SEASON, and could not find them with EPISODE %s', id)
raise cherrypy.HTTPRedirect('/tv/show')
if play == 'true' and id is not None:
if date is None:
id = None
play = 'false'
else:
try:
callingDate = datetime.strptime(date, "%a %b %d %H:%M:%S %Y %Z")
currentDate = datetime.utcnow() - timedelta(seconds = 60)
# Sat Feb 23 19:35:57 2013 GMT popcorn hour example call
#callingDate = datetime.utcfromtimestamp(date)
if callingDate < currentDate:
id = None
play = 'false'
logger.warn('episode', 'Play request time < now - 60 (%s < %s).', str(callingDate), str(currentDate))
except:
id = None
play = 'false'
logger.error('episode', 'Tv.py', 'Error converting UTC Javascript date for %s.', date)
if id is not None:
self.content.update_media_watched("tv",id)
filter = ((Filter.FILTER_SHOWID, show), (Filter.FILTER_SEASON, season))
if f is not None:
pFilter = Filter.ParseFilter(f)
if pFilter is not None:
filter += pFilter,
filter = Filter.ModifyFilter(Filter.FILTER_LETTER, filter, Filter.FILTER_LETTER_EPISODE, None) # we compare against episode here not show
show = self.content.get_tv_show(show)
episodes = self.content.get_tv_series_html(show, season, page, limit, filter)
total = self.content.get_total_items("episode e", "e.id", [" inner join show s on s.id = e.show "], Filter("tv", {"episode": "e", "show": "s"}, filter))
pPage = self.content.get_prev_page(page, limit, "episode", total)
nPage = self.content.get_next_page(page, limit, "episode", total)
tmpl = lookup.get_template("tv/episode.html")
return tmpl.render(id = id
, show = show["show"]
, episodes = episodes
, season = season
, prevPage = pPage
, nextPage = nPage
, totalPages = int(ceil(total/limit))
, page = page
, play = play
, selected = Filter.getFilterValue(Filter.FILTER_LETTER_EPISODE, filter)
, urlPrefix = "?show={}&season={}&play=false&page=0&".format(show["show"]["id"], season)
, filterUrl = "f=" + (f if f is not None else '')
, filterLetters = set())