本文整理汇总了Python中listing.Listing.get_movies方法的典型用法代码示例。如果您正苦于以下问题:Python Listing.get_movies方法的具体用法?Python Listing.get_movies怎么用?Python Listing.get_movies使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类listing.Listing
的用法示例。
在下文中一共展示了Listing.get_movies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from listing import Listing [as 别名]
# 或者: from listing.Listing import get_movies [as 别名]
def main():
(opts, args) = cli()
key = get_value('key')
td = Tmdb(key, opts.category)
if opts.listing:
li = Listing(opts.category)
movies = li.get_movies()
prefix = "list_"
subject = "Week %s: %s" % (THIS_WEEK, li.title)
else:
movies = td.get_movies(opts.numres)
prefix = ""
subject = "%s movies - week %s" % (opts.category.title().replace("_", " "), THIS_WEEK)
ca = Cache(prefix + os.path.basename(opts.category))
newMovies = ca.shelve_results(movies)
if opts.listing:
movieObjects = ca.shelve_get_items(movies) # allow dups
else:
movieObjects = ca.shelve_get_items(newMovies) # only new ones
op = Output(movieObjects)
html = [op.generate_header()]
html.append(op.generate_movie_html_div())
if opts.printres:
print "\n".join(html)
if opts.mailres:
sender = get_value('sender')
recipients = load_emails('recipients')
ma = Mail(sender)
ma.mail_html(recipients, subject, "\n".join(html))