def get_blockchain_interface_instance(config):
	source = config.get("BLOCKCHAIN", "blockchain_source")
	network = common.get_network()
	testnet = network=='testnet'
	if source == 'bitcoin-rpc':
		rpc_host = config.get("BLOCKCHAIN", "rpc_host")
		rpc_port = config.get("BLOCKCHAIN", "rpc_port")
		rpc_user = config.get("BLOCKCHAIN", "rpc_user")
		rpc_password = config.get("BLOCKCHAIN", "rpc_password")
		rpc = jsonrpc.JsonRpc(rpc_host, rpc_port, rpc_user, rpc_password)
		bc_interface = BitcoinCoreInterface(rpc, network)
	elif source == 'json-rpc':
		bitcoin_cli_cmd = config.get("BLOCKCHAIN", "bitcoin_cli_cmd").split(' ')
		rpc = CliJsonRpc(bitcoin_cli_cmd, testnet)
		bc_interface = BitcoinCoreInterface(rpc, network)
	elif source == 'regtest':
		rpc_host = config.get("BLOCKCHAIN", "rpc_host")
		rpc_port = config.get("BLOCKCHAIN", "rpc_port")
		rpc_user = config.get("BLOCKCHAIN", "rpc_user")
		rpc_password = config.get("BLOCKCHAIN", "rpc_password")
		rpc = jsonrpc.JsonRpc(rpc_host, rpc_port, rpc_user, rpc_password)
		bc_interface = RegtestBitcoinCoreInterface(rpc)
	elif source == 'blockr':
		bc_interface = BlockrInterface(testnet)
	else:
		raise ValueError("Invalid blockchain source")	
	return bc_interface
Example #2
0
	def log_statement(self, data):
		if common.get_network() == 'testnet':
			return

		data = [str(d) for d in data]
		self.income_statement = open(self.statement_file, 'a')
		self.income_statement.write(','.join(data) + '\n')
		self.income_statement.close()
Example #3
0
def modes():
	if sys.argv[2] == '':
		all_description = ''
		networks = common.get_networks()
		networks.sort(key = lambda x: x.SITE.replace('the', ''))
		for network in networks:
			if addon.getSetting(network.SITE) == 'true':
				if network.NAME.endswith(', The'):
					name = 'The ' + network.NAME.replace(', The', '')
				all_description += network.NAME + ', '
		count = 0
		common.add_directory(common.smart_utf8(addon.getLocalizedString(39000)), 'Favorlist', 'NoUrl', thumb = ustvpaths.FAVICON, count = count, description = common.smart_utf8(addon.getLocalizedString(39001)) + '\n' + all_description)
		count += 1
		common.add_directory(common.smart_utf8(addon.getLocalizedString(39002)), 'Masterlist', 'NoUrl', thumb = ustvpaths.ALLICON, count = count, description = common.smart_utf8(addon.getLocalizedString(39003)) + '\n' + all_description)
		count += 1
		for network in networks:
			network_name = network.NAME
			station_icon = os.path.join(ustvpaths.IMAGEPATH, network.SITE + '.png')
			if network_name.endswith(', The'):
				network_name = 'The ' + network_name.replace(', The', '')
			if addon.getSetting(network.SITE) == 'true':
				common.add_directory(network_name, network.SITE, 'rootlist', thumb = station_icon, fanart = ustvpaths.PLUGINFANART, description = network.DESCRIPTION, count = count)
			count += 1
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
		common.set_view()
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode == 'Masterlist':
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.load_showlist()
		common.set_view('tvshows')
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.sitemode == 'rootlist':
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.root_list(common.args.mode)
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode == 'Favorlist':   
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.load_showlist(favored = 1)
		common.set_view('tvshows')
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode == 'contextmenu':
		getattr(contextmenu, common.args.sitemode)()
	elif common.args.mode == 'common':
		getattr(common, common.args.sitemode)()
	else:
		network = common.get_network(common.args.mode)
		if network:
			getattr(network, common.args.sitemode)()
			if 'episodes' in  common.args.sitemode and addon.getSetting('add_episode_identifier') == 'false':
				try:
					xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_DATEADDED)
				except:
					pass
				xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_EPISODE)
				xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_UNSORTED)
			if not common.args.sitemode.startswith('play'):
				xbmcplugin.endOfDirectory(pluginHandle)
	def GetNetworkShows(self, site):
		network = common.get_network(site)
		if network:
			networkshows = getattr(network, 'masterlist')()
			shows = []
			for show in networkshows:
				try:
					series_title, mode, sitemode, url = show
					siteplot = None
				except:
					series_title, mode, sitemode, url, siteplot = show
				showdata = common.get_show_data(series_title, mode, sitemode, url, siteplot)
				shows.append(showdata)
			self.ExportShowList(shows, 100)
			image =  os.path.join(ustvpaths.IMAGEPATH, network.SITE + '.png')
			self.Notification(addon.getLocalizedString(39036), addon.getLocalizedString(39037) % network.NAME, image = image)
