def getFEED( url , postdata=None , proxy = False):
    try:
        print 'HULU --> common :: getFEED :: url = '+url
        if proxy == True:
            us_proxy = 'http://' + addoncompat.get_setting('us_proxy') + ':' + addoncompat.get_setting('us_proxy_port')
            proxy_handler = urllib2.ProxyHandler({'http':us_proxy})
            if addoncompat.get_setting('us_proxy_pass') <> '' and addoncompat.get_setting('us_proxy_user') <> '':
                print 'Using authenticated proxy: ' + us_proxy
                password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
                password_mgr.add_password(None, us_proxy, addoncompat.get_setting('us_proxy_user'), addoncompat.get_setting('us_proxy_pass'))
                proxy_auth_handler = urllib2.ProxyBasicAuthHandler(password_mgr)
                opener = urllib2.build_opener(proxy_handler, proxy_auth_handler)
            else:
                print 'Using proxy: ' + us_proxy
                opener = urllib2.build_opener(proxy_handler)
            urllib2.install_opener(opener)
        if postdata == None:
            req = urllib2.Request(url)
        else:
            req = urllib2.Request(url,postdata)
        req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)')
        req.add_header('Referer', 'http://download.hulu.com/hulu10.html')
        #req.add_header('x-flash-version', '11,1,102,55')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()

    except urllib2.URLError, e:
        print 'Error reason: ', e
        heading = 'Error'
        message = e
        duration = 10000
        xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % ( heading, message, duration) )
        return False
def getFEED( url , postdata=None , proxy = False):
    try:
        log( 'HULU --> common :: getFEED :: url = '+url)
        if proxy == True:
            us_proxy = 'http://' + addoncompat.get_setting('us_proxy') + ':' + addoncompat.get_setting('us_proxy_port')
            proxy_handler = urllib2.ProxyHandler({'http':us_proxy})
            if addoncompat.get_setting('us_proxy_pass') <> '' and addoncompat.get_setting('us_proxy_user') <> '':
                log( 'Using authenticated proxy: ' + us_proxy)
                password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
                password_mgr.add_password(None, us_proxy, addoncompat.get_setting('us_proxy_user'), addoncompat.get_setting('us_proxy_pass'))
                proxy_auth_handler = urllib2.ProxyBasicAuthHandler(password_mgr)
                opener = urllib2.build_opener(proxy_handler, proxy_auth_handler)
            else:
                log( 'Using proxy: ' + us_proxy)
                opener = urllib2.build_opener(proxy_handler)
            urllib2.install_opener(opener)
        if postdata == None:
            req = urllib2.Request(url)
        else:
            req = urllib2.Request(url,postdata)
        req.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)')
        req.add_header('Referer', 'http://download.hulu.com/hulu10.html')
        #req.add_header('x-flash-version', '11,1,102,55')
        response = urllib2.urlopen(req)
        link=response.read()
        response.close()

    except urllib2.URLError, e:
        log( 'Error reason: ', e)
        heading = 'Error'
        message = e
        duration = 10000
        xbmc.executebuiltin('XBMC.Notification("%s", "%s", %s)' % ( heading, message, duration) )
        return False
Exemple #3
0
def get_setting_videostream():  

    stream = 'h264 1500'

    stream_prefs = '0'
    try:
        stream_prefs = addoncompat.get_setting('video_stream')
    except:
        pass
        
    # Auto|H.264 (480kb)|H.264 (800kb)|H.264 (1500kb)|H.264 (3200kb)
    if stream_prefs == '0':
        environment = os.environ.get( "OS" )
        # check for xbox as we set a lower default for xbox (although it can do 1500kbit streams)
        if environment == 'xbox':
            stream = 'h264 800'
        else:
            # play full HD if the screen is large enough (not all programmes have this resolution)
            Y = int(xbmc.getInfoLabel('System.ScreenHeight'))
            X = int(xbmc.getInfoLabel('System.ScreenWidth'))
            # if the screen is large enough for HD
            if Y > 832 and X > 468:
                stream = 'h264 3200'
    elif stream_prefs == '1':
        stream = 'h264 480'
    elif stream_prefs == '2':
        stream = 'h264 800'
    elif stream_prefs == '3':
        stream = 'h264 1500'
    elif stream_prefs == '4':
        stream = 'h264 3200'

    logging.info("Video stream prefs %s - %s", stream_prefs, stream)
    return stream
