• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python win_unicode_console.enable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中win_unicode_console.enable函数的典型用法代码示例。如果您正苦于以下问题:Python enable函数的具体用法?Python enable怎么用?Python enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了enable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: on_ready

    async def on_ready(self):
        try:
            win_unicode_console.enable()
        except:
            0

        await self.change_status(game=discord.Game(name='with Eruru\'s tail'))

        print('Connected!\n')
        print('Username: %s' % self.user.name)
        print('Bot ID: %s' % self.user.id)
        print()

        print('Command prefix is %s'% self.config.command_prefix)
        print()

        print('--Connected Servers List--')
        if self.servers:
            [print(s) for s in self.servers]
        else:
            print('No servers have been joined yet.')
        print()
        
        print('--Users Registered--')
        if len(self.users) > 0:
            for user in self.users:
                print(user.id + ' - ' + user.kissUrl)
        else:
            print('No users have registered yet.')
        print()
        
        print('--Log--')
        handler = getattr(self, 'event_loop', None)
        await handler()
开发者ID:Wicloz,项目名称:AnimeNotifierBot,代码行数:34,代码来源:bot.py


示例2: enable_win_unicode_console

    def enable_win_unicode_console(self):
        if sys.version_info >= (3, 6):
            # Since PEP 528, Python uses the unicode APIs for the Windows
            # console by default, so WUC shouldn't be needed.
            return

        import win_unicode_console

        if PY3:
            win_unicode_console.enable()
        else:
            # https://github.com/ipython/ipython/issues/9768
            from win_unicode_console.streams import (TextStreamWrapper,
                                 stdout_text_transcoded, stderr_text_transcoded)

            class LenientStrStreamWrapper(TextStreamWrapper):
                def write(self, s):
                    if isinstance(s, bytes):
                        s = s.decode(self.encoding, 'replace')

                    self.base.write(s)

            stdout_text_str = LenientStrStreamWrapper(stdout_text_transcoded)
            stderr_text_str = LenientStrStreamWrapper(stderr_text_transcoded)

            win_unicode_console.enable(stdout=stdout_text_str,
                                       stderr=stderr_text_str)
开发者ID:briandrawert,项目名称:ipython,代码行数:27,代码来源:interactiveshell.py


示例3: enable_win_unicode_console

    def enable_win_unicode_console(self):
        if sys.version_info >= (3, 6):
            # Since PEP 528, Python uses the unicode APIs for the Windows
            # console by default, so WUC shouldn't be needed.
            return

        import win_unicode_console
        win_unicode_console.enable()
开发者ID:PKpacheco,项目名称:monitor-dollar-value-galicia,代码行数:8,代码来源:interactiveshell.py


示例4: setup_win_unicode_console

def setup_win_unicode_console(enable):
    """"Enables or disables unicode display on windows."""
    enable = to_bool(enable)
    if ON_WINDOWS and win_unicode_console:
        if enable:
            win_unicode_console.enable()
        else:
            win_unicode_console.disable()
    return enable
开发者ID:kirbyfan64,项目名称:xonsh,代码行数:9,代码来源:tools.py


示例5: on_ready

    async def on_ready(self):
        win_unicode_console.enable()

        print('Connected!\n')
        print('Username: ' + self.user.name)
        print('ID: ' + self.user.id)
        print('--Server List--')

        for server in self.servers:
            print(server.name)

        print()
开发者ID:akinunsal,项目名称:WeeDBot,代码行数:12,代码来源:bot.py


示例6: main

def main(argv):
    # parse config file
    configfile = './config.cfg'
    if len(argv) == 2:
        configfile = argv[1]
    config = parse_config(configfile)

    win_unicode_console.enable()
    result = check_update(config)
    win_unicode_console.disable()

    return result
开发者ID:bskim45,项目名称:ccleaner-auto-update,代码行数:12,代码来源:CCleanerAutoUpdate.py


示例7: setup_win_unicode_console

def setup_win_unicode_console(enable):
    """"Enables or disables unicode display on windows."""
    try:
        import win_unicode_console
    except ImportError:
        win_unicode_console = False
    enable = to_bool(enable)
    if ON_WINDOWS and win_unicode_console:
        if enable:
            win_unicode_console.enable()
        else:
            win_unicode_console.disable()
    return enable
