Skip to content

Commit

Permalink
better date descriptions in details
Browse files Browse the repository at this point in the history
  • Loading branch information
FuzzyGrim committed Apr 1, 2024
1 parent 7ba757e commit 1ed3ac4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/app/providers/igdb.py
Expand Up @@ -112,7 +112,7 @@ def game(media_id):
"synopsis": response["summary"],
"details": {
"format": get_category(response["category"]),
"start_date": get_start_date(response),
"release_date": get_start_date(response),
"genres": get_str_list(response, "genres"),
"themes": get_str_list(response, "themes"),
"platforms": get_str_list(response, "platforms"),
Expand Down
10 changes: 5 additions & 5 deletions src/app/providers/tmdb.py
Expand Up @@ -60,7 +60,7 @@ def movie(media_id):
"synopsis": get_synopsis(response["overview"]),
"details": {
"format": "Movie",
"start_date": get_start_date(response["release_date"]),
"release_date": get_start_date(response["release_date"]),
"status": response["status"],
"runtime": get_readable_duration(response["runtime"]),
"genres": get_genres(response["genres"]),
Expand Down Expand Up @@ -149,8 +149,8 @@ def process_tv(response):
"synopsis": get_synopsis(response["overview"]),
"details": {
"format": "TV",
"start_date": get_start_date(response["first_air_date"]),
"end_date": get_end_date(response["last_air_date"]),
"first_air_date": get_start_date(response["first_air_date"]),
"last_air_date": get_end_date(response["last_air_date"]),
"status": response["status"],
"number_of_seasons": response["number_of_seasons"],
"number_of_episodes": num_episodes,
Expand Down Expand Up @@ -196,7 +196,7 @@ def process_season(response):
"season_number": response["season_number"],
"synopsis": get_synopsis(response["overview"]),
"details": {
"start_date": get_start_date(response["air_date"]),
"air_date": get_start_date(response["air_date"]),
"number_of_episodes": num_episodes,
},
"episodes": response["episodes"],
Expand Down Expand Up @@ -341,7 +341,7 @@ def process_episodes(season_metadata, watched_episodes):
episodes_metadata.append(
{
"episode_number": episode_number,
"start_date": get_episode_air_date(episode["air_date"]),
"air_date": get_episode_air_date(episode["air_date"]),
"image": episode["still_path"],
"title": episode["name"],
"overview": episode["overview"],
Expand Down
8 changes: 4 additions & 4 deletions src/app/tests/test_providers.py
Expand Up @@ -93,15 +93,15 @@ def test_tv(self):
"""Test the metadata method for TV shows."""
response = tmdb.tv("1396")
self.assertEqual(response["title"], "Breaking Bad")
self.assertEqual(response["details"]["start_date"], "2008-01-20")
self.assertEqual(response["details"]["first_air_date"], "2008-01-20")
self.assertEqual(response["details"]["status"], "Ended")
self.assertEqual(response["details"]["number_of_episodes"], 62)

def test_movie(self):
"""Test the metadata method for movies."""
response = tmdb.movie("10494")
self.assertEqual(response["title"], "Perfect Blue")
self.assertEqual(response["details"]["start_date"], "1998-02-28")
self.assertEqual(response["details"]["release_date"], "1998-02-28")
self.assertEqual(response["details"]["status"], "Released")

@patch("requests.get")
Expand All @@ -116,7 +116,7 @@ def test_movie_unknown(self, mock_data: "patch"):
self.assertEqual(response["title"], "Unknown Movie")
self.assertEqual(response["image"], settings.IMG_NONE)
self.assertEqual(response["synopsis"], "No synopsis available.")
self.assertEqual(response["details"]["start_date"], "Unknown")
self.assertEqual(response["details"]["release_date"], "Unknown")
self.assertEqual(response["details"]["runtime"], "Unknown")
self.assertEqual(response["details"]["genres"], "Unknown")
self.assertEqual(response["details"]["studios"], "Unknown")
Expand All @@ -128,5 +128,5 @@ def test_games(self):
response = igdb.game("1942")
self.assertEqual(response["title"], "The Witcher 3: Wild Hunt")
self.assertEqual(response["details"]["format"], "Main game")
self.assertEqual(response["details"]["start_date"], "2015-05-19")
self.assertEqual(response["details"]["release_date"], "2015-05-19")
self.assertEqual(response["details"]["themes"], "Action, Fantasy, Open world")
4 changes: 2 additions & 2 deletions src/templates/app/season_details.html
Expand Up @@ -76,7 +76,7 @@ <h3 class="fs-5">
</h3>

<div class="mb-2">
<small class="text-body-secondary">{{ episode.start_date }}</small>
<small class="text-body-secondary">{{ episode.air_date }}</small>
</div>

<p class="episode-overview mb-2">{{ episode.overview }}</p>
Expand Down Expand Up @@ -127,7 +127,7 @@ <h5 class="modal-title">{{ tv.title|capfirst }} S{{ season.season_number }}.E{{
<button type="submit"
class="btn btn-secondary w-100 mt-3"
name="release"
value="{{ episode.start_date }}">Release</button>
value="{{ episode.air_date }}">Release</button>
<div class="d-flex date-btn-group mt-2">
<input type="date"
class="form-control pe-0 border-end-0 rounded-end-0"
Expand Down

0 comments on commit 1ed3ac4

Please sign in to comment.