mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
50bb12561b
commit
cd15edb7ba
@ -328,6 +328,14 @@ def extract(path, dir):
|
|||||||
|
|
||||||
def get_proxies():
|
def get_proxies():
|
||||||
proxies = {}
|
proxies = {}
|
||||||
|
|
||||||
|
for q in ('http', 'ftp'):
|
||||||
|
proxy = os.environ.get(q+'_proxy', None)
|
||||||
|
if not proxy: continue
|
||||||
|
if proxy.startswith(q+'://'):
|
||||||
|
proxy = proxy[7:]
|
||||||
|
proxies[q] = proxy
|
||||||
|
|
||||||
if iswindows:
|
if iswindows:
|
||||||
try:
|
try:
|
||||||
winreg = __import__('_winreg')
|
winreg = __import__('_winreg')
|
||||||
@ -349,13 +357,6 @@ def get_proxies():
|
|||||||
print('Unable to detect proxy settings: %s' % str(e))
|
print('Unable to detect proxy settings: %s' % str(e))
|
||||||
if proxies:
|
if proxies:
|
||||||
print('Using proxies: %s' % proxies)
|
print('Using proxies: %s' % proxies)
|
||||||
else:
|
|
||||||
for q in ('http', 'ftp'):
|
|
||||||
proxy = os.environ.get(q+'_proxy', None)
|
|
||||||
if not proxy: continue
|
|
||||||
if proxy.startswith(q+'://'):
|
|
||||||
proxy = proxy[7:]
|
|
||||||
proxies[q] = proxy
|
|
||||||
return proxies
|
return proxies
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,10 +21,11 @@ if iswindows:
|
|||||||
elif isosx:
|
elif isosx:
|
||||||
config_dir = os.path.expanduser('~/Library/Preferences/calibre')
|
config_dir = os.path.expanduser('~/Library/Preferences/calibre')
|
||||||
else:
|
else:
|
||||||
config_dir = os.path.expanduser('~/.config/calibre')
|
bdir = os.path.abspath(os.path.expanduser(os.environ.get('XDG_CONFIG_HOME', '~/.config')))
|
||||||
|
config_dir = os.path.join(bdir, 'calibre')
|
||||||
|
|
||||||
if not os.path.exists(config_dir):
|
if not os.path.exists(config_dir):
|
||||||
os.makedirs(config_dir)
|
os.makedirs(config_dir, mode=448) # 0700 == 448
|
||||||
|
|
||||||
class Option(object):
|
class Option(object):
|
||||||
|
|
||||||
|
@ -73,11 +73,6 @@ MAP = {
|
|||||||
u"ь" : u"'",
|
u"ь" : u"'",
|
||||||
} #: Translation table
|
} #: Translation table
|
||||||
|
|
||||||
for c in string.whitespace:
|
|
||||||
MAP[c] = ' '
|
|
||||||
PAT = re.compile('['+u''.join(MAP.keys())+']')
|
|
||||||
print repr('['+u''.join(MAP.keys())+']')
|
|
||||||
|
|
||||||
def ascii_filename(orig):
|
def ascii_filename(orig):
|
||||||
orig = PAT.sub(lambda m:MAP[m.group()], orig)
|
orig = PAT.sub(lambda m:MAP[m.group()], orig)
|
||||||
buf = []
|
buf = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user