开发者ID:DangerOnTheRanger,项目名称:xonsh,代码行数:13,代码来源:tools.py


示例8: main

def main():
    try:
        if os.name == 'nt':
            import win_unicode_console
            win_unicode_console.enable()
        fmt = '%(name)-20s%(lineno)-3s %(funcName)-17s: %(message)s'.format()
        logging.basicConfig(format=fmt, level=logging.INFO)
        functionName, args = simple_parse_args(sys.argv)
        functionObject = get_function_from_name(functionName)
        log.info("%s(%s) ...", functionObject.__name__, ", ".join(args))
        functionObject(*args)
        return 0
    except KeyboardInterrupt:
        print("\n... bye!")
开发者ID:Falk92,项目名称:mau-mau,代码行数:14,代码来源:cli.py


示例9: init_io

    def init_io(self):
        if sys.platform not in {'win32', 'cli'}:
            return

        import win_unicode_console
        import colorama

        win_unicode_console.enable()
        colorama.init()

        # For some reason we make these wrappers around stdout/stderr.
        # For now, we need to reset them so all output gets coloured.
        # https://github.com/ipython/ipython/issues/8669
        from IPython.utils import io
        io.stdout = io.IOStream(sys.stdout)
        io.stderr = io.IOStream(sys.stderr)
开发者ID:JaminJiang,项目名称:ipython,代码行数:16,代码来源:interactiveshell.py


示例10: run

def run():
    """ Run as CLI command """

    try:
        import win_unicode_console
        win_unicode_console.enable(use_unicode_argv=True)
    except ImportError:
        pass

    try:
        import colorama
        colorama.init()
    except ImportError:
        pass

    import warnings
    warnings.simplefilter("ignore")

    sys.exit(main())
开发者ID:RealDolos,项目名称:volaupload,代码行数:19,代码来源:__main__.py


示例11: set_colors

def set_colors():
	global G, Y, B, R, W , M , C , end ,Bold,underline
	if os.name=="nt":
		try:
			import win_unicode_console , colorama
			win_unicode_console.enable()
			colorama.init()
			#green - yellow - blue - red - white - magenta - cyan - reset
			G,Y,B,R,W,M,C,end= '\033[92m','\033[93m','\033[94m','\033[91m','\x1b[37m','\x1b[35m','\x1b[36m','\033[0m'
			Bold = "\033[1m"
			underline = "\033[4m"
		except:
			G = Y = B = R = W = G = Y = B = R = Bold = underline = ''
	else:
		#import colorama
		#colorama.init()
		#green - yellow - blue - red - white - magenta - cyan - reset
		G,Y,B,R,W,M,C,end= '\033[92m','\033[93m','\033[94m','\033[91m','\x1b[37m','\x1b[35m','\x1b[36m','\033[0m'
		Bold = "\033[1m"
		underline = "\033[4m"
开发者ID:Nicodiamond1c8,项目名称:One-Lin3r,代码行数:20,代码来源:color.py


示例12: enable_win_unicode_console

    def enable_win_unicode_console(self):
        import win_unicode_console

        if PY3:
            win_unicode_console.enable()
        else:
            # https://github.com/ipython/ipython/issues/9768
            from win_unicode_console.streams import (TextStreamWrapper,
                                 stdout_text_transcoded, stderr_text_transcoded)

            class LenientStrStreamWrapper(TextStreamWrapper):
                def write(self, s):
                    if isinstance(s, bytes):
                        s = s.decode(self.encoding, 'replace')

                    self.base.write(s)

            stdout_text_str = LenientStrStreamWrapper(stdout_text_transcoded)
            stderr_text_str = LenientStrStreamWrapper(stderr_text_transcoded)

            win_unicode_console.enable(stdout=stdout_text_str,
                                       stderr=stderr_text_str)
开发者ID:Zenigma,项目名称:ipython,代码行数:22,代码来源:interactiveshell.py


