def _update(self, info=None, is_watched=None, is_collected=None, **kwargs): if not info: return super(Video, self)._update(info, **kwargs) update_attributes(self, info, ['progress']) if 'action' in info: self.action = info.get('action') if 'id' in info: self.id = info.get('id') # Set timestamps if 'collected_at' in info: self.collected_at = from_iso8601_datetime(info.get('collected_at')) if 'paused_at' in info: self.paused_at = from_iso8601_datetime(info.get('paused_at')) if 'watched_at' in info: self.watched_at = from_iso8601_datetime(info.get('watched_at')) # Set flags if is_watched is not None: self.is_watched = is_watched if is_collected is not None: self.is_collected = is_collected
def _update(self, info=None, **kwargs): if not info: return super(Episode, self)._update(info, **kwargs) update_attributes( self, info, [ 'title', # Extended Info 'available_translations', 'runtime', ]) # Extended Info if 'first_aired' in info: self.first_aired = from_iso8601_datetime(info.get('first_aired')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at')) if 'number_abs' in info: self.number_abs = info.get('number_abs')
def _update(self, info=None): if not info: return if 'followed_at' in info: self.followed_at = from_iso8601_datetime(info.get('followed_at')) if 'friends_at' in info: self.friends_at = from_iso8601_datetime(info.get('friends_at')) update_attributes(self, info, ['username', 'name', 'private', 'vip', 'vip_ep'])
def _update(self, info=None): if not info: return if 'created_at' in info: self.created_at = from_iso8601_datetime(info.get('created_at')) if 'liked_at' in info: self.liked_at = from_iso8601_datetime(info.get('liked_at')) update_attributes(self, info, [ 'parent_id', 'comment', 'spoiler', 'review', 'replies', 'likes', 'user', 'user_rating' ])
def _update(self, info=None): if not info: return if 'liked_at' in info: self.liked_at = from_iso8601_datetime(info.get('liked_at')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at')) update_attributes(self, info, [ 'name', 'description', 'likes', 'allow_comments', 'display_numbers', 'comment_count', 'item_count' ])
def _update(self, info=None, **kwargs): if not info: return super(Show, self)._update(info, **kwargs) update_attributes( self, info, [ 'title', # Watched, Collected, and Played 'watcher_count', 'play_count', 'collected_count', 'collector_count', # Recommended 'user_count', # Trending 'watchers', # Extended Info 'airs', 'runtime', 'certification', 'network', 'country', 'status', 'homepage', 'language', 'available_translations', 'genres', 'aired_episodes' ]) # Ensure `year` attribute is an integer (fixes incorrect type returned by search) if info.get('year'): self.year = int(info['year']) # Extended Info if 'first_aired' in info: self.first_aired = from_iso8601_datetime(info.get('first_aired')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at'))
def _update(self, info=None, **kwargs): if not info: return super(Movie, self)._update(info, **kwargs) update_attributes(self, info, [ 'title', # Trending 'watchers', # Extended Info 'tagline', 'certification', 'homepage', 'trailer', 'language', 'available_translations', 'genres' ]) # Ensure `year` attribute is an integer (fixes incorrect type returned by search) if info.get('year'): self.year = int(info['year']) # Extended Info if info.get('runtime'): self.runtime = info['runtime'] if 'released' in info: self.released = from_iso8601_date(info.get('released')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at'))
def _update(self, info=None, **kwargs): if not info: return self.pk = info['number'] if 'progress_type' in kwargs: self.progress_type = kwargs['progress_type'] self.completed = info['completed'] if 'last_watched_at' in info: self.progress_timestamp = from_iso8601_datetime(info.get('last_watched_at')) elif 'collected_at' in info: self.progress_timestamp = from_iso8601_datetime(info.get('collected_at'))
def _update(self, info=None, in_watchlist=None, **kwargs): if not info: return update_attributes( self, info, [ # Extended Info 'overview', # Search 'score' ]) if 'images' in info: self.images = info['images'] # Set timestamps if 'listed_at' in info: self.listed_at = from_iso8601_datetime(info.get('listed_at')) # Set flags if in_watchlist is not None: self.in_watchlist = in_watchlist self.rating = Rating._construct(self._client, info) or self.rating
def test_datetime_conversion(): if arrow is None: pytest.skip('arrow not installed, skipping') d = arrow.utcnow().replace(microsecond=0) d_str = to_iso8601_datetime(d) d2 = from_iso8601_datetime(d_str) assert_that(d, equal_to(d2))
def _construct(cls, client, info): if not info or 'rating' not in info: return r = cls(client) r.value = info.get('rating') r.timestamp = from_iso8601_datetime(info.get('rated_at')) return r
def _update(self, info=None, **kwargs): if not info: return update_attributes(self, info, ['name']) # Set timestamps if 'listed_at' in info: self.listed_at = from_iso8601_datetime(info.get('listed_at'))
def _update(self, info=None, **kwargs): if not info: return super(Episode, self)._update(info, **kwargs) update_attributes(self, info, [ 'title', # Extended Info 'available_translations' ]) # Extended Info if 'first_aired' in info: self.first_aired = from_iso8601_datetime(info.get('first_aired')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at'))
def _update(self, info=None, **kwargs): if not info: return super(Progress, self)._update(info, **kwargs) label = LABELS['last_progress_change'][self.progress_type] if label in info: self.last_progress_change = from_iso8601_datetime(info.get(label)) if 'reset_at' in info: self.reset_at = from_iso8601_datetime(info.get('reset_at')) if 'seasons' in info: for season in info['seasons']: season_progress = SeasonProgress._construct( season, progress_type=self.progress_type) if season_progress: self.seasons[season_progress.pk] = season_progress if 'hidden_seasons' in info: self.hidden_seasons = {} for season in info['hidden_seasons']: hidden_season = self._client.construct('season', season) if hidden_season: self.hidden_seasons[hidden_season.pk] = hidden_season if 'next_episode' in info: episode = self._client.construct('episode', info['next_episode']) if episode: self.next_episode = episode if 'last_episode' in info: episode = self._client.construct('episode', info['last_episode']) if episode: self.last_episode = episode
def _update(self, info=None, **kwargs): if not info: return update_attributes(self, info, [ 'name' ]) # Set timestamps if 'listed_at' in info: self.listed_at = from_iso8601_datetime(info.get('listed_at'))
def _update(self, info=None, **kwargs): if not info: return super(Progress, self)._update(info, **kwargs) label = LABELS['last_progress_change'][self.progress_type] if label in info: self.last_progress_change = from_iso8601_datetime(info.get(label)) if 'reset_at' in info: self.reset_at = from_iso8601_datetime(info.get('reset_at')) if 'seasons' in info: for season in info['seasons']: season_progress = SeasonProgress._construct(season, progress_type=self.progress_type) if season_progress: self.seasons[season_progress.pk] = season_progress if 'hidden_seasons' in info: self.hidden_seasons = {} for season in info['hidden_seasons']: hidden_season = self._client.construct('season', season) if hidden_season: self.hidden_seasons[hidden_season.pk] = hidden_season if 'next_episode' in info: episode = self._client.construct('episode', info['next_episode']) if episode: self.next_episode = episode if 'last_episode' in info: episode = self._client.construct('episode', info['last_episode']) if episode: self.last_episode = episode
def _update(self, info=None, **kwargs): if not info: return super(Show, self)._update(info, **kwargs) update_attributes(self, info, [ 'title', # Trending 'watchers', # Extended Info 'airs', 'runtime', 'certification', 'network', 'country', 'status', 'homepage', 'language', 'available_translations', 'genres', 'aired_episodes' ]) # Ensure `year` attribute is an integer (fixes incorrect type returned by search) if info.get('year'): self.year = int(info['year']) # Extended Info if 'first_aired' in info: self.first_aired = from_iso8601_datetime(info.get('first_aired')) if 'updated_at' in info: self.updated_at = from_iso8601_datetime(info.get('updated_at'))
def _update(self, info=None, is_watched=None, is_collected=None, **kwargs): if not info: return super(Video, self)._update(info, **kwargs) update_attributes(self, info, [ 'plays', 'progress' ]) if 'action' in info: self.action = info.get('action') if 'id' in info: self.id = info.get('id') # Set timestamps if 'last_watched_at' in info: self.last_watched_at = from_iso8601_datetime(info.get('last_watched_at')) if 'collected_at' in info: self.collected_at = from_iso8601_datetime(info.get('collected_at')) if 'paused_at' in info: self.paused_at = from_iso8601_datetime(info.get('paused_at')) if 'watched_at' in info: self.watched_at = from_iso8601_datetime(info.get('watched_at')) # Set flags if is_watched is not None: self.is_watched = is_watched if is_collected is not None: self.is_collected = is_collected
def _update(self, info=None, **kwargs): if not info: return super(Season, self)._update(info, **kwargs) update_attributes(self, info, [ # Extended Info 'episode_count', 'aired_episodes' ]) # Extended Info if 'first_aired' in info: self.first_aired = from_iso8601_datetime(info.get('first_aired'))
def _update(self, info=None, **kwargs): if not info: return super(Season, self)._update(info, **kwargs) update_attributes( self, info, [ # Extended Info "episode_count", "aired_episodes", ], ) # Extended Info if "first_aired" in info: self.first_aired = from_iso8601_datetime(info.get("first_aired"))
def _update(self, info=None, in_watchlist=None, **kwargs): if not info: return update_attributes(self, info, [ # Extended Info 'overview', # Search 'score' ]) if 'images' in info: self.images = info['images'] # Set timestamps if 'listed_at' in info: self.listed_at = from_iso8601_datetime(info.get('listed_at')) # Set flags if in_watchlist is not None: self.in_watchlist = in_watchlist self.rating = Rating._construct(self._client, info) or self.rating