diff options
author | garret <garret@airmail.cc> | 2024-08-05 08:10:43 +0100 |
---|---|---|
committer | garret <garret@airmail.cc> | 2024-08-05 08:12:23 +0100 |
commit | eb94441420845970d48fe7b4e30cc5eed78ac95a (patch) | |
tree | fe1629d5de312da1f1172c33e4f2a0fc769edf98 /yt_dlp_plugins/extractor | |
parent | 76c3e466299b75fcb8e441654ac2fa1fcfcaced6 (diff) | |
download | yt-dlp-rajiko-eb94441420845970d48fe7b4e30cc5eed78ac95a.tar.gz yt-dlp-rajiko-eb94441420845970d48fe7b4e30cc5eed78ac95a.tar.bz2 yt-dlp-rajiko-eb94441420845970d48fe7b4e30cc5eed78ac95a.zip |
change names of RadikoTime functions so that datetime is the "default"
generally we should work in datetimes, the strings should be the "special" ones
Diffstat (limited to 'yt_dlp_plugins/extractor')
-rw-r--r-- | yt_dlp_plugins/extractor/radiko.py | 2 | ||||
-rwxr-xr-x | yt_dlp_plugins/extractor/radiko_time.py | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/yt_dlp_plugins/extractor/radiko.py b/yt_dlp_plugins/extractor/radiko.py index b76387d..2ec36d9 100644 --- a/yt_dlp_plugins/extractor/radiko.py +++ b/yt_dlp_plugins/extractor/radiko.py @@ -436,7 +436,7 @@ class RadikoTimeFreeIE(_RadikoBaseIE): }] def _get_programme_meta(self, station_id, url_time): - day = url_time.broadcast_day() + day = url_time.broadcast_day_string() meta = self._download_json(f"https://radiko.jp/v4/program/station/date/{day}/{station_id}.json", station_id, note="Downloading programme data") programmes = traverse_obj(meta, ("stations", lambda _, v: v["station_id"] == station_id, diff --git a/yt_dlp_plugins/extractor/radiko_time.py b/yt_dlp_plugins/extractor/radiko_time.py index c6be6ed..9e77008 100755 --- a/yt_dlp_plugins/extractor/radiko_time.py +++ b/yt_dlp_plugins/extractor/radiko_time.py @@ -8,7 +8,7 @@ class RadikoTime(datetime.datetime): def timestring(self): return self.strftime("%Y%m%d%H%M%S") - def broadcast_day_date(self): + def broadcast_day(self): # timetable api counts 05:00 -> 28:59 (04:59 next day) as all the same day # like the 30-hour day, 06:00 -> 29:59 (05:59) # https://en.wikipedia.org/wiki/Date_and_time_notation_in_Japan#Time @@ -21,14 +21,18 @@ class RadikoTime(datetime.datetime): dt = dt.date() # dont care about hours/mins, we're working in days return dt - def broadcast_day(self): - dt = self.broadcast_day_date() + def broadcast_day_string(self): + dt = self.broadcast_day() return dt.strftime("%Y%m%d") def broadcast_day_end(self): - date = self.broadcast_day_date() + date = self.broadcast_day() date += datetime.timedelta(days=1) + dt = datetime.datetime(date.year, date.month, date.day, 5, 0, 0, tzinfo=JST) + return dt + def broadcast_day_start(self): + date = self.broadcast_day() dt = datetime.datetime(date.year, date.month, date.day, 5, 0, 0, tzinfo=JST) return dt |