From: James Bunton Date: Wed, 21 Mar 2012 07:04:48 +0000 (+1100) Subject: Better messages X-Git-Url: https://code.delx.au/webdl/commitdiff_plain/d57e0cb75208ad2a0868d5521e1662ef1e297b9b Better messages --- diff --git a/autograbber.py b/autograbber.py index 9433d4a..a4fe7a2 100755 --- a/autograbber.py +++ b/autograbber.py @@ -20,19 +20,23 @@ class DownloadList(object): self.f.write(node.title + "\n") -def match(download_list, node, pattern): +def match(download_list, node, pattern, count=0): if node.can_download: if not download_list.has_seen(node): + print "Downloading", node.title if node.download(): download_list.mark_seen(node) else: print >>sys.stderr, "Failed to download!", node.title return - p = pattern[0] + if count >= len(pattern): + print "No match found for pattern:", "/".join(pattern) + return + p = pattern[count] for child in node.children: if fnmatch.fnmatch(child.title, p): - match(download_list, child, pattern[1:]) + match(download_list, child, pattern, count+1) def main():