update vod downloader to use the new database.py file
This commit is contained in:
@@ -9,33 +9,6 @@ from uploader import CategoryId
|
||||
|
||||
CHANNEL_NAME = 'teampgp' # Replace with the streamer's username
|
||||
|
||||
# Stores data locally
|
||||
CONN = sqlite3.connect("clips_database.db")
|
||||
CURSOR = CONN.cursor()
|
||||
|
||||
def create_database():
|
||||
"""Creates a table structured explicitly for Twitch clip properties."""
|
||||
CURSOR.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS clips (
|
||||
slug TEXT PRIMARY KEY,
|
||||
date TEXT NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
gamename TEXT NOT NULL,
|
||||
clip_by TEXT NOT NULL,
|
||||
view_count INTEGER NOT NULL,
|
||||
downloaded INTEGER NOT NULL,
|
||||
uploaded_yt INTEGER NOT NULL
|
||||
)
|
||||
"""
|
||||
)
|
||||
CONN.commit()
|
||||
|
||||
def close_database():
|
||||
"""Commits queries before ending connection context."""
|
||||
CONN.commit()
|
||||
CONN.close()
|
||||
|
||||
def download_clips():
|
||||
"""Loops over undownloaded metadata entries to write files down locally."""
|
||||
undownloaded_clips = get_undownloaded_clips()
|
||||
@@ -109,13 +82,6 @@ def mark_as_downloaded(slug: str):
|
||||
)
|
||||
CONN.commit()
|
||||
|
||||
def get_unuploaded_clips():
|
||||
"""Retrieves all clip rows remaining to be uploaded."""
|
||||
CURSOR.execute(
|
||||
"SELECT slug, date, title, gamename, clip_by, view_count, downloaded, uploaded_yt FROM clips WHERE downloaded = 1 AND uploaded_yt = 0"
|
||||
)
|
||||
return CURSOR.fetchall()
|
||||
|
||||
def get_undownloaded_clips():
|
||||
"""Retrieves all clip rows remaining to be captured."""
|
||||
CURSOR.execute(
|
||||
|
||||
Reference in New Issue
Block a user