Exemple #4
0
def read_url():
    args = cgi.parse_qs(sys.argv[2][1:])
    feed_channel = args.get('feed_channel', [None])[0]
    feed_atoz    = args.get('feed_atoz', [None])[0]
    listing      = args.get('listing', [None])[0]
    pid          = args.get('pid', [None])[0]
    tvradio      = args.get('tvradio', [None])[0]
    category     = args.get('category', [None])[0]
    series       = args.get('series', [None])[0]    
    url          = args.get('url', [None])[0]
    label        = args.get('label', [None])[0]
    deletesearch = args.get('deletesearch', [None])[0]
    radio        = args.get('radio', [None])[0]

    feed = None
    if feed_channel:
        feed = iplayer.feed('auto', channel=feed_channel, atoz=feed_atoz, radio=radio)
    elif feed_atoz:
        feed = iplayer.feed(tvradio or 'auto', atoz=feed_atoz, radio=radio)

    if not (feed or listing):
        section = addoncompat.get_setting('start_section')
        if   section == '1': tvradio = 'tv'
        elif section == '2': tvradio = 'radio'

    return (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio)
Exemple #5
0
def get_protocol():
    protocol = "rtmp"
    try:
        protocol_id = addoncompat.get_setting('protocol')
    except:
        pass

    if protocol_id == '1': protocol = 'rtmpt'

    return protocol
Exemple #6
0
def get_setting_subtitles():
    subtitles = addoncompat.get_setting('subtitles_control')
    #values="None|Download and Play|Download to File" default="None"
    if subtitles:
        if subtitles == 'None' or subtitles == '0':
            return None
        elif subtitles == 'Download and Play' or subtitles == '1':
            return 'autoplay'
        elif subtitles == 'Download to File' or subtitles == '2':
            return 'download'
    # default
    return None
Exemple #7
0
def get_provider():
    provider = ""
    try:
        provider_id = addoncompat.get_setting('provider')
    except:
        pass

    if   provider_id == '1': provider = 'akamai'
    elif provider_id == '2': provider = 'limelight'
    elif provider_id == '3': provider = 'level3'

    return provider
Exemple #8
0
def get_httplib():
    http = None
    try:
        if addoncompat.get_setting('proxy_use') == 'true':
            (proxy_type, proxy_server, proxy_port, proxy_dns, proxy_user, proxy_pass) = get_proxy()
            logging.info("Using proxy: type %i rdns: %i server: %s port: %s user: %s pass: %s", proxy_type, proxy_dns, proxy_server, proxy_port, "***", "***")
            http = httplib2.Http(proxy_info = httplib2.ProxyInfo(proxy_type, proxy_server, proxy_port, proxy_dns, proxy_user, proxy_pass))
        else:
          http = httplib2.Http()
    except:
        raise
        logging.error('Failed to initialize httplib2 module')

    return http
Exemple #9
0
def get_proxy():
    proxy_server = None
    proxy_type_id = 0
    proxy_port = 8080
    proxy_user = None
    proxy_pass = None
    try:
        proxy_server = addoncompat.get_setting('proxy_server')
        proxy_type_id = addoncompat.get_setting('proxy_type')
        proxy_port = int(addoncompat.get_setting('proxy_port'))
        proxy_user = addoncompat.get_setting('proxy_user')
        proxy_pass = addoncompat.get_setting('proxy_pass')
    except:
        pass

    if   proxy_type_id == '0': proxy_type = socks.PROXY_TYPE_HTTP_NO_TUNNEL
    elif proxy_type_id == '1': proxy_type = socks.PROXY_TYPE_HTTP
    elif proxy_type_id == '2': proxy_type = socks.PROXY_TYPE_SOCKS4
    elif proxy_type_id == '3': proxy_type = socks.PROXY_TYPE_SOCKS5

    proxy_dns = True
    
    return (proxy_type, proxy_server, proxy_port, proxy_dns, proxy_user, proxy_pass)
Exemple #10
0
def get_setting_thumbnail_size():
    size = addoncompat.get_setting('thumbnail_size')
    #Biggest|Large|Small|Smallest|None
    if size:
        if size == '0':
            return 'biggest'
        elif size == '1':
            return 'large'
        elif size == '2':
            return 'small'
        elif size == '3':
            return 'smallest'
        elif size == '4':
            return 'none'
    # default
    return 'large'
