Catch CollectionNotFound
This commit is contained in:
parent
3e17eb0991
commit
f815a9c2c2
2 changed files with 4 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue