Package biblio :: Package webquery :: Package scripts :: Module renamebyisbn
[hide private]
[frames] | no frames]

Module renamebyisbn

source code

Rename files as by the ISBN buried in their original name.
Functions [hide private]
 
parse_args() source code
 
dir_base_ext_from_path(fpath)
Return a files base name and extension from it's path.
source code
 
rename_file(oldpath, newname)
Rename a file, while keeping it in the same location.
source code
 
extract_isbn_from_filename(fname) source code
 
generate_new_name(bibrec, options) source code
 
postprocess_name(name, options) source code
 
main() source code
Variables [hide private]
  ISBN10_PAT = '(\\d{9}[\\d|X])'
  ISBN13_PAT = '(\\d{13})'
  ISBN_PATS = ['\\(ISBN([^\\)]+)\\)', '^(\\d{13})$', '^(\\d{13})...
  ISBN_RE = [re.compile(r'(?i)\(ISBN([^\)]+)\)'), re.compile(r'(...
  _DEV_MODE = True
  DEF_NAME_FMT = '%(auth)s%(year)s_%(short_title)s_(isbn%(isbn)s)'
  DEF_STRIP_CHARS = ':!,\'".?()'
  DEF_BLANK_CHARS = ''
  STRIP_CHARS_RE = re.compile(r'[\'":,!\.\?\(\)]')
  COLLAPSE_SPACE_RE = re.compile(r'\s+')
  CASE_CHOICES = ['orig', 'upper', 'lower']
  p = '\\D(\\d{9}[\\d|X])$'
Variables Details [hide private]

ISBN_PATS

Value:
['\\(ISBN([^\\)]+)\\)',
 '^(\\d{13})$',
 '^(\\d{13})[\\b|_|\\.|\\-|\\s]',
 '[\\b|_|\\.|\\-|\\s](\\d{13})$',
 '[\\b|_|\\.|\\-|\\s](\\d{13})[\\b|_|\\.]',
 '^(\\d{9}[\\d|X])$',
 '^(\\d{9}[\\d|X])[\\b|_|\\.|\\s|\\-]',
 '[\\b|_|\\.|\\-|\\s](\\d{9}[\\d|X])$',
...

ISBN_RE

Value:
[re.compile(r'(?i)\(ISBN([^\)]+)\)'),
 re.compile(r'(?i)^(\d{13})$'),
 re.compile(r'(?i)^(\d{13})[\x08\|_\|\.\|-\|\s]'),
 re.compile(r'(?i)[\x08\|_\|\.\|-\|\s](\d{13})$'),
 re.compile(r'(?i)[\x08\|_\|\.\|-\|\s](\d{13})[\x08\|_\|\.]'),
 re.compile(r'(?i)^(\d{9}[\d\|X])$'),
 re.compile(r'(?i)^(\d{9}[\d\|X])[\x08\|_\|\.\|\s\|-]'),
 re.compile(r'(?i)[\x08\|_\|\.\|-\|\s](\d{9}[\d\|X])$'),
...