[subtitle] add cd number

This commit is contained in:
Julien Veyssier 2013-02-22 13:54:16 +01:00
commit 27ef9ae477
3 changed files with 10 additions and 2 deletions

View file

@ -57,6 +57,8 @@ class SubtitlesPage(BasePage):
cols = self.parser.select(line,'td')
traduced_title = self.parser.select(cols[0],'font',1).text.lower()
original_title = self.parser.select(cols[1],'font',1).text.lower()
nb_cd = self.parser.select(cols[2],'font',1).text.strip()
nb_cd = int(nb_cd.split()[0])
traduced_title_words = traduced_title.split()
original_title_words = original_title.split()
@ -70,6 +72,7 @@ class SubtitlesPage(BasePage):
subtitle = Subtitle(id,name)
subtitle.url = url
subtitle.fps = 0
subtitle.nb_cd = nb_cd
subtitle.description = "no desc"
return subtitle
@ -100,6 +103,8 @@ class SubtitlesPage(BasePage):
traduced_title = " ".join(traduced_title_words)
original_title = " ".join(original_title_words)
nb_cd = self.parser.select(cols[2],'font',1).text.strip()
nb_cd = int(nb_cd.split()[0])
name = "%s (%s)"%(original_title,traduced_title)
href = self.parser.select(cols[3],'a',1).attrib.get('href','')
url = "http://davidbillemont3.free.fr/%s"%href
@ -107,5 +112,6 @@ class SubtitlesPage(BasePage):
subtitle = Subtitle(id,name)
subtitle.url = url
subtitle.fps = 0
subtitle.nb_cd = nb_cd
subtitle.description = "no desc"
yield subtitle

View file

@ -45,6 +45,7 @@ class SubtitleInfoFormatter(IFormatter):
result += 'ID: %s\n' % obj.fullid
result += 'URL: %s\n' % obj.url
result += 'FPS: %s\n' % obj.fps
result += 'NB CD: %s\n' % obj.nb_cd
result += '\n%sDescription%s\n' % (self.BOLD, self.NC)
result += obj.description
return result
@ -57,7 +58,7 @@ class SubtitleListFormatter(PrettyFormatter):
return obj.name
def get_description(self, obj):
return 'url : %s' % (obj.url)
return '%s CD ; url : %s' % (obj.nb_cd,obj.url)
class Suboob(ReplApplication):

View file

@ -32,7 +32,8 @@ class Subtitle(CapBaseObject):
name = StringField('Name of subtitle')
url = StringField('Direct url to subtitle file')
fps = StringField('Framerate of corresponding video')
description = StringField('Description of corresponding video')
nb_cd = StringField('Number of cd')
description=StringField('Description of corresponding video')
def __init__(self, id, name):
CapBaseObject.__init__(self, id)