diff --git a/modules/nolifetv/backend.py b/modules/nolifetv/backend.py index 89f55361..f4335a1b 100644 --- a/modules/nolifetv/backend.py +++ b/modules/nolifetv/backend.py @@ -46,7 +46,12 @@ class NolifeTVBackend(BaseBackend, ICapVideo, ICapCollection): default = '5' )) def create_default_browser(self): - return self.create_browser(self.config['username'].get(), self.config['password'].get()) + username = self.config['username'].get() + if username: + password = self.config['password'].get() + else: + password = None + return self.create_browser(username, password) def iter_resources(self, objs, split_path): with self.browser: diff --git a/modules/nolifetv/browser.py b/modules/nolifetv/browser.py index 5cd5ab9e..26752efb 100644 --- a/modules/nolifetv/browser.py +++ b/modules/nolifetv/browser.py @@ -43,9 +43,12 @@ class NolifeTVBrowser(BaseBrowser): AVAILABLE_VIDEOS = ['[Gratuit]'] def is_logged(self): - return not self.is_on_page(HomePage) or self.page.is_logged() + return (self.username is None or (not self.is_on_page(HomePage)) or self.page.is_logged()) def login(self): + if self.username is None: + return + if not self.is_on_page(LoginPage): self.location('/login', no_login=True)