Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions upodder/upodder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
help='Import feeds from an OPML file.')
parser.add_argument("--quiet", help="Only output errors.",
action="store_true")
parser.add_argument('--verbose', action='store_true',
help="Ask user for confirmation before downloading each episode.")
args = parser.parse_args()

YES = [1,"1","on","yes","Yes","YES","y","Y","true","True","TRUE","t","T"]
Expand Down Expand Up @@ -115,6 +117,11 @@ def _download_enclosure(self, enclosure, entry, feed, no_download=False):
"""Downloads URL to file, returns file name of download (from URL or Content-Disposition)"""
if not os.path.exists(os.path.dirname(downloadto)):
os.makedirs(os.path.dirname(downloadto))

if args.verbose:
user_wish_to_download = input("Would you like to download " + entry['title'] +"? (y/n) or quit? (Ctrl+c): ")
if user_wish_to_download not in YES:
return True

l.debug("Downloading %s from %s" % (entry['title'], enclosure['href']))
r = requests.get(enclosure['href'], stream=True, timeout=25)
Expand Down