def start (self):
        my_log("%s", "Start server")

        if ddd:
            dp = ddd()
            dp.create(heading = name)

            def progress_cb (a):
                _str = name
                if a.has_key('idx') and a.has_key('max'):
                    _str += ' %s of %d' % (a['idx'], a['max'])
                    dp.update(a['pr'], _str  , a['str'])

            self._kwa['proc_cb'] = progress_cb

        b = bsc.dodat(**self._kwa)
        self._datas['dat'], self._datas['ua']= b.gen_all()

        add_dumper(self)

        self._stop = threading.Event()
        self._work = threading.Thread(target=worker, name="Httpd", kwargs={"serv": self._server, "stop":  self._stop})
        self._work.start()

        if ddd:
            time.sleep(1)
            dp.close()
    def start(self):
        my_log("%s", "Start server")

        if ddd:
            dp = ddd()
            dp.create(heading=name)

            def progress_cb(a):
                _str = name
                if a.has_key('idx') and a.has_key('max'):
                    _str += ' %s of %d' % (a['idx'], a['max'])
                    dp.update(a['pr'], _str, a['str'])

            self._kwa['proc_cb'] = progress_cb

        b = bsc.dodat(**self._kwa)
        self._datas['dat'], self._datas['ua'] = b.gen_all()

        add_dumper(self)

        self._stop = threading.Event()
        self._work = threading.Thread(target=worker,
                                      name="Httpd",
                                      kwargs={
                                          "serv": self._server,
                                          "stop": self._stop
                                      })
        self._work.start()

        if ddd:
            time.sleep(1)
            dp.close()
Beispiel #3
0
  return u'%s %s' % (ts.strftime("%H:%M:%S"), te.strftime("%H:%M:%S"))

def get_prog_info(ch):
  s = u''
  pr = ch.get('programme', None)
  if pr is None:
    return s

  if isinstance(pr, list):
    for entry in ch['programme']:
      s += mk_info_string(entry)
  elif isinstance(pr, dict):
    s += mk_info_string(pr)
  return s

if __name__ == '__main__':
  import bsc
  print usr, psw
  b = bsc.dodat(base = 'https://api.iptv.bulsat.com',
                login = {'usr': usr,'pass': psw},
                cachepath = 'data.dat',
                cachetime = 60,
                dbg = True,
                timeout = 0.5)

  for g in b.get_genres():
    print '---------- %s ----------' % g.encode('utf-8', 'replace')
    for ch in b.get_all_by_genre(g):
      info = get_prog_info(ch)
      print ('Name: %s Quality: %s Info: %s' % (ch['title'], ch['quality'], ' '.join(info.split()))).encode('utf-8', 'replace')
                xbmc.log("Including channels from file: %s" %
                         additional_m3u_file)
        except Exception, e:
            xbmc.log(str(e))

    b = bsc.dodat(base=__addon__.getSetting('base'),
                  login={
                      'usr': __addon__.getSetting('username'),
                      'pass': __addon__.getSetting('password')
                  },
                  path=__data__,
                  cachetime=float(__addon__.getSetting('refresh')),
                  dbg=dbg,
                  timeout=float(__addon__.getSetting('timeout')),
                  ver=__version__,
                  xxx=xxx,
                  os_id=__ua_os[__addon__.getSetting('dev_id')]['osid'],
                  agent_id=__ua_os[__addon__.getSetting('dev_id')]['ua'],
                  app_ver=__addon__.getSetting('app_ver'),
                  force_group_name=_group_name,
                  gen_m3u=True,
                  gen_epg=not etx_epg,
                  compress=True,
                  map_url=map_url,
                  proc_cb=progress_cb,
                  excluded_ids=excluded_ids,
                  append_m3u=append_m3u)

    if check_plg():
        force = True
        if len(sys.argv) > 1 and sys.argv[1] == 'False':
            force = False
        xbmc.log("Including channels from file: %s" % additional_m3u_file)
    except Exception, e:
      xbmc.log(str(e))


  b = bsc.dodat(base = __addon__.getSetting('base'),
                login = {'usr': __addon__.getSetting('username'),
                        'pass': __addon__.getSetting('password')
                        },
                path = __data__,
                cachetime = float(__addon__.getSetting('refresh')),
                dbg = dbg,
                timeout=float(__addon__.getSetting('timeout')),
                ver = __version__,
                xxx = xxx,
                os_id = __ua_os[__addon__.getSetting('dev_id')]['osid'],
                agent_id = __ua_os[__addon__.getSetting('dev_id')]['ua'],
                app_ver = __addon__.getSetting('app_ver'),
                force_group_name = _group_name,
                gen_m3u = True,
                gen_epg = not etx_epg,
                compress = True,
                map_url = map_url,
                proc_cb = progress_cb,
                excluded_ids = excluded_ids,
                append_m3u = append_m3u)

  if check_plg():
    force = True
    if len(sys.argv) > 1 and sys.argv[1] == 'False':
      force = False
Beispiel #6
0
        return s

    if isinstance(pr, list):
        for entry in ch['programme']:
            s += mk_info_string(entry)
    elif isinstance(pr, dict):
        s += mk_info_string(pr)
    return s


