From f815a9c2c2a7fd26ef9ffd4cbb0c84498cffedf3 Mon Sep 17 00:00:00 2001 From: Nicolas Duhamel Date: Mon, 11 Apr 2011 17:36:43 +0200 Subject: [PATCH] Catch CollectionNotFound --- weboob/applications/videoob/videoob.py | 4 +++- weboob/backends/canalplus/browser.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index a6fcd046..e5ac17e1 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -29,7 +29,7 @@ from weboob.tools.application.repl import ReplApplication from weboob.tools.application.media_player import InvalidMediaPlayer, MediaPlayer, MediaPlayerNotFound from weboob.tools.application.formatters.iformatter import IFormatter -from weboob.capabilities.collection import Collection, ICapCollection +from weboob.capabilities.collection import Collection, ICapCollection, CollectionNotFound __all__ = ['Videoob'] @@ -302,6 +302,8 @@ class Videoob(ReplApplication): except NotImplementedError: print >>sys.stderr, "Error backend %s not implement collection" % working_backend return 1 + except CollectionNotFound: + print >>sys.stderr, "Path: %s not found" % ('/'+'/'.join(final_parse)) escape = lambda s: s.replace('/', '%2F') path = map(escape, path) diff --git a/weboob/backends/canalplus/browser.py b/weboob/backends/canalplus/browser.py index 70dfff2b..af98feeb 100644 --- a/weboob/backends/canalplus/browser.py +++ b/weboob/backends/canalplus/browser.py @@ -87,7 +87,7 @@ class CanalplusBrowser(BaseBrowser): if i in [collection.title for collection in collections if isinstance(collection, Collection)]: final.append(i) else: - print "Error path %s unknow, %s , %s " % (i,final,[collection.title for collection in collections if isinstance(collection, Collection)] ) + #~ print "Error path %s unknow, %s , %s " % (i,final,[collection.title for collection in collections if isinstance(collection, Collection)] ) raise CollectionNotFound() return walk(path, [collection.children for collection in collections if isinstance(collection, Collection) and collection.title == i][0], final) @@ -105,7 +105,6 @@ class CanalplusBrowser(BaseBrowser): return [collection.title for collection in collections ] i = path[0] if i not in [collection.title for collection in collections]: - print "Error path %s unknow" % i raise CollectionNotFound() return walk_res(path[1:], [collection.children for collection in collections if collection.title == i][0])