Example #1
0
def download(path, repo_path):
    '''
	Parameters
	----------
	path : string
		Link download zip repo.
	repo_path : string
		Tên thư mục của repo để kiểm tra đã cài chưa.
		Mặc định được gán cho item["label2"].
		Truyền "" để bỏ qua Kiểm tra đã cài
	'''
    if repo_path == "":
        repo_path = "temp"
        repo_zip = xbmc.translatePath(os.path.join(tmp, "%s.zip" % repo_path))
        urllib.urlretrieve(path, repo_zip)
        with contextlib.closing(zipfile.ZipFile(repo_zip, "r")) as z:
            z.extractall(addons_folder)
    else:
        repo_name = repo_path.split("/")[-1]
        extract_path = xbmc.translatePath("/".join(repo_path.split("/")[:-1]))
        local_path = xbmc.translatePath("%s" % repo_path)
        if not os.path.isdir(local_path):
            repo_zip = xbmc.translatePath(
                os.path.join(tmp, "%s.zip" % repo_name))
            urllib.urlretrieve(path, repo_zip)
            with contextlib.closing(zipfile.ZipFile(repo_zip, "r")) as z:
                z.extractall(extract_path)
Example #2
0
def tv_batch_add_to_library():
    """ Batch add tv shows to library """
    tv_batch_file = plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)
    if xbmcvfs.exists(tv_batch_file):
        try:
            f = open(xbmc.translatePath(tv_batch_file), 'r')
            r = f.read()
            f.close()
            ids = r.split('\n')
        except: return plugin.notify(msg='TVShows Batch Add File', title='Not found', delay=3000, image=get_icon_path("tv"))
        library_folder = setup_library(plugin.get_setting(SETTING_TV_LIBRARY_FOLDER))
        import_tvdb()
        for id in ids:
            if "," in id:
                csvs = id.split(',')
                for csv in csvs:
                    if str(csv).startswith("tt") and csv != "": tvdb_id = get_tvdb_id_from_imdb_id(csv)
                    else: tvdb_id = csv
                    show = tvdb[int(tvdb_id)]
                    batch_add_tvshows_to_library(library_folder, show)
            else:
                if str(id).startswith("tt") and id != "": tvdb_id = get_tvdb_id_from_imdb_id(id)
                else: tvdb_id = id
                if tvdb_id != "" and tvdb_id != None:
                    show = tvdb[int(tvdb_id)]
                    batch_add_tvshows_to_library(library_folder, show)
        os.remove(xbmc.translatePath(tv_batch_file))
        plugin.notify(msg='Adding tvshow strm-files', title='Starting library scan afterwards', delay=3000, image=get_icon_path("tv"))
        update_library()
        return True
Example #3
0
def download(download_path, repo_id):
    '''
	Parameters
	----------
	path : string
		Link download zip repo.
	repo_id : string
		Tên thư mục của repo để kiểm tra đã cài chưa.
		Mặc định được gán cho item["label2"].
		Truyền "" để bỏ qua Kiểm tra đã cài
	'''
    if repo_id == "":
        repo_id = "temp"
    if ":/" not in repo_id:
        zipfile_path = xbmc.translatePath(os.path.join(tmp,
                                                       "%s.zip" % repo_id))
        urllib.urlretrieve(download_path, zipfile_path)
        with zipfile.ZipFile(zipfile_path, "r") as z:
            z.extractall(addons_folder)
    else:
        zipfile_path = xbmc.translatePath(
            os.path.join(tmp, "%s.zip" % repo_id.split("/")[-1]))
        urllib.urlretrieve(download_path, zipfile_path)
        with zipfile.ZipFile(zipfile_path, "r") as z:
            z.extractall(xbmc.translatePath("/".join(repo_id.split("/")[:-1])))
Example #4
0
def write_list_id_files(misc_ids, tv_ids, movie_ids, slug, user):
    if len(misc_ids) > 0:
        misc_list_file_path = "special://home/userdata/addon_data/plugin.video.chappaai/misc_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(misc_list_file_path):
            os.remove(xbmc.translatePath(misc_list_file_path))
        misc_id_list = ""
        for id in misc_ids:
            misc_id_list = misc_id_list + str(id) + '\n'
        if not xbmcvfs.exists(misc_list_file_path):
            batch_add_file = xbmcvfs.File(misc_list_file_path, 'w')
            batch_add_file.write(misc_id_list)
            batch_add_file.close()
    if len(tv_ids) > 0:
        shows_list_file_path = "special://home/userdata/addon_data/plugin.video.chappaai/shows_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(shows_list_file_path):
            os.remove(xbmc.translatePath(shows_list_file_path))
        tv_id_list = ""
        for id in tv_ids:
            tv_id_list = tv_id_list + str(id) + '\n'
        if not xbmcvfs.exists(shows_list_file_path):
            batch_add_file = xbmcvfs.File(shows_list_file_path, 'w')
            batch_add_file.write(tv_id_list)
            batch_add_file.close()
    if len(movie_ids) > 0:
        movies_list_file_path = "special://home/userdata/addon_data/plugin.video.chappaai/movies_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(movies_list_file_path):
            os.remove(xbmc.translatePath(movies_list_file_path))
        movie_id_list = ""
        for id in movie_ids:
            movie_id_list = movie_id_list + str(id) + '\n'
        if not xbmcvfs.exists(movies_list_file_path):
            batch_add_file = xbmcvfs.File(movies_list_file_path, 'w')
            batch_add_file.write(movie_id_list)
            batch_add_file.close()
Example #5
0
def write_list_id_files(misc_ids, tv_ids, movie_ids, slug, user):
    if len(misc_ids) > 0:
        misc_list_file_path = "special://profile/addon_data/plugin.video.metalliq/misc_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(misc_list_file_path): os.remove(xbmc.translatePath(misc_list_file_path))
        misc_id_list = ""
        for id in misc_ids:
            misc_id_list = misc_id_list + str(id) + '\n'
        if not xbmcvfs.exists(misc_list_file_path):
            batch_add_file = xbmcvfs.File(misc_list_file_path, 'w')
            batch_add_file.write(misc_id_list)
            batch_add_file.close()
    if len(tv_ids) > 0:
        shows_list_file_path = "special://profile/addon_data/plugin.video.metalliq/shows_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(shows_list_file_path): os.remove(xbmc.translatePath(shows_list_file_path))
        tv_id_list = ""
        for id in tv_ids:
            tv_id_list = tv_id_list + str(id) + '\n'
        if not xbmcvfs.exists(shows_list_file_path):
            batch_add_file = xbmcvfs.File(shows_list_file_path, 'w')
            batch_add_file.write(tv_id_list)
            batch_add_file.close()
    if len(movie_ids) > 0:
        movies_list_file_path = "special://profile/addon_data/plugin.video.metalliq/movies_from_" + slug + "_by_" + user + ".txt"
        if xbmcvfs.exists(movies_list_file_path): os.remove(xbmc.translatePath(movies_list_file_path))
        movie_id_list = ""
        for id in movie_ids:
            movie_id_list = movie_id_list + str(id) + '\n'
        if not xbmcvfs.exists(movies_list_file_path):
            batch_add_file = xbmcvfs.File(movies_list_file_path, 'w')
            batch_add_file.write(movie_id_list)
            batch_add_file.close()
