new API in BaseBackend to create browser

This commit is contained in:
Romain Bignon 2010-05-20 10:39:49 +02:00
commit c1279aa496
12 changed files with 84 additions and 87 deletions

View file

@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Christophe Benz, Romain Bignon
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@ -37,16 +37,9 @@ class YoutubeBackend(BaseBackend, ICapVideoProvider):
LICENSE = 'GPLv3'
CONFIG = {}
_browser = None
BROWSER = YoutubeBrowser
domain = u'youtube.com'
def __getattr__(self, name):
if name == 'browser':
if not self._browser:
self._browser = YoutubeBrowser()
return self._browser
raise AttributeError, name
@id2url(domain, YoutubeVideo.id2url)
def get_video(self, _id):
return self.browser.get_video(_id)