OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import csv | 6 import csv |
7 import os | 7 import os |
8 import random | 8 import random |
9 | 9 |
10 NOT_AVAILABLE_STRING = 'not available' | 10 NOT_AVAILABLE_STRING = 'not available' |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 """ | 191 """ |
192 media_infos = [] | 192 media_infos = [] |
193 for i in range(0, len(self._video_titles)-1): | 193 for i in range(0, len(self._video_titles)-1): |
194 name = self._video_titles[i] | 194 name = self._video_titles[i] |
195 for sub_type in range(len(self._exts)): | 195 for sub_type in range(len(self._exts)): |
196 (info, url, link, tag, is_video, nickname) = ( | 196 (info, url, link, tag, is_video, nickname) = ( |
197 self._GenerateMediaInfo(sub_type, name, media_matrix_home_url)) | 197 self._GenerateMediaInfo(sub_type, name, media_matrix_home_url)) |
198 tag = ['audio', 'video'][is_video] | 198 tag = ['audio', 'video'][is_video] |
199 if ((not NOT_AVAILABLE_STRING in info) and | 199 if ((not NOT_AVAILABLE_STRING in info) and |
200 ((not video_only) or (video_only and is_video))): | 200 ((not video_only) or (video_only and is_video))): |
201 media_infos.append([tag, url, nickname]) | 201 media_infos.append([tag, url, nickname, name]) |
202 return media_infos | 202 return media_infos |
203 | 203 |
204 @staticmethod | 204 @staticmethod |
205 def LookForMediaInfoInCompactFormByNickName(compact_list, target): | 205 def LookForMediaInfoInCompactFormByNickName(compact_list, target): |
206 """Look for video by its nickname in the compact_list. | 206 """Look for video by its nickname in the compact_list. |
207 | 207 |
208 Args: | 208 Args: |
209 compact_list: a list generated by GenerateAllMediaInfosInCompactForm. | 209 compact_list: a list generated by GenerateAllMediaInfosInCompactForm. |
210 target: a target nickname string to look for. | 210 target: a target nickname string to look for. |
211 | 211 |
212 Returns: | 212 Returns: |
213 A tuple (url, nickname, tag) where nickname is a target string. | 213 A tuple (url, nickname, tag) where nickname is a target string. |
214 url: URL of the video/audio. | 214 url: URL of the video/audio. |
215 nickname: nickname of the video/audio for presentation | 215 nickname: nickname of the video/audio for presentation |
216 (such as bear.webm). | 216 (such as bear.webm). |
217 tag: HTML5 tag for the video/audio. | 217 tag: HTML5 tag for the video/audio. |
218 """ | 218 """ |
219 for tag, url, nickname in compact_list: | 219 for tag, url, nickname, title in compact_list: |
220 if target == nickname: | 220 if target == nickname: |
221 return (tag, url, nickname) | 221 return (tag, url, nickname, title) |
OLD | NEW |