~facundo/encuentro/trunk

« back to all changes in this revision

Viewing changes to server/get_cda_episodes.py

  • Committer: Facundo Batista
  • Date: 2015-12-31 20:41:12 UTC
  • Revision ID: facundo@taniquetil.com.ar-20151231204112-6ayjmxfih74r030c
Store separated the info in CDA metadata.

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
    all_programs = []
139
139
    already_stored = set()
140
140
    for section_id, section_name in SECTIONS:
141
 
        for title, image, info_text, episodes in get_per_section(section_name, section_id):
 
141
        for show_title, image, info_text, episodes in get_per_section(section_name, section_id):
142
142
            key = tuple(epid for _, epid in episodes)
143
143
            if key in already_stored:
144
 
                logger.info("Ignoring program %r with episodes %s", title, key)
 
144
                logger.info("Ignoring program %r with episodes %s", show_title, key)
145
145
                continue
146
146
            already_stored.add(key)
147
147
            for episode_name, episode_id in episodes:
149
149
                if video_info is None:
150
150
                    continue
151
151
                video_id, duration, video_url_info = video_info
152
 
                full_title = "{}: {}".format(title, episode_name)
153
152
                info = {
154
153
                    "duration": str(duration),
155
154
                    "channel": "CDA",
156
155
                    "section": section_name,
157
156
                    "description": info_text,
158
 
                    "title": full_title,
 
157
                    "title": episode_name,
159
158
                    "subtitle": None,
160
159
                    "url": video_url_info,
161
160
                    "episode_id": 'cda_{}_{}'.format(episode_id, video_id),
162
161
                    "image_url": image,
163
 
                    "season": None,
 
162
                    "season": show_title,
164
163
                }
165
164
                all_programs.append(info)
166
165