Exemple #11
0
def get_setting_audiostream():
    stream = 'wma'

    stream_prefs = '0'
    try:
        stream_prefs = addoncompat.get_setting('audio_stream')
    except:
        pass

    # Auto|MP3|AAC|WMA
    if stream_prefs == '1': 
        stream = 'mp3'
    elif stream_prefs == '2':
        stream = 'aac'        
    elif stream_prefs == '3':
        stream = 'wma'

    logging.info("Audio stream prefs %s - %s", stream_prefs, stream)
    return stream
Exemple #12
0
        logging.error("Couldn't create %s, %s" % (d, str(e)))
        raise

if os.path.isfile(VERSION_FILE):
    old_version = file_read(VERSION_FILE)
    
if old_version != __version__:
    file_write(VERSION_FILE, __version__)
    d = xbmcgui.Dialog()
    d.ok('Welcome to the BBC IPlayer addon', 'Please be aware this addon only works in the UK.', 'The IPlayer service checks to ensure UK IP addresses.')

if __name__ == "__main__":
    try:

        # setup and check script environment 
        if addoncompat.get_setting('http_cache_disable') == 'false': iplayer.set_http_cache(HTTP_CACHE_DIR)
    
        environment = os.environ.get( "OS", "xbox" )
        try:
            timeout = int(addoncompat.get_setting('socket_timeout'))
        except:
            timeout = 5
        if environment in ['Linux', 'xbox'] and timeout > 0:
            setdefaulttimeout(timeout)
    
        progcount = True
        if addoncompat.get_setting('progcount') == 'false':  progcount = False   
      
        # get current state parameters
        (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) = read_url()
        logging.info( (feed, listing, pid, tvradio, category, series, url, label, deletesearch, radio) )
hulu_fanart = os.path.join(pluginpath,'fanart.jpg')
hulu_icon = os.path.join(imagepath,'icon.png')


if os.path.isfile(WARNING):
    xbmcgui.Dialog().ok('Attention','This is Free Software.','If you paid for the Hulu plug-in then you have','been defrauded and should request a refund.',)
    os.remove(WARNING)
"""
    GET SETTINGS
"""

settings={}
handle = int(sys.argv[1])

#settings Advanced
settings['quality'] = addoncompat.get_setting("quality")
settings['adquality'] = int(addoncompat.get_setting("adquality"))
settings['prerollads'] = int(addoncompat.get_setting("prerollads"))
settings['networkpreroll'] = addoncompat.get_setting("networkpreroll")
settings['trailads'] = int(addoncompat.get_setting("trailads"))
settings['adbreaks'] = int(addoncompat.get_setting("adbreaks"))
settings['segmentvideos'] = addoncompat.get_setting("segmentvideos")
#settings['swfverify'] = addoncompat.get_setting("swfverify")
cdns = ['level3','limelight','akamai']
defualtcdn = int(addoncompat.get_setting("defaultcdn"))
settings['defaultcdn'] = cdns[defualtcdn]
fallbackcdns =['NONE','darwin-edgecast']
fallbackcdn = int(addoncompat.get_setting("fallbackcdn"))
settings['fallbackcdn']=fallbackcdns[fallbackcdn]
#setting captions
settings['enable_captions'] = addoncompat.get_setting("enable_captions")
imagepath  = os.path.join(pluginpath,'resources','images')
hulu_fanart = os.path.join(pluginpath,'fanart.jpg')
hulu_icon = os.path.join(imagepath,'icon.png')


if os.path.isfile(WARNING):
    xbmcgui.Dialog().ok('Attention','This is Free Software.','If you paid for the Hulu plug-in then you have','been defrauded and should request a refund.',)
    os.remove(WARNING)
"""
    GET SETTINGS
"""

settings={}
handle = int(sys.argv[1])

settings['chrome_file_source'] = addoncompat.get_setting("chrome_file_source")
settings['queueremove'] = addoncompat.get_setting("queueremove")
settings['proxy_enable'] = addoncompat.get_setting('us_proxy_enable')
#per page settings
page = ['25','50','100','250','500','1000','2000']
perpage = int(addoncompat.get_setting("perpage"))
settings['perpage'] = page[perpage]
popperpage = int(addoncompat.get_setting("popperpage"))
settings['popperpage'] = page[popperpage]
allperpage = int(addoncompat.get_setting("allperpage" ))
settings['allperpage'] = page[allperpage]
searchperpage = int(addoncompat.get_setting("searchperpage" ))
settings['searchperpage'] = page[searchperpage]