def select_quality():
    show_title, season, episode, thumb, displayname, qmode, url = args.url.split("<join>")
    common.args = _Info(url.split("?")[1].replace("&", " , "))
    network = common.get_network(common.args.mode)
    resultlist = getattr(network, qmode)()
    select = xbmcgui.Dialog()
    title = addon.getLocalizedString(39022)
    resultset = set(resultlist)
    resultlist = list(resultset)
    resultlist = sorted(resultlist)
    ret = select.select(title, [str(quality[0]) for quality in resultlist])
    bitrate = resultlist[ret][1]
    setattr(common.args, "name", base64.b64decode(displayname))
    setattr(common.args, "quality", bitrate)
    setattr(common.args, "thumb", thumb)
    setattr(common.args, "episode_number", int(episode))
    setattr(common.args, "season_number", int(season))
    setattr(common.args, "show_title", show_title)
    getattr(network, common.args.sitemode)()
def select_quality():
	show_title, season, episode, thumb, displayname, qmode, url = args.url.split('<join>')
	common.args = _Info(url.split('?')[1].replace('&', ' , '))
	network = common.get_network(common.args.mode)
	resultlist = getattr(network, qmode)()
	select = xbmcgui.Dialog()
	title = addon.getLocalizedString(39022)
	resultset = set(resultlist)
	resultlist = list(resultset)
	resultlist = sorted(resultlist)
	ret = select.select(title, [str(quality[0]) for quality in resultlist])
	bitrate = resultlist[ret][1]
	setattr(common.args, 'name', base64.b64decode(displayname))
	setattr(common.args, 'quality', bitrate)
	setattr(common.args, 'thumb', thumb)
	setattr(common.args, 'episode_number', int(episode))
	setattr(common.args, 'season_number', int(season))
	setattr(common.args, 'show_title', show_title)
	getattr(network, common.args.sitemode)()
def select_quality():
    show_title, season, episode, thumb, displayname, qmode, url = args.url.split(
        '<join>')
    common.args = _Info(url.split('?')[1].replace('&', ' , '))
    network = common.get_network(common.args.mode)
    resultlist = getattr(network, qmode)()
    select = xbmcgui.Dialog()
    title = addon.getLocalizedString(39022)
    resultset = set(resultlist)
    resultlist = list(resultset)
    resultlist = sorted(resultlist)
    ret = select.select(title, [str(quality[0]) for quality in resultlist])
    bitrate = resultlist[ret][1]
    setattr(common.args, 'name', base64.b64decode(displayname))
    setattr(common.args, 'quality', bitrate)
    setattr(common.args, 'thumb', thumb)
    setattr(common.args, 'episode_number', int(episode))
    setattr(common.args, 'season_number', int(season))
    setattr(common.args, 'show_title', show_title)
    getattr(network, common.args.sitemode)()