Example #6
0
def write_batch_id_files(tv_ids, movie_ids, misc_ids):
    if len(tv_ids) > 0:
        shows_import_file_path = "special://profile/addon_data/plugin.video.metalliq/shows_to_add.txt"
        if xbmcvfs.exists(shows_import_file_path): os.remove(xbmc.translatePath(shows_import_file_path))
        tv_id_list = ""
        for id in tv_ids:
            tv_id_list = tv_id_list + str(id) + '\n'
        if not xbmcvfs.exists(shows_import_file_path):
            batch_add_file = xbmcvfs.File(shows_import_file_path, 'w')
            batch_add_file.write(tv_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting tvshows, seasons & episodes', title='to id-list for batch-adding', delay=3000, image=get_icon_path("tvshows"))
    if len(movie_ids) > 0:
        movies_import_file_path = "special://profile/addon_data/plugin.video.metalliq/movies_to_add.txt"
        if xbmcvfs.exists(movies_import_file_path): os.remove(xbmc.translatePath(movies_import_file_path))
        movie_id_list = ""
        for id in movie_ids:
            movie_id_list = movie_id_list + str(id) + '\n'
        if not xbmcvfs.exists(movies_import_file_path):
            batch_add_file = xbmcvfs.File(movies_import_file_path, 'w')
            batch_add_file.write(movie_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting movies', title='to id-list for batch-adding', delay=3000, image=get_icon_path("movies"))
    if len(misc_ids) > 0:
        misc_import_file_path = "special://profile/addon_data/plugin.video.metalliq/misc_to_add.txt"
        if xbmcvfs.exists(misc_import_file_path): os.remove(xbmc.translatePath(misc_import_file_path))
        misc_id_list = ""
        for id in misc_ids:
            misc_id_list = misc_id_list + str(id) + '\n'
        if not xbmcvfs.exists(misc_import_file_path):
            batch_add_file = xbmcvfs.File(misc_import_file_path, 'w')
            batch_add_file.write(misc_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting miscellaneous', title='to id-list for batch-adding', delay=3000, image=get_icon_path("tvshows"))
Example #7
0
def write_batch_id_files(tv_ids, movie_ids, misc_ids):
    if len(tv_ids) > 0:
        shows_import_file_path = "special://profile/addon_data/plugin.video.metalliq/shows_to_add.txt"
        if xbmcvfs.exists(shows_import_file_path): os.remove(xbmc.translatePath(shows_import_file_path))
        tv_id_list = ""
        for id in tv_ids:
            tv_id_list = tv_id_list + str(id) + '\n'
        if not xbmcvfs.exists(shows_import_file_path):
            batch_add_file = xbmcvfs.File(shows_import_file_path, 'w')
            batch_add_file.write(tv_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting tvshows, seasons & episodes', title='to id-list for batch-adding', delay=3000, image=get_icon_path("tvshows"))
    if len(movie_ids) > 0:
        movies_import_file_path = "special://profile/addon_data/plugin.video.metalliq/movies_to_add.txt"
        if xbmcvfs.exists(movies_import_file_path): os.remove(xbmc.translatePath(movies_import_file_path))
        movie_id_list = ""
        for id in movie_ids:
            movie_id_list = movie_id_list + str(id) + '\n'
        if not xbmcvfs.exists(movies_import_file_path):
            batch_add_file = xbmcvfs.File(movies_import_file_path, 'w')
            batch_add_file.write(movie_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting movies', title='to id-list for batch-adding', delay=3000, image=get_icon_path("movies"))
    if len(misc_ids) > 0:
        misc_import_file_path = "special://profile/addon_data/plugin.video.metalliq/misc_to_add.txt"
        if xbmcvfs.exists(misc_import_file_path): os.remove(xbmc.translatePath(misc_import_file_path))
        misc_id_list = ""
        for id in misc_ids:
            misc_id_list = misc_id_list + str(id) + '\n'
        if not xbmcvfs.exists(misc_import_file_path):
            batch_add_file = xbmcvfs.File(misc_import_file_path, 'w')
            batch_add_file.write(misc_id_list)
            batch_add_file.close()
        dialogs.notify(msg='Converting miscellaneous', title='to id-list for batch-adding', delay=3000, image=get_icon_path("tvshows"))
def download(path,reponame):
	'''
	Parameters
	----------
	path : string
		Link download zip repo.
	reponame : string
		Tên thư mục của repo để kiểm tra đã cài chưa.
		Mặc định được gán cho item["label2"].
		Truyền "" để bỏ qua Kiểm tra đã cài
	'''
	if reponame == "":
		reponame = "temp"
		repo_zip = xbmc.translatePath(os.path.join(tmp,"%s.zip" % reponame))
		urllib.urlretrieve(path,repo_zip)
		with contextlib.closing(zipfile.ZipFile(repo_zip, "r")) as z:
			z.extractall(addons_folder)
	else:
		repo_path = xbmc.translatePath('special://home/addons/%s' % reponame)
		if not os.path.isdir(repo_path):
			if reponame == "": reponame = "temp"
			repo_zip = xbmc.translatePath(os.path.join(tmp,"%s.zip" % reponame))
			urllib.urlretrieve(path,repo_zip)
			with contextlib.closing(zipfile.ZipFile(repo_zip, "r")) as z:
				z.extractall(addons_folder)
Example #9
0
def movies_batch_add_to_library():
    """ Batch add movies to library """
    movie_batch_file = plugin.get_setting(SETTING_MOVIES_BATCH_ADD_FILE_PATH, unicode)
    if xbmcvfs.exists(movie_batch_file):
        try:
            f = open(xbmc.translatePath(movie_batch_file), 'r')
            r = f.read()
            f.close()
            ids = r.split('\n')
        except: return dialogs.notify(msg='Movies Batch Add File', title=_("%s not found").replace("%s ",""), delay=3000, image=get_icon_path("movies"))
        library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER, unicode))
        import_tmdb()
        for id in ids:
            if "," in id:
                csvs = id.split(',')
                for csv in csvs:
                    if not str(csv).startswith("tt") and csv != "":
                        movie = tmdb.Movies(csv).info()
                        csv = movie.get('imdb_id')
                    batch_add_movies_to_library(library_folder, csv)
            else:
                if not str(id).startswith("tt") and id != "":
                    movie = tmdb.Movies(id).info()
                    id = movie.get('imdb_id')
                batch_add_movies_to_library(library_folder, id)
        os.remove(xbmc.translatePath(movie_batch_file))
        if xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH, unicode)):
            xbmc.executebuiltin("RunPlugin(plugin://plugin.video.chappaai/tv/batch_add_to_library)")
            return True
        else:
            xbmc.sleep(1000)
            dialogs.notify(msg='Added movie strm-files', title='Starting library scan', delay=3000, image=get_icon_path("movies"))
            scan_library(type="video")
            return True
    if xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH, unicode)): xbmc.executebuiltin("RunPlugin(plugin://plugin.video.chappaai/tv/batch_add_to_library)")
Example #10
0
def IIi1IiiiI1Ii():
    I11i11Ii("None", "None")
    oO00oOo = xbmc.translatePath(
        xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
    oO00oOo = xbmc.translatePath(os.path.join(oO00oOo, "temp.jpg"))
    # urllib . urlretrieve ( 'https://googledrive.com/host/0B-ygKtjD8Sc-S04wUUxMMWt5dmM/images/anhtrang.jpg' , oO00oOo )
    # OOOo0 = xbmcgui . ControlImage ( 0 , 0 , 1280 , 720 , oO00oOo )
    # Oooo000o = xbmcgui . WindowDialog ( )
    # Oooo000o . addControl ( OOOo0 )
    # Oooo000o . doModal ( )
    # IiIi11iIIi1Ii = ""
    # Oo0O = ( "Busy" , "Bận" , "Band" , "Beschäftigt" , "Bezig" , "忙" , "忙碌" )
    # while True :
    # IiI = urllib . quote ( xbmc . getInfoLabel ( "System.KernelVersion" ) . strip ( ) )
    # if not any ( b in IiI for b in Oo0O ) : break
    # while True :
    # ooOo = urllib . quote ( xbmc . getInfoLabel ( "System.FriendlyName" ) . strip ( ) )
    # if not any ( b in ooOo for b in Oo0O ) : break
    # try :
    # IiIi11iIIi1Ii = open ( '/sys/class/net/eth0/address' ) . read ( ) . strip ( )
    # except :
    # while True :
    # IiIi11iIIi1Ii = xbmc . getInfoLabel ( "Network.MacAddress" ) . strip ( )
    # if re . match ( "[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$" , IiIi11iIIi1Ii . lower ( ) ) : break
    # Oo = urllib2 . urlopen ( "http://www.viettv24.com/main/checkActivation.php?MacID=%s&app_id=%s&sys=%s&dev=%s" % ( IiIi11iIIi1Ii , "2" , IiI , ooOo ) ) . read ( )
    if True:
        o0O = [{
            'label':
            'Phim mới',
            'path':
            '%s/latest/%s/%s' %
            (ii,
             urllib.quote_plus(
                 'http://phim.anhtrang.org/danh-sach/new/trang-%s.html'), 1)
        }, {
            'label':
            'Phim HD',
            'path':
            '%s/hd/%s/%s' %
            (ii,
             urllib.quote_plus(
                 'http://phim.anhtrang.org/danh-sach/phim-hd/trang-%s.html'),
             1)
        }, {
            'label': 'Thể loại',
            'path': '%s/genres' % ii
        }, {
            'label': 'Quốc gia',
            'path': '%s/nations' % ii
        }, {
            'label': 'Tìm kiếm',
            'path': '%s/search' % ii
        }]
        return oo000.finish(o0O)
    else:
        IiiIII111iI = xbmcgui.Dialog()
        IiiIII111iI.ok("Chú ý", Oo)
        if 34 - 34:
            iii1I1I / O00oOoOoO0o0O.O0oo0OO0 + Oo0ooO0oo0oO.I1i1iI1i - II
        if 100 - 100: i11Ii11I1Ii1i.ooO - OOoO / ooo0Oo0 * i1 - OOooo0000ooo
Example #11
0
def movies_batch_add_to_library():
    """ Batch add movies to library """
    movie_batch_file = plugin.get_setting(SETTING_MOVIES_BATCH_ADD_FILE_PATH)
    if xbmcvfs.exists(movie_batch_file):
        try:
            f = open(xbmc.translatePath(movie_batch_file), 'r')
            r = f.read()
            f.close()
            ids = r.split('\n')
        except: return plugin.notify(msg='Movies Batch Add File', title='Not found', delay=3000, image=get_icon_path("movies"))
        library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))
        import_tmdb()
        for id in ids:
            if "," in id:
                csvs = id.split(',')
                for csv in csvs:
                    if not str(csv).startswith("tt") and csv != "":
                        movie = tmdb.Movies(csv).info()
                        id = movie.get('imdb_id')
                    batch_add_movies_to_library(library_folder, id)
            else:
                if not str(id).startswith("tt") and id != "":
                    movie = tmdb.Movies(id).info()
                    id = movie.get('imdb_id')
                batch_add_movies_to_library(library_folder, id)
        os.remove(xbmc.translatePath(movie_batch_file))
        if xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)): 
            xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
            return True
        else:
            xbmc.sleep(1000)
            plugin.notify(msg='Added movie strm-files', title='Starting library scan', delay=3000, image=get_icon_path("movies"))
            scan_library(type="video")
            return True
    elif xbmcvfs.exists(plugin.get_setting(SETTING_TV_BATCH_ADD_FILE_PATH)): xbmc.executebuiltin("RunPlugin(plugin://plugin.video.metalliq/tv/batch_add_to_library)")
