Exemple #1
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['t']
        e.link = raw['l']
        e.occurred = datetime.datetime.utcfromtimestamp(float(raw['time']))
        e.raw = raw

        return e
Exemple #2
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.text = Runkeeper.get_text(raw)
        e.link = raw['activity']
        e.occurred = Runkeeper.get_date(raw, self.timezone)
        e.raw = raw

        return e
Exemple #3
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = "[" + raw["name"] + "]"
        e.text = "Obtained"
        e.link = "http://www.wowhead.com/item=" + str(raw['id'])
        e.occurred = WoW.parse_date(raw['timestamp'])
        e.raw = raw

        return e
Exemple #4
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.text = raw['artist']['#text'] + " - " + raw['name']
        e.link = raw.get('url')
        e.occurred = datetime.datetime.utcfromtimestamp(
            float(raw["date"]["uts"]))
        e.thumbnail_url = Lastfm.get_image_url(raw)
        e.raw = raw

        return e
Exemple #5
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = Foursquare.get_title(raw)
        e.link = Foursquare.get_link(raw)
        e.occurred = datetime.datetime.utcfromtimestamp(
            float(raw['createdAt'])
        )
        e.thumbnail_url = Foursquare.get_image_url(raw)
        e.raw = raw

        return e
Exemple #6
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.link = urllib.parse.urljoin('http://www.reddit.com',
                                      raw['data']['permalink'])
        e.title = raw['data']['title']
        e.occurred = datetime.datetime.utcnow()
        e.thumbnail_url = raw['data']['url']
        e.archive_url = raw['data']['url']
        e.raw = raw

        return e
Exemple #7
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['d']
        e.link = raw['u']
        e.occurred = datetime.datetime.strptime(
            raw['dt'], '%Y-%m-%dT%H:%M:%SZ'
        )
        e.thumbnail_url = raw['u']
        e.archive_url = raw['u']
        e.raw = raw

        return e
Exemple #8
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()

        if raw['caption']:
            e.title = raw['caption']['text']

        e.link = raw["images"]["standard_resolution"]["url"]
        e.occurred = datetime.datetime.utcfromtimestamp(
            float(raw['created_time']))
        e.thumbnail_url = e.link
        e.original_url = e.link
        e.raw = raw

        return e
Exemple #9
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['shot']['title']
        e.link = raw['shot']['html_url']
        e.occurred = datetime.datetime.strptime(raw['created_at'],
                                                '%Y-%m-%dT%H:%M:%SZ')
        e.thumbnail_url = raw['shot']['html_url']
        e.original_url = raw['shot']['images'].get('hidpi')

        # if no hidpi image, use normal
        if e.original_url is None:
            e.original_url = raw['shot']['images'].get('normal')

        e.raw = raw

        return e
Exemple #10
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['title']
        e.link = "http://www.flickr.com/photos/%s/%s" % (raw['owner'],
                                                         raw['id'])
        e.occurred = datetime.datetime.utcfromtimestamp(
            float(raw['dateupload']))
        e.thumbnail_url = e.link
        e.original_url = raw['url_o']
        e.raw = raw

        # crude check for placeholder image
        if (raw['height_o'], raw['width_o']) == (PLACEHOLDER_HEIGHT,
                                                 PLACEHOLDER_WIDTH):
            raise FlickrImageNotReady(
                'Upstream full size image is not ready for processing.')

        return e
Exemple #11
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['project']['name']
        e.link = raw['project']['url']
        e.occurred = datetime.datetime.utcfromtimestamp(raw['timestamp'])

        # get largest cover
        sizes = sorted(
            [
                int(size) for size in raw['project']['covers']
                if size != 'original'
            ]
        )
        largest = sizes[-1]

        e.thumbnail_url = raw['project']['covers'][str(largest)]
        e.original_url = raw['project']['covers'][str(largest)]
        e.raw = raw

        return e