diff --git a/tubearchivist/home/src/download/queue.py b/tubearchivist/home/src/download/queue.py index 13bd49b..bd35a8d 100644 --- a/tubearchivist/home/src/download/queue.py +++ b/tubearchivist/home/src/download/queue.py @@ -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( diff --git a/tubearchivist/home/src/download/yt_dlp_base.py b/tubearchivist/home/src/download/yt_dlp_base.py index 2ab6248..fd59a9d 100644 --- a/tubearchivist/home/src/download/yt_dlp_base.py +++ b/tubearchivist/home/src/download/yt_dlp_base.py @@ -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) diff --git a/tubearchivist/home/src/download/yt_dlp_handler.py b/tubearchivist/home/src/download/yt_dlp_handler.py index c6d415c..c5c452d 100644 --- a/tubearchivist/home/src/download/yt_dlp_handler.py +++ b/tubearchivist/home/src/download/yt_dlp_handler.py @@ -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): diff --git a/tubearchivist/home/src/es/snapshot.py b/tubearchivist/home/src/es/snapshot.py index 48baeaf..6d6563c 100644 --- a/tubearchivist/home/src/es/snapshot.py +++ b/tubearchivist/home/src/es/snapshot.py @@ -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") diff --git a/tubearchivist/home/src/frontend/watched.py b/tubearchivist/home/src/frontend/watched.py index 88f694f..e8b3e15 100644 --- a/tubearchivist/home/src/frontend/watched.py +++ b/tubearchivist/home/src/frontend/watched.py @@ -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""" diff --git a/tubearchivist/home/src/index/channel.py b/tubearchivist/home/src/index/channel.py index 6e738bf..fb80e25 100644 --- a/tubearchivist/home/src/index/channel.py +++ b/tubearchivist/home/src/index/channel.py @@ -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, diff --git a/tubearchivist/home/src/index/comments.py b/tubearchivist/home/src/index/comments.py index 14cb1a5..c512802 100644 --- a/tubearchivist/home/src/index/comments.py +++ b/tubearchivist/home/src/index/comments.py @@ -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, } diff --git a/tubearchivist/home/src/index/playlist.py b/tubearchivist/home/src/index/playlist.py index 5a85b91..375082e 100644 --- a/tubearchivist/home/src/index/playlist.py +++ b/tubearchivist/home/src/index/playlist.py @@ -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): diff --git a/tubearchivist/home/src/index/reindex.py b/tubearchivist/home/src/index/reindex.py index 780d7de..5b65afc 100644 --- a/tubearchivist/home/src/index/reindex.py +++ b/tubearchivist/home/src/index/reindex.py @@ -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""" diff --git a/tubearchivist/home/src/index/subtitle.py b/tubearchivist/home/src/index/subtitle.py index 1c8e0ac..7c56c4d 100644 --- a/tubearchivist/home/src/index/subtitle.py +++ b/tubearchivist/home/src/index/subtitle.py @@ -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, } diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py index 7780c63..6b8cb93 100644 --- a/tubearchivist/home/src/index/video.py +++ b/tubearchivist/home/src/index/video.py @@ -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