settings['viewenable'] = addoncompat.get_setting("viewenable")
settings['defaultview'] = addoncompat.get_setting("defaultview")
Exemple #15
0
    def read_media_node(self, media):
        """
        Reads media info from a media XML node
        media: media node from BeautifulStoneSoup
        """
        self.kind = media.get('kind')
        self.mimetype = media.get('type')
        self.encoding = media.get('encoding')
        self.width, self.height = media.get('width'), media.get('height')
        self.live = media.get('live') == 'true'
        self.service = media.get('service')
        try:
            self.bitrate = int(media.get('bitrate'))
        except:
            if media.get('bitrate') != None:
                logging.info("bitrate = " + '"' + media.get('bitrate') + '"')
            self.bitrate = None

        self.connection_kind = None
        self.connection_live = None
        self.connection_protocol = None
        self.connection_href = None
        self.connection_method = None
        
        # try to find a stream from users preference
        conn = None
        provider = get_provider()

        if provider != "":
            for c in media.findall('connection'):
                if c.get('kind') == provider:
                    conn = c
                    break
        if conn == None:
            conn = media.find('connection')
        if conn == None:
            return
        
        self.connection_kind = conn.get('kind')
        self.connection_protocol = conn.get('protocol')

        if self.mimetype[:5] == 'audio':
            self.kind = 'audio'
            self.bitrate = None

        # some akamai rtmp streams (radio) don't specify rtmp protocol
        if self.connection_protocol == None and self.connection_kind == 'akamai':
            self.connection_protocol = 'rtmp'

        if self.connection_kind in ['http', 'sis']:
            self.connection_href = conn.get('href')
            self.connection_protocol = 'http'
            if self.kind == 'captions':
                self.connection_method = None

        elif self.connection_protocol == 'rtmp':
            server = conn.get('server')
            identifier = conn.get('identifier')
            auth = conn.get('authString')
            application = conn.get('application')
            # sometimes we don't get a rtmp application for akamai
            if application == None and self.connection_kind == 'akamai':
                application = "ondemand"

            timeout = addoncompat.get_setting('stream_timeout')
            swfplayer = 'http://www.bbc.co.uk/emp/10player.swf'       
            params = dict(protocol = get_protocol(), port = get_port(), server = server, auth = auth, ident = identifier, app = application)

            if self.connection_kind == 'limelight':
                # note that librtmp has a small issue with constructing the tcurl here. we construct it ourselves for now (fixed in later librtmp)
                self.connection_href = "%(protocol)s://%(server)s:%(port)s/ app=%(app)s?%(auth)s tcurl=%(protocol)s://%(server)s:%(port)s/%(app)s?%(auth)s playpath=%(ident)s" % params
            else:
                self.connection_href = "%(protocol)s://%(server)s:%(port)s/%(app)s?%(auth)s playpath=%(ident)s" % params

            self.connection_href += " swfurl=%s swfvfy=true timeout=%s" % (swfplayer, timeout)

        else:
            logging.error("connectionkind %s unknown", self.connection_kind)

        if self.connection_protocol and addoncompat.get_setting('enhanceddebug') == 'true':
            logging.info("protocol: %s - kind: %s - type: %s - encoding: %s, - bitrate: %s" % 
                         (self.connection_protocol, self.connection_kind, self.mimetype, self.encoding, self.bitrate))
            logging.info("conn href: %s", self.connection_href)
