Skip to content

Conversation

@mbertrand
Copy link
Member

@mbertrand mbertrand commented Jul 24, 2024

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/4432

Description (What does it do?)

Converts podcast episode duration (if present) to ISO-8601 format.

How can this be tested?

  • Run ./manage.py backpopulate_podcast_data
  • It should complete successfully after which all published PodcastEpisode objects should have a duration that starts with "PT" or be null.
from learning_resources.models import PodcastEpisode
all_eps = PodcastEpisode.objects.filter(learning_resource__published=True)
pt_eps = all_eps.filter(duration__startswith="PT)
null_eps = all_eps.filter(duration__isnull=True)
print(all_eps.count(), pt_eps.count(), null_eps.count())
assert all_eps.count() == pt_eps.count() + null_eps.count()

>1781 1744 37

Additional Context

There are some python libraries to output durations in 8601 format (isodate, isodate2) but neither have been updated since late 2021 so I decided to roll my own function.

I placed the iso8601_duration function in etl.utils rather than etl.podcasts just in case we might want to use it for something other than podcast episodes. For example, maybe videos if we ever start ingesting them from somewhere other than Youtube (where it is already in ISO-8601 format).

@mbertrand mbertrand added the Needs Review An open Pull Request that is ready for review label Jul 24, 2024
@shanbady shanbady self-assigned this Jul 25, 2024
@shanbady shanbady self-requested a review July 25, 2024 14:48
Copy link
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. minor non-blocking suggestion

@shanbady shanbady assigned mbertrand and unassigned shanbady Jul 25, 2024
@shanbady shanbady added Waiting on author and removed Needs Review An open Pull Request that is ready for review labels Jul 25, 2024
@mbertrand mbertrand merged commit bfe6eee into main Jul 25, 2024
@mbertrand mbertrand deleted the mb/duration branch October 23, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants