def to_dict(self):
        """Dump progress to a dictionary.

        :return: Progress dictionary
        :rtype: :class:`~python:dict`
        """

        result = super(Progress, self).to_dict()

        label = LABELS['last_progress_change'][self.progress_type]
        result[label] = to_iso8601_datetime(self.last_progress_change)

        if self.progress_type == 'watched':
            result['reset_at'] = self.reset_at

        result['seasons'] = [
            season.to_dict()
            for season in self.seasons.values()
        ]

        if self.hidden_seasons:
            result['hidden_seasons'] = [
                popitems(season.to_dict(), ['number', 'ids'])
                for season in self.hidden_seasons.values()
            ]

        if self.next_episode:
            result['next_episode'] = popitems(self.next_episode.to_dict(), ['season', 'number', 'title', 'ids'])
            result['next_episode']['season'] = self.next_episode.keys[0][0]

        if self.last_episode:
            result['last_episode'] = popitems(self.last_episode.to_dict(), ['season', 'number', 'title', 'ids'])
            result['last_episode']['season'] = self.last_episode.keys[0][0]

        return result
def to_dict ( self ) : result = super ( Progress , self ) . to_dict ( ) label = LABELS [ 'last_progress_change' ] [ self . progress_type ] result [ label ] = to_iso8601_datetime ( self . last_progress_change ) if self . progress_type == 'watched' : result [ 'reset_at' ] = self . reset_at result [ 'seasons' ] = [ season . to_dict ( ) for season in self . seasons . values ( ) ] if self . hidden_seasons : result [ 'hidden_seasons' ] = [ popitems ( season . to_dict ( ) , [ 'number' , 'ids' ] ) for season in self . hidden_seasons . values ( ) ] if self . next_episode : result [ 'next_episode' ] = popitems ( self . next_episode . to_dict ( ) , [ 'season' , 'number' , 'title' , 'ids' ] ) result [ 'next_episode' ] [ 'season' ] = self . next_episode . keys [ 0 ] [ 0 ] if self . last_episode : result [ 'last_episode' ] = popitems ( self . last_episode . to_dict ( ) , [ 'season' , 'number' , 'title' , 'ids' ] ) result [ 'last_episode' ] [ 'season' ] = self . last_episode . keys [ 0 ] [ 0 ] return result
Dump progress to a dictionary.

        :return: Progress dictionary
        :rtype: :class:`~python:dict`