Example #12
0
def IIi1IiiiI1Ii():
    I11i11Ii("None", "None")
    # oO00oOo = ""
    # OOOo0 = ( "Busy" , "Bận" , "Band" , "Beschäftigt" , "Bezig" , "忙" , "忙碌" )
    # while True :
    # Oooo000o = urllib . quote ( xbmc . getInfoLabel ( "System.KernelVersion" ) . strip ( ) )
    # if not any ( b in Oooo000o for b in OOOo0 ) : break
    # while True :
    # IiIi11iIIi1Ii = urllib . quote ( xbmc . getInfoLabel ( "System.FriendlyName" ) . strip ( ) )
    # if not any ( b in IiIi11iIIi1Ii for b in OOOo0 ) : break
    # try :
    # oO00oOo = open ( '/sys/class/net/eth0/address' ) . read ( ) . strip ( )
    # except :
    # while True :
    # oO00oOo = xbmc . getInfoLabel ( "Network.MacAddress" ) . strip ( )
    # if re . match ( "[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$" , oO00oOo . lower ( ) ) : break
    # Oo0O = urllib2 . urlopen ( "http://www.viettv24.com/main/checkActivation.php?MacID=%s&app_id=%s&sys=%s&dev=%s" % ( oO00oOo , "10" , Oooo000o , IiIi11iIIi1Ii ) ) . read ( )
    if True:
        IiI = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo("path")).decode("utf-8")
        IiI = xbmc.translatePath(os.path.join(IiI, "temp.jpg"))
        # urllib . urlretrieve ( 'https://googledrive.com/host/0B-ygKtjD8Sc-S04wUUxMMWt5dmM/images/phim14.jpg' , IiI )
        # ooOo = xbmcgui . ControlImage ( 0 , 0 , 1280 , 720 , IiI )
        # Oo = xbmcgui . WindowDialog ( )
        # Oo . addControl ( ooOo )
        # Oo . doModal ( )
        if 67 - 67:
            O00ooOO.I1iII1iiII
        iI1Ii11111iIi = [
            {
                "label": "Phim mới",
                "path": "%s/latest/%s/%s"
                % (ii, urllib.quote_plus("http://m.phim14.net/danh-sach/phim-moi/page-%s.html"), 1),
            },
            {
                "label": "Phim lẻ",
                "path": "%s/movies/%s/%s"
                % (ii, urllib.quote_plus("http://m.phim14.net/danh-sach/phim-le/page-%s.html"), 1),
            },
            {
                "label": "Phim bộ",
                "path": "%s/series/%s/%s"
                % (ii, urllib.quote_plus("http://m.phim14.net/danh-sach/phim-bo/page-%s.html"), 1),
            },
            {"label": "Theo thể loại", "path": "%s/genres" % ii},
            {"label": "Theo Quốc gia", "path": "%s/nations" % ii},
            {"label": "Tìm kiếm", "path": "%s/search" % ii},
        ]
        return oo000.finish(iI1Ii11111iIi)
    else:
        i1i1II = xbmcgui.Dialog()
        i1i1II.ok("Chú ý", Oo0O)
        if 96 - 96:
            o0OO0 - Oo0ooO0oo0oO.I1i1iI1i - o00ooo0 / o00 * Oo0oO0ooo
        if 56 - 56:
            ooO00oOoo - O0OOo
