use timestamp() instead of strftime
This commit is contained in:
parent
e804dd1aec
commit
4cccb73812
|
@ -270,7 +270,7 @@ class PendingList(PendingIndex):
|
|||
"channel_id": vid["channel_id"],
|
||||
"duration": duration_str,
|
||||
"published": published,
|
||||
"timestamp": int(datetime.now().strftime("%s")),
|
||||
"timestamp": int(datetime.now().timestamp()),
|
||||
}
|
||||
if self.all_channels:
|
||||
youtube_details.update(
|
||||
|
|
|
@ -151,7 +151,7 @@ class CookieHandler:
|
|||
now = datetime.now()
|
||||
message = {
|
||||
"status": response,
|
||||
"validated": int(now.strftime("%s")),
|
||||
"validated": int(now.timestamp()),
|
||||
"validated_str": now.strftime("%Y-%m-%d %H:%M"),
|
||||
}
|
||||
RedisArchivist().set_message("cookie:valid", message)
|
||||
|
|
|
@ -28,7 +28,7 @@ class DownloadPostProcess:
|
|||
|
||||
def __init__(self, download):
|
||||
self.download = download
|
||||
self.now = int(datetime.now().strftime("%s"))
|
||||
self.now = int(datetime.now().timestamp())
|
||||
self.pending = False
|
||||
|
||||
def run(self):
|
||||
|
|
|
@ -135,7 +135,7 @@ class ElasticSnapshot:
|
|||
return True
|
||||
|
||||
last_stamp = snap_dicts[0]["end_stamp"]
|
||||
now = int(datetime.now().strftime("%s"))
|
||||
now = int(datetime.now().timestamp())
|
||||
outdated = (now - last_stamp) / 60 / 60 > 24
|
||||
if outdated:
|
||||
print("snapshot: is outdated, create new now")
|
||||
|
|
|
@ -14,7 +14,7 @@ class WatchState:
|
|||
|
||||
def __init__(self, youtube_id):
|
||||
self.youtube_id = youtube_id
|
||||
self.stamp = int(datetime.now().strftime("%s"))
|
||||
self.stamp = int(datetime.now().timestamp())
|
||||
|
||||
def mark_as_watched(self):
|
||||
"""update es with new watched value"""
|
||||
|
|
|
@ -88,7 +88,7 @@ class ChannelScraper:
|
|||
# build and return dict
|
||||
self.json_data = {
|
||||
"channel_active": True,
|
||||
"channel_last_refresh": int(datetime.now().strftime("%s")),
|
||||
"channel_last_refresh": int(datetime.now().timestamp()),
|
||||
"channel_subs": self._get_channel_subs(main_tab),
|
||||
"channel_name": main_tab["title"],
|
||||
"channel_banner_url": self._get_thumbnails(main_tab, "banner"),
|
||||
|
@ -203,7 +203,7 @@ class YoutubeChannel(YouTubeItem):
|
|||
print(f"{self.youtube_id}: fallback to video metadata")
|
||||
self.json_data = {
|
||||
"channel_active": False,
|
||||
"channel_last_refresh": int(datetime.now().strftime("%s")),
|
||||
"channel_last_refresh": int(datetime.now().timestamp()),
|
||||
"channel_subs": fallback.get("channel_follower_count", 0),
|
||||
"channel_name": fallback["uploader"],
|
||||
"channel_banner_url": False,
|
||||
|
|
|
@ -40,7 +40,7 @@ class Comments:
|
|||
|
||||
self.json_data = {
|
||||
"youtube_id": self.youtube_id,
|
||||
"comment_last_refresh": int(datetime.now().strftime("%s")),
|
||||
"comment_last_refresh": int(datetime.now().timestamp()),
|
||||
"comment_channel_id": channel_id,
|
||||
"comment_comments": self.comments_format,
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class YoutubePlaylist(YouTubeItem):
|
|||
"playlist_channel_id": self.youtube_meta["channel_id"],
|
||||
"playlist_thumbnail": playlist_thumbnail,
|
||||
"playlist_description": self.youtube_meta["description"] or False,
|
||||
"playlist_last_refresh": int(datetime.now().strftime("%s")),
|
||||
"playlist_last_refresh": int(datetime.now().timestamp()),
|
||||
}
|
||||
|
||||
def get_entries(self, playlistend=False):
|
||||
|
|
|
@ -50,7 +50,7 @@ class ReindexBase:
|
|||
|
||||
def __init__(self):
|
||||
self.config = AppConfig().config
|
||||
self.now = int(datetime.now().strftime("%s"))
|
||||
self.now = int(datetime.now().timestamp())
|
||||
|
||||
def populate(self, all_ids, reindex_config):
|
||||
"""add all to reindex ids to redis queue"""
|
||||
|
|
|
@ -285,7 +285,7 @@ class SubtitleParser:
|
|||
"title": video.json_data.get("title"),
|
||||
"subtitle_channel": channel.get("channel_name"),
|
||||
"subtitle_channel_id": channel.get("channel_id"),
|
||||
"subtitle_last_refresh": int(datetime.now().strftime("%s")),
|
||||
"subtitle_last_refresh": int(datetime.now().timestamp()),
|
||||
"subtitle_lang": self.lang,
|
||||
"subtitle_source": source,
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class SponsorBlock:
|
|||
def __init__(self, user_id=False):
|
||||
self.user_id = user_id
|
||||
self.user_agent = f"{settings.TA_UPSTREAM} {settings.TA_VERSION}"
|
||||
self.last_refresh = int(datetime.now().strftime("%s"))
|
||||
self.last_refresh = int(datetime.now().timestamp())
|
||||
|
||||
def get_sb_id(self):
|
||||
"""get sponsorblock userid or generate if needed"""
|
||||
|
@ -180,7 +180,7 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
|
|||
upload_date = self.youtube_meta["upload_date"]
|
||||
upload_date_time = datetime.strptime(upload_date, "%Y%m%d")
|
||||
published = upload_date_time.strftime("%Y-%m-%d")
|
||||
last_refresh = int(datetime.now().strftime("%s"))
|
||||
last_refresh = int(datetime.now().timestamp())
|
||||
# base64_blur = ThumbManager().get_base64_blur(self.youtube_id)
|
||||
base64_blur = False
|
||||
# build json_data basics
|
||||
|
|
Loading…
Reference in New Issue