Ejemplo n.º 1
0
class StreamInfo(BaseObject):
    """
    Stream related information.
    """
    who = StringField('Who is currently on air')
    what = StringField('What is currently on air')

    def __iscomplete__(self):
        return self.who is not NotLoaded or self.what is not NotLoaded

    def __unicode__(self):
        if self.who:
            return u'%s - %s' % (self.who, self.what)
        else:
            return self.what
Ejemplo n.º 2
0
class StreamInfo(BaseObject):
    """
    Stream related information.
    """
    who = StringField('Who is currently on air')
    what = StringField('What is currently on air')

    def __iscomplete__(self):
        # This volatile information may be reloaded everytimes.
        return False

    def __unicode__(self):
        if self.who:
            return u'%s - %s' % (self.who, self.what)
        else:
            return self.what
Ejemplo n.º 3
0
class ImgPaste(BasePaste):
    delete_url = StringField('URL to delete the image')

    @classmethod
    def id2url(cls, id):
        return 'https://imgur.com/%s' % id

    @property
    def raw_url(self):
        # TODO get the right extension
        return 'https://i.imgur.com/%s.png' % self.id
Ejemplo n.º 4
0
class Description(BaseObject):
    pv = StringField('Pv of the Pokemon')
    attack = StringField('Attack of the Pokemon')
    defense = StringField('Defense of the Pokemon')
    speAttack = StringField('Special attack of the Pokemon')
    speDefense = StringField('Special defense of the Pokemon')
    speed = StringField('Speed of the Pokemon')
Ejemplo n.º 5
0
class QuviVideo(BaseVideo):
    BACKENDS = {
        'youtube': 'https://www.youtube.com/watch?v=%s',
        'vimeo': 'http://vimeo.com/%s',
        'dailymotion': 'http://www.dailymotion.com/video/%s',
        'metacafe': 'http://www.metacafe.com/watch/%s/',
        'arte': 'http://videos.arte.tv/fr/videos/plop--%s.html',
        'videa': 'http://videa.hu/videok/%s/',
        'wimp': 'http://www.wimp.com/%s/',
        'funnyordie': 'http://www.funnyordie.com/videos/%s/',
        'tapuz': 'http://flix.tapuz.co.il/v/watch-%s-.html',
        'liveleak': 'http://www.liveleak.com/view?i=%s',
        # nsfw
        'xhamster': 'https://xhamster.com/movies/%s/plop.html',
        'xvideos': 'http://www.xvideos.com/video%s/',
        'redtube': 'http://www.redtube.com/%s',
        'xnxx': 'http://video.xnxx.com/video%s/',
        # more websites are supported, but <service>.<id> isn't always enough
        # however, URLs are supported, like this:
        # https://www.youtube.com/watch?v=BaW_jenozKc@quvi
    }

    page = StringField('Page URL of the video')

    @classmethod
    def id2url(cls, _id):
        if _id.startswith('http'):
            return _id

        if '.' not in _id:
            raise UserError(
                'Please give an ID in form WEBSITE.ID (for example youtube.BaW_jenozKc). Supported websites are: %s'
                % ', '.join(cls.BACKENDS.keys()))

        sub_backend, sub_id = _id.split('.', 1)
        try:
            return cls.BACKENDS[sub_backend] % sub_id
        except KeyError:
            raise NotImplementedError()

    @property
    def page_url(self):
        if self.page:
            return self.page
        else:
            return self.id2url(self.id)
Ejemplo n.º 6
0
class Thumbnail(CapBaseObject):
    """
    Thumbnail of an image.
    """

    url = StringField('URL to photo thumbnail')
    data = BytesField('Data')

    def __init__(self, url):
        CapBaseObject.__init__(self, url)
        self.url = url.replace(u' ', u'%20')

    def __str__(self):
        return self.url

    def __repr__(self):
        return '<Thumbnail url="%s">' % self.url

    def __iscomplete__(self):
        return self.data is not NotLoaded
Ejemplo n.º 7
0
class BikeSensor(GaugeSensor):
    longitude = StringField('Longitude of the sensor')
    latitude = StringField('Latitude of the sensor')
Ejemplo n.º 8
0
class Pokemon(BaseObject):
    pokedex_id = IntField('Pokedex id of the Pokemon')
    name = StringField('Name of the Pokemon')
    types = Field('Types of the Pokemon')
Ejemplo n.º 9
0
class BREvent(BaseCalendarEvent):
    siteid = StringField('Site id')
import weboob.capabilities.bank as OLD
from weboob.capabilities.base import StringField
from weboob.capabilities.date import DateField

# can't import *, __all__ is incomplete...
for attr in dir(OLD):
    globals()[attr] = getattr(OLD, attr)

try:
    __all__ = OLD.__all__
except AttributeError:
    pass

# can't create a subclass because of CapBank.iter_resources reimplementations:
# modules will import our subclass, but boobank will call iter_resources with the OLD class
Account._fields['ownership'] = StringField(
    'Relationship between the credentials owner (PSU) and the account')
Loan._fields['ownership'] = StringField(
    'Relationship between the credentials owner (PSU) and the account')

Transaction._fields['bdate'] = DateField(
    'Bank date, when the transaction appear on website (usually extracted from column date)'
)


class RecipientInvalidOTP(AddRecipientError):
    code = 'invalidOTP'


class TransferInvalidOTP(TransferError):
    code = 'invalidOTP'