Merge branch 'master' into masseffect2in

This commit is contained in:
Dmitry Kozliuk
2015-07-27 20:03:04 +03:00
4 changed files with 38 additions and 20 deletions
+2 -2
View File
@@ -392,8 +392,8 @@ add_to_replace_metadata:
tagsfromtitle=>^.*?([\(\[]([^\]\)]+)[\)\]]).*?$=>\1
# remove () []
tagsfromtitle=>[\(\)\[\]]=>
# change (spaces)slash(spaces) to comma
tagsfromtitle=> */ *=>,
# change (spaces)slash(or semicolon)(spaces) to comma
tagsfromtitle=> *[/;] *=>,
tagsfromtitle=> x =>,
# remove [] or () blocks and leading/trailing spaces/dashes/colons
+9 -16
View File
@@ -16,7 +16,7 @@
#
from optparse import OptionParser
from os.path import expanduser, isfile, join, dirname
from os.path import expanduser, join, dirname
from os import access, R_OK
from subprocess import call
import ConfigParser
@@ -214,25 +214,18 @@ def do_download(arg,
if passed_defaultsini:
configuration.readfp(passed_defaultsini)
if isfile(join(dirname(__file__), 'defaults.ini')):
conflist.append(join(dirname(__file__), 'defaults.ini'))
if isfile(join(homepath, 'defaults.ini')):
conflist.append(join(homepath, 'defaults.ini'))
if isfile(join(homepath2, 'defaults.ini')):
conflist.append(join(homepath2, 'defaults.ini'))
if isfile('defaults.ini'):
conflist.append('defaults.ini')
# don't need to check existance for our selves.
conflist.append(join(dirname(__file__), 'defaults.ini'))
conflist.append(join(homepath, 'defaults.ini'))
conflist.append(join(homepath2, 'defaults.ini'))
conflist.append('defaults.ini')
if passed_personalini:
configuration.readfp(passed_personalini)
if isfile(join(homepath, 'personal.ini')):
conflist.append(join(homepath, 'personal.ini'))
if isfile(join(homepath2, 'personal.ini')):
conflist.append(join(homepath2, 'personal.ini'))
if isfile('personal.ini'):
conflist.append('personal.ini')
conflist.append(join(homepath, 'personal.ini'))
conflist.append(join(homepath2, 'personal.ini'))
conflist.append('personal.ini')
if options.configfile:
conflist.extend(options.configfile)
+25
View File
@@ -17,6 +17,7 @@
import ConfigParser, re
import exceptions
import codecs
from ConfigParser import DEFAULTSECT, MissingSectionHeaderError, ParsingError
# All of the writers(epub,html,txt) and adapters(ffnet,twlt,etc)
@@ -459,6 +460,30 @@ class Configuration(ConfigParser.SafeConfigParser):
else:
return self.linenos.get(section,None)
## Copied from Python 2.7 library so as to make read utf8.
def read(self, filenames):
"""Read and parse a filename or a list of filenames.
Files that cannot be opened are silently ignored; this is
designed so that you can specify a list of potential
configuration file locations (e.g. current directory, user's
home directory, systemwide directory), and all existing
configuration files in the list will be read. A single
filename may also be given.
Return list of successfully read files.
"""
if isinstance(filenames, basestring):
filenames = [filenames]
read_ok = []
for filename in filenames:
try:
fp = codecs.open(filename,encoding='utf-8')
except IOError:
continue
self._read(fp, filename)
fp.close()
read_ok.append(filename)
return read_ok
## Copied from Python 2.7 library so as to make it save linenos too.
#
# Regular expressions for parsing section headers and options.
+2 -2
View File
@@ -389,8 +389,8 @@ add_to_replace_metadata:
tagsfromtitle=>^.*?([\(\[]([^\]\)]+)[\)\]]).*?$=>\1
# remove () []
tagsfromtitle=>[\(\)\[\]]=>
# change (spaces)slash(spaces) to comma
tagsfromtitle=> */ *=>,
# change (spaces)slash(or semicolon)(spaces) to comma
tagsfromtitle=> *[/;] *=>,
tagsfromtitle=> x =>,
# remove [] or () blocks and leading/trailing spaces/dashes/colons