def processJson(self, json): dir = Directory() for segment in json['segments']: id = segment['id'] info = {} info['title'] = segment['title'] info['thumbnailImage'] = segment['thumb'] info['date'] = segment['date'] info['program'] = segment['thumbAlt'][6:].split(' - ')[0] video, url = VideoFactory.fromSegmentId(id, info) dir.addFile(video, url) dir.display()
def fastChannel(self, channel): channel = self.getChannels().findAll('channel')[channel] for video in channel.findAll('video'): id = video.url.string.split(';id=')[1].split(';')[0] info = {} info['title'] = video.title.string info['program'] = channel.title.string info['date'] = video.title.date info['thumbnailImage'] = video.image.string.split('?width')[0] print id video, url = VideoFactory.fromSegmentId(id, info) print video self.dir.addFile(video, url) self.dir.display()
def __init__(self): ''' Constructor ''' super(VideoWall, self).__init__() xml = self.getWallXml() sortmethods = (xbmcplugin.SORT_METHOD_LABEL, xbmcplugin.SORT_METHOD_SIZE, xbmcplugin.SORT_METHOD_DATE, xbmcplugin.SORT_METHOD_VIDEO_RUNTIME, xbmcplugin.SORT_METHOD_VIDEO_YEAR) for sortmethod in sortmethods: xbmcplugin.addSortMethod(handle = self._plugin.handle, sortMethod = sortmethod) xbmcplugin.setContent(self._plugin.handle, 'movies') dir = Directory() try: for segment in xml.findAll('segment'): id, info = self.parseSegment(segment) video, url = VideoFactory.fromSegmentId(id, info) dir.addFile(video, url) except Exception, error: exc_type, exc_value, exc_traceback = sys.exc_info() print 'ERROR', error, exc_type, traceback.print_stack(), traceback.print_tb(exc_traceback) pass