from datetime import date def get_playlists_tracks_trend( current_position: int, current_highest_position: int, previous_position: int ) -> int or None: """Calculate track is trend in playlist. Args: current_position (int): Current track position in playlist. current_highest_position (int): The highest position for the specific isrc of the specific playlist. previous_position (int or None): Previous track position in playlist. Returns: Int or None """ if current_position != current_highest_position or previous_position is None: return return current_highest_position - previous_position def is_track_new_entry( current_position: int, current_highest_position: int, earliest_added_date: date, current_date: date or None = None ) -> bool: """Calculate if track is new in playlist. Args: current_position (int): Current track position in playlist. current_highest_position (int): The highest position for the specific isrc of the specific playlist. earliest_added_date (date): Earliest date of track in playlist. current_date (date or None): Current date. Returns: Boolean """ current_date = current_date or date.today() return current_position == current_highest_position and current_date == earliest_added_date