예제 #1
0
    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()
예제 #2
0
 def __init__(self):
     super(ChannelScraper, self).__init__()
     self.dir = Directory()
     if len(self._plugin.pathItems) >= 2:
         if 'parse' in self._plugin.queryItems:
             self.parseChannel(int(self._plugin.pathItems[1]))
         else:
             self.fastChannel(int(self._plugin.pathItems[1]))
     else:
         self.root()
예제 #3
0
파일: wall.py 프로젝트: alshain/xbmc-sftv
 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
예제 #4
0
class ChannelScraper(SfTvClass):
    def __init__(self):
        super(ChannelScraper, self).__init__()
        self.dir = Directory()
        if len(self._plugin.pathItems) >= 2:
            if 'parse' in self._plugin.queryItems:
                self.parseChannel(int(self._plugin.pathItems[1]))
            else:
                self.fastChannel(int(self._plugin.pathItems[1]))
        else:
            self.root()


    def root(self):
        channels = self.getChannels()
        for key, channel in enumerate(channels.findAll('channel')):
            self.dir.createFolder(channel.title.string, str(key))

        self.dir.display()

    def getChannels(self):
        server = server_factory()
        return server.channelsXml()

    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 parseChannel(self, channel):
        pass