From d57e0cb75208ad2a0868d5521e1662ef1e297b9b Mon Sep 17 00:00:00 2001 From: James Bunton Date: Wed, 21 Mar 2012 18:04:48 +1100 Subject: [PATCH] Better messages --- autograbber.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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(): -- 2.39.2