示例13: on_ready

    async def on_ready(self):
        win_unicode_console.enable()

        print('Connected!\n')
        print('Username: %s' % self.user.name)
        print('Bot ID: %s' % self.user.id)
        print('Owner ID: %s' % self.config.owner_id)
        print()

        print("Command prefix is %s" % self.config.command_prefix)
        # print("Days active required to use commands is %s" % self.config.days_active) # NYI
        print("Skip threshold at %s votes or %g%%" % (self.config.skips_required, self.config.skip_ratio_required*100))
        print("Whitelist check is %s" % ['disabled', 'enabled'][self.config.white_list_check])
        print("Now Playing message @mentions are %s" % ['disabled', 'enabled'][self.config.now_playing_mentions])
        print("Autosummon is %s" % ['disabled', 'enabled'][self.config.auto_summon])
        print("Auto-playlist is %s" % ['disabled', 'enabled'][self.config.auto_playlist])
        print()

        if self.servers:
            print('--Server List--')
            [print(s) for s in self.servers]
        else:
            print("No servers have been joined yet.")

        print()

        if self.config.owner_id == self.user.id:
            print(
                "[Notice] You have either set the OwnerID config option to the bot's id instead "
                "of yours, or you've used your own credentials to log the bot in instead of the "
                "bot's account (the bot needs its own account to work properly).")

        # maybe option to leave the ownerid blank and generate a random command for the owner to use

        if self.config.auto_summon:
            as_ok = await self._auto_summon()

            if self.config.auto_playlist and as_ok:
                await self.on_finished_playing(await self.get_player(self._get_owner_voice_channel()))
开发者ID:pengu5055,项目名称:unified-servant-bot,代码行数:39,代码来源:bot.py


示例14: print

    pass

# Check if we are running this on windows platform
is_windows = sys.platform.startswith('win')

# Console Colors
if is_windows:
    # Windows deserves coloring too :D
    G = '\033[92m'  # green
    Y = '\033[93m'  # yellow
    B = '\033[94m'  # blue
    R = '\033[91m'  # red
    W = '\033[0m'   # white
    try:
        import win_unicode_console , colorama
        win_unicode_console.enable()
        colorama.init()
        #Now the unicode will work ^_^
    except:
        print("[!] Error: Coloring libraries not installed, no coloring will be used [Check the readme]")
        G = Y = B = R = W = G = Y = B = R = W = ''


else:
    G = '\033[92m'  # green
    Y = '\033[93m'  # yellow
    B = '\033[94m'  # blue
    R = '\033[91m'  # red
    W = '\033[0m'   # white

开发者ID:exploitprotocol,项目名称:Sublist3r,代码行数:29,代码来源:sublist3r.py


示例15: init_output

def init_output():
    import colorama
    win_unicode_console.enable()
    colorama.init()
开发者ID:Googulator,项目名称:thefuck,代码行数:4,代码来源:win32.py


示例16:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
# pylint: disable=redefined-variable-type

try:
    import win_unicode_console
    win_unicode_console.enable(use_unicode_argv=True)
except ImportError:
    pass

import logging
import sys
import time

from contextlib import ExitStack, suppress

from path import Path
from volapi import Room, listen_many

from .constants import ADMINFAG, PARROTFAG
from ._version import __fulltitle__, __version__
from .arb import ARBITRATOR
开发者ID:RealDolos,项目名称:volaparrot,代码行数:31,代码来源:__main__.py


示例17: main

