[suboob] language hashtable moved from opensubtitles backend to application

This commit is contained in:
Julien Veyssier 2013-03-12 20:50:08 +01:00
commit e98008338a
6 changed files with 33 additions and 26 deletions

View file

@ -18,10 +18,10 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.capabilities.subtitle import ICapSubtitle,LanguageNotSupported
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from weboob.tools.backend import BaseBackend
from .browser import OpensubtitlesBrowser
from .pages import LANGUAGE_CONV
from urllib import quote_plus

View file

@ -19,8 +19,9 @@
from weboob.tools.browser import BaseBrowser
from weboob.applications.suboob.suboob import LANGUAGE_CONV
from .pages import SubtitlesPage, SearchPage, SubtitlePage, LANGUAGE_CONV
from .pages import SubtitlesPage, SearchPage, SubtitlePage
__all__ = ['OpensubtitlesBrowser']

View file

@ -21,29 +21,12 @@
from weboob.capabilities.subtitle import Subtitle
from weboob.capabilities.base import NotAvailable
from weboob.tools.browser import BasePage
from weboob.applications.suboob.suboob import LANGUAGE_CONV
__all__ = ['SubtitlesPage','SubtitlePage','SearchPage']
LANGUAGE_CONV = {
'ar':'ara', 'eo':'epo', 'ga':'', 'ru':'rus',
'af':'' , 'et':'est', 'it':'ita', 'sr':'scc',
'sq':'alb', 'tl':'' , 'ja':'jpn', 'sk':'slo',
'hy':'arm', 'fi':'fin', 'kn':'', 'sl':'slv',
'az':'' , 'fr':'fre', 'ko':'kor', 'es':'spa',
'eu':'baq', 'gl':'glg', 'la':'', 'sw':'swa',
'be':'' , 'ka':'geo', 'lv':'lav', 'sv':'swe',
'bn':'ben', 'de':'ger', 'lt':'lit', 'ta':'',
'bg':'bul', 'gr':'ell', 'mk':'mac', 'te':'tel',
'ca':'cat', 'gu':'' , 'ms':'may', 'th':'tha',
'zh':'chi', 'ht':'' , 'mt':'', 'tr':'tur',
'hr':'hrv', 'iw':'heb', 'no':'nor', 'uk':'ukr',
'cz':'cze', 'hi':'hin', 'fa':'per', 'ur':'urd',
'da':'dan', 'hu':'hun', 'pl':'pol', 'vi':'vie',
'nl':'dut', 'is':'ice', 'pt':'por', 'cy':'',
'en':'eng', 'id':'ind', 'ro':'rum', 'yi':''}
class SearchPage(BasePage):
""" Page which contains results as a list of movies
"""

View file

@ -24,6 +24,7 @@ from PyQt4.QtGui import QFrame, QImage, QPixmap
from weboob.applications.qcineoob.ui.movie_ui import Ui_Movie
from weboob.capabilities.base import NotAvailable, NotLoaded
from weboob.applications.suboob.suboob import LANGUAGE_CONV
class Movie(QFrame):
def __init__(self, movie, parent=None):
@ -31,6 +32,10 @@ class Movie(QFrame):
self.parent = parent
self.ui = Ui_Movie()
self.ui.setupUi(self)
langs = LANGUAGE_CONV.keys()
langs.sort()
for lang in langs:
self.ui.langCombo.addItem(lang)
self.connect(self.ui.castingButton, SIGNAL("clicked()"), self.casting)
self.connect(self.ui.torrentButton, SIGNAL("clicked()"), self.searchTorrent)

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>748</width>
<height>463</height>
</rect>
</property>
@ -108,8 +108,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>292</height>
<width>708</width>
<height>293</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2"/>
@ -130,8 +130,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>292</height>
<width>78</width>
<height>18</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8"/>
@ -149,7 +149,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>748</width>
<height>23</height>
</rect>
</property>

View file

@ -29,6 +29,24 @@ from weboob.core import CallErrors
__all__ = ['Suboob']
LANGUAGE_CONV = {
'ar':'ara', 'eo':'epo', 'ga':'', 'ru':'rus',
'af':'' , 'et':'est', 'it':'ita', 'sr':'scc',
'sq':'alb', 'tl':'' , 'ja':'jpn', 'sk':'slo',
'hy':'arm', 'fi':'fin', 'kn':'', 'sl':'slv',
'az':'' , 'fr':'fre', 'ko':'kor', 'es':'spa',
'eu':'baq', 'gl':'glg', 'la':'', 'sw':'swa',
'be':'' , 'ka':'geo', 'lv':'lav', 'sv':'swe',
'bn':'ben', 'de':'ger', 'lt':'lit', 'ta':'',
'bg':'bul', 'gr':'ell', 'mk':'mac', 'te':'tel',
'ca':'cat', 'gu':'' , 'ms':'may', 'th':'tha',
'zh':'chi', 'ht':'' , 'mt':'', 'tr':'tur',
'hr':'hrv', 'iw':'heb', 'no':'nor', 'uk':'ukr',
'cz':'cze', 'hi':'hin', 'fa':'per', 'ur':'urd',
'da':'dan', 'hu':'hun', 'pl':'pol', 'vi':'vie',
'nl':'dut', 'is':'ice', 'pt':'por', 'cy':'',
'en':'eng', 'id':'ind', 'ro':'rum', 'yi':''}
def sizeof_fmt(num):
for x in ['bytes', 'KB', 'MB', 'GB', 'TB']: