def iter_resources(self, split_path): if not self.is_on_page(ChannelsPage): self.home() channels = self.page.get_channels() if len(split_path) == 0: for channel in channels: if channel.path_level == 1: yield channel elif len(split_path) == 1: for channel in channels: if channel.path_level == 2 and split_path == channel.parent_path: yield channel elif len(split_path) == 2: subchannels = self.iter_resources(split_path[0:1]) try: channel = [ subchannel for subchannel in subchannels if split_path == subchannel.split_path ][0] self.location( "http://service.canal-plus.com/video/rest/getMEAs/cplus/%s" % channel._link_id) assert self.is_on_page(VideoPage) for video in self.page.iter_channel(): yield video except IndexError: raise CollectionNotFound(split_path) else: raise CollectionNotFound(split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseVideo in objs and collection.split_path == [u'latest_nsfw']: collection.title = u'Latest YouPorn videos (NSFW)' return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseVideo in objs and collection.split_path == [u'latest']: collection.title = u'Latest Dailymotion videos' return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseGallery in objs and collection.split_path == [u'latest_nsfw']: collection.title = u'Latest E-Hentai galleries (NSFW)' return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseVideo in objs and (collection.split_path[0] == u'vimeo-categories' or collection.split_path[0] == u'vimeo-channels'): return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseVideo in objs and (collection.split_path[0] in [ value.get('id') for value in SITE.values ]): return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if collection.path_level == 1 and collection.split_path[0] in \ [u'profils', u'trendy', u'me', u'hashtags', u'search']: return if collection.path_level == 2: return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if BaseVideo in objs: if collection.path_level == 0: return if collection.path_level == 1 and collection.split_path[0] in [u'theme', u'type', u'latest']: return if collection.path_level > 1: return raise CollectionNotFound(collection.split_path)
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']): return if BaseVideo in objs and collection.path_level == 2 and collection.split_path[ 0] == u'arte-live': return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if collection.path_level == 1 and (collection.basename in [u'comingsoon', u'nowshowing', u'acshow', u'interview']): return if collection.path_level == 2 and collection.parent_path == [u'acshow']: return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if Issue in objs and collection.path_level == 1: for project in self.iter_projects(): if collection.basename == project.id: return Collection([project.id], project.name) # if the project is not found by ID, try again by name for project in self.iter_projects(): if collection.basename == project.name: return Collection([project.id], project.name) raise CollectionNotFound(collection.split_path)
def iter_resources(self, objs, split_path): if Radio in objs: if split_path == [u'francebleu']: for _id in sorted(self._RADIOS.iterkeys()): if _id.startswith('fb'): yield self.get_radio(_id) elif len(split_path) == 0: for _id in sorted(self._RADIOS.iterkeys()): if not _id.startswith('fb'): yield self.get_radio(_id) yield Collection([u'francebleu'], u'France Bleu') else: raise CollectionNotFound(split_path)
def validate_collection(self, objs, collection): if collection.path_level == 0: return if BaseVideo in objs and collection.split_path in [ [u'arte-latest'], [u'arte-live'], [u'arte-program'], ]: return if ( BaseVideo in objs and collection.path_level == 2 and collection.split_path[0] in [u'arte-live', u'arte-program'] ): return raise CollectionNotFound(collection.split_path)
def validate_collection(self, objs, collection): if not self.browser.check_collection(collection.split_path): raise CollectionNotFound()
def validate_collection(self, objs, collection): if collection.path_level <= 3: return raise CollectionNotFound(collection.split_path)
def iter_resources(self, objs, split_path): if len(split_path) == 0: for _id, item in sorted(self._RADIOS.iteritems()): if not _id.startswith('fb'): yield Collection([_id], item['title']) yield Collection([u'francebleu'], u'France Bleu') elif split_path[0] == u'francebleu': if len(split_path) == 1: for _id, item in sorted(self._RADIOS.iteritems()): if _id.startswith('fb'): yield Collection([_id], item['title']) elif len(split_path) > 1 and split_path[1] in self._RADIOS: if len(split_path) == 2: yield Collection([split_path[0], u'direct'], u'Direct') if 'selection' in self._RADIOS[split_path[1]]: yield Collection([split_path[0], u'selection'], u'Selection') elif len(split_path) == 3 and split_path[2] == 'selection': selection_url = self._RADIOS[split_path[1]]['selection'] for item in self.browser.get_selection( 'francebleu', selection_url, split_path[1]): yield item elif len(split_path) == 3 and split_path[2] == 'direct': yield self.get_radio(split_path[1]) else: raise CollectionNotFound(split_path) elif len(split_path) == 1: yield Collection([split_path[0], u'direct'], u'Direct') if 'selection' in self._RADIOS[split_path[0]]: yield Collection([split_path[0], u'selection'], u'Selection') if 'podcast' in self._RADIOS[split_path[0]]: yield Collection([split_path[0], u'podcasts'], u'Podcast') elif len(split_path) == 2 and split_path[1] == 'selection': for _id, item in sorted(self._RADIOS.iteritems()): if _id == split_path[0]: if 'selection' in self._RADIOS[_id]: selection_url = self._RADIOS[_id]['selection'] for item in self.browser.get_selection( _id, selection_url, _id): yield item break elif len(split_path) == 2 and split_path[1] == 'podcasts': for item in self.browser.get_podcast_emissions( split_path[0], self._RADIOS[split_path[0]]['podcast'], split_path): yield item elif len(split_path) == 2 and split_path[1] == 'direct': yield self.get_radio(split_path[0]) elif len(split_path) == 3: podcasts_url = split_path[-1] if split_path[0] == 'franceculture': podcasts_url = self.browser.get_france_culture_podcasts_url( split_path[-1]) if podcasts_url: for item in self.browser.get_podcasts(podcasts_url): yield item else: raise CollectionNotFound(split_path)