diff --git a/help.sqlite3-query b/help.sqlite3-query index 03f1e61..c81b372 100644 --- a/help.sqlite3-query +++ b/help.sqlite3-query @@ -1,4 +1,9 @@ -- database: ./database.db SELECT * FROM twitch_videos WHERE clip_is == "1" and uploaded_yt_shorts == "1"; -UPDATE twitch_videos SET uploaded_yt_shorts = 0 WHERE uploaded_yt_shorts == "1"; \ No newline at end of file +UPDATE twitch_videos SET uploaded_yt_shorts = 0 WHERE uploaded_yt_shorts == "1"; +SELECT * FROM twitch_videos WHERE title == "Oh Dear"; +SELECT * FROM twitch_videos WHERE title = 'Kreestuh FINALLY hits her "Ryan Dark Story" limit. Jesus Big K it''s about time!'; +SELECT * FROM twitch_videos WHERE title = "Bolt-Action Bureaucracy"; +SELECT * FROM twitch_videos WHERE title = "Just after going through a mass starvation..."; +SELECT * FROM twitch_videos WHERE title = "Semi-Automatic Sanctimony"; \ No newline at end of file diff --git a/package/database/database.py b/package/database/database.py index a2a1702..1dd3345 100644 --- a/package/database/database.py +++ b/package/database/database.py @@ -158,7 +158,8 @@ class Database: stmt = select(TwitchVideo).where(TwitchVideo.clip_is == False) return self.session.scalars(stmt).all() - def __update_date(self, record_id: str, field_name: str, date: str): + def __update_date(self, field_name: str, date: str): + record_id = 1 record = self.session.get(Data, record_id) if record: @@ -167,6 +168,9 @@ class Database: else: print(f"❌ Record {record_id} not found in __update_date.") + def update_date_shorts(self, date: str): + self.__update_date("date_shorts", date) + def get_data(self) -> list[Data]: stmt = select(Data) return self.session.scalars(stmt).all() diff --git a/package/process_uploads.py b/package/process_uploads.py index a6e788c..b86ce4c 100644 --- a/package/process_uploads.py +++ b/package/process_uploads.py @@ -53,7 +53,11 @@ def process_shorts(): youtube_info = YoutubeInfo() if os.path.exists(original_path): - if yt_video_id := upload_video(original_path, short.title, categoryId, description, 'unlisted', tags): + yt_video_id = None + if (youtube_info.id == short.id and youtube_info.yt_short_id is not None) or (yt_video_id := upload_video(original_path, short.title, categoryId, description, 'unlisted', tags)): + if youtube_info.id == short.id: + yt_video_id = youtube_info.yt_short_id + data_csv = [yt_video_id, current_time] release_time += timedelta(days=1) @@ -64,23 +68,25 @@ def process_shorts(): if yt_video_id := upload_video(file_path, short.title, categoryId, f"{description} Original Full size @ https://youtu.be/{yt_video_id}", privatcyStatus, tags, release_time): data_csv.extend([yt_video_id, release_time]) - DB.mark_as_uploaded_shorts(short.id) DB.mark_as_uploaded_yt(short.id) + DB.mark_as_uploaded_shorts(short.id) utils.write_csv([data_csv], file_csv) youtube_info.yt_short_id = yt_video_id youtube_info.yt_short_date = datetime.now(TZ) - DB.insert(youtube_info) + DB.insert(youtube_info) + else: + break - DB.update_date_shorts(meta_data.id, release_time) + DB.update_date_shorts(release_time) def process_chats(): pass def process_uploads(): process_shorts() - process_chats() + #process_chats() if __name__ == "__main__": pass \ No newline at end of file