[opensubtitles] search is faster, fillobj is handled for info command

This commit is contained in:
Julien Veyssier 2013-03-13 14:37:53 +01:00
commit 2c3eb10ac3
2 changed files with 49 additions and 6 deletions

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.subtitle import ICapSubtitle,LanguageNotSupported
from weboob.capabilities.subtitle import ICapSubtitle,LanguageNotSupported,Subtitle
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from weboob.tools.backend import BaseBackend
@ -54,3 +54,14 @@ class OpensubtitlesBackend(BaseBackend, ICapSubtitle):
if language not in LANGUAGE_CONV.keys():
raise LanguageNotSupported()
return self.browser.iter_subtitles(language,quote_plus(pattern.encode('utf-8')))
def fill_subtitle(self, subtitle, fields):
if 'description' in fields:
sub = self.get_subtitle(subtitle.id)
subtitle.description = sub.description
return subtitle
OBJECTS = {
Subtitle:fill_subtitle,
}