if __name__ == '__main__':
    import bsc
    print usr, psw
    b = bsc.dodat(base='https://api.iptv.bulsat.com',
                  login={
                      'usr': usr,
                      'pass': psw
                  },
                  cachepath='data.dat',
                  cachetime=60,
                  dbg=True,
                  timeout=0.5)

    for g in b.get_genres():
        print '---------- %s ----------' % g.encode('utf-8', 'replace')
        for ch in b.get_all_by_genre(g):
            info = get_prog_info(ch)
            print('Name: %s Quality: %s Info: %s' %
                  (ch['title'], ch['quality'], ' '.join(info.split()))).encode(
                      'utf-8', 'replace')
Beispiel #7
0
    if not __addon__.getSetting('password'):
        Notify('Password', 'empty')

    import traceback
    try:
        import bsc
        b = bsc.dodat(login={
            'usr': __addon__.getSetting('username'),
            'pass': __addon__.getSetting('password')
        },
                      path=__data__,
                      picons_path=__picons__,
                      cachetime=float(__addon__.getSetting('refresh')),
                      dbg=dbg,
                      timeout=float(__addon__.getSetting('timeout')),
                      ver=__version__,
                      xxx=xxx,
                      os_id=__ua_os[__addon__.getSetting('dev_id')]['osid'],
                      agent_id=__ua_os[__addon__.getSetting('dev_id')]['ua'],
                      force_group_name=_group_name,
                      gen_m3u=True,
                      epg_type=epg_type,
                      compress=True,
                      proc_cb=progress_cb,
                      map_file=__map__)

        if check_plg():
            force = True
            if len(sys.argv) > 1 and sys.argv[1] == 'False':
                force = False
                dbg_msg('Reload timer')
  if sys.argv[1] != '0':
    UA['User-Agent'] = __ua_os[sys.argv[1]]['ua']

  import bsc
  start_time = time.time()
  p = os.path.join(os.getcwd(), 'tmp')
  v = '0.0.0'

  map_url = 'http://snip.li/epgmap'

  print usr, psw, p, v
  b = bsc.dodat(base = 'https://api.iptv.bulsat.com',
                login = {'usr': usr,'pass': psw},
                path = p,
                cachetime = 1,
                dbg = dbg,
                timeout = 10,
                ver = v,
                xxx = True,
                os_id =  __ua_os[sys.argv[1]]['osid'],
                agent_id = __ua_os[sys.argv[1]]['ua'],
                app_ver = '0.2.17',
                gen_m3u = True,
                gen_epg = False,
                compress = True,
                map_url = map_url,
                proc_cb = progress_cb,
            )
  b.gen_all(True)
  dbg = True
else:
  dbg = False

if not __addon__.getSetting("username"):
  Notify('User', 'empty')
if not __addon__.getSetting("password"):
  Notify('Password', 'empty')

import traceback
try:
  import bsc
  b = bsc.dodat(base = base,
                login = {'usr': __addon__.getSetting("username"),
                        'pass': __addon__.getSetting("password")
                        },
                cachepath = __data__,
                cachetime = refresh,
                dbg = dbg,
                timeout=float(timeout))
except Exception, e:
  Notify('Module Import', 'Fail')
  traceback.print_exc()
  update('exception', e.args[0], sys.exc_info())
  pass

def update(name, dat, crash=None):
  payload = {}
  payload['an'] = __scriptname__
  payload['av'] = __version__
  payload['ec'] = name
  payload['ea'] = 'tv_start'
Beispiel #10
0
    import bsc
    start_time = time.time()
    p = os.path.join(os.getcwd(), 'tmp')
    v = '0.0.0'

    map_url = 'http://snip.li/epgmap'

    print usr, psw, p, v
    b = bsc.dodat(
        base='https://api.iptv.bulsat.com',
        login={
            'usr': usr,
            'pass': psw
        },
        path=p,
        cachetime=1,
        dbg=dbg,
        timeout=10,
        ver=v,
        xxx=True,
        os_id=__ua_os[sys.argv[1]]['osid'],
        agent_id=__ua_os[sys.argv[1]]['ua'],
        app_ver='0.2.17',
        gen_m3u=True,
        gen_epg=False,
        compress=True,
        map_url=map_url,
        proc_cb=progress_cb,
    )
    b.gen_all(True)
Beispiel #11
0
else:
    dbg = False

if not __addon__.getSetting("username"):
    Notify('User', 'empty')
if not __addon__.getSetting("password"):
    Notify('Password', 'empty')

import traceback
try:
    import bsc
    b = bsc.dodat(base=base,
                  login={
                      'usr': __addon__.getSetting("username"),
                      'pass': __addon__.getSetting("password")
                  },
                  cachepath=__data__,
                  cachetime=refresh,
                  dbg=dbg,
                  timeout=float(timeout))
except Exception, e:
    Notify('Module Import', 'Fail')
    traceback.print_exc()
    update('exception', e.args[0], sys.exc_info())
    pass


def update(name, dat, crash=None):
    payload = {}
    payload['an'] = __scriptname__
    payload['av'] = __version__