def yt_start(value): if '?t=' in value: # Treat ?t= the same as #t= value = value.replace('?t=', '#t=') if '#t=' in value: sp = value.split('#t=') video_id = sp[0] old_ts = sp[1] total_seconds = YouTubeVideoHelper.time_to_seconds(old_ts) value = '%s?start=%i' % (video_id, total_seconds) return value
def youtube_videos_formatted(self): """ Get youtube video ids formatted for embedding """ if self._youtube_videos is None: self._youtube_videos = [] for video in self.youtube_videos: if '?t=' in video: # Treat ?t= the same as #t= video = video.replace('?t=', '#t=') if '#t=' in video: sp = video.split('#t=') video_id = sp[0] old_ts = sp[1] total_seconds = YouTubeVideoHelper.time_to_seconds(old_ts) video = '%s?start=%i' % (video_id, total_seconds) self._youtube_videos.append(video) return self._youtube_videos