Esempio n. 1
0
    def __init__(self,
                 author=None,
                 category=None,
                 content=None,
                 atom_id=None,
                 link=None,
                 published=None,
                 title=None,
                 updated=None,
                 rating=None,
                 noembed=None,
                 statistics=None,
                 racy=None,
                 media=None,
                 extension_elements=None,
                 extension_attributes=None):
        gdata.GDataEntry.__init__(self,
                                  author=author,
                                  category=category,
                                  content=content,
                                  atom_id=atom_id,
                                  link=link,
                                  published=published,
                                  title=title,
                                  updated=updated)

        self.rating = rating
        self.noembed = noembed
        self.statistics = statistics
        self.racy = racy
        self.media = media or Media.Group()
Esempio n. 2
0
class PhotoData(object):
    _children = {'{%s}id' % PHOTOS_NAMESPACE: ('gphoto_id', Id), '{%s}albumid' % PHOTOS_NAMESPACE: ('albumid', Albumid),
                 '{%s}checksum' % PHOTOS_NAMESPACE: ('checksum', Checksum), '{%s}client' % PHOTOS_NAMESPACE: ('client', Client),
                 '{%s}height' % PHOTOS_NAMESPACE: ('height', Height), '{%s}position' % PHOTOS_NAMESPACE: ('position', Position),
                 '{%s}rotation' % PHOTOS_NAMESPACE: ('rotation', Rotation), '{%s}size' % PHOTOS_NAMESPACE: ('size', Size),
                 '{%s}timestamp' % PHOTOS_NAMESPACE: ('timestamp', Timestamp), '{%s}version' % PHOTOS_NAMESPACE: ('version', Version),
                 '{%s}width' % PHOTOS_NAMESPACE: ('width', Width), '{%s}commentingEnabled' % PHOTOS_NAMESPACE: ('commentingEnabled', CommentingEnabled),
                 '{%s}commentCount' % PHOTOS_NAMESPACE: ('commentCount', CommentCount), '{%s}tags' % EXIF_NAMESPACE: ('exif', Exif.Tags),
                 '{%s}where' % GEORSS_NAMESPACE: ('geo', Geo.Where), '{%s}group' % MEDIA_NAMESPACE: ('media', Media.Group),
                 '{%s}snippet' % PHOTOS_NAMESPACE: ('snippet', Snippet), '{%s}snippettype' % PHOTOS_NAMESPACE: ('snippettype', Snippettype),
                 '{%s}truncated' % PHOTOS_NAMESPACE: ('truncated', Truncated)}
    ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id
    ## NOTE: storing media:group as self.media, exif:tags as self.exif, and
    ## geo:where as self.geo, to create a self-explaining api
    # These elements show up in search feeds
    gphoto_id = None
    albumid = None
    checksum = None
    client = None
    height = None
    position = None
    rotation = None
    size = None
    timestamp = None
    version = None
    width = None
    commentingEnabled = None
    commentCount = None
    snippet = None
    snippettype = None
    truncated = None
    media = Media.Group()
    geo = Geo.Where()
    tags = Exif.Tags()
Esempio n. 3
0
  def __init__(self, author=None, category=None, content=None,
      atom_id=None, link=None, published=None, 
      title=None, updated=None, text=None,
      # GPHOTO NAMESPACE:
      gphoto_id=None, albumid=None, checksum=None, client=None, height=None,
      position=None, rotation=None, size=None, timestamp=None, version=None,
      width=None, commentCount=None, commentingEnabled=None,
      # MEDIARSS NAMESPACE:
      media=None,
      # EXIF_NAMESPACE:
      exif=None,
      # GEORSS NAMESPACE:
      geo=None,
      extension_elements=None, extension_attributes=None):
    GPhotosBaseEntry.__init__(self, author=author, category=category,
                              content=content,
                              atom_id=atom_id, link=link, published=published,
                              title=title, updated=updated, text=text,
                              extension_elements=extension_elements,
                              extension_attributes=extension_attributes)
                              

    ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id
    self.gphoto_id = gphoto_id
    self.albumid = albumid
    self.checksum = checksum
    self.client = client
    self.height = height
    self.position = position
    self.rotation = rotation
    self.size = size
    self.timestamp = timestamp
    self.version = version
    self.width = width
    self.commentingEnabled = commentingEnabled
    self.commentCount = commentCount
    ## NOTE: storing media:group as self.media, to create a self-explaining api
    self.media = media or Media.Group()
    self.exif = exif or Exif.Tags()
    self.geo = geo or Geo.Where()