Example #13
0
def dir(url, title=""):
    oO00oOo = []
    i1IIi11111i("Browse Menu [%s]" % title, "/dir/%s/%s" % (title, url))
    try:
        if "://" in url:
            pass
        else:
            oO00oOo = IiII("%s/dir/%s" % (oooo, urllib.quote_plus(url)))
            for iII11i in oO00oOo:
                if "plugin://" not in iII11i["path"]:
                    iII11i["path"] = iI11I1II1I1I + iII11i["path"]
                elif "plugin://plugin.video.f4mTester" in iII11i["path"]:
                    iII11i[
                        "path"] = iI11I1II1I1I + "/execbuiltin/" + urllib.quote_plus(
                            iII11i["path"])
                    if 70 - 70: IiIi1Iii1I1 * ooO00oOoo
                    if 46 - 46: i1iIIIiI1I / o0OIiiIII111iI
                    if 52 - 52: iiI1i1 - O0O + I1Ii + I1Ii - iiI1i1 / Ooooo
                    if 44 - 44:
                        i1iIIIiI1I.oo000i1iIi11iIIi1 - ooO00oOoo.ooO0OO000o - i1iIIIiI1I
                    if 92 - 92: IiIi1Iii1I1.i1iIIII + iiI1i1
                    if 28 - 28:
                        oo000i1iIi11iIIi1 * Oo - iiI1i1 * O0O0O0O00OooO * I1Ii / o0OIiiIII111iI
                    if 94 - 94: Iii1IIIiiI % ooO00oOoo / Ii11111i * I11i11Ii
                    if 54 - 54: iiI1i1 - iI + O0O
                    if 70 - 70: I1Ii / i1iIIII.IiIi1Iii1I1 % Oo
                    if 67 - 67:
                        Ii11111i * iiI1i1.O0O0O0O00OooO - o0OIiiIII111iI * iiI1i1
                    if 46 - 46:
                        i1iII1I1i1i1 + Ii11111i.iI * O0OOo % O0O0O0O00OooO
                    if 86 - 86: iI + I1Ii % ii1I * O0OOo.i1iIIIiI1I * i1iIIII
    except:
        oo000 = xbmc.translatePath(
            xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
        i1I11i1iI = xbmc.translatePath(os.path.join(oo000, "error_icon.jpg"))
        I1ii1Ii1 = xbmc.translatePath(os.path.join(oo000, "error_bg.jpg"))
        iii11 = xbmc.translatePath(os.path.join(oo000, "error_fullscreen.jpg"))
        if 68 - 68: o0OIiiIII111iI
        IIi1iIIiI = [{
            "label":
            "Connection Error! OK Here for more details",
            "path":
            "%s/showimage/%s" % (iI11I1II1I1I, urllib.quote_plus(iii11)),
            "thumbnail":
            i1I11i1iI,
            "properties": {
                'fanart_image': I1ii1Ii1
            }
        }]
        oO00oOo += IIi1iIIiI
    return O0.finish(oO00oOo)
    if 58 - 58:
        i1iIIIiI1I / Iii1IIIiiI - i1iII1I1i1i1 - ii1I % Ii11111i - Ooooo
Example #14
0
def IIi1IiiiI1Ii():
    I11i11Ii = xbmc.translatePath(
        xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
    I11i11Ii = xbmc.translatePath(os.path.join(I11i11Ii, "temp.jpg"))
    #urllib . urlretrieve ( 'https://googledrive.com/host/0B-ygKtjD8Sc-S04wUUxMMWt5dmM/images/kenh108.jpg' , I11i11Ii )
    #oO00oOo = xbmcgui . ControlImage ( 0 , 0 , 1280 , 720 , I11i11Ii )
    #OOOo0 = xbmcgui . WindowDialog ( )
    #OOOo0 . addControl ( oO00oOo )
    #OOOo0 . doModal ( )
    #Oooo000o = ""
    #IiIi11iIIi1Ii = ( "Busy" , "Bận" , "Band" , "Beschäftigt" , "Bezig" , "忙" , "忙碌" )
    #while True :
    #Oo0O = urllib . quote ( xbmc . getInfoLabel ( "System.KernelVersion" ) . strip ( ) )
    #if not any ( b in Oo0O for b in IiIi11iIIi1Ii ) : break
    #while True :
    #IiI = urllib . quote ( xbmc . getInfoLabel ( "System.FriendlyName" ) . strip ( ) )
    #if not any ( b in IiI for b in IiIi11iIIi1Ii ) : break
    #try :
    #Oooo000o = open ( '/sys/class/net/eth0/address' ) . read ( ) . strip ( )
    #except :
    #while True :
    #Oooo000o = xbmc . getInfoLabel ( "Network.MacAddress" ) . strip ( )
    #if re . match ( "[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$" , Oooo000o . lower ( ) ) : break
    #ooOo = urllib2 . urlopen ( "http://www.viettv24.com/main/checkActivation.php?MacID=%s&app_id=%s&sys=%s&dev=%s" % ( Oooo000o , "6" , Oo0O , IiI ) ) . read ( )
    if True:
        Oo = [{
            'label':
            'Recently Updated Videos',
            'path':
            '%s/updated/%s/%s' %
            (ii,
             urllib.quote_plus(
                 'http://www.lsb-movies.net/kenh108/index.php?do=list&type=recently_updated&page=%s'
             ), 1)
        }, {
            'label':
            'Recently Added Videos',
            'path':
            '%s/added/%s/%s' %
            (ii,
             urllib.quote_plus(
                 'http://www.lsb-movies.net/kenh108/index.php?do=list&type=more&page=%s'
             ), 1)
        }, {
            'label': 'Search',
            'path': '%s/search' % ii
        }]
        return oo000.finish(Oo)
    else:
        o0O = xbmcgui.Dialog()
        o0O.ok("Chú ý", ooOo)
        if 48 - 48: iII111i % IiII + I1Ii111 / ooOoO0o * o00O0oo
        if 97 - 97: oO0o0ooO0 - IIII / O0oO - o0oO0
Example #15
0
def setup_library(library_folder):
    if library_folder[-1] != "/": library_folder += "/"
    playlist_folder = plugin.get_setting(SETTING_TV_PLAYLIST_FOLDER, unicode)
    if plugin.get_setting(SETTING_TV_PLAYLIST_FOLDER, unicode)[-1] != "/":
        playlist_folder += "/"
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        xbmcvfs.mkdir(library_folder)
        # auto configure folder
        msg = _(
            "Would you like to automatically set [COLOR limegreen]M[/COLOR]etalli[COLOR limegreen]Q[/COLOR] 4[COLOR limegreen]Q[/COLOR]ed as a tv shows source?"
        )
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            try:
                source_thumbnail = get_icon_path("tv")
                source_name = "[COLOR limegreen]M[/COLOR]etalli[COLOR limegreen]Q[/COLOR] 4[COLOR limegreen]Q[/COLOR]ed " + _(
                    "TV shows")
                source_content = "('{0}','tvshows','metadata.tvdb.com','',0,0,'<settings><setting id=\"RatingS\" value=\"TheTVDB\" /><setting id=\"absolutenumber\" value=\"false\" /><setting id=\"dvdorder\" value=\"false\" /><setting id=\"fallback\" value=\"true\" /><setting id=\"fanart\" value=\"true\" /><setting id=\"language\" value=\"{1}\" /></settings>',0,0,NULL,NULL)".format(
                    library_folder, LANG)
                add_source(source_name, library_folder, source_content,
                           source_thumbnail)
            except:
                pass
    # return translated path
    return xbmc.translatePath(library_folder)
Example #16
0
    def _inside(self, num):
        if num == -1:
            self._inside_root(select=self.insideIndex)
            return

        with self.lock:
            source, links = self.items[num]

            if len(links) == 1:
                self.selection = links[0]
                self.close()
                return
            self.list.reset()
            for item in links:
                listitem = xbmcgui.ListItem(item['label'])
                listitem.setProperty("Path", item['path'])
                try:
                    if "plugin://" in links[0]['path']:
                        icon = xbmcaddon.Addon(id=links[0]['path'].split("/")
                                               [2]).getAddonInfo('icon')
                    else:
                        icon = xbmc.translatePath("{0}/folder.jpg".format(
                            links[0]['path'].rsplit("/", 2)[0]))
                    listitem.setIconImage(icon)
                    listitem.setThumbnailImage(icon)
                except:
                    pass
                self.list.addItem(listitem)
            self.insideIndex = num
Example #17
0
    def __init__(self, name, addon_id, filepath):
        self._name = name
        self._filepath = filepath
        self._addon_id = addon_id
        self._routes = []
        self._view_functions = {}
        self._addon = xbmcaddon.Addon(id=self._addon_id)

        # Keeps track of the added list items
        self._current_items = []

        # Gets initialized when self.run() is called
        self._request = None

        # A flag to keep track of a call to xbmcplugin.endOfDirectory()
        self._end_of_directory = False

        # The plugin's named logger
        self._log = setup_log(addon_id)

        # The path to the cache directory for the addon
        self._cache_path = xbmc.translatePath(
            'special://profile/addon_data/%s/.cache/' % self._addon_id)

        # If we are runing in CLI, we need to load the strings.xml manually
        # TODO: a better way to do this. Perhaps allow a user provided filepath
        if xbmcswift2.CLI_MODE:
            from xbmcswift2.mockxbmc import utils
            utils.load_addon_strings(self._addon,
                os.path.join(os.path.dirname(self._filepath), 'resources',
                             'language', 'English', 'strings.xml'))
Example #18
0
def add_source(source_name, source_path, source_content, source_thumbnail):    
    xml_file = xbmc.translatePath('special://profile/sources.xml')
    if not os.path.exists(xml_file):
        with open(xml_file, "w") as f:
            f.write("""<sources>
    <programs>
        <default pathversion="1" />
    </programs>
    <video>
        <default pathversion="1" />
    </video>
    <music>
        <default pathversion="1" />
    </music>
    <pictures>
        <default pathversion="1" />
    </pictures>
    <files>
        <default pathversion="1" />
    </files>
</sources>""")
    
    existing_source = _get_source_attr(xml_file, source_name, "path")
    if existing_source and existing_source != source_path:
        _remove_source_content(existing_source)
    
    if _add_source_xml(xml_file, source_name, source_path, source_thumbnail):
        _set_source_content(source_content)
Example #19
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    chappaai_playlist_folder = "special://profile/playlists/mixed/Chappaai/"
    if not xbmcvfs.exists(chappaai_playlist_folder):
        xbmcvfs.mkdir(chappaai_playlist_folder)
    playlist_folder = plugin.get_setting(SETTING_MOVIES_PLAYLIST_FOLDER,
                                         unicode)
    if plugin.get_setting(SETTING_MOVIES_PLAYLIST_FOLDER, unicode)[-1] != "/":
        playlist_folder += "/"
    # create folders
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        # auto configure folder
        msg = _(
            "Would you like to automatically set Chappaai as a movies video source?"
        )
        if dialogs.yesno(_("Library setup"), msg):
            source_thumbnail = get_icon_path("movies")
            source_name = "Chappaai " + _("Movies")
            source_content = "('{0}','movies','metadata.themoviedb.org','',2147483647,1,'<settings><setting id=\"RatingS\" value=\"TMDb\" /><setting id=\"certprefix\" value=\"Rated \" /><setting id=\"fanart\" value=\"true\" /><setting id=\"keeporiginaltitle\" value=\"false\" /><setting id=\"language\" value=\"{1}\" /><setting id=\"tmdbcertcountry\" value=\"us\" /><setting id=\"trailer\" value=\"true\" /></settings>',0,0,NULL,NULL)".format(
                library_folder, LANG)
            add_source(source_name, library_folder, source_content,
                       source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #20
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    playlist_folder = plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER,
                                         unicode)
    if plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER, unicode)[-1] != "/":
        playlist_folder += "/"
    # create folders
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        msg = _(
            "Would you like to automatically set [COLOR limegreen]M[/COLOR]etalli[COLOR limegreen]Q[/COLOR] 4[COLOR limegreen]Q[/COLOR]ed as a music source?"
        )
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            source_thumbnail = get_icon_path("musicvideos")
            source_name = "[COLOR limegreen]M[/COLOR]etalli[COLOR limegreen]Q[/COLOR] 4[COLOR limegreen]Q[/COLOR]ed " + _(
                "Music videos")
            source_content = "('{0}','musicvideos','metadata.musicvideos.theaudiodb.com','',2147483647,0,'<settings><setting id=\"fanarttvalbumthumbs\" value=\"true\" /><setting id=\"tadbalbumthumbs\" value=\"true\" /></settings>',0,0,NULL,NULL)".format(
                library_folder)
            add_source(source_name, library_folder, source_content,
                       source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #21
0
def add_source(source_name, source_path, source_content):
    xml_file = xbmc.translatePath('special://profile/sources.xml')
    if not os.path.exists(xml_file):
        with open(xml_file, "w") as f:
            f.write("""<sources>
    <programs>
        <default pathversion="1" />
    </programs>
    <video>
        <default pathversion="1" />
    </video>
    <music>
        <default pathversion="1" />
    </music>
    <pictures>
        <default pathversion="1" />
    </pictures>
    <files>
        <default pathversion="1" />
    </files>
</sources>""")

    existing_source = _get_source_attr(xml_file, source_name, "path")
    if existing_source and existing_source != source_path:
        _remove_source_content(existing_source)

    if _add_source_xml(xml_file, source_name, source_path):
        _set_source_content(source_content)
Example #22
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    chappaai_playlist_folder = "special://home/playlists/mixed/Chappaai/"
    if not xbmcvfs.exists(chappaai_playlist_folder):
        xbmcvfs.mkdir(chappaai_playlist_folder)
    playlist_folder = plugin.get_setting(SETTING_LIVE_PLAYLIST_FOLDER, unicode)
    # create folders
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        # auto configure folder
        msg = _(
            "Would you like to automatically set Chappaai as a channel video source?"
        )
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            source_thumbnail = get_icon_path("live")
            source_name = "Chappaai " + _("Channels")
            source_content = "('{0}','','','',0,0,'<settings></settings>',0,0,NULL,NULL)".format(
                library_folder)
            add_source(source_name, library_folder, source_content,
                       source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #23
0
def show_seq_info(url):
	
	#dir_contents = dircache.listdir(seq_location)
	#dir_contents = fnmatch.filter(dir_contents, '*.lseq')
	fullpath = xbmc.translatePath(seq_location + '/' + url)
	seqs = [{'label': url, 'path': plugin.url_for('play_sequence', url=fullpath)}]
	return seqs
Example #24
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    metalliq_playlist_folder = "special://profile/playlists/mixed/MetalliQ/"
    if not xbmcvfs.exists(metalliq_playlist_folder):
        xbmcvfs.mkdir(metalliq_playlist_folder)
    playlist_folder = plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER,
                                         unicode)
    if plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER, unicode)[-1] != "/":
        playlist_folder += "/"
    # create folders
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        msg = _(
            "Would you like to automatically set [COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] as a music source?"
        )
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            source_thumbnail = get_icon_path("tv")
            source_name = "[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] " + _(
                "Music")
            source_content = "('{0}','musicvideos','metadata.musicvideos.imvdb','',2147483647,0,'<settings/>',0,0,NULL,NULL)".format(
                library_folder)
            add_source(source_name, library_folder, source_content,
                       source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #25
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    metalliq_playlist_folder = "special://profile/playlists/mixed/MetalliQ/"
    if not xbmcvfs.exists(metalliq_playlist_folder):
        xbmcvfs.mkdir(metalliq_playlist_folder)
    playlist_folder = plugin.get_setting(SETTING_MOVIES_PLAYLIST_FOLDER, converter=str)
    if plugin.get_setting(SETTING_MOVIES_PLAYLIST_FOLDER, converter=str)[-1] != "/":
        playlist_folder += "/"
    # create folders
    if not xbmcvfs.exists(playlist_folder):
        xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        # auto configure folder
        msg = _(
            "Would you like to automatically set [COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] as a movies video source?"
        )
        if dialogs.yesno(_("Library setup"), msg):
            source_thumbnail = get_icon_path("movies")
            source_name = "[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] " + _("Movies")
            source_content = '(\'{0}\',\'movies\',\'metadata.themoviedb.org\',\'\',2147483647,1,\'<settings><setting id="RatingS" value="TMDb" /><setting id="certprefix" value="Rated " /><setting id="fanart" value="true" /><setting id="keeporiginaltitle" value="false" /><setting id="language" value="{1}" /><setting id="tmdbcertcountry" value="us" /><setting id="trailer" value="true" /></settings>\',0,0,NULL,NULL)'.format(
                library_folder, LANG
            )
            add_source(source_name, library_folder, source_content, source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #26
0
def get_thumb(imageid):
    filepath = ''
    url = urlimages.format(imageid)
    datapath = xbmc.translatePath(
        'special://profile/addon_data/plugin.video.prontv/')
    imagename = "{0}.png".format(imageid)
    imagefile = path.join(datapath, imagename)
    print "**GET THUMB: ImgID={0} Path={1} Imagefilename={2}".format(
        plugin.id, datapath, imagefile)
    if path.exists(imagefile) and path.isfile(imagefile):
        return imagefile
    else:
        try:
            results = DL(url).decode("utf-8")
            res = json.loads(results)
            plugin.log.debug(res)
            imagedata = res.get('result').get("thumbnail_base64").decode(
                'base64')
            plugin.log.info("**IMAGE DATA**\n" + results + "\n*** LEN=" +
                            str(len(imagedata)))
            fh = open(imagefile, "wb")
            fh.write(decodestring(imagedata))
            fh.close()
            return imagefile
        except:
            return 'DefaultVideo.png'
Example #27
0
def o0O0O00(url):
    O0oo0OO0 = xbmc.translatePath(
        xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
    o000o = xbmc.translatePath(os.path.join(O0oo0OO0, "tmp"))
    if os.path.exists(o000o):
        shutil.rmtree(o000o)
    os.makedirs(o000o)
    if ".zip" in url:
        I11IiI1I11i1i = xbmc.translatePath(os.path.join(o000o, "temp.zip"))
        urllib.urlretrieve(url, I11IiI1I11i1i)
        IiiIII111iI(I11IiI1I11i1i, o000o)
    else:
        iI1ii1Ii = xbmc.translatePath(os.path.join(o000o, "temp.jpg"))
        urllib.urlretrieve(url, iI1ii1Ii)
    xbmc.executebuiltin("SlideShow(%s,recursive)" % o000o)
    if 92 - 92: Ooo0O
Example #28
0
def Iii1I1():
    OOO0O0O0ooooo = xbmc.translatePath(
        xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
    if 49 - 49:
        OOO0O0O0ooooo = xbmc.translatePath(
            os.path.join(OOO0O0O0ooooo, "temp.jpg"))
    if 49 - 49:
        urllib.urlretrieve(
            'https://googledrive.com/host/0B-ygKtjD8Sc-S04wUUxMMWt5dmM/images/donggiao.jpg',
            OOO0O0O0ooooo)
    if 49 - 49:
        iIIii1IIi = xbmcgui.ControlImage(0, 0, 1280, 720, OOO0O0O0ooooo)
    if 49 - 49: o0OO00 = xbmcgui.WindowDialog()
    if 49 - 49: o0OO00.addControl(iIIii1IIi)
    if 49 - 49: o0OO00.doModal()
    oo = [{
        'label':
        'Đồng Giao Official',
        'path':
        'plugin://plugin.video.youtube/channel/UCZTjI84dMcWPLMDd7HjzFnA/',
        'thumbnail':
        'https://yt3.ggpht.com/-5TD-pJoIQRY/AAAAAAAAAAI/AAAAAAAAAAA/oBUSns1u68U/s256-c-k-no/photo.jpg'
    }, {
        'label':
        'Dong Giao Pro',
        'path':
        'plugin://plugin.video.youtube/channel/UCkRLTtpdJj-8Of10-N9E9Ug/',
        'thumbnail':
        'https://yt3.ggpht.com/-S280zJuQrK0/AAAAAAAAAAI/AAAAAAAAAAA/qrXrrcjVT28/s256-c-k-no/photo.jpg'
    }, {
        'label':
        'Giang Nguyen',
        'path':
        'plugin://plugin.video.youtube/channel/UCfxY1HzwvH1gBfAG8O-kNwA/',
        'thumbnail':
        'https://yt3.ggpht.com/-FDJoaZ4E_MU/AAAAAAAAAAI/AAAAAAAAAAA/0F0jKAmhaP0/s256-c-k-no/photo.jpg'
    }, {
        'label':
        'MrBeGiang',
        'path':
        'plugin://plugin.video.youtube/channel/UC1L_0MbpbkPRPE01t8neBZg/',
        'thumbnail':
        'https://yt3.ggpht.com/-WbQ8qe3augw/AAAAAAAAAAI/AAAAAAAAAAA/u3YVPUd0U4o/s256-c-k-no/photo.jpg'
    }]
    return oo000.finish(oo)
    if 27 - 27: oO0OooOoO * o0Oo
    if 5 - 5: OoO0O00
Example #29
0
def get_stream(channel):
    playlistFilename = (xbmc.translatePath('special://temp/') +
        'twitchplaylist.m3u8')

    srlVideoResolver.resolveChannelToPlaylist(channel, playlistFilename)
    xbmc.Player().play(playlistFilename)

    plugin.set_resolved_url(playlistFilename)
Example #30
0
def resolve_video_url(url):
    from xbmcswift2 import xbmc
    cookiepath = xbmc.translatePath( 'special://temp/dabdate_cookie.lwp' )
    userid = plugin.get_setting('id', str)
    passwd = plugin.get_setting('pass', str)

    page_url = dabdate.root_url+url
    return dabdate.getStreamUrl( page_url, userid=userid, passwd=passwd, cookiefile=cookiepath )
Example #31
0
def ensure_path_local(path):
    path = xbmc.translatePath(path)
    if "://" in path:
        if sys.platform.startswith('win') and path.lower().startswith("smb://"):
            path = path.replace("smb:", "").replace("/", "\\")
        else:
            raise LocalizedError(33030, "Downloading to an unmounted network share is not supported",
                                 check_settings=True)
    return ensure_unicode(path)
Example #32
0
def auto_tv_setup(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    if not xbmcvfs.exists(library_folder):
        xbmcvfs.mkdir(library_folder)
        source_thumbnail = xbmc.translatePath('special://home/addons/plugin.video.meta/resources/img/tv.png')
        source_name = "Meta TVShows"
        source_content = "('{0}','tvshows','metadata.tvdb.com','',0,0,'<settings><setting id=\"RatingS\" value=\"TheTVDB\" /><setting id=\"absolutenumber\" value=\"false\" /><setting id=\"dvdorder\" value=\"false\" /><setting id=\"fallback\" value=\"true\" /><setting id=\"fanart\" value=\"true\" /><setting id=\"language\" value=\"{1}\" /></settings>',0,0,NULL,NULL)".format(library_folder, LANG)
        add_source(source_name, library_folder, source_content, source_thumbnail)
Example #33
0
def get_skin_resolution():
    import xml.etree.ElementTree as ElementTree
    skin_path = xbmc.translatePath("special://skin/addon.xml")
    if not os.path.exists(skin_path):
        return Resolution(1280, 720)
    else:
        tree = ElementTree.parse(skin_path)
        res = tree.findall("./extension/res")[0]
        return Resolution(int(res.attrib["width"]), int(res.attrib["height"]))
Example #34
0
def get_skin_resolution():
    import xml.etree.ElementTree as ElementTree
    skin_path = xbmc.translatePath("special://skin/addon.xml")
    if not os.path.exists(skin_path):
        return Resolution(1280, 720)
    else:
        tree = ElementTree.parse(skin_path)
        res = tree.findall("./extension/res")[0]
        return Resolution(int(res.attrib["width"]), int(res.attrib["height"]))
Example #35
0
    def __init__(self, name=None, addon_id=None, filepath=None, info_type=None):
        self._name = name
        self._routes = []
        self._view_functions = {}

        # addon_id is no longer required as it can be parsed from addon.xml
        if addon_id:
            self._addon = xbmcaddon.Addon(id=addon_id)
        else:
            self._addon = xbmcaddon.Addon()

        self._addon_id = addon_id or self._addon.getAddonInfo('id')
        self._name = name or self._addon.getAddonInfo('name')

        self._info_type = info_type
        if not self._info_type:
            types = {
                'video': 'video',
                'audio': 'music',
                'image': 'pictures',
            }
            self._info_type = types.get(self._addon_id.split('.')[1], 'video')

        # Keeps track of the added list items
        self._current_items = []

        # Gets initialized when self.run() is called
        self._request = None

        # A flag to keep track of a call to xbmcplugin.endOfDirectory()
        self._end_of_directory = False

        # Keep track of the update_listing flag passed to
        # xbmcplugin.endOfDirectory()
        self._update_listing = False

        # The plugin's named logger
        self._log = setup_log(self._addon_id)

        # The path to the storage directory for the addon
        self._storage_path = xbmc.translatePath(
            'special://profile/addon_data/%s/.storage/' % self._addon_id)
        if not os.path.isdir(self._storage_path):
            os.makedirs(self._storage_path)

        # If we are runing in CLI, we need to load the strings.xml manually
        # Since xbmcswift2 currently relies on execution from an addon's root
        # directly, we can rely on cwd for now...
        if xbmcswift2.CLI_MODE:
            from xbmcswift2.mockxbmc import utils
            if filepath:
                addon_dir = os.path.dirname(filepath)
            else:
                addon_dir = os.getcwd()
            strings_fn = os.path.join(addon_dir, 'resources', 'language',
                                      'English', 'strings.xml')
            utils.load_addon_strings(self._addon, strings_fn)
def ensure_path_local(path):
    path = xbmc.translatePath(path)
    if "://" in path:
        if sys.platform.startswith('win') and path.lower().startswith("smb://"):
            path = path.replace("smb:", "").replace("/", "\\")
        else:
            raise LocalizedError(33030, "Downloading to an unmounted network share is not supported",
                                 check_settings=True)
    return ensure_unicode(path)
Example #37
0
    def __init__(self, name=None, addon_id=None, filepath=None, info_type=None):
        self._name = name
        self._routes = []
        self._view_functions = {}

        # addon_id is no longer required as it can be parsed from addon.xml
        if addon_id:
            self._addon = xbmcaddon.Addon(id=addon_id)
        else:
            self._addon = xbmcaddon.Addon()

        self._addon_id = addon_id or self._addon.getAddonInfo('id')
        self._name = name or self._addon.getAddonInfo('name')

        self._info_type = info_type
        if not self._info_type:
            types = {
                'video': 'video',
                'audio': 'music',
                'image': 'pictures',
            }
            self._info_type = types.get(self._addon_id.split('.')[1], 'video')

        # Keeps track of the added list items
        self._current_items = []

        # Gets initialized when self.run() is called
        self._request = None

        # A flag to keep track of a call to xbmcplugin.endOfDirectory()
        self._end_of_directory = False

        # Keep track of the update_listing flag passed to
        # xbmcplugin.endOfDirectory()
        self._update_listing = False

        # The plugin's named logger
        self._log = setup_log(self._addon_id)

        # The path to the storage directory for the addon
        self._storage_path = xbmc.translatePath(
            'special://profile/addon_data/%s/.storage/' % self._addon_id)
        if not os.path.isdir(self._storage_path):
            os.makedirs(self._storage_path)

        # If we are runing in CLI, we need to load the strings.xml manually
        # Since xbmcswift2 currently relies on execution from an addon's root
        # directly, we can rely on cwd for now...
        if xbmcswift2.CLI_MODE:
            from xbmcswift2.mockxbmc import utils
            if filepath:
                addon_dir = os.path.dirname(filepath)
            else:
                addon_dir = os.getcwd()
            strings_fn = os.path.join(addon_dir, 'resources', 'language',
                                      'English', 'strings.xml')
            utils.load_addon_strings(self._addon, strings_fn)
 def get_xbmc_log(self):
   from xbmcswift2 import xbmc
   log_path = xbmc.translatePath('special://logpath')
   log_file_path = os.path.join(log_path, 'xbmc.log')
   self.utils.log.debug("Reading log file from \"%s\"" % log_file_path)
   with open(log_file_path, 'r') as f:
     log_content = f.read()
   for pattern, repl in LOG_FILTERS:
     log_content = re.sub(pattern, repl, log_content)
   return log_content
Example #39
0
def show_seq_info(url):

    #dir_contents = dircache.listdir(seq_location)
    #dir_contents = fnmatch.filter(dir_contents, '*.lseq')
    fullpath = xbmc.translatePath(seq_location + '/' + url)
    seqs = [{
        'label': url,
        'path': plugin.url_for('play_sequence', url=fullpath)
    }]
    return seqs
Example #40
0
def check_thumb(entry, item, missing_thumbs):
    """Check if thumbnail already exists"""

    local_thumb_path = os.path.join(xbmc.translatePath('special://temp/'), entry['rev'] + '.jpeg')
    item['thumbnail'] = local_thumb_path

    thumb_hash = get_crc32(local_thumb_path)
    local_thumb_cache = os.path.join(xbmc.translatePath('special://thumbnails/'), thumb_hash[0], thumb_hash + '.jpg')
    if os.path.exists(local_thumb_cache):
        if dbg:
            plugin.log.info('Local thumb of {0} already exists: {1}'.format(entry['path'].encode('utf-8'), local_thumb_cache))
    elif os.path.exists(local_thumb_path):
        if dbg:
            plugin.log.info('Local thumb of {0} already fetched, but not in cache: {1} - {2}'.format(entry['path'].encode('utf-8'), local_thumb_path, local_thumb_cache))
    else:
        if dbg:
            plugin.log.info('Will need to fetch the thumbnail of {0} into {1} - {2} not found'.format(entry['path'].encode('utf-8'), local_thumb_path, local_thumb_cache))
        
        missing_thumbs.append((local_thumb_path, entry['path']))
def channel_inventory():
    lib = plugin.get_setting(SETTING_LIVE_LIBRARY_FOLDER, unicode)
    LIBITEMS = os.listdir(xbmc.translatePath(lib))
    plugin.log.info("{0}".format(LIBITEMS))
    QITEMS = []
    for item in LIBITEMS:
        player_file = xbmc.translatePath(os.path.join(lib, item,
                                                      "player.info"))
        if os.path.exists(player_file):
            with open(player_file) as pf:
                content = pf.read()
        elif item != 'mqlib.info':
            with open(player_file, "w") as pf:
                pf.write('library')
                content = 'library'
        QITEMS.append(str([item, content]))
    lib_file = xbmc.translatePath(os.path.join(lib, "mqlib.info"))
    with open(lib_file, "w") as lf:
        lf.write('\n'.join(
            sorted(QITEMS, key=lambda s: s.strip('[u"').strip("[u'").lower())))
Example #42
0
def resolve_video_url(url):
    from xbmcswift2 import xbmc
    cookiepath = xbmc.translatePath('special://temp/dabdate_cookie.lwp')
    userid = plugin.get_setting('id', str)
    passwd = plugin.get_setting('pass', str)

    page_url = dabdate.root_url + url
    return dabdate.getStreamUrl(page_url,
                                userid=userid,
                                passwd=passwd,
                                cookiefile=cookiepath)
Example #43
0
    def setup_database_connection(self):
        global c
        global conn
        # set up sqlite connection
        path = xbmc.translatePath("special://home/userdata/Database")
        files = glob.glob(os.path.join(path, "MyMusic*.db"))
        ver = 0
        dbPath = ""
        # Find the highest version number of textures, it's always been textures13.db but you can never be too careful!
        for file in files:
            dbversion = int(re.compile("MyMusic(.+?).db").findall(file)[0])
            if ver < dbversion:
                ver = dbversion
                dbPath = file

        db = xbmc.translatePath(dbPath)
        conn = sqlite3.connect(db, timeout=10, detect_types=sqlite3.PARSE_DECLTYPES, check_same_thread=False)
        conn.text_factory = str
        c = conn.cursor()
        c.row_factory = sqlite3.Row
Example #44
0
def OOooOoooOoOo(url):
    oo000 = xbmc.translatePath(
        xbmcaddon.Addon().getAddonInfo('path')).decode("utf-8")
    o0OOOO00O0Oo = xbmc.translatePath(os.path.join(oo000, "tmp"))
    if os.path.exists(o0OOOO00O0Oo):
        shutil.rmtree(o0OOOO00O0Oo)
    os.makedirs(o0OOOO00O0Oo)
    if ".zip" in url:
        iioOooOOOoOo = xbmc.translatePath(
            os.path.join(o0OOOO00O0Oo, "temp.zip"))
        urllib.urlretrieve(url, iioOooOOOoOo)
        i1I1ii1II1iII(iioOooOOOoOo, o0OOOO00O0Oo)
        xbmc.executebuiltin("SlideShow(%s,recursive)" % o0OOOO00O0Oo)
        if 41 - 41: I1Ii - ooO0OO000o - ooO0OO000o
        if 68 - 68: i1iII1I1i1i1 % Ooooo
    else:
        ooO00OO0 = xbmcgui.WindowDialog()
        i11111IIIII = xbmcgui.ControlImage(0, 0, 1280, 720, url)
        ooO00OO0.addControl(i11111IIIII)
        ooO00OO0.doModal()
        if 19 - 19: Ii11111i * oo000i1iIi11iIIi1
Example #45
0
class Sources(object):
    SOURCES_XML_PATH = 'special://userdata/sources.xml'
    SOURCES_REAL_PATH = xbmc.translatePath(SOURCES_XML_PATH)

    def __init__(self):
        self.xml_tree = ET.parse(self.SOURCES_REAL_PATH)
        self.sources = None

    def get(self, media_type=None):
        if self.sources is None:
            self.sources = []
            for t in self.xml_tree.getroot():
                m_type = t.tag
                if media_type is not None and m_type != media_type:
                    continue
                for s in t.findall('source'):
                    label = s.find('name').text
                    path = s.find('path').text
                    self.sources.append(Source(m_type, path, label))
        return self.sources

    def has(self, media_type=None, label=None, path=None):
        return any((s.path == path or path is None) and (
            s.label == label or label is None) for s in self.get(media_type))

    def add(self, media_type, path, label):
        if self.has(media_type, label):
            raise SourceAlreadyExists(label=label)
        for t in self.xml_tree.getroot():
            if t.tag == media_type:
                s = ET.SubElement(t, 'source')
                ET.SubElement(s, 'name').text = label
                ET.SubElement(s, 'path', {'pathversion': '1'}).text = path
                ET.SubElement(s, 'allowsharing').text = 'true'
                self.xml_tree.write(self.SOURCES_REAL_PATH, 'utf-8')
                return
        raise UnknownMediaType(media_type=media_type)

    def add_video(self,
                  path,
                  label,
                  scraper_settings,
                  scan_recursive=False,
                  use_folder_names=False,
                  no_update=False):
        """
        :type scraper_settings: ScraperSettings
        """
        self.add('video', path, label)
        with closing(VideoDatabase()) as db:
            db.update_path(path, scraper_settings, scan_recursive,
                           use_folder_names, no_update)
Example #46
0
def update_library():
    """ Update library """
    url = plugin.get_setting(SETTING_MOVIES_SERVER_URL, converter=str)
    if not url:
        return

    # Get movies list from movies-server
    movies = query_movies_server(url)

    # setup library folder
    library_folder = setup_library(
        plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))

    changed = False

    # add new movies
    for movie in movies:
        date = int(movie.get('date', 0))
        imdb = movie.get('imdb')
        tmdb = movie.get('tmdb')

        if imdb:
            if add_movie_to_library(library_folder, "imdb", imdb, date):
                changed = True
        elif tmdb:
            if add_movie_to_library(library_folder, "tmdb", tmdb, date):
                changed = True

    # remove old movies from DB
    keep_movies = [movie['imdb'] for movie in movies]

    db_movies = RPC.video_library.get_movies(
        properties=['title', 'imdbnumber', 'file'])
    for movie in db_movies.get('movies', []):
        file = xbmc.translatePath(movie['file'])
        imdb = os.path.splitext(os.path.basename(file))[0]
        if imdb not in keep_movies and plugin.id in file:

            # remove movie
            RPC.video_library.remove_movie(movieid=movie["movieid"])

            # remove strm and nfo files
            os.remove(file)
            try:
                os.remove(file.replace(".strm", ".nfo"))
            except:
                pass

            changed = True

    if changed:
        scan_library()
Example #47
0
def download(download_path,repo_id):
	'''
	Parameters
	----------
	path : string
		Link download zip repo.
	repo_id : string
		Tên thư mục của repo để kiểm tra đã cài chưa.
		Mặc định được gán cho item["label2"].
		Truyền "" để bỏ qua Kiểm tra đã cài
	'''
	if repo_id == "": repo_id = "temp"
	if ":/" not in repo_id:
		zipfile_path = xbmc.translatePath(os.path.join(tmp,"%s.zip" % repo_id))
		urllib.urlretrieve(download_path,zipfile_path)
		with contextlib.closing(zipfile.ZipFile(zipfile_path, "r")) as z:
			z.extractall(addons_folder)
	else:
		zipfile_path = xbmc.translatePath(os.path.join(tmp,"%s.zip" % repo_id.split("/")[-1]))
		urllib.urlretrieve(download_path,zipfile_path)
		with contextlib.closing(zipfile.ZipFile(zipfile_path, "r")) as z:
			z.extractall(xbmc.translatePath("/".join(repo_id.split("/")[:-1])))
def library_inventory(type="movies"):
    if type == "movies":
        LIBITEMS = RPC.VideoLibrary.GetMovies(
            properties=["imdbnumber", "title", "file", "year"])[type]
        lib = plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER, unicode)
    elif type == "tvshows":
        LIBITEMS = RPC.VideoLibrary.GetTVShows(
            properties=["imdbnumber", "title", "file", "year"])[type]
        lib = plugin.get_setting(SETTING_TV_LIBRARY_FOLDER, unicode)
    QITEMS = []
    LITEMS = []
    plugin.log.info("{0}".format(lib))
    for i in LIBITEMS:
        if lib in i['file']:
            player_file = xbmc.translatePath(
                os.path.join(lib, i['imdbnumber'], "player.info"))
            if os.path.exists(player_file):
                with open(player_file) as pf:
                    content = pf.read()
            else:
                with open(player_file, "w") as pf:
                    pf.write('library')
                    content = 'library'
            QITEMS.append(
                str([i['title'], i['year'], content, i['imdbnumber']]))
        else:
            LITEMS.append(
                str([i['title'], i['year'], i['file'], i['imdbnumber']]))
    lib_file = xbmc.translatePath(os.path.join(lib, "mqlib.info"))
    with open(lib_file, "w") as lf:
        lf.write('\n'.join(
            sorted(QITEMS, key=lambda s: s.strip('[u"').strip("[u'").lower())))
    if len(LIBITEMS) > len(QITEMS):
        lib_file = xbmc.translatePath(os.path.join(lib, "nqlib.info"))
        with open(lib_file, "w") as lf:
            lf.write('\n'.join(
                sorted(LITEMS,
                       key=lambda s: s.strip('[u"').strip("[u'").lower())))
Example #49
0
def update_library():
    """ Update library """
    url = plugin.get_setting(SETTING_MOVIES_SERVER_URL, converter=str)
    if not url:
        return
    
    # Get movies list from movies-server
    movies = query_movies_server(url)
    
    # setup library folder
    library_folder = setup_library(plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER))

    changed = False

    # add new movies
    for movie in movies:
        date = int(movie.get('date', 0))
        imdb = movie.get('imdb')
        tmdb = movie.get('tmdb')
        
        if imdb:
            if add_movie_to_library(library_folder, "imdb", imdb, date):
                changed = True
        elif tmdb:
            if add_movie_to_library(library_folder, "tmdb", tmdb, date):
                changed = True
        
    # remove old movies from DB
    keep_movies = [movie['imdb'] for movie in movies]
    
    db_movies = RPC.video_library.get_movies(properties=['title', 'imdbnumber','file'])    
    for movie in db_movies.get('movies', []):
        file = xbmc.translatePath(movie['file'])
        imdb = os.path.splitext(os.path.basename(file))[0]
        if imdb not in keep_movies and plugin.id in file:
            
            # remove movie
            RPC.video_library.remove_movie(movieid=movie["movieid"])
            
            # remove strm and nfo files
            os.remove(file)
            try:
                os.remove(file.replace(".strm", ".nfo"))
            except:
                pass
            
            changed = True
    
    if changed:
        scan_library()
def migrate_my_stations():
    if not plugin.get_setting("migrate") == "done":
        __log("migrate_my_stations")
        import os
        import simplejson as json

        profile_path = xbmc.translatePath(plugin._addon.getAddonInfo("profile"))
        ms_file = os.path.join(profile_path, "mystations.json")
        if os.path.isfile(ms_file):
            my_stations_old = json.load(open(ms_file, "r"))
            for old_station in my_stations_old:
                station_id = old_station["station_id"]
                __log("migrating: %s" % station_id)
                station = radio_api.get_station_by_station_id(station_id)
                my_stations[station_id] = station
            my_stations.sync()
        plugin.set_setting("migrate", "done")
Example #51
0
def setup_library(library_folder):
    if library_folder[-1] != "/": library_folder += "/"
    playlist_folder = plugin.get_setting(SETTING_TV_PLAYLIST_FOLDER, unicode)
    if plugin.get_setting(SETTING_TV_PLAYLIST_FOLDER, unicode)[-1] != "/": playlist_folder += "/"
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        xbmcvfs.mkdir(library_folder)
        # auto configure folder
        msg = _("Would you like to automatically set [COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] as a tv shows source?")
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            try:
                source_thumbnail = get_icon_path("tv")
                source_name = "[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] " + _("TV shows")
                source_content = "('{0}','tvshows','metadata.tvdb.com','',0,0,'<settings><setting id=\"RatingS\" value=\"TheTVDB\" /><setting id=\"absolutenumber\" value=\"false\" /><setting id=\"dvdorder\" value=\"false\" /><setting id=\"fallback\" value=\"true\" /><setting id=\"fanart\" value=\"true\" /><setting id=\"language\" value=\"{1}\" /></settings>',0,0,NULL,NULL)".format(library_folder, LANG)
                add_source(source_name, library_folder, source_content, source_thumbnail)
            except: pass
    # return translated path
    return xbmc.translatePath(library_folder)
Example #52
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"

    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        
        # auto configure folder
        msg = _("Would you like to automatically set Meta as a tv shows source?")
        if dialogs.yesno(_("Library setup"), msg):
            source_name = "Meta TVShows"
            
            source_content = "('{0}','tvshows','metadata.tvdb.com','',0,0,'<settings><setting id=\"RatingS\" value=\"TheTVDB\" /><setting id=\"absolutenumber\" value=\"false\" /><setting id=\"dvdorder\" value=\"false\" /><setting id=\"fallback\" value=\"true\" /><setting id=\"fanart\" value=\"true\" /><setting id=\"language\" value=\"{1}\" /></settings>',0,0,NULL,NULL)".format(library_folder, LANG)

            add_source(source_name, library_folder, source_content)

    # return translated path
    return xbmc.translatePath(library_folder)
Example #53
0
    def _inside_root(self, select=-1):
        with self.lock:
            self.list.reset()
            
            for source, links in self.items:
                if len(links) > 1:
                    source += " > {0}".format(_("Found %i items") % len(links))
                listitem = xbmcgui.ListItem(source)
                try:
                    if "plugin://" in links[0]['path']: icon = xbmcaddon.Addon(id=links[0]['path'].split("/")[2]).getAddonInfo('icon')
                    else: icon = xbmc.translatePath("{0}/folder.jpg".format(links[0]['path'].rsplit("/",2)[0]))
                    listitem.setIconImage(icon)
                    listitem.setThumbnailImage(icon)
                except: pass
                self.list.addItem(listitem)

            if select >= 0:
                self.list.selectItem(select)
            self.insideIndex = -1
Example #54
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"

    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        
        # auto configure folder
        msg = _("Would you like to automatically set Meta as a movies video source?")
        if dialogs.yesno(_("Library setup"), msg):
            source_name = "Meta Movies"
            
            source_content = "('{0}','movies','metadata.themoviedb.org','',2147483647,0,'<settings><setting id=\"RatingS\" value=\"TMDb\" /><setting id=\"certprefix\" value=\"Rated \" /><setting id=\"fanart\" value=\"true\" /><setting id=\"keeporiginaltitle\" value=\"false\" /><setting id=\"language\" value=\"{1}\" /><setting id=\"tmdbcertcountry\" value=\"us\" /><setting id=\"trailer\" value=\"true\" /></settings>',0,0,NULL,NULL)".format(library_folder, LANG)

            add_source(source_name, library_folder, source_content)

    # return translated path
    return xbmc.translatePath(library_folder)
Example #55
0
def setup_library(library_folder):
    if library_folder[-1] != "/":
        library_folder += "/"
    metalliq_playlist_folder = "special://profile/playlists/mixed/MetalliQ/"
    if not xbmcvfs.exists(metalliq_playlist_folder): xbmcvfs.mkdir(metalliq_playlist_folder)
    playlist_folder = plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER, unicode)
    if plugin.get_setting(SETTING_MUSIC_PLAYLIST_FOLDER, unicode)[-1] != "/": playlist_folder += "/"
    # create folders
    if not xbmcvfs.exists(playlist_folder): xbmcvfs.mkdir(playlist_folder)
    if not xbmcvfs.exists(library_folder):
        # create folder
        xbmcvfs.mkdir(library_folder)
        msg = _("Would you like to automatically set [COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] as a music source?")
        if dialogs.yesno("{0} {1}".format(_("Library"), "setup"), msg):
            source_thumbnail = get_icon_path("tv")
            source_name = "[COLOR ff0084ff]M[/COLOR]etalli[COLOR ff0084ff]Q[/COLOR] "  + _("Music")
            source_content = "('{0}','musicvideos','metadata.musicvideos.imvdb','',2147483647,0,'<settings/>',0,0,NULL,NULL)".format(library_folder)
            add_source(source_name, library_folder, source_content, source_thumbnail)
    # return translated path
    return xbmc.translatePath(library_folder)
Example #56
0
def play_sequence(url):
	plugin.log.info('Playing url: %s' % url)
	xbmc.log('playing url: %s' % url)
	plugin.set_resolved_url(url)
	show = Show()
	
	show.load_file(config)
	sequence.load_file(url, show.controllers)
	schedule = sched.scheduler(time.time, time.sleep)
	for time_stamp, method, arglist in sequence.compile(keep_state=True):
		schedule.enter(time_stamp / 1000.0, 0, method, arglist)

	if sequence.audio is not None:
		audio_fullpath = xbmc.translatePath(audio_path + '/' + sequence.audio.filename)
		xbmc.log('playing audio: %s' % audio_fullpath)
		xbmc.executebuiltin('XBMC.PlayMedia('+audio_fullpath+')')
	else:
		xbmc.log('audio was none')
	schedule.run()
	show.networks['lights'].close()
Example #57
0
def get_players(media, filters = {}):
    assert media in ("tvshows", "movies")
    
    players = []
    
    players_path = "special://profile/addon_data/{0}/players/".format(plugin.id)
    files = [x for x in xbmcvfs.listdir(players_path)[1] if x.endswith(EXTENSION)]
    for file in files:
        path = xbmc.translatePath(players_path + "/" + file)
                    
        try:
            with open(path, "r") as f:
                meta = json.loads(f.read())
            player = AddonPlayer(file, media, meta)
            if not player.is_empty():
                players.append(player)
        except Exception, e:
            plugin.log.error(repr(e))
            msg = "player %s is invalid" % file
            xbmcgui.Dialog().ok('Invalid player', msg)
            raise
Example #58
0
def get_thumb(imageid):
    filepath = ''
    url = urlimages.format(imageid)
    datapath = xbmc.translatePath('special://profile/addon_data/plugin.video.prontv/')
    imagename = "{0}.png".format(imageid)
    imagefile = path.join(datapath, imagename)
    print "**GET THUMB: ImgID={0} Path={1} Imagefilename={2}".format(plugin.id, datapath, imagefile)
    if path.exists(imagefile) and path.isfile(imagefile):
        return imagefile
    else:
        try:
            results = DL(url).decode("utf-8")
            res = json.loads(results)
            plugin.log.debug(res)
            imagedata = res.get('result').get("thumbnail_base64").decode('base64')
            plugin.log.info("**IMAGE DATA**\n"+results + "\n*** LEN=" + str(len(imagedata)))
            fh = open(imagefile, "wb")
            fh.write(decodestring(imagedata))
            fh.close()
            return imagefile
        except:
            return 'DefaultVideo.png'
Example #59
0
    def _inside(self, num):
        if num == -1:
            self._inside_root(select=self.insideIndex)
            return

        with self.lock:
            source, links = self.items[num]

            if len(links) == 1:
                self.selection = links[0]
                self.close()
                return
            self.list.reset()        
            for item in links:
                listitem = xbmcgui.ListItem(item['label'])
                listitem.setProperty("Path", item['path'])
                try:
                    if "plugin://" in links[0]['path']: icon = xbmcaddon.Addon(id=links[0]['path'].split("/")[2]).getAddonInfo('icon')
                    else: icon = xbmc.translatePath("{0}/folder.jpg".format(links[0]['path'].rsplit("/",2)[0]))
                    listitem.setIconImage(icon)
                    listitem.setThumbnailImage(icon)
                except: pass
                self.list.addItem(listitem)
            self.insideIndex = num