Example #1
0
 def play(self, params):
     stream = self.resolve(params['play'])
     print type(stream)
     if type(stream) == type([]):
         sdict={}
         for s in stream:
             if s['surl'] not in sdict:
                 sdict[s['surl']] = s
                 
             if len(sdict) > 1:
                 break
         else:
             return xbmcprovider.XBMCMultiResolverContentProvider.play(self,params)
             
         # resolved to mutliple files, we'll feed playlist and play the first one
         playlist = []
         i = 0
         for video in stream:
             i += 1
             if 'headers' in video.keys():
                 playlist.append(xbmcutil.create_play_it(params['title'] + " [" + str(i) + "]", "", video['quality'], video['url'], subs=video['subs'], filename=params['title'], headers=video['headers']))
             else:
                 playlist.append(xbmcutil.create_play_it(params['title'] + " [" + str(i) + "]", "", video['quality'], video['url'], subs=video['subs'], filename=params['title']))
         xbmcutil.add_playlist(params['title'], playlist)
     elif stream:
         if 'headers' in stream.keys():
             xbmcutil.add_play(params['title'], "", stream['quality'], stream['url'], subs=stream['subs'], filename=params['title'], headers=stream['headers'])
         else:
             xbmcutil.add_play(params['title'], "", stream['quality'], stream['url'], subs=stream['subs'], filename=params['title'])
Example #2
0
    def play(self, params):
        stream = self.resolve(params['play'])
        print type(stream)
        if type(stream) == type([]):
            sdict={}
            for s in stream:
                if s['surl'] not in sdict:
                    sdict[s['surl']] = s
                if len(sdict) > 1:
                    break
            else:
                return xbmcprovider.XBMCMultiResolverContentProvider.play(self,params)

            # resolved to mutliple files, we'll feed playlist and play the first one
            playlist = []
            i = 0
            for video in stream:
                i += 1
                if 'headers' in video.keys():
                    playlist.append(xbmcutil.create_play_it(params['title'] + " [" + str(i) + "]", "", video['quality'], video['url'], subs=video['subs'], filename=params['title'], headers=video['headers']))
                else:
                    playlist.append(xbmcutil.create_play_it(params['title'] + " [" + str(i) + "]", "", video['quality'], video['url'], subs=video['subs'], filename=params['title']))
            xbmcutil.add_playlist(params['title'], playlist)
        elif stream:
            if 'headers' in stream.keys():
                xbmcutil.add_play(params['title'], "", stream['quality'], stream['url'], subs=stream['subs'], filename=params['title'], headers=stream['headers'])
            else:
                xbmcutil.add_play(params['title'], "", stream['quality'], stream['url'], subs=stream['subs'], filename=params['title'])