processing_uploads Shorts are working
This commit is contained in:
1 parent
d4db0b04a4
commit
f21a587cd0
3 files changed
+22
-7
No files matched your search
+6
-1
@@ -1,4 +1,9 @@
|
|||||||
-- database: ./database.db
|
-- database: ./database.db
|
||||||
|
|
||||||
SELECT * FROM twitch_videos WHERE clip_is == "1" and uploaded_yt_shorts == "1";
|
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";
|
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";
|
||||||
@@ -158,7 +158,8 @@ class Database:
|
|||||||
stmt = select(TwitchVideo).where(TwitchVideo.clip_is == False)
|
stmt = select(TwitchVideo).where(TwitchVideo.clip_is == False)
|
||||||
return self.session.scalars(stmt).all()
|
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)
|
record = self.session.get(Data, record_id)
|
||||||
|
|
||||||
if record:
|
if record:
|
||||||
@@ -167,6 +168,9 @@ class Database:
|
|||||||
else:
|
else:
|
||||||
print(f"❌ Record {record_id} not found in __update_date.")
|
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]:
|
def get_data(self) -> list[Data]:
|
||||||
stmt = select(Data)
|
stmt = select(Data)
|
||||||
return self.session.scalars(stmt).all()
|
return self.session.scalars(stmt).all()
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ def process_shorts():
|
|||||||
youtube_info = YoutubeInfo()
|
youtube_info = YoutubeInfo()
|
||||||
|
|
||||||
if os.path.exists(original_path):
|
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]
|
data_csv = [yt_video_id, current_time]
|
||||||
release_time += timedelta(days=1)
|
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):
|
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])
|
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_yt(short.id)
|
||||||
|
DB.mark_as_uploaded_shorts(short.id)
|
||||||
utils.write_csv([data_csv], file_csv)
|
utils.write_csv([data_csv], file_csv)
|
||||||
|
|
||||||
youtube_info.yt_short_id = yt_video_id
|
youtube_info.yt_short_id = yt_video_id
|
||||||
youtube_info.yt_short_date = datetime.now(TZ)
|
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():
|
def process_chats():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def process_uploads():
|
def process_uploads():
|
||||||
process_shorts()
|
process_shorts()
|
||||||
process_chats()
|
#process_chats()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
pass
|
pass
|
||||||
Reference in new issue
Block a user