Esempio n. 4
0
  def __init__(self, author=None, category=None, content=None,
      atom_id=None, link=None, published=None,
      title=None, updated=None,
      #GPHOTO NAMESPACE:
      gphoto_id=None, name=None, location=None, access=None, 
      timestamp=None, numphotos=None, user=None, nickname=None,
      commentingEnabled=None, commentCount=None, thumbnail=None,
      # MEDIA NAMESPACE:
      media=None,
      # GEORSS NAMESPACE:
      geo=None,
      extended_property=None,
      extension_elements=None, extension_attributes=None, text=None):
    GPhotosBaseEntry.__init__(self, author=author, category=category,
                        content=content, atom_id=atom_id, link=link,
                        published=published, title=title,
                        updated=updated, text=text,
                        extension_elements=extension_elements,
                        extension_attributes=extension_attributes)

    ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id
    self.gphoto_id = gphoto_id 
    self.name = name
    self.location = location
    self.access = access
    self.timestamp = timestamp
    self.numphotos = numphotos
    self.user = user
    self.nickname = nickname
    self.commentingEnabled = commentingEnabled
    self.commentCount = commentCount
    self.thumbnail = thumbnail
    self.extended_property = extended_property or []
    self.text = text
    ## NOTE: storing media:group as self.media, and geo:where as geo,
    ## to create a self-explaining api
    self.media = media or Media.Group()
    self.geo = geo or Geo.Where()
Esempio n. 5
0
class AlbumEntry(GPhotosBaseEntry, AlbumData):
    """All metadata for a Google Photos Album

    Take a look at AlbumData for metadata accessible as attributes to this object.

    Notes:
      To avoid name clashes, and to create a more sensible api, some
      objects have names that differ from the original elements:

      o media:group -> self.media,
      o geo:where -> self.geo,
      o photo:id -> self.gphoto_id
    """

    _kind = 'album'
    _children = GPhotosBaseEntry._children.copy()
    _children.update(AlbumData._children.copy())
    # child tags only for Album entries, not feeds
    _children['{%s}where' % GEORSS_NAMESPACE] = ('geo', Geo.Where)
    _children['{%s}group' % MEDIA_NAMESPACE] = ('media', Media.Group)
    media = Media.Group()
    geo = Geo.Where()

    def __init__(
            self,
            author=None,
            category=None,
            content=None,
            atom_id=None,
            link=None,
            published=None,
            title=None,
            updated=None,
            #GPHOTO NAMESPACE:
            gphoto_id=None,
            name=None,
            location=None,
            access=None,
            timestamp=None,
            numphotos=None,
            user=None,
            nickname=None,
            commentingEnabled=None,
            commentCount=None,
            thumbnail=None,
            # MEDIA NAMESPACE:
            media=None,
            # GEORSS NAMESPACE:
            geo=None,
            extended_property=None,
            extension_elements=None,
            extension_attributes=None,
            text=None):
        GPhotosBaseEntry.__init__(self,
                                  author=author,
                                  category=category,
                                  content=content,
                                  atom_id=atom_id,
                                  link=link,
                                  published=published,
                                  title=title,
                                  updated=updated,
                                  text=text,
                                  extension_elements=extension_elements,
                                  extension_attributes=extension_attributes)

        ## NOTE: storing photo:id as self.gphoto_id, to avoid name clash with atom:id
        self.gphoto_id = gphoto_id
        self.name = name
        self.location = location
        self.access = access
        self.timestamp = timestamp
        self.numphotos = numphotos
        self.user = user
        self.nickname = nickname
        self.commentingEnabled = commentingEnabled
        self.commentCount = commentCount
        self.thumbnail = thumbnail
        self.extended_property = extended_property or []
        self.text = text
        ## NOTE: storing media:group as self.media, and geo:where as geo,
        ## to create a self-explaining api
        self.media = media or Media.Group()
        self.geo = geo or Geo.Where()

    def GetAlbumId(self):
        "Return the id of this album"

        return self.GetFeedLink().href.split('/')[-1]

    def GetPhotosUri(self):
        "(string) Return the uri to this albums feed of the PhotoEntry kind"
        return self._feedUri('photo')

    def GetCommentsUri(self):
        "(string) Return the uri to this albums feed of the CommentEntry kind"
        return self._feedUri('comment')

    def GetTagsUri(self):
        "(string) Return the uri to this albums feed of the TagEntry kind"
        return self._feedUri('tag')