def main(argv=None):
    """Command line app main function.

    :param list | None argv: Overrides command options (for libuse or testing)
    """
    parser = create_parser()

    args = parser.parse_args() if argv is None else parser.parse_args(argv)

    schemas = ('xsd',) if not args.schemas else tuple(args.schemas)

    if args.debug:
        logging.basicConfig(
            level=logging.DEBUG,
            format='%(asctime)s - %(levelname)s - %(name)s - %(message)s'
        )
        print('DEBUG logging enabled.')

    try:
        import win_unicode_console
        win_unicode_console.enable()
        log.debug('Running with win-unicode-console patch')
    except Exception:
        pass

    log.debug('TYPE of path: %s' % type(args.path))
    # validate current working dir
    if not args.infile and not args.path:
        args.path = os.getcwdu()
        log.debug('NEW TYPE of path: %s' % type(args.path))

    all_valid = True

    if args.infile:
        log.debug('TYPE of infile.name: %s' % type(args.infile.name))
        print('Validating: %s' % args.infile.name)
        messages = validate(args.infile, schemas)
        is_valid = messages == []
        if is_valid:
            print('VALID - No errors found')
        else:
            print('INVALID - errors found:', file=sys.stderr)
            all_valid = False
            for msg in messages:
                if args.debug:
                    print(msg.__str__(), file=sys.stderr)
                else:
                    print(msg.short, file=sys.stderr)

    if args.path:
        tree_or_dir = 'tree' if args.recursive else 'dir'
        print()
        print('Validating all files in %s %s' % (tree_or_dir, args.path))

        for onix_file_path in iter_files(args.path, args.ext, args.recursive):
            print()
            print('Validating: %s' % onix_file_path)
            with open(onix_file_path, 'rb') as onix_file:
                messages = validate(onix_file, schemas)
                is_valid = messages == []

            if is_valid:
                print('VALID - No errors found')
            else:
                print('INVALID - errors found:', file=sys.stderr)
                all_valid = False
                for msg in messages:
                    if args.debug:
                        print(msg.__str__(), file=sys.stderr)
                    else:
                        print(msg.short, file=sys.stderr)
    if all_valid:
        return 0
    else:
        return 1
开发者ID:titusz,项目名称:onixcheck,代码行数:75,代码来源:__main__.py


示例18: write_html

