def get_subscription_changes(self, user, device, since, now, domain): """gets new, removed and current subscriptions""" history = get_subscription_history(user, device, since, now) add, rem = subscription_diff(history) subscriptions = device.get_subscribed_podcasts() add = [podcast_data(p, domain) for p in add] rem = [p.url for p in rem] return add, rem, subscriptions
def get_subscription_changes(self, user, device, since, now, domain): """ gets new, removed and current subscriptions """ history = get_subscription_history(user, device, since, now) add, rem = subscription_diff(history) subscriptions = device.get_subscribed_podcasts() add = [podcast_data(p, domain) for p in add] rem = [p.url for p in rem] return add, rem, subscriptions
def get_changes(self, user, device, since, until): """ Returns subscription changes for the given device """ history = get_subscription_history(user, device, since, until) logger.info('Subscription History: {num}'.format(num=len(history))) add, rem = subscription_diff(history) logger.info('Subscription Diff: +{num_add}/-{num_remove}'.format( num_add=len(add), num_remove=len(rem))) until_ = get_timestamp(until) # TODO: we'd need to get the ref_urls here somehow add_urls = [p.url for p in add] rem_urls = [p.url for p in rem] return (add_urls, rem_urls, until_)