Example #8
0
def bench(model_name, batch_size):
    dtype='float32'
    net, data_shape = get_network(model_name, batch_size)
    mod = mx.mod.Module(symbol=net, context=gpu)
    mod.bind(for_training=False, inputs_need_grad=False, data_shapes=data_shape)
    mod.init_params(initializer=mx.init.Xavier(magnitude=2.))

    # get data
    data = [mx.random.uniform(-1.0, 1.0, shape=shape, ctx=gpu) for _, shape in mod.data_shapes]
    batch = mx.io.DataBatch(data, []) # empty label

    # run
    dry_run = 5                 # use 5 iterations to warm up

    for i in range(dry_run + num_batches):
        if i == dry_run:
            t = time.time()
        mod.forward(batch, is_train=False)
        for output in mod.get_outputs():
            output.wait_to_read()
    mx.nd.waitall()
    return (time.time() - t) * 1000. / num_batches
Example #9
0
def bench(name, batch):
    sym, data_shape = get_network(name, batch)
    data_shape = data_shape[0][1]
    sym, _ = relay.frontend.from_mxnet(sym, {'data': data_shape})
    sym, params = tvm.relay.testing.create_workload(sym)
    with relay.quantize.qconfig(skip_k_conv=0, round_for_shift=True):
        sym = relay.quantize.quantize(sym, params)

    with relay.build_module.build_config(opt_level=3):
        graph, lib, params = relay.build(sym, 'cuda', 'llvm', params=params)

    m = graph_runtime.create(graph, lib, ctx)
    x = np.random.uniform(size=data_shape)
    data_tvm = tvm.nd.array(x.astype('float32'))
    m.set_input("data", data_tvm)
    m.set_input(**{k: tvm.nd.array(v, ctx) for k, v in params.items()})
    m.run()
    e = m.module.time_evaluator("run", ctx, number=2000, repeat=3)
    t = e(data_tvm).results
    t = np.array(t) * 1000

    print('{} (batch={}): {} ms'.format(name, batch, t.mean()))
Example #10
0
		seed = btc.sha256(os.urandom(64))[:32]
		words = old_mnemonic.mn_encode(seed)
		print 'Write down this wallet recovery seed\n\n' + ' '.join(words) + '\n'
	elif method == 'recover':
		words = raw_input('Input 12 word recovery seed: ')
		words = words.split(' ')
		seed = old_mnemonic.mn_decode(words)
		print seed
	password = getpass.getpass('Enter wallet encryption passphrase: ')
	password2 = getpass.getpass('Reenter wallet encryption passphrase: ')
	if password != password2:
		print 'ERROR. Passwords did not match'
		sys.exit(0)
	password_key = btc.bin_dbl_sha256(password)
	encrypted_seed = slowaes.encryptData(password_key, seed.decode('hex'))
	timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
	walletfile = json.dumps({'creator': 'joinmarket project', 'creation_time': timestamp,
		'encrypted_seed': encrypted_seed.encode('hex'), 'network': common.get_network()})
	walletname = raw_input('Input wallet file name (default: wallet.json): ')
	if len(walletname) == 0:
		walletname = 'wallet.json'
	fd = open(os.path.join('wallets', walletname), 'w')
	fd.write(walletfile)
	fd.close()
	print 'saved to ' + walletname
elif method == 'showseed':
	hexseed = wallet.seed
	print 'hexseed = ' + hexseed
	words = old_mnemonic.mn_encode(hexseed)
	print 'Wallet recovery seed\n\n' + ' '.join(words) + '\n'
Example #11
0
        words = raw_input('Input 12 word recovery seed: ')
        words = words.split(' ')
        seed = old_mnemonic.mn_decode(words)
        print seed
    password = getpass.getpass('Enter wallet encryption passphrase: ')
    password2 = getpass.getpass('Reenter wallet encryption passphrase: ')
    if password != password2:
        print 'ERROR. Passwords did not match'
        sys.exit(0)
    password_key = btc.bin_dbl_sha256(password)
    encrypted_seed = aes.encryptData(password_key, seed.decode('hex'))
    timestamp = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")
    walletfile = json.dumps({
        'creator': 'joinmarket project',
        'creation_time': timestamp,
        'encrypted_seed': encrypted_seed.encode('hex'),
        'network': common.get_network()
    })
    walletname = raw_input('Input wallet file name (default: wallet.json): ')
    if len(walletname) == 0:
        walletname = 'wallet.json'
    fd = open(os.path.join('wallets', walletname), 'w')
    fd.write(walletfile)
    fd.close()
    print 'saved to ' + walletname