#!/usr/bin/python
import argparse, codecs, colorama, os, requests, urllib, sysfrom bs4 import BeautifulSoupfrom mako.template import Template
if sys.platform == 'win32': import win_unicode_console	win_unicode_console.enable()
colorama.init()
import readline
try:	readline.read_history_file(os.path.expanduser('~/.wash.history'))except IOError: pass
buffer = []
def write_html(fp):	template = Template('''<!doctype html><html>	<head>		<meta charset="utf-8"/>		<title>W|ASH Workbook</title>		<link href='https://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700' rel='stylesheet' type='text/css'>		<link href='http://fonts.googleapis.com/css?family=Anonymous+Pro' rel='stylesheet' type='text/css'>		<style>		body {			background-color: #E4E9EB;			font-family: 'PT Sans Caption', sans-serif;			margin-left: 60px;			margin-right: 60px;		}		h1 {			color: #004B63;			margin-left: -40px;		}		article {			margin-top: 2em;			margin-bottom: 1em;		}		h2 {			margin-bottom: 1em;		}		h3 {			background-color: #def;			margin-top: 0;			margin-bottom: 0;			padding-left: 10px;			padding-right: 10px;			padding-top: 1.5px;			padding-bottom: 1.5px;			font-size: 1.02em;			border: 1px solid #69a;			border-collapse: collapse;		}		pre {			font-family: 'Anonymous Pro', serif;			background-color: white;			padding-top: .75em;			padding-bottom: .6em;			padding-left: 10px;			padding-right: 10px;			margin-top: 0;			margin-bottom: 0;			border-left: 1px solid #9ac;			border-right: 1px solid #9ac;			border-collapse: collapse;			white-space: pre-wrap;		}		article > h3:nth-of-type(1) {			border-top-left-radius: 4px;			border-top-right-radius: 4px;		}		article > *:last-child {			border-bottom: 1px solid #69a;			border-bottom-left-radius: 4px;			border-bottom-right-radius: 4px;		}		a {			color: #004B63;			text-decoration: none;			border-bottom: 1px dashed black;		}		a:hover {			border-bottom: 1px solid black;		}		</style>	</head>	<body>		<h1>W|ASH Workbook</h1> % for query, pods in data:			<article class="query">				<h2><a href="http://www.wolframalpha.com/input/?i=${quote(query.encode('utf-8'))}">${query}</a></h2> % for name, texts in pods:					<h3>${name}</h3> % for text in texts:						<pre>${indent(text, prefix='')}</pre> % endfor % endfor			</article> % endfor	</body></html>''')	fp.write(template.render(data=buffer, quote=urllib.quote, indent=indent))
def write_markdown(fp):	template = Template('''W|ASH Workbook==============% for query, pods in data:${query}${'-' * len(query)} % for name, texts in pods:${'###'} ${name} % for text in texts:${indent(text)} % endfor % endfor% endfor''')	fp.write(template.render(data=buffer, indent=indent))
def indent(text, prefix=' '):	lines = text.split('\n')	initial = min(len(line) - len(line.lstrip()) for line in lines) return '\n'.join(prefix + x[initial:].rstrip() for x in lines)
def clean(text):	text = text.replace(u'\uf7d9', '=') return text
url = 'http://api.wolframalpha.com/v2/query'def wa_query(query):	xml = requests.get(url, params=dict(input=query, appid=appid, format='plaintext')).content if args.verbose: print xml return BeautifulSoup(xml, 'html.parser')
def main(): global appid, args	parser = argparse.ArgumentParser(description='Wolfram|Alpha interactive shell')	parser.add_argument('-v', '--verbose', action='store_true', help='Output XML for each response')
	args = parser.parse_args()
	fn = os.path.expanduser('~/.wash.appid') try:		appid = file(fn).read()		first_run = False except:		first_run = True print '\033[93m-- No Wolfram|Alpha app ID' print 'If you do not already have one, go to:' print '  https://developer.wolframalpha.com/portal/apisignup.html\033[0m' while True:			appid = raw_input('Please enter your app ID: ').strip()			bs = wa_query('Cody Brocious') print '\033[93mVerifying App ID...' if bs.queryresult['success'] == 'true' and bs.queryresult['error'] == 'false': print '\033[92mApp ID is correct\033[0m' with file(fn, 'w') as fp:					fp.write(appid) break else: print '\033[91mApp ID is invalid\033[0m'
 if first_run: print print '\033[92mWelcome to W|ASH\033[0m' print '\033[93mTo get started, simply type a query here as if you are on the Wolfram|Alpha site.' print 'For instance, try this: the 15th prime number * 20\033[0m' print
	result = None
 while True: try:			query = raw_input('W|A> ').strip() except EOFError: print break except KeyboardInterrupt: print continue		readline.write_history_file(os.path.expanduser('~/.wash.history')) if query == '': continue elif query == 'quit' or query == 'exit': print '\033[91mTo quit W|ASH, press Ctrl-D\033[0m' continue elif query == 'help': print '\033[1m\033[92mW|ASH Help\033[0m' print '\033[93m - Type a query to send it to Wolfram|Alpha' print ' - $$ in a query will be replaced by the previous result' print ' - save <filename> will save the current buffer to a file as HTML or Markdown' print '   - To save HTML, simply add .html to the filename' print ' - Ctrl-D to quit\033[0m' print continue elif query.startswith('save '):			fn = query[5:].strip() print '\033[92mSaving to', fn, '\033[0m' with codecs.open(fn, 'w', 'utf-8') as fp: if fn.lower().endswith('.html'):					write_html(fp) else:					write_markdown(fp) continue
 if '$$' in query: if result is not None:				query = query.replace('$$', ' (%s) ' % result) else: print '\033[91m$$ in query with no previous result!\033[0m' print continue
		bs = wa_query(query) if bs.queryresult['success'] == 'true':			element = (query, [])			buffer.append(element) for pod in bs.find_all('pod'):				numsubpods = int(pod['numsubpods']) if numsubpods == 0 or ''.join(''.join(subpod.plaintext.contents) for subpod in pod.find_all('subpod')).strip() == '': continue				epod = (pod['title'], [])				element[1].append(epod) print ' \033[1m\033[92m%s\033[0m' % pod['title'] for i, subpod in enumerate(pod.find_all('subpod')): if len(subpod.plaintext.contents):						text = clean('\n'.join(subpod.plaintext.contents)) print indent(text)						epod[1].append(text)
 if pod['title'] == 'Result':							result = text if '  (' in result:								result = result.split('  (', 1)[0] if i + 1 < numsubpods and numsubpods > 1 and '\n' in text: print if len(bs.find_all('pod', dict(scanner='Formula'))): print print '\033[91mThis appears to be an interactive formula.' print 'Results may be nonsensical.\033[0m' else: print '\033[91mQuery failed\033[0m' for tip in bs.find_all('tip'): print '\033[93m-', tip['text'], '\033[0m' print
if __name__=='__main__':	main()
开发者ID:ccavxx,项目名称:py-search,代码行数:22,代码来源:daeken_wash.py


示例19: fix_command

