use the new add_field() method to define fields

This commit is contained in:
Romain Bignon 2010-10-08 13:43:23 +02:00
commit 92c6507f71
14 changed files with 133 additions and 178 deletions

View file

@ -268,7 +268,6 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
contact = Contact(_id, profile.get_name(), s)
contact.status_msg = u'%s old' % profile.table['details']['old']
contact.summary = profile.description
contact.avatar = None
for photo in profile.photos:
contact.set_photo(photo.split('/')[-1], url=photo, thumbnail_url=photo.replace('image', 'thumb1_'))
contact.profile = []

View file

@ -15,6 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from datetime import datetime
import re
from logging import warning
@ -26,7 +28,7 @@ class Message(object):
self.browser = browser
self.board = board
self.filename = filename
self.datetime = 0
self.datetime = datetime.now()
self.url = url
self.author = u''
self.text = u''

View file

@ -18,6 +18,7 @@
from __future__ import with_statement
from weboob.capabilities.geolocip import ICapGeolocIp, IpLocation
from weboob.capabilities.base import NotAvailable
from weboob.tools.backend import BaseBackend
from weboob.tools.browser import BaseBrowser
@ -66,5 +67,8 @@ class GeolocIpBackend(BaseBackend, ICapGeolocIp):
iploc.lg = float(tab['lg'])
iploc.host = tab['host']
iploc.tld = tab['tld']
iploc.isp = tab['fai']
if 'fai' in tab:
iploc.isp = tab['fai']
else:
iploc.isp = NotAvailable
return iploc

View file

@ -36,11 +36,11 @@ class OuiFMBackend(BaseBackend, ICapRadio):
LICENSE = 'GPLv3'
BROWSER = OuiFMBrowser
_RADIOS = {'general': (u'OUÏ FM', u'OUI FM', 'http://ouifm.ice.infomaniak.ch/ouifm-high.mp3'),
'alternatif': (u'OUÏ FM Alternatif', u'OUI FM - L\'Alternative Rock', 'http://ouifm.ice.infomaniak.ch/ouifm2.mp3'),
'collector': (u'OUÏ FM Collector', u'OUI FM - Classic Rock', 'http://ouifm.ice.infomaniak.ch/ouifm3.mp3'),
'blues': (u'OUÏ FM Blues', u'OUI FM - Blues', 'http://ouifm.ice.infomaniak.ch/ouifm4.mp3'),
'inde': (u'OUÏ FM Indé', u'OUI FM - Rock Indé', 'http://ouifm.ice.infomaniak.ch/ouifm5.mp3'),
_RADIOS = {'general': (u'OUÏ FM', u'OUI FM', u'http://ouifm.ice.infomaniak.ch/ouifm-high.mp3'),
'alternatif': (u'OUÏ FM Alternatif', u'OUI FM - L\'Alternative Rock', u'http://ouifm.ice.infomaniak.ch/ouifm2.mp3'),
'collector': (u'OUÏ FM Collector', u'OUI FM - Classic Rock', u'http://ouifm.ice.infomaniak.ch/ouifm3.mp3'),
'blues': (u'OUÏ FM Blues', u'OUI FM - Blues', u'http://ouifm.ice.infomaniak.ch/ouifm4.mp3'),
'inde': (u'OUÏ FM Indé', u'OUI FM - Rock Indé', u'http://ouifm.ice.infomaniak.ch/ouifm5.mp3'),
}
def iter_radios(self):
@ -70,7 +70,7 @@ class OuiFMBackend(BaseBackend, ICapRadio):
radio.current = current
stream = Stream(0)
stream.title = '128kbits/s'
stream.title = u'128kbits/s'
stream.url = url
radio.streams = [stream]
return radio

View file

@ -31,4 +31,4 @@ class PlayerPage(BasePage):
_radio = '_%s' % radio
title = select(self.document.getroot(), 'div#titre%s' % _radio, 1).text.strip()
artist = select(self.document.getroot(), 'div#artiste%s' % _radio, 1).text.strip()
return artist, title
return unicode(artist), unicode(title)