1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 20:22:36 +01:00
gallery-dl/gallery_dl/__init__.py

52 lines
1.3 KiB
Python
Raw Normal View History

2015-04-05 17:15:27 +02:00
# -*- coding: utf-8 -*-
# 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.
2014-10-12 21:56:44 +02:00
__author__ = "Mike Fährmann"
2015-04-05 17:15:27 +02:00
__copyright__ = "Copyright 2014, 2015 Mike Fährmann"
2014-10-12 21:56:44 +02:00
2015-04-05 17:15:27 +02:00
__license__ = "GPLv2"
__version__ = "0.2"
2014-10-12 21:56:44 +02:00
__maintainer__ = "Mike Fährmann"
__email__ = "mike_faehrmann@web.de"
import os
import sys
import argparse
2015-10-05 13:26:38 +02:00
from . import config, download
2014-10-12 21:56:44 +02:00
def parse_cmdline_options():
2015-04-05 17:15:27 +02:00
parser = argparse.ArgumentParser(
2014-10-12 21:56:44 +02:00
description='Download images from various sources')
2015-04-05 17:15:27 +02:00
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()
2014-10-12 21:56:44 +02:00
def main():
2015-10-05 13:26:38 +02:00
config.load()
2014-10-12 21:56:44 +02:00
opts = parse_cmdline_options()
2015-10-05 13:26:38 +02:00
dlmgr = download.DownloadManager(opts)
2014-10-12 21:56:44 +02:00
try:
for url in opts.urls:
dlmgr.add(url)
except KeyboardInterrupt:
2015-06-28 12:45:52 +02:00
print("\nKeyboardInterrupt")