Exemple #16
0
def watch(feed, pid, showDialog):

    times = []
    times.append(['start',time.clock()])
    if showDialog:
        pDialog = xbmcgui.DialogProgress()
        times.append(['xbmcgui.DialogProgress()',time.clock()])
        pDialog.create('IPlayer', 'Loading catchup stream info')
        times.append(['pDialog.create',time.clock()])

    subtitles_file = None
    item      = get_item(pid)
    times.append(['get_item',time.clock()])
    thumbnail = item.programme.thumbnail
    title     = item.programme.title
    summary   = item.programme.summary
    updated   = item.programme.updated
    channel   = None
    thumbfile = None
    if feed and feed.name:
        channel = feed.name
    times.append(['setup variables',time.clock()])        
    logging.info('watching channel=%s pid=%s' % (channel, pid))
    times.append(['logging',time.clock()])
    logging.info('thumb =%s   summary=%s' % (thumbnail, summary))
    times.append(['logging',time.clock()])   
    subtitles = get_setting_subtitles()
    times.append(['get_setting_subtitles',time.clock()])

    if thumbnail: 
        # attempt to use the existing thumbnail file
        thumbcache = xbmc.getCacheThumbName( sys.argv[ 0 ] + sys.argv[ 2 ] )
        thumbfile  = os.path.join( xbmc.translatePath( "special://profile" ), "Thumbnails", "Video", thumbcache[ 0 ], thumbcache )
        logging.info('Reusing existing thumbfile =%s for url %s%s' % (thumbfile, sys.argv[ 0 ], sys.argv[ 2 ]))
        
    if thumbnail and not os.path.isfile(thumbfile):
        # thumbnail wasn't available locally so download    
        try:
            # The thumbnail needs to accessed via the local filesystem
            # for "Media Info" to display it when playing a video
            if showDialog:
                pDialog.update(20, 'Fetching thumbnail')
                if pDialog.iscanceled(): raise 
                times.append(['update dialog',time.clock()])
            iplayer.httpretrieve(thumbnail, thumbfile)
            times.append(['retrieve thumbnail',time.clock()])
        except:
            pass

    if item.is_tv:
        # TV Stream
        iconimage = 'DefaultVideo.png'

        if showDialog:
            pDialog.update(50, 'Fetching video stream info')
            if pDialog.iscanceled(): raise
            times.append(['update dialog',time.clock()])
        pref = get_setting_videostream()        
        times.append(['get_setting_videostream',time.clock()])
        opref = pref
        if showDialog:
            pDialog.update(70, 'Selecting video stream')
            if pDialog.iscanceled(): raise
            times.append(['update dialog',time.clock()])

        streams = ['h264 3200', 'h264 1500', 'h264 800', 'h264 480', 'h264 400']
        (media, pref) = get_matching_stream(item, pref, streams)

        # A potentially usable stream was found (higher bitrate than the default) offer it to the user
        if not media:
            # Nothing usable was found
            d = xbmcgui.Dialog()
            d.ok('Stream Error', 'Can\'t locate any usable TV streams.')            
            return False

        if streams.index(opref) > streams.index(pref):
            d = xbmcgui.Dialog()
            if d.yesno('Default %s Stream Not Available' % opref, 'Play higher bitrate %s stream ?' % pref ) == False:
                return False
  
        times.append(['media 2',time.clock()])    
        url = media.url
        times.append(['media.url',time.clock()]) 
        logging.info('watching url=%s' % url)
        times.append(['logging',time.clock()])

        if showDialog:
            pDialog.update(90, 'Selecting subtitles')
            if pDialog.iscanceled(): raise
            times.append(['update dialog',time.clock()])
        if subtitles:
            subtitles_media = item.get_media_for('captions')
            times.append(['subtitles_media',time.clock()])
            if subtitles_media:
                subtitles_file = download_subtitles(subtitles_media.url)
                times.append(['subtitles download',time.clock()])

        listitem = xbmcgui.ListItem(title)
        times.append(['create listitem',time.clock()])
        #listitem.setIconImage(iconimage)
        listitem.setInfo('video', {
                                   "TVShowTitle": title,
                                   'Plot': summary + ' ' + updated,
                                   'PlotOutline': summary,
                                   "Date": updated,})
        times.append(['listitem setinfo',time.clock()])
        play=xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
        times.append(['xbmc.PlayList',time.clock()])
        
    else:
        # Radio stream        
        if showDialog:
            pDialog.update(30, 'Fetching radio stream info')
            if pDialog.iscanceled(): raise
            times.append(['update dialog',time.clock()])
        pref = get_setting_audiostream()
        if showDialog:
            pDialog.update(50, 'Selecting radio stream')
            if pDialog.iscanceled(): raise
            times.append(['update dialog',time.clock()])
 
        (media, pref) = get_matching_stream(item, pref, ['wma', 'mp3', 'aac'])

        if not media:            
            d = xbmcgui.Dialog()
            d.ok('Stream Error', 'Error: can\'t locate radio stream')            
            return False
        url = media.url
            
        logging.info('Listening to url=%s' % url)

        listitem = xbmcgui.ListItem(title)
        times.append(['listitem create',time.clock()])
        listitem.setIconImage('defaultAudio.png')
        times.append(['listitem.setIconImage',time.clock()])
        play=xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
        times.append(['xbmc.PlayList',time.clock()])

    logging.info('Playing preference %s' % pref)
    times.append(['logging.info',time.clock()])
    times.append(['listitem.setproperty x 3',time.clock()])

    if thumbfile: 
        listitem.setIconImage(thumbfile)
        times.append(['listitem.setIconImage(thumbfile)',time.clock()])
        listitem.setThumbnailImage(thumbfile)
        times.append(['listitem.setThumbnailImage(thumbfile)',time.clock()])
    
    del item
    del media
    
    if showDialog:
        pDialog.update(80, 'Playing')
        if pDialog.iscanceled(): raise
        times.append(['update dialog',time.clock()])
    play.clear()
    times.append(['play.clear()',time.clock()])
    play.add(url,listitem)
    times.append(['play.add',time.clock()])
    player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
    times.append(['xbmc.Player()',time.clock()])
    player.play(play)
    times.append(['player.play',time.clock()])
    # Auto play subtitles if they have downloaded 
    logging.info("subtitles: %s   - subtitles_file %s " % (subtitles,subtitles_file))
    times.append(['logging.info',time.clock()])
    if subtitles == 'autoplay' and subtitles_file: 
        player.setSubtitles(subtitles_file)
        times.append(['player.setSubtitles',time.clock()])
    
    if showDialog: pDialog.close()
    times.append(['pDialog.close()',time.clock()])
    
    if addoncompat.get_setting('enhanceddebug') == 'true':
        pt = times[0][1]
        for t in times:
            logging.info('Took %2.2f sec for %s' % (t[1] - pt, t[0]))
            pt = t[1]