elif method == 'showseed':
    hexseed = wallet.seed
    print 'hexseed = ' + hexseed
    words = old_mnemonic.mn_encode(hexseed)
    print 'Wallet recovery seed\n\n' + ' '.join(words) + '\n'
Example #12
0
def modes():
    if sys.argv[2] == '':
        all_description = ''
        networks = common.get_networks()
        networks.sort(key=lambda x: x.SITE.replace('the', ''))
        for network in networks:
            if addon.getSetting(network.SITE) == 'true':
                if network.NAME.endswith(', The'):
                    name = 'The ' + network.NAME.replace(', The', '')
                all_description += network.NAME + ', '
        count = 0
        cmlib = [(common.smart_utf8(addon.getLocalizedString(39034)) %
                  common.smart_utf8(addon.getLocalizedString(39000)),
                  "XBMC.RunPlugin(%s?mode='ForceFavoriteEpisodesLibrary')" %
                  (sys.argv[0]))]
        cmlib.append(
            (common.smart_utf8(addon.getLocalizedString(39035)),
             "XBMC.RunPlugin(%s?mode='ClearLibrary')" % (sys.argv[0])))
        export_u = sys.argv[0] + '?url="<join>"' + sys.argv[
            0] + '?url="' + '&mode=contextmenu' + '&sitemode=export_fav'

        cmlib.append(('Export Favorites', 'XBMC.RunPlugin(%s)' % export_u))
        del_u = sys.argv[0] + '?url="<join>"' + sys.argv[
            0] + '?url="' + '&mode=contextmenu' + '&sitemode=del_fav'

        cmlib.append(('Delete Favorites', 'XBMC.RunPlugin(%s)' % del_u))
        import_u = sys.argv[0] + '?url="<join>"' + sys.argv[
            0] + '?url="' + '&mode=contextmenu' + '&sitemode=import_fav'

        cmlib.append(('Import Favorites', 'XBMC.RunPlugin(%s)' % import_u))
        common.add_directory(
            common.smart_utf8(addon.getLocalizedString(39000)),
            'Favorlist',
            'NoUrl',
            thumb=ustvpaths.FAVICON,
            count=count,
            description=common.smart_utf8(addon.getLocalizedString(39001)) +
            '\n' + all_description,
            contextmenu=cmlib)
        count += 1
        cmlib = [(common.smart_utf8(addon.getLocalizedString(39034)) %
                  common.smart_utf8(addon.getLocalizedString(39002)),
                  "XBMC.RunPlugin(%s?mode='AllShowsLibrary')" % (sys.argv[0]))]
        cmlib.append(
            (common.smart_utf8(addon.getLocalizedString(39035)),
             "XBMC.RunPlugin(%s?mode='ClearLibrary')" % (sys.argv[0])))
        common.add_directory(
            common.smart_utf8(addon.getLocalizedString(39002)),
            'Masterlist',
            'NoUrl',
            thumb=ustvpaths.ALLICON,
            count=count,
            description=common.smart_utf8(addon.getLocalizedString(39003)) +
            '\n' + all_description,
            contextmenu=cmlib)
        count += 1
        for network in networks:
            network_name = network.NAME
            station_icon = os.path.join(ustvpaths.IMAGEPATH,
                                        network.SITE + '.png')
            if network_name.endswith(', The'):
                network_name = 'The ' + network_name.replace(', The', '')
            if addon.getSetting(network.SITE) == 'true':
                cmlib = [
                    (common.smart_utf8(addon.getLocalizedString(39034)) %
                     network_name,
                     "XBMC.RunPlugin(%s?mode='NetworkLibrary&submode='%s')" %
                     (sys.argv[0], network.SITE))
                ]
                cmlib.append(
                    (common.smart_utf8(addon.getLocalizedString(39035)),
                     "XBMC.RunPlugin(%s?mode='ClearLibrary')" % (sys.argv[0])))
                common.add_directory(network_name,
                                     network.SITE,
                                     'rootlist',
                                     thumb=station_icon,
                                     fanart=ustvpaths.PLUGINFANART,
                                     description=network.DESCRIPTION,
                                     count=count,
                                     contextmenu=cmlib)
            count += 1
        xbmcplugin.addSortMethod(pluginHandle,
                                 xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
        common.set_view()
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.mode.startswith('script_check'):
        try:
            updater = xbmcaddon.Addon('script.ustvvodlibraryautoupdate')
            updater.openSettings()
        except:
            dialog = xbmcgui.Dialog()
            dialog.ok(addon.getAddonInfo('name'),
                      addon.getLocalizedString(39041))
    elif common.args.mode.startswith('script_sources'):
        xbmclibrary.Validate()
    elif common.args.mode.endswith('Library'):
        xbmclibrary.Main()
    elif common.args.mode == 'Masterlist':
        xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
        common.load_showlist()
        common.set_view('tvshows')
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.sitemode == 'rootlist':
        xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
        common.root_list(common.args.mode)
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.sitemode.startswith('seasons'):
        common.season_list()
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.sitemode.startswith('episodes'):
        try:
            common.episode_list()
        except Exception as e:
            print "Error in Episodes:" + e
        if addon.getSetting('add_episode_identifier') == 'false':
            try:
                xbmcplugin.addSortMethod(pluginHandle,
                                         xbmcplugin.SORT_METHOD_DATEADDED)
            except:
                pass
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_EPISODE)
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_UNSORTED)
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_LABEL)
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_MPAA_RATING)
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_GENRE)
            xbmcplugin.addSortMethod(pluginHandle,
                                     xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.mode == 'Favorlist':
        xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
        common.load_showlist(favored=1)
        common.set_view('tvshows')
        xbmcplugin.endOfDirectory(pluginHandle)
    elif common.args.mode == 'contextmenu':
        getattr(contextmenu, common.args.sitemode)()
    elif common.args.mode == 'common':
        getattr(common, common.args.sitemode)()
    else:
        network = common.get_network(common.args.mode)
        if network:
            getattr(network, common.args.sitemode)()
            if 'episodes' in common.args.sitemode and addon.getSetting(
                    'add_episode_identifier') == 'false':
                try:
                    xbmcplugin.addSortMethod(pluginHandle,
                                             xbmcplugin.SORT_METHOD_DATEADDED)
                except:
                    pass
                xbmcplugin.addSortMethod(pluginHandle,
                                         xbmcplugin.SORT_METHOD_EPISODE)
                xbmcplugin.addSortMethod(pluginHandle,
                                         xbmcplugin.SORT_METHOD_UNSORTED)
            if not common.args.sitemode.startswith('play'):
                xbmcplugin.endOfDirectory(pluginHandle)
Example #13
0
def modes():
	if sys.argv[2] == '':
		all_description = ''
		networks = common.get_networks()
		networks.sort(key = lambda x: x.SITE.replace('the', ''))
		for network in networks:
			if addon.getSetting(network.SITE) == 'true':
				if network.NAME.endswith(', The'):
					name = 'The ' + network.NAME.replace(', The', '')
				all_description += network.NAME + ', '
		count = 0
		cmlib = [ (common.smart_utf8(addon.getLocalizedString(39034)) % common.smart_utf8(addon.getLocalizedString(39000)), "XBMC.RunPlugin(%s?mode='ForceFavoriteEpisodesLibrary')" % ( sys.argv[0] ) ) ]
		cmlib.append( (common.smart_utf8(addon.getLocalizedString(39035)), "XBMC.RunPlugin(%s?mode='ClearLibrary')" % ( sys.argv[0] ) ) )
		common.add_directory(common.smart_utf8(addon.getLocalizedString(39000)), 'Favorlist', 'NoUrl', thumb = ustvpaths.FAVICON, count = count, description = common.smart_utf8(addon.getLocalizedString(39001)) + '\n' + all_description,  contextmenu = cmlib)
		count += 1
		cmlib = [ (common.smart_utf8(addon.getLocalizedString(39034)) % common.smart_utf8(addon.getLocalizedString(39002)), "XBMC.RunPlugin(%s?mode='AllShowsLibrary')" % ( sys.argv[0] ) ) ]
		cmlib.append( (common.smart_utf8(addon.getLocalizedString(39035)), "XBMC.RunPlugin(%s?mode='ClearLibrary')" % ( sys.argv[0] ) ) )
		common.add_directory(common.smart_utf8(addon.getLocalizedString(39002)), 'Masterlist', 'NoUrl', thumb = ustvpaths.ALLICON, count = count, description = common.smart_utf8(addon.getLocalizedString(39003)) + '\n' + all_description,  contextmenu = cmlib)
		count += 1
		for network in networks:
			network_name = network.NAME
			station_icon = os.path.join(ustvpaths.IMAGEPATH, network.SITE + '.png')
			if network_name.endswith(', The'):
				network_name = 'The ' + network_name.replace(', The', '')
			if addon.getSetting(network.SITE) == 'true':
				cmlib = [ (common.smart_utf8(addon.getLocalizedString(39034)) % network_name, "XBMC.RunPlugin(%s?mode='NetworkLibrary&submode='%s')" % ( sys.argv[0], network.SITE ) ) ]
				cmlib.append( (common.smart_utf8(addon.getLocalizedString(39035)), "XBMC.RunPlugin(%s?mode='ClearLibrary')" % ( sys.argv[0] ) ) )
				common.add_directory(network_name, network.SITE, 'rootlist', thumb = station_icon, fanart = ustvpaths.PLUGINFANART, description = network.DESCRIPTION, count = count, contextmenu = cmlib)
			count += 1
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
		common.set_view()
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode.endswith('Library'):
		xbmclibrary.Main()
	elif common.args.mode == 'Masterlist':
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.load_showlist()
		common.set_view('tvshows')
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.sitemode == 'rootlist':
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.root_list(common.args.mode)
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.sitemode.startswith('seasons'):
		common.season_list()
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.sitemode.startswith('episodes'):
		try:
			common.episode_list()
		except Exception as e:
			print "Error in Episodes:" + e
		if addon.getSetting('add_episode_identifier') == 'false':
			try:
				xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_DATEADDED)
			except:
				pass
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_EPISODE)
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_UNSORTED)
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_MPAA_RATING)
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_GENRE)
			xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_VIDEO_RATING)
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode == 'Favorlist':   
		xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_LABEL)
		common.load_showlist(favored = 1)
		common.set_view('tvshows')
		xbmcplugin.endOfDirectory(pluginHandle)
	elif common.args.mode == 'contextmenu':
		getattr(contextmenu, common.args.sitemode)()
	elif common.args.mode == 'common':
		getattr(common, common.args.sitemode)()
	else:
		network = common.get_network(common.args.mode)
		if network:
			getattr(network, common.args.sitemode)()
			if 'episodes' in  common.args.sitemode and addon.getSetting('add_episode_identifier') == 'false':
				try:
					xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_DATEADDED)
				except:
					pass
				xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_EPISODE)
				xbmcplugin.addSortMethod(pluginHandle, xbmcplugin.SORT_METHOD_UNSORTED)
			if not common.args.sitemode.startswith('play'):
				xbmcplugin.endOfDirectory(pluginHandle)
	def ExportShow(self, show):
		series_title, mode, sitemode, url, tvdb_id, imdb_id, tvdbbanner, tvdbposter, tvdbfanart, first_aired, date, year, actors, genres, studio, plot, runtime, rating, airs_dayofweek, airs_time, status, has_full_episodes, favor, hide, show_name = show
		network = common.get_network(mode)
		allepisodes = []
		has_episodes = False
		has_movies = False
		if network:
			setattr(common.args, 'url', url)
			if '--' not in series_title:
				seasons = getattr(network, sitemode)(url)
				for season in seasons:
					section_title,  site, subsitemode, suburl, locked, unlocked = season
					episodes = getattr(network, subsitemode)(suburl)
					allepisodes.extend(episodes)
					for episode in allepisodes:
						type = episode[-1]
						info = episode[3]
						try:
							number = info['episode']
						except:
							number = -1
						if type == 'Full Episode' and number > -1:
							has_episodes = True
			else:
				episodes = getattr(network, sitemode)(url)
				allepisodes = episodes
				has_movies = True
			if has_movies:
				directory = MOVIE_PATH
				for episode in allepisodes:
					self.ExportVideo(episode, directory, studio = studio)
					icon = episode[2]
					self.Notification(addon.getLocalizedString(39036), addon.getLocalizedString(39037) % episode[1], image = icon)
			elif has_episodes:
				directory = os.path.join(TV_SHOWS_PATH, self.cleanfilename(show_name))
				self.CreateDirectory(directory)
				if addon.getSetting('shownfo') == 'true':
					plot = common.replace_signs(plot)
					tvshowDetails  = '<tvshow>'
					tvshowDetails += '<title>'+ show_name + '</title>'
					tvshowDetails += '<showtitle>' + show_name + '</showtitle>'
					tvshowDetails +=  '<rating>' + str(rating) + '</rating>'
					tvshowDetails +=  '<year>' + str(year) + '</year>'
					tvshowDetails +=  '<plot>' + plot + '</plot>'
					try:
						tvshowDetails += '<runtime>' + runtime +'</runtime>'
					except:
						pass
					try:
						tvshowDetails += '<thumb>' + tvdbposter +'</thumb>'
					except:
						try:
							tvshowDetails += '<thumb>' + tvdbbanner +'</thumb>'
						except:
							pass
					try:
						tvshowDetails += '<fanart>'
						tvshowDetails += '<thumb dim="1920x1080" colors="" preview="' + tvdbfanart + '">' + tvdbposter + '</thumb></fanart>'
					except:
						pass
					try:
						epguide = common.TVDBURL + ('/api/%s/series/%s/all/en.zip' % (common.TVDBAPIKEY, TVDB_ID))
						tvshowDetails += '<episodeguide>'
						tvshowDetails += '<url cache="' + TVDB_ID + '.xml">'+ epguide +'</url>'
						tvshowDetails += '</episodeguide>'
						tvshowDetails += '<id>' + TVDB_ID +'</id>'
					except:
						pass
					try:
						for genre in genres.split('|'):
							if genre:
								tvshowDetails += '<genre>' + genre + '</genre>'
					except:
						pass
					try:
						tvshowDetails += '<premiered>' + first_aired + '</premiered>'
					except:
						pass
					try:
						tvshowDetails += '<status>' + status + '</status>'
					except:
						pass
					try:
						tvshowDetails += '<studio>' + studio + '</studio>'
					except:
						pass
					try:
						for actor in actors.split('|'):
							if actor:
								tvshowDetails += '<actor><name>' + common.smart_unicode(actor) + '</name></actor>'
					except:
						pass
					tvshowDetails +='<dateadded>' + time.strftime("%Y-%m-%d %H:%M:%S") + '</dateadded>'
					tvshowDetails +='</tvshow>'					
					self.SaveFile( 'tvshow.nfo', tvshowDetails, directory)
				for episode in allepisodes:
					self.ExportVideo(episode, directory, studio = studio)
				self.Notification(addon.getLocalizedString(39036), addon.getLocalizedString(39037) % show_name, image = tvdbposter)