This file is indexed.

/usr/lib/python2.7/dist-packages/gdata/media/__init__.py is in python-gdata 2.0.18+dfsg1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# -*-*- encoding: utf-8 -*-*-
#
# This is gdata.photos.media, implementing parts of the MediaRSS spec in gdata structures
#
# $Id: __init__.py 81 2007-10-03 14:41:42Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl 
# Portions copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


"""Essential attributes of photos in Google Photos/Picasa Web Albums are 
expressed using elements from the `media' namespace, defined in the 
MediaRSS specification[1].

Due to copyright issues, the elements herein are documented sparingly, please 
consult with the Google Photos API Reference Guide[2], alternatively the 
official MediaRSS specification[1] for details. 
(If there is a version conflict between the two sources, stick to the 
Google Photos API).

[1]: http://search.yahoo.com/mrss (version 1.1.1)
[2]: http://code.google.com/apis/picasaweb/reference.html#media_reference

Keep in mind that Google Photos only uses a subset of the MediaRSS elements 
(and some of the attributes are trimmed down, too): 

media:content
media:credit
media:description
media:group
media:keywords
media:thumbnail
media:title
"""

__author__ = u'havard@gulldahl.no'# (Håvard Gulldahl)' #BUG: api chokes on non-ascii chars in __author__
__license__ = 'Apache License v2'


import atom
import gdata

MEDIA_NAMESPACE = 'http://search.yahoo.com/mrss/'
YOUTUBE_NAMESPACE = 'http://gdata.youtube.com/schemas/2007'


class MediaBaseElement(atom.AtomBase):
  """Base class for elements in the MEDIA_NAMESPACE. 
  To add new elements, you only need to add the element tag name to self._tag
  """
  
  _tag = ''
  _namespace = MEDIA_NAMESPACE
  _children = atom.AtomBase._children.copy()
  _attributes = atom.AtomBase._attributes.copy()

  def __init__(self, name=None, extension_elements=None,
      extension_attributes=None, text=None):
    self.name = name
    self.text = text
    self.extension_elements = extension_elements or []
    self.extension_attributes = extension_attributes or {}


class Content(MediaBaseElement):
  """(attribute container) This element describes the original content,
    e.g. an image or a video. There may be multiple Content elements
    in a media:Group.

    For example, a video may have a
    <media:content medium="image"> element that specifies a JPEG
    representation of the video, and a <media:content medium="video">
    element that specifies the URL of the video itself.
  
  Attributes:
    url: non-ambigous reference to online object
    width: width of the object frame, in pixels
    height: width of the object frame, in pixels
    medium: one of `image' or `video', allowing the api user to quickly
            determine the object's type
    type: Internet media Type[1] (a.k.a. mime type) of the object -- a more
          verbose way of determining the media type. To set the type member
          in the contructor, use the content_type parameter.
    (optional) fileSize: the size of the object, in bytes
  
  [1]: http://en.wikipedia.org/wiki/Internet_media_type
  """
  
  _tag = 'content'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['url'] = 'url'
  _attributes['width'] = 'width'
  _attributes['height'] = 'height'
  _attributes['medium'] = 'medium'
  _attributes['type'] = 'type'
  _attributes['fileSize'] = 'fileSize'

  def __init__(self, url=None, width=None, height=None,
      medium=None, content_type=None, fileSize=None, format=None,
      extension_elements=None, extension_attributes=None, text=None):
    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes,
                              text=text)
    self.url = url
    self.width = width
    self.height = height
    self.medium = medium
    self.type = content_type
    self.fileSize = fileSize


def ContentFromString(xml_string):
  return atom.CreateClassFromXMLString(Content, xml_string)


class Credit(MediaBaseElement):
  """(string) Contains the nickname of the user who created the content,
  e.g. `Liz Bennet'.
  
  This is a user-specified value that should be used when referring to
  the user by name.

  Note that none of the attributes from the MediaRSS spec are supported.
  """
  
  _tag = 'credit'


def CreditFromString(xml_string):
  return atom.CreateClassFromXMLString(Credit, xml_string)


class Description(MediaBaseElement):
  """(string) A description of the media object.
  Either plain unicode text, or entity-encoded html (look at the `type'
  attribute).

  E.g `A set of photographs I took while vacationing in Italy.'
  
  For `api' projections, the description is in plain text;
  for `base' projections, the description is in HTML.
  
  Attributes:
    type: either `text' or `html'. To set the type member in the contructor,
          use the description_type parameter.
  """
  
  _tag = 'description'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['type'] = 'type'
  def __init__(self, description_type=None, 
      extension_elements=None, extension_attributes=None, text=None):
    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes,
                              text=text)
    
    self.type = description_type


def DescriptionFromString(xml_string):
  return atom.CreateClassFromXMLString(Description, xml_string)


class Keywords(MediaBaseElement):
  """(string) Lists the tags associated with the entry,
  e.g `italy, vacation, sunset'.
  
  Contains a comma-separated list of tags that have been added to the photo, or
  all tags that have been added to photos in the album.
  """
  
  _tag = 'keywords'


def KeywordsFromString(xml_string):
  return atom.CreateClassFromXMLString(Keywords, xml_string)


