diff --git a/plexdb.py b/plexdb.py index 47d86dc..661ed84 100644 --- a/plexdb.py +++ b/plexdb.py @@ -12,12 +12,6 @@ def run_db_injection(db_path): conn = sqlite3.connect(db_path) cursor = conn.cursor() - # Print table columns for debugging - cursor.execute("PRAGMA table_info(media_items)") - print("[*] media_items columns: {}".format([row[1] for row in cursor.fetchall()])) - cursor.execute("PRAGMA table_info(media_streams)") - print("[*] media_streams columns: {}".format([row[1] for row in cursor.fetchall()])) - # Find unanalyzed STRM files cursor.execute(""" SELECT media_parts.id, media_items.id, media_parts.file @@ -48,18 +42,18 @@ def run_db_injection(db_path): # 3. Insert Video Stream record cursor.execute(""" INSERT INTO media_streams ( - media_part_id, stream_type_id, codec, [index], language, - bitrate, class, display_title, created_at, updated_at - ) VALUES (?, 1, 'h264', 0, 'eng', 5000000, 'video', '1080p H.264', datetime('now'), datetime('now')) - """, (part_id,)) + media_part_id, media_item_id, stream_type_id, codec, [index], language, + bitrate, created_at, updated_at + ) VALUES (?, ?, 1, 'h264', 0, 'eng', 5000000, datetime('now'), datetime('now')) + """, (part_id, item_id)) # 4. Insert Audio Stream record cursor.execute(""" INSERT INTO media_streams ( - media_part_id, stream_type_id, codec, [index], language, - channels, bitrate, class, display_title, created_at, updated_at - ) VALUES (?, 2, 'aac', 1, 'eng', 2, 192000, 'audio', 'AAC Stereo', datetime('now'), datetime('now')) - """, (part_id,)) + media_part_id, media_item_id, stream_type_id, codec, [index], language, + channels, bitrate, created_at, updated_at + ) VALUES (?, ?, 2, 'aac', 1, 'eng', 2, 192000, datetime('now'), datetime('now')) + """, (part_id, item_id)) conn.commit() print("[+] Successfully injected analysis metadata for {} files.".format(len(unanalyzed)))