-
Notifications
You must be signed in to change notification settings - Fork 16
/
video.py
23 lines (17 loc) · 772 Bytes
/
video.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from media import Media
class Video(object):
def __init__(self, element, server):
self.element = element
self.server = server
# browse element and extract some information
self.key = element.attrib['key']
self.type = 'video'
self.title = element.attrib['title']
self.summary = element.attrib['summary']
self.viewed = ('viewCount' in element.attrib) and (element.attrib['viewCount'] >= '1')
self.offset = int(element.attrib['viewOffset']) if 'viewOffset' in element.attrib else 0
self.media = [Media(e, self.server) for e in element.findall('.Media')]
def __str__(self):
return "<Video: %s>" % (self.key)
def __repr__(self):
return "<Video: %s>" % (self.key)