def __init__(self, name, uri=None, user=None, order_by_date_added=False, tracks_added_since=None, tracks_added_before=None): self.name = name self.uri = spotify_plugs.normalize_uri(uri) self.user = user self.order_by_date_added = order_by_date_added self.tracks_added_before = tracks_added_before self.tracks_added_since = tracks_added_since self.next_offset = 0 self.limit = 100 self.tracks = [] self.total = 1 self.cur_index = 0 self.track_count = 0
def __init__(self, name, uri=None, user=None, order_by_date_added=False, tracks_added_since=None, tracks_added_before=None): self.name = name self.uri = spotify_plugs.normalize_uri(uri) self.user = user self.order_by_date_added = order_by_date_added if tracks_added_before != None and len(tracks_added_before) > 0: try: delta = reltime.parse_to_rel_time(tracks_added_before) self.tracks_added_before = date_to_epoch(now()) - delta except ValueError as e: raise pbl.PBLException('bad relative time format', str(e)) else: self.tracks_added_before = -1 if tracks_added_since != None and len(tracks_added_since) > 0: try: delta = reltime.parse_to_rel_time(tracks_added_since) self.tracks_added_since = date_to_epoch(now()) - delta except ValueError as e: raise pbl.PBLException(self, 'bad relative time format ' + str(e)) else: self.tracks_added_since = -1 #print "since", tracks_added_since, self.tracks_added_since, date_to_epoch(now()) #print "before", tracks_added_before, self.tracks_added_before, date_to_epoch(now()) self.next_offset = 0 self.limit = 100 self.tracks = [] self.total = 1 self.cur_index = 0 self.track_count = 0