sbtools/downloader.py

18 lines
861 B
Python
Raw Normal View History

#!/usr/bin/env python3
2016-08-06 13:00:05 +00:00
def argparser():
parser = argparse.ArgumentParser()
parser.add_argument("url", type=str, nargs="+", help="photo URL as copied from message window")
group = parser.add_mutually_exclusive_group()
group.add_argument("-s", "--sender", type=str, help="name of the sender, puts images into subdirectory")
group.add_argument("-g", "--get-urls", help="get URLs only, don't download", action="store_true")
group2 = parser.add_mutually_exclusive_group()
group2.add_argument("-S", "--shut-up", help="don't output any notices and warnings", action="store_true")
2016-03-27 17:06:25 +00:00
group2.add_argument("-v", "--verbose", help="more verbose output", action="store_true")
return parser.parse_args()
if __name__ == "__main__":
args = argparser()
for url in args.url:
2016-08-06 13:00:05 +00:00
phototools.processURL(url, args.sender, args.get_urls, args.verbose, args.shut_up)