def __init__(self,
id_: VideoId,
- title: ProseText,
- description: ProseText,
- published_at: DatetimeStr,
- duration: str = '',
- definition: str = ''
+ title: ProseText = ProseText('?'),
+ description: ProseText = ProseText('?'),
+ published_at: DatetimeStr = DatetimeStr('?'),
+ duration: str = '?',
+ definition: str = '?'
) -> None:
self.id_ = id_
self.title = title
return downloads_db
def _send_thumbnail(self, filename: PathStr) -> None:
- with open(path_join(PATH_DIR_THUMBNAILS, filename), 'rb') as f:
+ path_thumbnail = path_join(PATH_DIR_THUMBNAILS, filename)
+ if not path_exists(path_thumbnail):
+ raise NotFoundException
+ with open(path_thumbnail, 'rb') as f:
img = f.read()
self._send_http(img, [('Content-type', 'image/jpg')])
downloads_db = self._make_downloads_db()
conn = DatabaseConnection()
linked_queries = QueryData.get_all_for_video(conn, video_id)
- video_data = VideoData.get_one(conn, video_id)
+ try:
+ video_data = VideoData.get_one(conn, video_id)
+ except NotFoundException:
+ video_data = VideoData(video_id)
conn.commit_close()
self._send_rendered_template(
NAME_TEMPLATE_VIDEO_ABOUT,