本文整理汇总了Python中channel.Channel.buildSchedule方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.buildSchedule方法的具体用法?Python Channel.buildSchedule怎么用?Python Channel.buildSchedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel.Channel
的用法示例。
在下文中一共展示了Channel.buildSchedule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Genre
# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import buildSchedule [as 别名]
if not found:
newGenre = Genre(genre)
newGenre.addMovie(mv)
genres.append(newGenre)
# Sort them by number of movies
genres = sorted(genres, key=lambda x: x.movieCount, reverse=True)
# We build some channels from the 10 heaviest genres
channels = []
i=0
for genre in genres:
newChannel = Channel(genre.name)
for mv in genre.movies:
newChannel.addMovie(mv)
newChannel.buildSchedule(86400000)
channels.append(newChannel)
del genre
i+=1
if i > 10:
break
#Serialize the channels and write them to a json
data = []
for channel in channels:
moviesData = []
for mv in channel.schedule:
moviesData.append(dict({
"title":mv.title,
"key":mv.key,