from argparse import ArgumentParser
from warnings import warn
from pprint import pformat
import sys
import win_unicode_console
win_unicode_console.enable() #https://github.com/tartley/colorama/issues/32
import colorama
from . import logs, types, shells
from .conf import settings
from .corrector import get_corrected_commands
from .exceptions import EmptyCommand
from .utils import get_installation_info
from .ui import select_command


def fix_command():
    """Fixes previous command. Used when `thefuck` called without arguments."""
    colorama.init()
    settings.init()
    with logs.debug_time('Total'):
        logs.debug(u'Run with settings: {}'.format(pformat(settings)))

        try:
            command = types.Command.from_raw_script(sys.argv[1:])
        except EmptyCommand:
            logs.debug('Empty command, nothing to do')
            return

        corrected_commands = get_corrected_commands(command)
        selected_command = select_command(corrected_commands)
开发者ID:pakrym,项目名称:thefuck,代码行数:30,代码来源:main.py


示例20: main

def main():

	# Fix console for windows users
	if platform.system() == 'Windows':
		import win_unicode_console
		win_unicode_console.enable()

	args = docopt(__doc__, version = ('lyrico ' + __version__))

	# The check_config flag instructs the "Config.load_config" to skip the 'BadConfigError's.
	# So only when user is running downloads, the config must be valid.
	# When user is running cmds to update config, it will be always loaded
	# regardless of values of the settings.
	check_config = not(args['--settings'] or args['disable'] or args['enable'] or args['set'])

	Config.load_config(check_config)
	if not Config.is_loaded:
		# Config not loaded due to exceptions. Error logged by exception handlers.
		return
	
	if args['--settings']:
		# show current settings
		Config.show_settings()
		return

	if args['disable'] or args['enable'] or args['set']:
		# User is updating config

		if args['set']:
			# setting 'lyrics_dir' or 'source_dir'

			# This general try catch block is intended for os.makedirs call if
			# it raises OSError which is not due to directory already existing or
			# some other error than OSError
			try:
				Config.set_dir(args['<dir_type>'], args['<full_path_to_dir>'])
			except Exception as e:
				print(e)

		if args['enable'] or args['disable']:
			# setting 'save_to_file', 'save_to_tag' or 'overwrite'.

			# detect wether user wants to enable or disable a lyrico action
			update_type = 'enable' if args['enable'] else 'disable'
			Config.update_lyrico_actions(args['<lyrico_action>'], update_type)
	else:
		# User wants to download lyrics.

		if args['<source_dir>']:
			# if lyrico <source_dir> invocation is used:
			# update user's "source_dir" in config
			# update Config class' 'source_dir' class variable

			# This general try catch block is intended for os.makedirs call if
			# it raises OSError which is not due to directory already existing or
			# some other error than OSError
			try:
				set_dir_success = Config.set_dir('source_dir', args['<source_dir>'])
			except Exception as e:
				print(e)
				# Don't go ahead with excution since user gave bad path or might have
				# correct system settings?
				return

			# For this usage if user provides non existing dir, return by using boolean
			# return value of Config.set_dir
			if not set_dir_success:
				return

			# update class variable so that new setting is reflected across modules.
			Config.source_dir = args['<source_dir>']
				
		song_list = [Song(song_path) for song_path in get_song_list(Config.source_dir)]
		print(len(song_list), 'songs detected.')
		print('Metadata extracted for', (str(Song.valid_metadata_count) + '/' + str(len(song_list))), 'songs.')
		for song in song_list:
			# Only download lyrics if 'title' and 'artist' is present
			# Error str is already present in song.error
			if song.artist and song.title:
				song.download_lyrics()

			# Show immidiate log in console
			else:
				# If title was present, use that
				if song.title:
					print(song.title, 'was ignored.', song.error)
				# else use audio file path
				else:
					print(song.path, 'was ignored.', song.error)


		print('\nBuilding log...')
		Song.log_results(song_list)
		print('FINISHED')
		
		# Disable windows unicode console anyways
		if platform.system() == 'Windows':
			win_unicode_console.disable()
开发者ID:abhimanyuPathania,项目名称:lyrico,代码行数:98,代码来源:lyrico.py



注:本文中的win_unicode_console.enable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python winappdbg.Debug类代码示例发布时间:2022-05-26
下一篇:
Python winUser.setCursorPos函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap