Exemple #1
0
    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
Exemple #2
0
    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
Exemple #3
0
    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_)
Exemple #4
0
    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_)
Exemple #5
0
 def items(self, user):
     history = get_subscription_history(user, public_only=True)
     history = get_subscription_change_history(history)
     history = list(history)[-self.NUM_ITEMS:]
     return history
Exemple #6
0
 def items(self, user):
     history = get_subscription_history(user, public_only=True)
     history = get_subscription_change_history(history)
     history = list(history)[-self.NUM_ITEMS:]
     return history