Esempio n. 1
0
class Main:

    BASEURL = 'mms://straumv.nrk.no/nrk_tv_direkte_nrk%s_%s'
    CHANNELS = [('NRK', '1',
                 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk1_100x57.gif'),
                ('NRK2', '2',
                 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk2_100x57.gif'),
                ('NRK3', '3',
                 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk3_100x57.gif')]

    def __init__(self):

        key = Key(sys.argv[2])
        self.hndl = int(sys.argv[1])
        self.success = True

        if not key.id:
            self.parse_channels()
        else:
            self.get_stream(key.id)

    def get_stream(self, id):
        self.get_settings()
        self.dman = DataHandle()
        url = mms_to_http(self.BASEURL %
                          (id, self.settings['connection_speed']))
        data = self.dman.get_data(url)
        url = mms_url(data)
        listitem = ListItem(self.CHANNELS[int(id) - 1][0], path=url)
        setResolvedUrl(self.hndl, self.success, listitem)

    def get_settings(self):
        self.settings = PluginSettings()
        #Connection speed
        options = (
            'l',
            'm',
            'h',
        )
        index = 11
        self.settings.add('connection_speed', 'values', options, index)

    def parse_channels(self):
        for i in self.CHANNELS:
            self.add(i[0], i[1], img=i[2])
        endOfDirectory(self.hndl)

    def add(self,
            label,
            id,
            type='channel',
            prefix='kanalene',
            img='',
            icon='',
            isdir=False):
        url = Key.build_url(prefix, type=type, id=id)
        li = ListItem(label, iconImage=icon, thumbnailImage=img)
        li.setProperty('IsPlayable', 'true')
        ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
        return ok
Esempio n. 2
0
 def get_settings(self):
     self.settings = PluginSettings()
     #Connection speed
     options = (
         'l',
         'm',
         'h',
     )
     index = 11
     self.settings.add('connection_speed', 'values', options, index)
Esempio n. 3
0
class Main:

    CHANNELS = [
        ("nrk tv direkte", "mms://straumv.nrk.no/nrk_tv_direkte_nrk1_%s"),
        ("nrk tv", "mms://straumV.nrk.no/nrk_tv_nrk1_%s"),
        ("nrk webvid 1", "mms://straumv.nrk.no/nrk_tv_webvid01_%s"),
    ]

    def __init__(self):

        key = Key(sys.argv[2])
        self.hndl = int(sys.argv[1])
        self.success = True

        if not key.url:
            self.parse_channels()
        else:
            self.get_stream(key.url)

    def get_stream(self, url):
        self.get_settings()
        self.dman = DataHandle()
        url = url % self.settings("connection_speed")
        url = mms_to_http(url)
        data = self.dman.get_data(url)
        url = mms_url(data)
        listitem = ListItem(url, path=url)
        print "Play url: %s" % url
        setResolvedUrl(self.hndl, self.success, listitem)

    def get_settings(self):
        self.settings = PluginSettings()
        # Connection speed
        options = ("l", "m", "h")
        index = 11
        self.settings.add("connection_speed", "values", options, index)

    def parse_channels(self):
        for i in self.CHANNELS:
            self.add(i[0], i[1])
        endOfDirectory(self.hndl)

    def add(self, label, url, type="channel", prefix="kanalene", img="", icon="", isdir=False):
        url = Key.build_url(prefix, type=type, url=url)
        li = ListItem(label, iconImage=icon, thumbnailImage=img)
        li.setProperty("IsPlayable", "true")
        ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
        return ok
Esempio n. 4
0
class Main:

    CHANNELS = [
            ('nrk tv direkte', 'mms://straumv.nrk.no/nrk_tv_direkte_nrk1_%s'),
            ('nrk tv', 'mms://straumV.nrk.no/nrk_tv_nrk1_%s'),
            ('nrk webvid 1', 'mms://straumv.nrk.no/nrk_tv_webvid01_%s')
        ]
  
    
    def __init__(self):

        key = Key( sys.argv[2] )
        self.hndl = int(sys.argv[1])
        self.success = True
        
        if not key.url:
            self.parse_channels()
        else:
            self.get_stream(key.url)
            
    def get_stream(self, url):
        self.get_settings()
        self.dman = DataHandle()
        url = url % self.settings('connection_speed')
        url = mms_to_http( url )
        data = self.dman.get_data(url)
        url = mms_url(data)
        listitem = ListItem( url, path=url)
        print 'Play url: %s' % url
        setResolvedUrl(self.hndl, self.success, listitem)
        
    def get_settings(self):
        self.settings = PluginSettings()
        #Connection speed
        options = ( 'l', 'm', 'h', ); index = 11
        self.settings.add('connection_speed', 'values', options, index)
        
    def parse_channels(self):
        for i in self.CHANNELS:
            self.add(i[0], i[1])
        endOfDirectory(self.hndl)

    def add(self, label, url, type='channel', prefix='kanalene', img='', icon='', isdir=False):
        url = Key.build_url(prefix, type=type, url=url)
        li = ListItem(label, iconImage=icon, thumbnailImage=img)
        li.setProperty('IsPlayable', 'true')
        ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
        return ok
Esempio n. 5
0
class Main:

    BASEURL = 'mms://straumv.nrk.no/nrk_tv_direkte_nrk%s_%s'
    CHANNELS = [
            ('NRK',  '1', 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk1_100x57.gif'),
            ('NRK2', '2', 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk2_100x57.gif'),
            ('NRK3', '3', 'http://fil.nrk.no/nett-tv/data/stillbilder/nrk3_100x57.gif')
        ]
  
    
    def __init__(self):

        key = Key( sys.argv[2] )
        self.hndl = int(sys.argv[1])
        self.success = True
        
        if not key.id:
            self.parse_channels()
        else:
            self.get_stream(key.id)
            
    def get_stream(self, id):
        self.get_settings()
        self.dman = DataHandle()
        url = mms_to_http( self.BASEURL % (id, self.settings['connection_speed']) )
        data = self.dman.get_data(url)
        url = mms_url(data)
        listitem = ListItem( self.CHANNELS[int(id) - 1][0], path=url)
        setResolvedUrl(self.hndl, self.success, listitem)
        
    def get_settings(self):
        self.settings = PluginSettings()
        #Connection speed
        options = ( 'l', 'm', 'h', ); index = 11
        self.settings.add('connection_speed', 'values', options, index)
        
    def parse_channels(self):
        for i in self.CHANNELS:
            self.add(i[0], i[1], img=i[2])
        endOfDirectory(self.hndl)

    def add(self, label, id, type='channel', prefix='kanalene', img='', icon='', isdir=False):
        url = Key.build_url(prefix, type=type, id=id)
        li = ListItem(label, iconImage=icon, thumbnailImage=img)
        li.setProperty('IsPlayable', 'true')
        ok = addDirectoryItem(self.hndl, url=url, listitem=li, isFolder=isdir)
        return ok
Esempio n. 6
0
 def get_settings(self):
     self.settings = PluginSettings()
     # Connection speed
     options = ("l", "m", "h")
     index = 11
     self.settings.add("connection_speed", "values", options, index)
Esempio n. 7
0
 def get_settings(self):
     self.settings = PluginSettings()
     #Connection speed
     options = ( 'l', 'm', 'h', ); index = 11
     self.settings.add('connection_speed', 'values', options, index)