This commit is contained in:
Bezleputh 2014-08-26 15:51:25 +02:00
commit 30f814ec65
2 changed files with 61 additions and 5 deletions

View file

@ -122,6 +122,7 @@ class ArteBackend(BaseBackend, CapVideo, CapCollection):
if collection.path_level == 0:
yield Collection([u'arte-latest'], u'Latest Arte videos')
yield Collection([u'arte-live'], u'Arte Web Live videos')
yield Collection([u'arte-program'], u'Arte Programs')
if collection.path_level == 1:
if collection.split_path == [u'arte-latest']:
for video in self.browser.latest_videos():
@ -129,18 +130,40 @@ class ArteBackend(BaseBackend, CapVideo, CapCollection):
if collection.split_path == [u'arte-live']:
for categorie in self.browser.get_arte_live_categories():
yield categorie
if collection.split_path == [u'arte-program']:
for item in self.browser.get_arte_programs():
lang = self.TRANSLATION[self.config['lang'].get()]
if lang == 'F':
title = 'titleFR'
elif lang == 'D':
title = 'titleDE'
else:
title = 'name'
name = item['clusterId']
if title in item.keys():
name = item[title]
yield Collection([u'arte-program', item['clusterId']], u'%s' % name)
if collection.path_level == 2:
if collection.split_path[0] == u'arte-live':
for video in self.browser.live_videos(collection.basename):
yield video
if collection.split_path[0] == u'arte-program':
for video in self.browser.program_videos(collection.split_path[1]):
yield video
def validate_collection(self, objs, collection):
if collection.path_level == 0:
return
if BaseVideo in objs and (collection.split_path == [u'arte-latest'] or collection.split_path == [u'arte-live']):
if BaseVideo in objs and (collection.split_path == [u'arte-latest'] or
collection.split_path == [u'arte-live'] or
collection.split_path == [u'arte-program']):
return
if BaseVideo in objs and collection.path_level == 2 and collection.split_path[0] == u'arte-live':
if BaseVideo in objs and collection.path_level == 2 and (collection.split_path[0] == u'arte-live' or
collection.split_path[0] == u'arte-program'):
return
raise CollectionNotFound(collection.split_path)
OBJECTS = {ArteVideo: fill_video, ArteLiveVideo: fill_video }
OBJECTS = {ArteVideo: fill_video, ArteLiveVideo: fill_video}