From 63bf0d1725f2dd9a05d2bb3ea5aca2b70622f08c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 5 Apr 2015 17:15:27 +0200 Subject: [PATCH] update __init__.py --- gallery_dl/__init__.py | 52 +++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/gallery_dl/__init__.py b/gallery_dl/__init__.py index ef7208ef..dbb4c7e7 100644 --- a/gallery_dl/__init__.py +++ b/gallery_dl/__init__.py @@ -1,8 +1,16 @@ -__author__ = "Mike Fährmann" -__copyright__ = "Copyright 2014, Mike Fährmann" +# -*- coding: utf-8 -*- -__license__ = "GPLv3" -__version__ = "0.4" +# Copyright 2014, 2015 Mike Fährmann +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +__author__ = "Mike Fährmann" +__copyright__ = "Copyright 2014, 2015 Mike Fährmann" + +__license__ = "GPLv2" +__version__ = "0.2" __maintainer__ = "Mike Fährmann" __email__ = "mike_faehrmann@web.de" @@ -11,34 +19,40 @@ import sys import argparse import configparser -from . import extractor -from . import downloader +from download import DownloadManager def parse_cmdline_options(): - p = argparse.ArgumentParser( + parser = argparse.ArgumentParser( description='Download images from various sources') - p.add_argument("-c", "--config", - default="~/.config/gallery/config", metavar="CFG", help="alternate configuration file") - p.add_argument("-d", "--dest", - metavar="DEST", help="destination directory") - p.add_argument("urls", nargs="+", - metavar="URL", help="url to download images from") - return p.parse_args() + parser.add_argument( + "-c", "--config", + default="~/.config/gallery/config", metavar="CFG", + help="alternate configuration file" + ) + parser.add_argument( + "-d", "--dest", + metavar="DEST", + help="destination directory" + ) + parser.add_argument( + "urls", + nargs="+", metavar="URL", + help="url to download images from" + ) + return parser.parse_args() def parse_config_file(path): config = configparser.ConfigParser( interpolation=None, ) - config.optionxform = lambda opt:opt + config.optionxform = lambda opt: opt config.read(os.path.expanduser(path)) return config def main(): opts = parse_cmdline_options() conf = parse_config_file(opts.config) - extf = extractor.ExtractorFinder(conf) - dlmg = downloader.DownloadManager(opts, conf) + dlmgr = DownloadManager(opts, conf) for url in opts.urls: - ex = extf.match(url) - dlmg.add(ex) + dlmgr.add(url)