def fromVideoInfo(cls, json, info = None): """Return tuple(video item, url)""" server = server_factory() date = ('1', '1', '1970') if 'time_published' in json: time_published = json['time_published'] date = VideoFactory._convertDate(time_published) info['date'] = "%s.%s.%s" % date info['year'] = date[2] bitrate = 0 selected_stream = 0 for key, stream in enumerate(json['streaming_urls']): if stream['bitrate'] > bitrate: selected_stream = key stream = json['streaming_urls'][selected_stream] url = server.getStream(stream['url']) if 'title' not in info: info['title'] = json['description_title'] if 'desc' not in info: info['desc'] = json['description_title'] if 'plot' not in info: info['plot'] = json['description_title'] #defaults final_info = info.copy() final_info['label'] = VideoFactory._format(info, util.getSetting('titleFormat')) final_info['title'] = VideoFactory._format(info, util.getSetting('titleFormat')) final_info['label2'] = VideoFactory._format(info, util.getSetting('label2Format')) final_info['plot'] = VideoFactory._format(info, util.getSetting('plotFormat')) return (Factory.video(final_info), url)
def __init__(self, function_name): super(GenericJasonScraper, self).__init__() server = server_factory() try: json = getattr(server, function_name)() except AttributeError: self._log('Invalid function name') item = xbmcgui.ListItem('No videos.... Try upgrading or come back later') Directory().addFile(item, util.currentPath(['..'])) else: self.processJson(json)
def fromSegmentId(cls, segment_id, info): plugin.PluginFactory.factory().log('Loading from segmentid', 'media') server = server_factory() json = server.getVideoInfo(segment_id) return VideoFactory.fromVideoInfo(json, info)
def getWallXml(self): server = server_factory() return server.wall()
def getChannels(self): server = server_factory() return server.channelsXml()