class Thumbnail(MediaBaseElement):
  """(attributes) Contains the URL of a thumbnail of a photo or album cover.
  
  There can be multiple <media:thumbnail> elements for a given <media:group>; 
  for example, a given item may have multiple thumbnails at different sizes. 
  Photos generally have two thumbnails at different sizes; 
  albums generally have one cropped thumbnail.  
    
  If the thumbsize parameter is set to the initial query, this element points 
  to thumbnails of the requested sizes; otherwise the thumbnails are the 
  default thumbnail size. 
  
  This element must not be confused with the <gphoto:thumbnail> element.
  
  Attributes:
  url:  The URL of the thumbnail image.
  height:  The height of the thumbnail image, in pixels.
  width:  The width of the thumbnail image, in pixels.
  """
  
  _tag = 'thumbnail'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['url'] = 'url'
  _attributes['width'] = 'width'
  _attributes['height'] = 'height'
  def __init__(self, url=None, width=None, height=None,
      extension_attributes=None, text=None, extension_elements=None):
    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes,
                              text=text)
    self.url = url
    self.width = width
    self.height = height


def ThumbnailFromString(xml_string):
  return atom.CreateClassFromXMLString(Thumbnail, xml_string)


class Title(MediaBaseElement):
  """(string) Contains the title of the entry's media content, in plain text.
  
  Attributes:
    type: Always set to plain. To set the type member in the constructor, use
          the title_type parameter.
  """
  
  _tag = 'title'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['type'] = 'type'
  def __init__(self, title_type=None, 
      extension_attributes=None, text=None, extension_elements=None):
    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes,
                              text=text)
    self.type = title_type


def TitleFromString(xml_string):
  return atom.CreateClassFromXMLString(Title, xml_string)


class Player(MediaBaseElement):
  """(string) Contains the embeddable player URL for the entry's media content 
  if the media is a video.
  
  Attributes:
  url: Always set to plain
  """
  
  _tag = 'player'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['url'] = 'url'
  
  def __init__(self, player_url=None, 
      extension_attributes=None, extension_elements=None):
    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes)
    self.url= player_url


class Private(atom.AtomBase):
  """The YouTube Private element"""
  _tag = 'private'
  _namespace = YOUTUBE_NAMESPACE


class Duration(atom.AtomBase):
  """The YouTube Duration element"""
  _tag = 'duration'
  _namespace = YOUTUBE_NAMESPACE
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['seconds'] = 'seconds'


class Category(MediaBaseElement):
  """The mediagroup:category element"""

  _tag = 'category'
  _attributes = atom.AtomBase._attributes.copy()
  _attributes['term'] = 'term'
  _attributes['scheme'] = 'scheme'
  _attributes['label'] = 'label'

  def __init__(self, term=None, scheme=None, label=None, text=None, 
               extension_elements=None, extension_attributes=None):
    """Constructor for Category

    Args:
      term: str
      scheme: str
      label: str
      text: str The text data in the this element
      extension_elements: list A  list of ExtensionElement instances
      extension_attributes: dict A dictionary of attribute value string pairs
    """

    self.term = term
    self.scheme = scheme
    self.label = label
    self.text = text
    self.extension_elements = extension_elements or []
    self.extension_attributes = extension_attributes or {}


class Group(MediaBaseElement):
  """Container element for all media elements.
  The <media:group> element can appear as a child of an album, photo or 
  video entry."""

  _tag = 'group'
  _children = atom.AtomBase._children.copy()
  _children['{%s}content' % MEDIA_NAMESPACE] = ('content', [Content,]) 
  _children['{%s}credit' % MEDIA_NAMESPACE] = ('credit', Credit) 
  _children['{%s}description' % MEDIA_NAMESPACE] = ('description', Description) 
  _children['{%s}keywords' % MEDIA_NAMESPACE] = ('keywords', Keywords) 
  _children['{%s}thumbnail' % MEDIA_NAMESPACE] = ('thumbnail', [Thumbnail,])
  _children['{%s}title' % MEDIA_NAMESPACE] = ('title', Title) 
  _children['{%s}category' % MEDIA_NAMESPACE] = ('category', [Category,]) 
  _children['{%s}duration' % YOUTUBE_NAMESPACE] = ('duration', Duration)
  _children['{%s}private' % YOUTUBE_NAMESPACE] = ('private', Private)
  _children['{%s}player' % MEDIA_NAMESPACE] = ('player', Player)

  def __init__(self, content=None, credit=None, description=None, keywords=None,
               thumbnail=None, title=None, duration=None, private=None, 
               category=None, player=None, extension_elements=None, 
               extension_attributes=None, text=None):

    MediaBaseElement.__init__(self, extension_elements=extension_elements,
                              extension_attributes=extension_attributes,
                              text=text)
    self.content=content
    self.credit=credit
    self.description=description
    self.keywords=keywords
    self.thumbnail=thumbnail or []
    self.title=title
    self.duration=duration
    self.private=private
    self.category=category or []
    self.player=player


def GroupFromString(xml_string):
  return atom.CreateClassFromXMLString(Group, xml_string)