def get_subscription_changes(self, since, until): """ Returns the subscription changes for the device as two lists. The first lists contains the Ids of the podcasts that have been subscribed to, the second list of those that have been unsubscribed from. """ from mygpo.db.couchdb.podcast_state import podcast_states_for_device podcast_states = podcast_states_for_device(self.id) return subscription_changes(self.id, podcast_states, since, until)
def get_subscription_changes(self, device, since, now, domain): """ gets new, removed and current subscriptions """ # DB: get all podcast states for the device podcast_states = podcast_states_for_device(device.id) add, rem = subscription_changes(device.id, podcast_states, since, now) subscriptions = filter(lambda s: s.is_subscribed_on(device), podcast_states) # DB get podcast objects for the subscribed podcasts subscriptions = podcasts_for_states(subscriptions) podcasts = dict( (p.url, p) for p in subscriptions ) add = [podcast_data(podcasts.get(url), domain) for url in add ] return add, rem, subscriptions