Example #1
0
    def __init__(self):

        if common.args.mode.endswith('TV_play'):
            if os.path.isfile(common.ADCACHE):
                os.remove(common.ADCACHE)
            self.GUID = common.makeGUID()

            if common.settings['enable_login'] == 'true' and common.settings[
                    'usertoken']:
                common.viewed(common.args.videoid)  # POST VIEW

            video_id = common.args.url
            finalUrl = 'http://www.hulu.com/stand_alone/%s' % (str(video_id))
            smilSoup = self.getSMIL(video_id)
            displayname, infoLabels, segments = self.getMeta(smilSoup)
            item = xbmcgui.ListItem(displayname, path=finalUrl)
            item.setInfo(type="Video", infoLabels=infoLabels)
            item.setProperty('IsPlayable', 'true')
            xbmcplugin.setResolvedUrl(common.handle, True, item)

            if common.settings['queueremove'] == 'true' and common.settings[
                    'enable_login'] == 'true' and common.settings['usertoken']:
                self.queueViewComplete()
Example #2
0
    def __init__(self):
        if 'http://' in common.args.url:
            video_id = self.getIDS4HTTP(common.args.url)
            self.queue = True
            httpplay = True
        else:
            self.queue = False
            httpplay = False
            video_id = common.args.url
        admodule = ads.Main()
        common.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        if common.args.mode.endswith('TV_play'):
            if os.path.isfile(common.ADCACHE):
                os.remove(common.ADCACHE)
            self.NoResolve = False
            self.GUID = common.makeGUID()

            if common.args.mode.startswith('Captions'):
                common.settings['enable_captions'] = 'true'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve = True
            elif common.args.mode.startswith('NoCaptions'):
                common.settings['enable_captions'] = 'false'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve = True
            elif common.args.mode.startswith('Select'):
                common.settings['quality'] = '0'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve = True

            if ((common.settings['segmentvideos'] == 'true')
                    or (common.settings['networkpreroll'] == 'true')
                    or (common.settings['prerollads'] > 0)
                    or (common.settings['trailads'] > 0)):
                common.playlist.clear()

            # POST VIEW
            if common.settings['enable_login'] == 'true' and common.settings[
                    'usertoken']:
                common.viewed(common.args.videoid)

            if not self.NoResolve:
                if (common.settings['networkpreroll'] == 'true'):
                    self.NetworkPreroll()
                addcount = admodule.PreRoll(video_id, self.GUID, self.queue)
                if addcount > 0:
                    self.queue = True
            else:
                addcount = 0
            if common.settings['segmentvideos'] == 'true':
                segments = self.playSegment(video_id)
                if segments:
                    adbreaks = common.settings['adbreaks']
                    for i in range(1, len(segments) + 1):
                        admodule.queueAD(video_id, adbreaks + addcount,
                                         addcount)
                        addcount += adbreaks
                        self.queueVideoSegment(video_id, segment=i)
            else:
                self.play(video_id)
            admodule.Trailing(addcount, video_id, self.GUID)

            if common.settings['queueremove'] == 'true' and common.settings[
                    'enable_login'] == 'true' and common.settings['usertoken']:
                self.queueViewComplete()

            if httpplay:
                xbmc.Player().play(common.playlist)

        elif common.args.mode == 'SEGMENT_play':
            self.queue = False
            self.NoResolve = False
            self.GUID = common.args.guid
            self.playSegment(video_id, segment=int(common.args.segment))
        elif common.args.mode == 'AD_play':
            self.NoResolve = False
            self.GUID = common.args.guid
            pod = int(common.args.pod)
            admodule.playAD(video_id, pod, self.GUID)
        elif common.args.mode == 'SUBTITLE_play':
            subtitles.Main().SetSubtitles(video_id)
    def __init__( self ):
        if 'http://' in common.args.url:
            video_id=self.getIDS4HTTP(common.args.url)
            self.queue=True
            httpplay=True
        else:
            self.queue=False
            httpplay=False
            video_id=common.args.url
        admodule = ads.Main()
        common.playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        if common.args.mode.endswith('TV_play'):
            if os.path.isfile(common.ADCACHE):
                os.remove(common.ADCACHE)
            self.NoResolve=False
            self.GUID = common.makeGUID()
            
            if common.args.mode.startswith('Captions'):
                common.settings['enable_captions']='true'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve=True
            elif common.args.mode.startswith('NoCaptions'):
                common.settings['enable_captions']='false'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve=True
            elif common.args.mode.startswith('Select'):
                common.settings['quality']='0'
                common.settings['segmentvideos'] = 'false'
                self.NoResolve=True 
                
            if ((common.settings['segmentvideos'] == 'true') or
                (common.settings['networkpreroll'] == 'true') or
                (common.settings['prerollads'] > 0) or
                (common.settings['trailads'] > 0)):
                    common.playlist.clear()
            
            # POST VIEW
            if common.settings['enable_login']=='true' and common.settings['usertoken']:
                common.viewed(common.args.videoid)
                
            if not self.NoResolve:
                if (common.settings['networkpreroll'] == 'true'):
                    self.NetworkPreroll()
                addcount = admodule.PreRoll(video_id,self.GUID,self.queue)
                if addcount > 0:
                    self.queue=True
            else:
                addcount = 0
            if common.settings['segmentvideos'] == 'true':
                segments = self.playSegment(video_id)
                if segments:
                    adbreaks = common.settings['adbreaks']
                    for i in range(1,len(segments)+1):
                        admodule.queueAD(video_id,adbreaks+addcount,addcount)
                        addcount += adbreaks
                        self.queueVideoSegment(video_id,segment=i)
            else:
                self.play(video_id)
            admodule.Trailing(addcount,video_id,self.GUID)
            
            if common.settings['queueremove']=='true' and common.settings['enable_login']=='true' and common.settings['usertoken']:
                self.queueViewComplete()
            
            if httpplay:
                xbmc.Player().play(common.playlist)

        elif common.args.mode == 'SEGMENT_play':
            self.queue=False
            self.NoResolve=False
            self.GUID = common.args.guid
            self.playSegment(video_id,segment=int(common.args.segment))
        elif common.args.mode == 'AD_play':
            self.NoResolve=False
            self.GUID = common.args.guid
            pod = int(common.args.pod)
            admodule.playAD(video_id,pod,self.GUID)
        elif common.args.mode == 'SUBTITLE_play':
            subtitles.Main().SetSubtitles(video_id)
Example #4
0
 def MakeIV(self):
     data = common.makeGUID()
     data = binascii.unhexlify(data)
     return base64.encodestring(data).replace('\n','')
Example #5
0
 def MakeIV(self):
     data = common.makeGUID()
     data = binascii.unhexlify(data)
     return base64.encodestring(data).replace('\n', '')