
# -*- coding: utf-8 -*-

'''
    Genesis Add-on
    Copyright (C) 2015 lambda

    -Mofidied by  __    ____  ________ __ ____  ____ _       ___   __     __  ______   ________  _______   ________
   / /   / __ \/ ____/ //_// __ \/ __ \ |     / / | / /    /  |/  /   | / ____/ / / /  _/ | / / ____/
  / /   / / / / /   / ,<  / / / / / / / | /| / /  |/ /    / /|_/ / /| |/ /   / /_/ // //  |/ / __/   
 / /___/ /_/ / /___/ /| |/ /_/ / /_/ /| |/ |/ / /|  /    / /  / / ___ / /___/ __  // // /|  / /___   
/_____/\____/\____/_/ |_/_____/\____/ |__/|__/_/ |_/____/_/  /_/_/  |_\____/_/ /_/___/_/ |_/_____/   
                                                  /_____/                                            


    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import os,re,sys,hashlib,json,base64,random,datetime
import six
from kodi_six import xbmc
from six.moves import urllib_parse, zip, range
try: from sqlite3 import dbapi2 as database
except: from pysqlite2 import dbapi2 as database

from resources.lib.modules import cache
from resources.lib.modules import metacache
from resources.lib.modules import client
from six import PY2, PY3
from resources.lib.modules import control
from resources.lib.modules import regex
from resources.lib.modules import trailer
from resources.lib.modules import workers
from resources.lib.modules import youtube
from resources.lib.modules import views
from resources.lib.modules import log_utils

def six_encode(txt, char='utf-8'):
    if six.PY2 and isinstance(txt, six.text_type):
        txt = txt.encode(char)
    return txt

def six_decode(txt, char='utf-8'):
    if six.PY3 and isinstance(txt, six.binary_type):
        txt = txt.decode(char)
    return txt



class indexer:
    def __init__(self):
        self.list = []
        self.hash = []

    def rootextinfo(self):
            regex.clear()
            url = 'https://repos.ratpack.appboxes.co/xmls/index4.xml'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
    
    def rootlists1(self):
            regex.clear()
            url = 'https://repos.ratpack.appboxes.co/xmls/index3.xml'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlists2(self):
            regex.clear()
            url = 'https://repos.ratpack.appboxes.co/xmls/index1.xml'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlists3(self):
            regex.clear()
            url = 'https://repos.ratpack.appboxes.co/xmls/index2.xml'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlists4(self):
            regex.clear()
            url = 'https://franchises.encrypticmh.appboxes.co/playlist.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
    
    def rootlists5(self):
            regex.clear()
            url = 'https://movies.encrypticmh.appboxes.co/killerbells/playlist.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
     
    def rootlists6(self):
            regex.clear()
            url = 'https://movies.encrypticmh.appboxes.co/playlist.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list   

    def rootad(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ad.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootae(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ae.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootaf(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/af.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootag(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ag.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootal(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/al.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootam(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/am.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootao(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ao.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootar(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ar.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootat(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/at.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootat_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/at_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootau(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/au.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootau_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/au_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootaw(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/aw.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootaz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/az.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootba(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ba.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbb(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bb.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbd(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bd.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbe(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/be.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbe_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/be_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbf(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bf.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbg(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bg.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbh(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bh.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbj(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bj.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/br.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbr_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/br_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootbs(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/bs.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootby(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/by.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootca(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ca.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootca_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ca_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcd(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cd.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcg(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cg.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootch(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ch.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootch_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ch_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootci(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ci.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootco(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/co.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcu(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cu.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcw(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cw.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcy(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cy.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootcz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/cz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootde(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/de.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootde_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/de_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootdk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/dk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootdk_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/dk_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootdo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/do.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootdz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/dz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootec(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ec.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootee(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ee.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rooteg(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/eg.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootes(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/es.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootes_rakuten(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/es_rakuten.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootes_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/es_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootet(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/et.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfi(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fi.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfi_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fi_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfj(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fj.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootfr_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/fr_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootge(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ge.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgh(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gh.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgp(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gp.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgq(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gq.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootgt(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/gt.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roothk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/hk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roothn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/hn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roothr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/hr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootht(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ht.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roothu(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/hu.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootid(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/id.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootie(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ie.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootie_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ie_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootil(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/il.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootin(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/in.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootin_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/in_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootiq(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/iq.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootir(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ir.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootis(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/is.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootit(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/it.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootit_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/it_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootjm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/jm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootjo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/jo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootjp(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/jp.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootke(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ke.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkg(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kg.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkh(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kh.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkp(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kp.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkw(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kw.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootkz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/kz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootla(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/la.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlb(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lb.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootli(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/li.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlt(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lt.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlu(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lu.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlu_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lu_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootlv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/lv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootly(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ly.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootma(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ma.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmc(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mc.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmd(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/md.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootme(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/me.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootml(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ml.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmq(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mq.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmt(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mt.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmx(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mx.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmx_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mx_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmy(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/my.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootmz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/mz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootne(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ne.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootng(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ng.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootni(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ni.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootnl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/nl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootnl_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/nl_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootno(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/no.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootno_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/no_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootnp(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/np.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootnz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/nz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootom(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/om.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpa(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pa.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpe(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pe.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpf(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pf.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootph(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ph.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootps(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ps.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpt(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pt.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpt_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/pt_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootpy(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/py.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootqa(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/qa.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootro(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ro.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootrs(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/rs.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootru(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ru.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootru_catcast(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ru_catcast.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootrw(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/rw.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsa(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sa.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsd(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sd.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootse(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/se.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootse_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/se_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsg(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sg.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsi(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/si.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootso(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/so.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootsy(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/sy.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootth(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/th.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottj(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tj.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottt(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tt.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottw(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tw.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def roottz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/tz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootua(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ua.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootug(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ug.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootuk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/uk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootuk_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/uk_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootuk_sportstribal(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/uk_sportstribal.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootunsorted(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/unsorted.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_adultiptv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_adultiptv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_adultswim(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_adultswim.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_bumblebee(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_bumblebee.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_distro(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_distro.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_filmon(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_filmon.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_fubo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_fubo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_glewedtv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_glewedtv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_imdbtv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_imdbtv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_klowdtv(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_klowdtv.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_localnow(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_localnow.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_pbs(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_pbs.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_plex(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_plex.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_pluto(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_pluto.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_redbox(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_redbox.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_redtraffic(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_redtraffic.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_roku(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_roku.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_samsung(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_samsung.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_stirr(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_stirr.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_tcl(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_tcl.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_teleup(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_teleup.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_tubi(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_tubi.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_vizio(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_vizio.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootus_xumo(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/us_xumo.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootuy(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/uy.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootuz(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/uz.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootva(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/va.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootve(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ve.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootvn(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/vn.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootxk(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/xk.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootye(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/ye.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list
            
    def rootzm(self):
            regex.clear()
            url = 'https://raw.githubusercontent.com/iptv-org/iptv/master/channels/zm.m3u'
            self.list = self.construct_mag(url)
            for i in self.list: i.update({'content': 'addons'})
            self.addDirectory(self.list)
            return self.list

    def get(self, url):
            self.list = self.construct_mag(url)
            self.worker()
            self.addDirectory(self.list)
            return self.list

    def getq(self, url):
            self.list = self.construct_mag(url)
            self.worker()
            self.addDirectory(self.list, queue=True)
            return self.list

    def getx(self, url, worker=False):
            r, x = re.findall('(.+?)\|regex=(.+?)$', url)[0]
            x = regex.fetch(x)
            r += urllib_parse.unquote_plus(x)
            url = regex.resolve(r)
            self.list = self.construct_mag('', result=url)
            self.addDirectory(self.list)
            return self.list

    def developer(self):
            url = os.path.join(control.dataPath, 'testings.xml')
            f = control.openFile(url)
            result = f.read()
            f.close()
            self.list = self.construct_mag('', result=result)
            for i in self.list:
                i.update({'content': 'videos'})
            self.addDirectory(self.list)
            return self.list

    def youtube(self, url, action):
        try:
            key = trailer.trailer().key_link.split('=', 1)[-1]

            if 'PlaylistTuner' in action:
                self.list = cache.get(youtube.youtube(key=key).playlist, 1, url)
            elif 'Playlist' in action:
                self.list = cache.get(youtube.youtube(key=key).playlist, 1, url, True)
            elif 'ChannelTuner' in action:
                self.list = cache.get(youtube.youtube(key=key).videos, 1, url)
            elif 'Channel' in action:
                self.list = cache.get(youtube.youtube(key=key).videos, 1, url, True)

            if 'Tuner' in action:
                for i in self.list: i.update({'name': i['title'], 'poster': i['image'], 'action': 'plugin', 'folder': False})
                if 'Tuner2' in action: self.list = sorted(self.list, key=lambda x: random.random())
                self.addDirectory(self.list, queue=True)
            else:
                for i in self.list: i.update({'name': i['title'], 'poster': i['image'], 'nextaction': action, 'action': 'play', 'folder': False})
                self.addDirectory(self.list)

            return self.list
        except:
            pass



    def construct_mag(self, url, result=None):

            if result == None:
                result = cache.get(client.request, 0, url)

            if result.strip().startswith('#EXTM3U') and '#EXTINF' in result:
                result = re.compile(
                    '#EXTINF:.+?\,(.+?)\n(.+?)\n', re.MULTILINE | re.DOTALL).findall(result)
                result = ['<item><title>%s</title><link>%s</link></item>' %
                          (i[0], i[1]) for i in result]
                result = ''.join(result)

            try: 
                r = base64.b64decode(result)
                r= six_decode(r)
            except: r = ''
            if '</link>' in r: result = r

            result = six.ensure_str(result)

            #result = self.account_filter(result)

            info = result.split('<item>')[0].split('<dir>')[0]

            try: vip = re.findall('<poster>(.+?)</poster>', info)[0]
            except: vip = '0'

            try: image = re.findall('<thumbnail>(.+?)</thumbnail>', info)[0]
            except: image = '0'

            try: fanart = re.findall('<fanart>(.+?)</fanart>', info)[0]
            except: fanart = '0'

            items = re.compile('((?:<item>.+?</item>|<dir>.+?</dir>|<plugin>.+?</plugin>|<info>.+?</info>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><mode>[^<]+</mode>|<name>[^<]+</name><link>[^<]+</link><thumbnail>[^<]+</thumbnail><date>[^<]+</date>))', re.MULTILINE|re.DOTALL).findall(result)

            for item in items:
                regdata = re.compile('(<regex>.+?</regex>)', re.MULTILINE|re.DOTALL).findall(item)
                regdata = ''.join(regdata)
                reglist = re.compile('(<listrepeat>.+?</listrepeat>)', re.MULTILINE|re.DOTALL).findall(regdata)
                regdata = urllib_parse.quote_plus(regdata)

                reghash = hashlib.md5()
                for i in regdata:
                    if PY2:
                        reghash.update(str(i))
                    else:
                        reghash.update(i.encode('utf-8'))
                reghash = str(reghash.hexdigest())
                item = item.replace('\r','').replace('\n','').replace('\t','').replace('&nbsp;','')
                item = re.sub('<regex>.+?</regex>','', item)
                item = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', item)
                item = re.sub('<link></link>','', item)

                name = re.sub('<meta>.+?</meta>','', item)
                try: name = re.findall('<title>(.+?)</title>', name)[0]
                except: name = re.findall('<name>(.+?)</name>', name)[0]

                try: date = re.findall('<date>(.+?)</date>', item)[0]
                except: date = ''
                if re.search(r'\d+', date): name += ' [COLOR red] Updated %s[/COLOR]' % date

                try: image2 = re.findall('<thumbnail>(.+?)</thumbnail>', item)[0]
                except: image2 = image

                try: fanart2 = re.findall('<fanart>(.+?)</fanart>', item)[0]
                except: fanart2 = fanart

                try: meta = re.findall('<meta>(.+?)</meta>', item)[0]
                except: meta = '0'

                try: url = re.findall('<link>(.+?)</link>', item)[0]
                except: url = '0'
                url = url.replace('>search<', '><preset>search</preset>%s<' % meta)
                url = '<preset>search</preset>%s' % meta if url == 'search' else url
                url = url.replace('>searchsd<', '><preset>searchsd</preset>%s<' % meta)
                url = '<preset>searchsd</preset>%s' % meta if url == 'searchsd' else url
                url = re.sub('<sublink></sublink>|<sublink\s+name=(?:\'|\").*?(?:\'|\")></sublink>','', url)

                if item.startswith('<item>'): action = 'play'
                elif item.startswith('<plugin>'): action = 'plugin'
                elif item.startswith('<info>') or url == '0': action = '0'
                else: action = 'directory'
                if action == 'play' and reglist: action = 'xdirectory'

                if not regdata == '':
                    self.hash.append({'regex': reghash, 'response': regdata})
                    url += '|regex=%s' % reghash

                if action in ['directory', 'xdirectory', 'plugin']:
                    folder = True
                else:
                    folder = False

                try: content = re.findall('<content>(.+?)</content>', meta)[0]
                except: content = '0'
                if content == '0':
                    try: content = re.findall('<content>(.+?)</content>', item)[0]
                    except: content = '0'
                if not content == '0': content += 's'

                if 'tvshow' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvindexer</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
                    action = 'tvtuner'

                if 'tvtuner' in content and not url.strip().endswith('.xml'):
                    url = '<preset>tvtuner</preset><url>%s</url><thumbnail>%s</thumbnail><fanart>%s</fanart>%s' % (url, image2, fanart2, meta)
                    action = 'tvtuner'

                try: imdb = re.findall('<imdb>(.+?)</imdb>', meta)[0]
                except: imdb = '0'

                try: tvdb = re.findall('<tvdb>(.+?)</tvdb>', meta)[0]
                except: tvdb = '0'

                try: tvshowtitle = re.findall('<tvshowtitle>(.+?)</tvshowtitle>', meta)[0]
                except: tvshowtitle = '0'

                try: title = re.findall('<title>(.+?)</title>', meta)[0]
                except: title = '0'

                if title == '0' and not tvshowtitle == '0': title = tvshowtitle

                try: year = re.findall('<year>(.+?)</year>', meta)[0]
                except: year = '0'

                try: premiered = re.findall('<premiered>(.+?)</premiered>', meta)[0]
                except: premiered = '0'

                try: season = re.findall('<season>(.+?)</season>', meta)[0]
                except: season = '0'

                try: episode = re.findall('<episode>(.+?)</episode>', meta)[0]
                except: episode = '0'

                self.list.append({'name': name, 'vip': vip, 'url': url, 'action': action, 'folder': folder, 'poster': image2, 'banner': '0', 'fanart': fanart2, 'content': content, 'imdb': imdb, 'tvdb': tvdb, 'tmdb': '0', 'title': title, 'originaltitle': title, 'tvshowtitle': tvshowtitle, 'year': year, 'premiered': premiered, 'season': season, 'episode': episode})
                                                                                                                                                                                                                                                                                                                                

            regex.insert(self.hash)

            return self.list

    def worker(self):

        self.imdb_info_link = 'http://www.omdbapi.com/?i=%s&plot=full&r=json'
        self.tvmaze_info_link = 'http://api.tvmaze.com/lookup/shows?thetvdb=%s'
        self.lang = 'en'

        self.meta = []
        total = len(self.list)
        if total == 0: return

        for i in list(range(0, total)): self.list[i].update({'metacache': False})
        self.list = metacache.fetch(self.list, self.lang)

        multi = [i['imdb'] for i in self.list]
        multi = [x for y,x in enumerate(multi) if x not in multi[:y]]
        if len(multi) == 1:
                self.movie_info(0) ; self.tv_info(0)
                if self.meta: metacache.insert(self.meta)

        for i in list(range(0, total)): self.list[i].update({'metacache': False})
        self.list = metacache.fetch(self.list, self.lang)

        for r in list(range(0, total, 50)):
            threads = []
            for i in list(range(r, r+50)):
                if i <= total: threads.append(workers.Thread(self.movie_info, i))
                if i <= total: threads.append(workers.Thread(self.tv_info, i))
            [i.start() for i in threads]
            [i.join() for i in threads]

        if self.meta: metacache.insert(self.meta)

    def movie_info(self, i):
        try:
            if self.list[i]['metacache'] == True: raise Exception()

            if not self.list[i]['content'] == 'movies': raise Exception()

            imdb = self.list[i]['imdb']
            if imdb == '0': raise Exception()

            url = self.imdb_info_link % imdb

            item = client.request(url, timeout='10')
            item = json.loads(item)

            if 'Error' in item and 'incorrect imdb' in item['Error'].lower():
                return self.meta.append({'imdb': imdb, 'tmdb': '0', 'tvdb': '0', 'lang': self.lang, 'item': {'code': '0'}})

            title = item['Title']
            six.ensure_str(title)
            if not title == '0': self.list[i].update({'title': title})

            year = item['Year']
            six.ensure_str(year)
            if not year == '0': self.list[i].update({'year': year})

            imdb = item['imdbID']
            if imdb == None or imdb == '' or imdb == 'N/A': imdb = '0'
            six.ensure_str(imdb)
            if not imdb == '0': self.list[i].update({'imdb': imdb, 'code': imdb})

            premiered = item['Released']
            if premiered == None or premiered == '' or premiered == 'N/A': premiered = '0'
            premiered = re.findall('(\d*) (.+?) (\d*)', premiered)
            try: premiered = '%s-%s-%s' % (premiered[0][2], {'Jan':'01', 'Feb':'02', 'Mar':'03', 'Apr':'04', 'May':'05', 'Jun':'06', 'Jul':'07', 'Aug':'08', 'Sep':'09', 'Oct':'10', 'Nov':'11', 'Dec':'12'}[premiered[0][1]], premiered[0][0])
            except: premiered = '0'
            six.ensure_str(premiered)
            if not premiered == '0': self.list[i].update({'premiered': premiered})

            genre = item['Genre']
            if genre == None or genre == '' or genre == 'N/A': genre = '0'
            genre = genre.replace(', ', ' / ')
            six.ensure_str(genre)
            if not genre == '0': self.list[i].update({'genre': genre})

            duration = item['Runtime']
            if duration == None or duration == '' or duration == 'N/A': duration = '0'
            duration = re.sub('[^0-9]', '', str(duration))
            try: duration = str(int(duration) * 60)
            except: pass
            six.ensure_str(duration)
            if not duration == '0': self.list[i].update({'duration': duration})

            rating = item['imdbRating']
            if rating == None or rating == '' or rating == 'N/A' or rating == '0.0': rating = '0'
            six.ensure_str(rating)
            if not rating == '0': self.list[i].update({'rating': rating})

            votes = item['imdbVotes']
            try: votes = str(format(int(votes),',d'))
            except: pass
            if votes == None or votes == '' or votes == 'N/A': votes = '0'
            six.ensure_str(votes)
            if not votes == '0': self.list[i].update({'votes': votes})

            mpaa = item['Rated']
            if mpaa == None or mpaa == '' or mpaa == 'N/A': mpaa = '0'
            six.ensure_str(mpaa)
            if not mpaa == '0': self.list[i].update({'mpaa': mpaa})

            director = item['Director']
            if director == None or director == '' or director == 'N/A': director = '0'
            director = director.replace(', ', ' / ')
            director = re.sub(r'\(.*?\)', '', director)
            director = ' '.join(director.split())
            six.ensure_str(director)
            if not director == '0': self.list[i].update({'director': director})

            writer = item['Writer']
            if writer == None or writer == '' or writer == 'N/A': writer = '0'
            writer = writer.replace(', ', ' / ')
            writer = re.sub(r'\(.*?\)', '', writer)
            writer = ' '.join(writer.split())
            six.ensure_str(writer)
            if not writer == '0': self.list[i].update({'writer': writer})

            cast = item['Actors']
            if cast == None or cast == '' or cast == 'N/A': cast = '0'
            cast = [x.strip() for x in cast.split(',') if not x == '']
            try: cast = [(six.ensure_str(x), '') for x in cast]
            except: cast = []
            if cast == []: cast = '0'
            if not cast == '0': self.list[i].update({'cast': cast})

            plot = item['Plot']
            if plot == None or plot == '' or plot == 'N/A': plot = '0'
            plot = client.replaceHTMLCodes(plot)
            six.ensure_str(plot)
            if not plot == '0': self.list[i].update({'plot': plot})

            director = writer = ''
            if 'crew' in people and 'directing' in people['crew']:
                director = ', '.join([director['person']['name'] for director in people['crew']
                                      ['directing'] if director['job'].lower() == 'director'])
            if 'crew' in people and 'writing' in people['crew']:
                writer = ', '.join([writer['person']['name'] for writer in people['crew']
                                    ['writing'] if writer['job'].lower() in ['writer', 'screenplay', 'author']])

            cast = []
            for person in people.get('cast', []):
                cast.append(
                    {'name': person['person']['name'], 'role': person['character']})
            cast = [(person['name'], person['role']) for person in cast]

            self.meta.append({'imdb': imdb, 'tmdb': '0', 'tvdb': '0', 'lang': self.lang, 'item': {'title': title, 'year': year, 'code': imdb, 'imdb': imdb, 'premiered': premiered,
                                                                                                  'genre': genre, 'duration': duration, 'rating': rating, 'votes': votes, 'mpaa': mpaa, 'director': director, 'writer': writer, 'cast': cast, 'plot': plot}})
        except:
            pass

    def tv_info(self, i):
        try:
            if self.list[i]['metacache'] == True: raise Exception()

            if not self.list[i]['content'] in ['tvshows', 'seasons', 'episodes']: raise Exception()

            tvdb = self.list[i]['tvdb']
            if tvdb == '0': raise Exception()

            url = self.tvmaze_info_link % tvdb

            item = client.request(url, output='extended', error=True, timeout='10')

            if item[1] == '404':
                return self.meta.append({'imdb': '0', 'tmdb': '0', 'tvdb': tvdb, 'lang': self.lang, 'item': {'code': '0'}})

            item = json.loads(item[0])

            tvshowtitle = item['name']
            six.ensure_str(tvshowtitle)
            if not tvshowtitle == '0': self.list[i].update({'tvshowtitle': tvshowtitle})

            year = item['premiered']
            year = re.findall('(\d{4})', year)[0]
            six.ensure_str(year)
            if not year == '0': self.list[i].update({'year': year})

            try: imdb = item['externals']['imdb']
            except: imdb = '0'
            if imdb == '' or imdb == None: imdb = '0'
            six.ensure_str(imdb)
            if self.list[i]['imdb'] == '0' and not imdb == '0': self.list[i].update({'imdb': imdb})

            try: studio = item['network']['name']
            except: studio = '0'
            if studio == '' or studio == None: studio = '0'
            six.ensure_str(studio)
            if not studio == '0': self.list[i].update({'studio': studio})

            genre = item['genres']
            if genre == '' or genre == None or genre == []: genre = '0'
            genre = ' / '.join(genre)
            six.ensure_str(genre)
            if not genre == '0': self.list[i].update({'genre': genre})

            try: duration = str(item['runtime'])
            except: duration = '0'
            if duration == '' or duration == None: duration = '0'
            try: duration = str(int(duration) * 60)
            except:
                pass
            six.ensure_str(duration)
            if not duration == '0': self.list[i].update({'duration': duration})

            rating = str(item['rating']['average'])
            if rating == '' or rating == None: rating = '0'
            six.ensure_str(rating)
            if not rating == '0': self.list[i].update({'rating': rating})

            plot = item['summary']
            if plot == '' or plot == None: plot = '0'
            plot = re.sub('\n|<.+?>|</.+?>|.+?#\d*:', '', plot)
            six.ensure_str(plot)
            if not plot == '0': self.list[i].update({'plot': plot})

            self.meta.append({'imdb': imdb, 'tmdb': '0', 'tvdb': tvdb, 'lang': self.lang, 'item': {'tvshowtitle': tvshowtitle, 'year': year, 'code': imdb, 'imdb': imdb, 'tvdb': tvdb, 'studio': studio, 'genre': genre, 'duration': duration, 'rating': rating, 'plot': plot}})
        except:
            pass

    def addDirectory(self, items, queue=False):
        if items == None or len(items) == 0: return

        sysaddon = sys.argv[0]
        addonPoster = addonBanner = control.addonInfo('icon')
        addonFanart = control.addonInfo('fanart')

        playlist = control.playlist
        if not queue == False: playlist.clear()

        try: devmode = True if 'testings.xml' in control.listDir(control.dataPath)[1] else False
        except: devmode = False

        mode = [i['content'] for i in items if 'content' in i]
        if 'movies' in mode: mode = 'movies'
        elif 'tvshows' in mode: mode = 'tvshows'
        elif 'seasons' in mode: mode = 'seasons'
        elif 'episodes' in mode: mode = 'episodes'
        elif 'videos' in mode: mode = 'videos'
        else: mode = 'addons'

        for i in items:
                try: name = control.lang(int(i['name'])).encode('utf-8')
                except:
                    name = i['name']
                    pass

                url = '%s?action=%s' % (sysaddon, i['action'])
                try: url += '&url=%s' % urllib_parse.quote_plus(i['url'])
                except:
                    pass
                try: url += '&content=%s' % urllib_parse.quote_plus(i['content'])
                except:
                    pass

                if i['action'] == 'plugin' and 'url' in i: url = i['url']

                try: devurl = dict(urllib_parse.parse_qsl(urllib_parse.urlparse(url).query))['action']
                except:
                    devurl = None

                if devurl == 'developer' and not devmode == True: continue

                poster = i['poster'] if 'poster' in i else '0'
                banner = i['banner'] if 'banner' in i else '0'
                fanart = i['fanart'] if 'fanart' in i else '0'
                if poster == '0': poster = addonPoster
                if banner == '0' and poster == '0': banner = addonBanner
                elif banner == '0': banner = poster

                content = i['content'] if 'content' in i else '0'
                folder = i['folder'] if 'folder' in i else True
                meta = dict((k,v) for k, v in six.iteritems(i) if not v == '0')

                cm = []

                if content in ['movies', 'tvshows']:
                    meta.update({'trailer': '%s?action=trailer&name=%s' % (sysaddon, urllib_parse.quote_plus(name))})
                    cm.append((control.lang(30707).encode('utf-8'), 'RunPlugin(%s?action=trailer&name=%s)' % (sysaddon, urllib_parse.quote_plus(name))))

                if content in ['movies', 'tvshows', 'seasons', 'episodes']:
                    cm.append((control.lang(30708).encode('utf-8'), 'XBMC.Action(Info)'))

                if (folder == False and not '|regex=' in str(i.get('url'))) or (folder == True and content in ['tvshows', 'seasons']):
                    cm.append((control.lang(30723).encode('utf-8'), 'RunPlugin(%s?action=queueItem)' % sysaddon))

                if content == 'movies':
                    try: dfile = '%s (%s)' % (i['title'], i['year'])
                    except:
                        dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'),  'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib_parse.quote_plus(dfile), urllib_parse.quote_plus(i['url']), urllib_parse.quote_plus(poster))))
                    except:
                        pass
                elif content == 'episodes':
                    try: dfile = '%s S%02dE%02d' % (i['tvshowtitle'], int(i['season']), int(i['episode']))
                    except: dfile = name
                    try: cm.append((control.lang(30722).encode('utf-8'),  'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib_parse.quote_plus(dfile), urllib_parse.quote_plus(i['url']), urllib_parse.quote_plus(poster))))
                    except:
                        pass
                elif content == 'songs':
                    try: cm.append((control.lang(30722).encode('utf-8'), 'RunPlugin(%s?action=addDownload&name=%s&url=%s&image=%s)' % (sysaddon, urllib_parse.quote_plus(name), urllib_parse.quote_plus(i['url']), urllib_parse.quote_plus(poster))))
                    except:
                        pass


                if mode == 'movies':
                    cm.append((control.lang(30711).encode('utf-8'), 'RunPlugin(%s?action=addView&content=movies)' % sysaddon))
                elif mode == 'tvshows':
                    cm.append((control.lang(30712).encode('utf-8'), 'RunPlugin(%s?action=addView&content=tvshows)' % sysaddon))
                elif mode == 'seasons':
                    cm.append((control.lang(30713).encode('utf-8'), 'RunPlugin(%s?action=addView&content=seasons)' % sysaddon))
                elif mode == 'episodes':
                    cm.append((control.lang(30714).encode('utf-8'), 'RunPlugin(%s?action=addView&content=episodes)' % sysaddon))

                if devmode == True:
                    try: cm.append(('Open in browser', 'RunPlugin(%s?action=browser&url=%s)' % (sysaddon, urllib_parse.quote_plus(i['url']))))
                    except: pass

                item = control.item(label=name)



                try: item.setArt({'icon': poster, 'thumb': poster, 'poster': poster, 'tvshow.poster': poster, 'season.poster': poster, 'banner': banner, 'tvshow.banner': banner, 'season.banner': banner})
                except:
                    pass

                if not fanart == '0':
                    item.setProperty('Fanart_Image', fanart)
                elif not addonFanart == None:
                    item.setProperty('Fanart_Image', addonFanart)

                if queue == False:
                    item.setInfo(type='Video', infoLabels = meta)
                    item.addContextMenuItems(cm)
                    control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=folder)
                else:
                    item.setInfo(type='Video', infoLabels = meta)
                    playlist.add(url=url, listitem=item)


        if not queue == False:
            return control.player.play(playlist)

        try:
            i = items[0]
            if i['next'] == '': raise Exception()
            url = '%s?action=%s&url=%s' % (sysaddon, i['nextaction'], urllib_parse.quote_plus(i['next']))
            item = control.item(label=control.lang(30500).encode('utf-8'))
            item.setArt({'addonPoster': addonPoster, 'thumb': addonPoster, 'poster': addonPoster, 'tvshow.poster': addonPoster, 'season.poster': addonPoster, 'banner': addonPoster, 'tvshow.banner': addonPoster, 'season.banner': addonPoster})
            item.setProperty('addonFanart_Image', addonFanart)
            control.addItem(handle=int(sys.argv[1]), url=url, listitem=item, isFolder=True)
        except:
            pass

        if not mode == None: control.content(int(sys.argv[1]), mode)
        control.directory(int(sys.argv[1]), cacheToDisc=True)
        if mode in ['movies', 'tvshows', 'seasons', 'episodes']:
            views.setView(mode, {'skin.estuary': 55})


class resolver:
    def browser(self, url):
        try:
            url = self.get(url)
            if url == False: return
            control.execute('RunPlugin(plugin://plugin.program.chrome.launcher/?url=%s&mode=showSite&stopPlayback=no)' % urllib_parse.quote_plus(url))
        except:
            pass


    def link(self, url):
        try:
            url = self.get(url)
            if url == False: return

            control.execute('ActivateWindow(busydialog)')
            url = self.process(url)
            control.execute('Dialog.Close(busydialog)')

            if url == None: return control.infoDialog(control.lang(30705).encode('utf-8'))
            return url
        except:
            pass

    def get(self, url):
        try:
            items = re.compile('<sublink(?:\s+name=|)(?:\'|\"|)(.*?)(?:\'|\"|)>(.+?)</sublink>').findall(url)

            if len(items) == 0: return url
            if len(items) == 1: return items[0][1]

            items = [('Link %s' % (int(items.index(i))+1) if i[0] == '' else i[0], i[1]) for i in items]

            select = control.selectDialog([i[0] for i in items], control.infoLabel('listitem.label'))

            if select == -1: return False
            else: return items[select][1]
        except:
            pass

    def f4m(self, url, name):
            try:
                if not any(i in url for i in ['.f4m', '.ts']): raise Exception()
                ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
                if not ext in ['f4m', 'ts']: raise Exception()

                params = urllib_parse.parse_qs(url)

                try: proxy = params['proxy'][0]
                except: proxy = None

                try: proxy_use_chunks = json.loads(params['proxy_for_chunks'][0])
                except: proxy_use_chunks = True

                try: maxbitrate = int(params['maxbitrate'][0])
                except: maxbitrate = 0

                try: simpleDownloader = json.loads(params['simpledownloader'][0])
                except: simpleDownloader = False

                try: auth_string = params['auth'][0]
                except: auth_string = ''

                try: streamtype = params['streamtype'][0]
                except: streamtype = 'TSDOWNLOADER' if ext == 'ts' else 'HDS'

                try: swf = params['swf'][0]
                except: swf = None

                from F4mProxy import f4mProxyHelper
                return f4mProxyHelper().playF4mLink(url, name, proxy, proxy_use_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, False, swf)
            except:
                pass

    def process(self, url, direct=True):
        try:
            if not any(i in url for i in ['.jpg', '.png', '.gif']): raise Exception()
            ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower()
            if not ext in ['jpg', 'png', 'gif']: raise Exception()
            try:
                i = os.path.join(control.dataPath,'img')
                control.deleteFile(i)
                f = control.openFile(i, 'w')
                f.write(client.request(url))
                f.close()
                control.execute('ShowPicture("%s")' % i)
                return False
            except:
                return
        except:
            pass

        try:
            r, x = re.findall('(.+?)\|regex=(.+?)$', url)[0]
            x = regex.fetch(x)
            r += urllib_parse.unquote_plus(x)
            if not '</regex>' in r: raise Exception()
            u = regex.resolve(r)
            if not u == None: url = u
        except:
            pass

        try:
            if not url.startswith('rtmp'):
                raise Exception()
            if len(re.compile('\s*timeout=(\d*)').findall(url)) == 0:
                url += ' timeout=10'
            return url
        except:
            pass

        try:
            if not any(i in url for i in ['.m3u8', '.f4m', '.ts']):
                raise Exception()
            ext = url.split('?')[0].split('&')[0].split(
                '|')[0].rsplit('.')[-1].replace('/', '').lower()
            if not ext in ['m3u8', 'f4m', 'ts']:
                raise Exception()
            return url
        except:
            pass

        try:
            preset = re.findall('<preset>(.+?)</preset>', url)[0]

            if not 'search' in preset:
                raise Exception()

            title, year, imdb = re.findall('<title>(.+?)</title>', url)[0], re.findall(
                '<year>(.+?)</year>', url)[0], re.findall('<imdb>(.+?)</imdb>', url)[0]

            try:
                tvdb, tvshowtitle, premiered, season, episode = re.findall('<tvdb>(.+?)</tvdb>', url)[0], re.findall('<tvshowtitle>(.+?)</tvshowtitle>', url)[0], re.findall(
                    '<premiered>(.+?)</premiered>', url)[0], re.findall('<season>(.+?)</season>', url)[0], re.findall('<episode>(.+?)</episode>', url)[0]
            except:
                tvdb = tvshowtitle = premiered = season = episode = None

            direct = False

            quality = 'HD' if not preset == 'searchsd' else 'SD'

            from resources.lib.modules import sources

            u = sources.sources().getSources(title, year, imdb, tvdb, season,
                                              episode, tvshowtitle, premiered, quality)

            if not u == None:
                return u
        except:
            pass

        try:
            from resources.lib.modules import sources

            u = sources.sources().getURISource(url)

            if not u == False:
                direct = False
            if u == None or u == False:
                raise Exception()

            return u
        except:
            pass

        try:
            if not '.google.com' in url:
                raise Exception()
            from resources.lib.modules import directstream
            u = directstream.google(url)[0]['url']
            return u
        except:
            pass

        try:
            if not 'filmon.com/' in url:
                raise Exception()
            from resources.lib.modules import filmon
            u = filmon.resolve(url)
            return u
        except:
            pass

        try:
            import resolveurl

            hmf = resolveurl.HostedMediaFile(url=url)

            if hmf.valid_url() == False:
                raise Exception()

            direct = False
            u = hmf.resolve()

            if not u == False:
                return u
        except:
            pass

        if direct == True:
            return url


class player(xbmc.Player):
    def __init__ (self):
        xbmc.Player.__init__(self)


    def play(self, url, content=None):
            base = url

            url = resolver().get(url)
            if url == False: return

            control.execute('ActivateWindow(busydialog)')
            url = resolver().process(url)
            control.execute('Dialog.Close(busydialog)')

            if url == None: return control.infoDialog(control.lang(30705).encode('utf-8'))
            if url == False: return

            meta = {}
            for i in ['title', 'originaltitle', 'tvshowtitle', 'year', 'season', 'episode', 'genre', 'rating', 'votes', 'director', 'writer', 'plot', 'tagline']:
                try: meta[i] = control.infoLabel('listitem.%s' % i)
                except: pass
            meta = dict((k,v) for k, v in six.iteritems(meta) if not v == '')
            if not 'title' in meta: meta['title'] = control.infoLabel('listitem.label')
            icon = control.infoLabel('listitem.icon')


            self.name = meta['title'] ; self.year = meta['year'] if 'year' in meta else '0'

            self.getbookmark = True if (content == 'movies' or content == 'episodes') else False

            self.offset = bookmarks().get(self.name, self.year)

            f4m = resolver().f4m(url, self.name)
            if not f4m == None: return


            item = control.item(path=url)
            item.setArt({'icon': icon})
            item.setInfo(type='Video', infoLabels = meta)
            control.player.play(url, item)
            control.resolve(int(sys.argv[1]), True, item)

            self.totalTime = 0 ; self.currentTime = 0

            for i in list(range(0, 240)):
                if self.isPlayingVideo(): break
                control.sleep(1000)
            while self.isPlayingVideo():
                try:
                    self.totalTime = self.getTotalTime()
                    self.currentTime = self.getTime()
                except:
                    pass
                control.sleep(2000)
            control.sleep(5000)

    def onPlayBackStarted(self):
        control.execute('Dialog.Close(all,true)')
        if self.getbookmark == True and not self.offset == '0':
            self.seekTime(float(self.offset))

    def onPlayBackStopped(self):
        if self.getbookmark == True:
            bookmarks().reset(self.currentTime, self.totalTime, self.name, self.year)

    def onPlayBackEnded(self):
        self.onPlayBackStopped()


class bookmarks:
    def get(self, name, year='0'):
        try:
            offset = '0'

            #if not control.setting('bookmarks') == 'true': raise Exception()

            idFile = hashlib.md5()
            for i in name: idFile.update(str(i))
            for i in year: idFile.update(str(i))
            idFile = str(idFile.hexdigest())

            dbcon = database.connect(control.bookmarksFile)
            dbcur = dbcon.cursor()
            dbcur.execute("SELECT * FROM bookmark WHERE idFile = '%s'" % idFile)
            match = dbcur.fetchone()
            self.offset = str(match[1])
            dbcon.commit()

            if self.offset == '0': raise Exception()

            minutes, seconds = divmod(float(self.offset), 60) ; hours, minutes = divmod(minutes, 60)
            label = '%02d:%02d:%02d' % (hours, minutes, seconds)
            label = (control.lang(32502) % label).encode('utf-8')

            try: yes = control.dialog.contextmenu([label, control.lang(32501).encode('utf-8'), ])
            except: yes = control.yesnoDialog(label, '', '', str(name), control.lang(32503).encode('utf-8'), control.lang(32501).encode('utf-8'))

            if yes: self.offset = '0'

            return self.offset
        except:
            return offset

    def reset(self, currentTime, totalTime, name, year='0'):
        try:
            #if not control.setting('bookmarks') == 'true': raise Exception()

            timeInSeconds = str(currentTime)
            ok = int(currentTime) > 180 and (currentTime / totalTime) <= .92

            idFile = hashlib.md5()
            for i in name: idFile.update(str(i))
            for i in year: idFile.update(str(i))
            idFile = str(idFile.hexdigest())

            control.makeFile(control.dataPath)
            dbcon = database.connect(control.bookmarksFile)
            dbcur = dbcon.cursor()
            dbcur.execute("CREATE TABLE IF NOT EXISTS bookmark (""idFile TEXT, ""timeInSeconds TEXT, ""UNIQUE(idFile)"");")
            dbcur.execute("DELETE FROM bookmark WHERE idFile = '%s'" % idFile)
            if ok: dbcur.execute("INSERT INTO bookmark Values (?, ?)", (idFile, timeInSeconds))
            dbcon.commit()
        except:
            pass

