本文整理汇总了Python中videos.models.Video.title方法的典型用法代码示例。如果您正苦于以下问题:Python Video.title方法的具体用法?Python Video.title怎么用?Python Video.title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类videos.models.Video
的用法示例。
在下文中一共展示了Video.title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import title [as 别名]
def main():
parsed = feedparser.parse(file("mostravideolivre.atom").read())
for i in parsed.entries:
mp4_url = i.content[0].src
ogg_url = mp4_url.replace(".mp4", ".ogg")
ogg_url = ogg_url.replace(".MP4", ".ogg")
thumb = ogg_url + ".png"
video = Video()
video.title = i.title
video.creation_date = datetime.now()
video.summary = i.get("summary", "")
video.author = i.author
video.license_name = "Creative Commons - Atribuição - Partilha nos Mesmos " + "Termos 3.0 Não Adaptada"
video.license_link = "http://creativecommons.org/licenses/by-sa/3.0/"
video.thumb_url = thumb
video.save()
tag = Tag.objects.get_or_create(name="mvl2010")[0]
tag.save()
video.tags.add(tag.id)
url = Url()
url.url = mp4_url
url.content_type = 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
url.video = video
url.save()
url = Url()
url.url = ogg_url
url.content_type = 'video/ogg; codecs="theora, vorbis"'
url.video = video
url.save()
示例2: _import_video
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import title [as 别名]
def _import_video(self, video_url, videoid, title, description, thumbnail, videosrt):
videoid_match = VIDEOID_RE.search(videoid)
videoid = videoid_match.group(1)
video_type = YoutubeVideoType(
'http://www.youtube.com/watch?v={0}'.format(videoid))
try:
video_url_obj = VideoUrl.objects.get(
url=video_type.convert_to_video_url())
video = video_url_obj.video
except ObjectDoesNotExist:
video_url_obj = None
video = Video()
video.youtube_videoid = videoid
video.title = title
video.description = description
if video_type.entry.media.duration:
video.duration = int(video_type.entry.media.duration.seconds)
video.thumbnail = thumbnail
video.save()
Action.create_video_handler(video)
if videosrt:
self._import_srt(video, videosrt)
else:
SubtitleLanguage(video=video, language='en', is_original=True, is_forked=True).save()
if not video_url_obj:
video_url_obj = VideoUrl(
videoid=videoid,
url=video_type.convert_to_video_url(),
type=video_type.abbreviation,
original=True,
primary=True,
video=video)
video_url_obj.save()
self._save_alternate_url(video, video_url)
示例3: main
# 需要导入模块: from videos.models import Video [as 别名]
# 或者: from videos.models.Video import title [as 别名]
def main():
for index, line in enumerate(csv.reader(file('mostravideolivre.csv'))):
# I don't need the column names :)
if index == 0:
continue
# No title
if not line[0].strip():
continue
video = Video()
video.title = line[0]
video.creation_date = datetime.now()
video.summary = line[5]
video.author = line[1]
video.license_name = \
'Creative Commons - Atribuição - Partilha nos Mesmos ' + \
'Termos 3.0 Não Adaptada'
video.license_link = 'http://creativecommons.org/licenses/by-sa/3.0/'
video.thumb_url = findvideo(line[7]).replace('ogv', 'png')
video.save()
tag = Tag.objects.get_or_create(name='mvl2011')[0]
tag.save()
video.tags.add(tag.id)
for tag_name in line[4].split(','):
tag = Tag.objects.get_or_create(name=tag_name.strip())[0]
tag.save()
video.tags.add(tag.id)
url = Url()
url.url = findvideo(line[7])
url.content_type = 'video/ogg; codecs="theora, vorbis"'
url.video = video
url.save()