Exemple #17
0
if os.path.isfile(WARNING):
    xbmcgui.Dialog().ok(
        'Attention',
        'This is Free Software.',
        'If you paid for the Hulu plug-in then you have',
        'been defrauded and should request a refund.',
    )
    os.remove(WARNING)
"""
    GET SETTINGS
"""

settings = {}
handle = int(sys.argv[1])

settings['chrome_file_source'] = addoncompat.get_setting("chrome_file_source")
settings['queueremove'] = addoncompat.get_setting("queueremove")
settings['proxy_enable'] = addoncompat.get_setting('us_proxy_enable')
#per page settings
page = ['25', '50', '100', '250', '500', '1000', '2000']
perpage = int(addoncompat.get_setting("perpage"))
settings['perpage'] = page[perpage]
popperpage = int(addoncompat.get_setting("popperpage"))
settings['popperpage'] = page[popperpage]
allperpage = int(addoncompat.get_setting("allperpage"))
settings['allperpage'] = page[allperpage]
searchperpage = int(addoncompat.get_setting("searchperpage"))
settings['searchperpage'] = page[searchperpage]

settings['viewenable'] = addoncompat.get_setting("viewenable")
settings['defaultview'] = addoncompat.get_setting("defaultview")
Exemple #18
0
    xbmcgui.Dialog().ok(
        'Attention',
        'This is Free Software.',
        'If you paid for the Hulu plug-in then you have',
        'been defrauded and should request a refund.',
    )
    os.remove(WARNING)
"""
    GET SETTINGS
"""

settings = {}
handle = int(sys.argv[1])

#settings Advanced
settings['quality'] = addoncompat.get_setting("quality")
settings['adquality'] = int(addoncompat.get_setting("adquality"))
settings['prerollads'] = int(addoncompat.get_setting("prerollads"))
settings['networkpreroll'] = addoncompat.get_setting("networkpreroll")
settings['trailads'] = int(addoncompat.get_setting("trailads"))
settings['adbreaks'] = int(addoncompat.get_setting("adbreaks"))
settings['segmentvideos'] = addoncompat.get_setting("segmentvideos")
#settings['swfverify'] = addoncompat.get_setting("swfverify")
cdns = ['level3', 'limelight', 'akamai']
defualtcdn = int(addoncompat.get_setting("defaultcdn"))
settings['defaultcdn'] = cdns[defualtcdn]
fallbackcdns = ['NONE', 'darwin-edgecast']
fallbackcdn = int(addoncompat.get_setting("fallbackcdn"))
settings['fallbackcdn'] = fallbackcdns[fallbackcdn]
#setting captions
settings['enable_captions'] = addoncompat.get_setting("enable_captions")