{ "db": "SQLite", "0022efb830d617cddcf675f07d8e1f2d9bc4cb75d455fd7723473842b993de58": { "query": "UPDATE videos\n\tSET download_status = 3,\n\t\"like\" = NULL\nWHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "06c1f76111672175bfc0e869501700496867e35914d3ac7b97292e58750b0740": { "query": "SELECT vid, title, channel AS \"channel!: _\", download_status AS \"download_status!: _\", like AS \"like!: _\"\nFROM channel_list\nWHERE vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel!: _", "ordinal": 2, "type_info": "Null" }, { "name": "download_status!: _", "ordinal": 3, "type_info": "Int64" }, { "name": "like!: _", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, null, false, false ] } }, "0739eb1cd26784e6298d7996d8776c9396903e62e154b4a5c0598f6a59e5f14b": { "query": "UPDATE videos\n SET download_status = 3\nWHERE vid = ?\n", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "0e8e822b2723fd5b0615ac8c9bb5bde7abc5806da58b43e77cba01c7f92cc1f1": { "query": "SELECT\nCASE\n WHEN query.vid LIKE '%:video:%' THEN (SELECT url FROM videos WHERE vid = query.vid)\n ELSE (SELECT 'https://youtube.com/channel?cid=' || cid FROM channels WHERE cid = query.vid)\nEND AS \"url!: _\"\nFROM (SELECT ? AS vid) AS query", "describe": { "columns": [ { "name": "url!: _", "ordinal": 0, "type_info": "Text" } ], "parameters": { "Right": 1 }, "nullable": [ null ] } }, "11d521f1135dbcd518a6ea761f7f109c22032c0d5e84094949e1338f8fb788cb": { "query": "SELECT id\nFROM download_list\nORDER BY id DESC\nLIMIT 1", "describe": { "columns": [ { "name": "id", "ordinal": 0, "type_info": "Int64" } ], "parameters": { "Right": 0 }, "nullable": [ false ] } }, "1f79284389f595d1a19798c138cc9482b49f867d72d70e29e3df4dd13bdedab5": { "query": "SELECT id\nFROM download_list\nWHERE id < (\n SELECT id\n FROM download_list\n WHERE vid = ?\n)\nORDER BY id DESC\nLIMIT 2", "describe": { "columns": [ { "name": "id", "ordinal": 0, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false ] } }, "2492db6ae6a798b8ba6965187194698f037c1b3a3204f8bb42ae5660a4eebd64": { "query": "INSERT INTO download_list\n (id, vid) VALUES (IFNULL((\n SELECT id\n FROM download_list\n ORDER BY id DESC\n LIMIT 1\n ), 1) + 100, ?)", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "24a9851199659c4929cc4c6e321ad6d8ee43c3e2a912447f473a7c57075397b9": { "query": "UPDATE download_list\n SET id = ?\n WHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 2 }, "nullable": [] } }, "33a3dd7751fe77207b9185f8058e33a021ef122021706f013223b01fcc6bd4af": { "query": "SELECT *\nFROM download_like_list\nWHERE download_status = 3 AND vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel", "ordinal": 2, "type_info": "Text" }, { "name": "download_status", "ordinal": 3, "type_info": "Int64" }, { "name": "like", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, false, false, true ] } }, "34d5ac0485ba54491e8d105dc949b3097a59da7d0509c7a64064ee02b7feb312": { "query": "SELECT id\nFROM download_list\nORDER BY id ASC\nLIMIT 1", "describe": { "columns": [ { "name": "id", "ordinal": 0, "type_info": "Int64" } ], "parameters": { "Right": 0 }, "nullable": [ false ] } }, "396e24595bf8ca978c7eefe18cf00fae95374034b643e01f05dacc1dc6f97ecb": { "query": "SELECT *\nFROM download_like_list\nWHERE \"like\" IS NULL AND vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel", "ordinal": 2, "type_info": "Text" }, { "name": "download_status", "ordinal": 3, "type_info": "Int64" }, { "name": "like", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, false, false, true ] } }, "46c30bc43a84284655862d533aa57e1f37a29f807b6b9b1c83589d09749d0331": { "query": "UPDATE videos\nSET location = NULL\nWHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "4dfaec32c244508a5d2cd79c1f3da8201f9cf954d794c0ffcfe8afa43017fdbd": { "query": "UPDATE videos\n SET download_status = 4\n WHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "642bf409b8b02b62c1dbe1b65cc7c3bdbb65ce52ddf2a22fc816cb40e96db330": { "query": "SELECT *\nFROM download_like_list\nWHERE download_status = 3", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel", "ordinal": 2, "type_info": "Text" }, { "name": "download_status", "ordinal": 3, "type_info": "Int64" }, { "name": "like", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 0 }, "nullable": [ false, false, false, false, true ] } }, "669c7388d409b35f26e188d8376b06c02711824b49dd5816accb72437523f728": { "query": "UPDATE videos\n SET download_status = 0\nWHERE vid = ?;\nDELETE FROM download_list WHERE vid = ?;\n", "describe": { "columns": [], "parameters": { "Right": 2 }, "nullable": [] } }, "672f0da4d303e4a188bb52387080cbdcf7bd663c9af0318b1edb0eef3be7c0be": { "query": "SELECT id\nFROM download_list\nWHERE id > (\n SELECT id\n FROM download_list\n WHERE vid = ?\n)\nORDER BY id ASC\nLIMIT 2", "describe": { "columns": [ { "name": "id", "ordinal": 0, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false ] } }, "67f8d9e9e50edcf42363d9284eadd2c22a567c9df9429ec28d4680325dca66ff": { "query": "UPDATE channels\n SET subscribed = NOT subscribed\n WHERE cid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "6c39ce4131a4c990723a93e27ebd523e7816cf153d69590fd4664db4152d97eb": { "query": "SELECT cid AS \"cid: _\" FROM fts_channels WHERE document MATCH ? ORDER BY rank;", "describe": { "columns": [ { "name": "cid: _", "ordinal": 0, "type_info": "Null" } ], "parameters": { "Right": 1 }, "nullable": [ true ] } }, "74bfc85bfdb0bffff5b4c1502187802fb99ad4a732575f62c40a9f3fad8f8638": { "query": "SELECT v.vid, v.title, v.description, v.thumbnail_url FROM videos v\nINNER JOIN download_list dl ON dl.vid = v.vid\nORDER BY dl.id", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "description", "ordinal": 2, "type_info": "Text" }, { "name": "thumbnail_url", "ordinal": 3, "type_info": "Text" } ], "parameters": { "Right": 0 }, "nullable": [ false, false, false, true ] } }, "7d0f1af744dfd56f2b599fead30497ea6416f46968ca1406232922d066c87cf3": { "query": "UPDATE videos\n SET download_status = 1\nWHERE vid = ?\n", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "97c83eed2fe69a5188ec9cc86b502fc5d25b744cbb255d4e8fee6403f3e7c81e": { "query": "SELECT cid, instant FROM channels WHERE subscribed = 1", "describe": { "columns": [ { "name": "cid", "ordinal": 0, "type_info": "Text" }, { "name": "instant", "ordinal": 1, "type_info": "Bool" } ], "parameters": { "Right": 0 }, "nullable": [ false, false ] } }, "98bb729964a4b66a6e588caaf9e52ae2e1b933c31e81e053ee0bd349dc620b14": { "query": "SELECT vid AS \"vid: _\" FROM fts_videos WHERE document MATCH ? ORDER BY rank;", "describe": { "columns": [ { "name": "vid: _", "ordinal": 0, "type_info": "Null" } ], "parameters": { "Right": 1 }, "nullable": [ true ] } }, "a3906bd2ec95e84175aa89b15aaa415280412283fc1f027b0db7754b514211c4": { "query": "SELECT vid FROM videos WHERE vid = ?;\n", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" } ], "parameters": { "Right": 1 }, "nullable": [ false ] } }, "ad454069d4b2b63a15c155b5474fb0da317875e2c9b2a46597a33a34ccdd0fe1": { "query": "UPDATE videos\n SET download_status = 0,\n mark_watched = ?\n WHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 2 }, "nullable": [] } }, "afd6fb9c987c8401551be9e47b433900f69f398b21bf5477c3a3feda63d2dc8f": { "query": "-- Tables\nCREATE TABLE IF NOT EXISTS channels (\n cid TEXT PRIMARY KEY NOT NULL CHECK (cid LIKE '%:channel:%'),\n name TEXT NOT NULL DEFAULT '',\n description TEXT NOT NULL DEFAULT '',\n subscribed BOOL NOT NULL DEFAULT false,\n instant BOOL NOT NULL DEFAULT false\n);\nCREATE TABLE IF NOT EXISTS videos (\n vid TEXT PRIMARY KEY NOT NULL CHECK (vid LIKE '%:video:%'),\n url TEXT NOT NULL CHECK (url like 'https://%'),\n title TEXT NOT NULL DEFAULT '',\n description TEXT NOT NULL DEFAULT '',\n cid TEXT NOT NULL,\n published DATETIME NOT NULL DEFAULT (datetime('now','localtime')),\n likes INT NOT NULL,\n dislikes INT NOT NULL,\n views INT NOT NULL,\n duration INT NOT NULL,\n comments INT NOT NULL,\n thumbnail_url TEXT,\n download_status INT NOT NULL DEFAULT 3,\n mark_watched INT NOT NULL DEFAULT 2,\n like INT,\n location TEXT,\n FOREIGN KEY (cid)\n REFERENCES channels (cid)\n ON DELETE CASCADE\n ON UPDATE NO ACTION\n);\nCREATE TABLE IF NOT EXISTS streams (\n sid TEXT PRIMARY KEY NOT NULL CHECK (sid LIKE '%:stream:%'),\n title TEXT NOT NULL DEFAULT '',\n start_time INT NOT NULL DEFAULT (datetime('now','localtime')),\n cid NOT NULL,\n ended BOOL NOT NULL DEFAULT false,\n description TEXT NOT NULL DEFAULT '',\n rating REAL NOT NULL,\n rating_count INT NOT NULL,\n views INT NOT NULL,\n FOREIGN KEY (cid)\n REFERENCES channels (cid)\n ON DELETE CASCADE\n ON UPDATE NO ACTION\n);\nCREATE TABLE IF NOT EXISTS download_list (\n id INTEGER PRIMARY KEY ASC,\n vid TEXT NOT NULL UNIQUE,\n FOREIGN KEY (vid)\n REFERENCES videos (vid)\n ON DELETE CASCADE\n ON UPDATE NO ACTION\n);\n-- indexes\nCREATE INDEX IF NOT EXISTS channels_instant\nON channels (instant);\nCREATE INDEX IF NOT EXISTS channels_subscribed\nON channels (subscribed);\nCREATE UNIQUE INDEX IF NOT EXISTS download_list_vid\nON download_list (vid);\nCREATE INDEX IF NOT EXISTS videos_download_status\nON videos (download_status);\nCREATE INDEX IF NOT EXISTS videos_cid\nON videos (cid);\nCREATE INDEX IF NOT EXISTS videos_like\nON videos (like);\n-- views\nDROP VIEW IF EXISTS download_like_list;\nCREATE VIEW IF NOT EXISTS download_like_list AS\nSELECT v.vid, v.title, c.name AS channel, v.download_status, v.\"like\"\nFROM videos v\nINNER JOIN channels c ON v.cid = c.cid;\nDROP VIEW IF EXISTS channel_list;\nCREATE VIEW IF NOT EXISTS channel_list AS\nSELECT\n cid AS vid,\n name AS title,\n substr(description, 1, instr(description, '\\n')-1) AS channel,\n 0 AS download_status,\n 0 AS like\nFROM channels;\nDROP VIEW IF EXISTS fts_videos_view;\nCREATE VIEW IF NOT EXISTS fts_videos_view AS\nSELECT\n url || ' ' || title || ' ' || description AS document,\n vid\nFROM videos;\nDROP VIEW IF EXISTS fts_channels_view;\nCREATE VIEW IF NOT EXISTS fts_channels_view AS\nSELECT\n cid || ' ' || name || ' ' || description AS document,\n cid\nFROM channels;\nDROP VIEW IF EXISTS popup_content;\nCREATE VIEW IF NOT EXISTS popup_content AS\nSELECT v.vid, v.title, v.description, v.url, v.cid, v.location AS path,\nc.subscribed, v.likes, v.views, v.comments, v.duration\nFROM videos v\nINNER JOIN channels c ON c.cid = v.cid;\n-- Full text search\nCREATE VIRTUAL TABLE IF NOT EXISTS fts_videos USING fts5(\n document, vid UNINDEXED, tokenize = \"trigram\"\n);\nCREATE VIRTUAL TABLE IF NOT EXISTS fts_channels USING fts5(\n document, cid UNINDEXED, tokenize = \"trigram\"\n);\n-- triggers\nCREATE TRIGGER IF NOT EXISTS videos_ad AFTER DELETE ON videos BEGIN\n DELETE FROM fts_videos WHERE vid = old.vid;\nEND;\nCREATE TRIGGER IF NOT EXISTS videos_ai AFTER INSERT ON videos BEGIN\n INSERT INTO fts_videos(document, vid) SELECT * FROM fts_videos_view WHERE vid = new.vid;\nEND;\nCREATE TRIGGER IF NOT EXISTS videos_auf AFTER UPDATE OF url, name, description ON videos BEGIN\n UPDATE fts_videos\n SET document = view.document\n FROM (SELECT document FROM fts_videos_view WHERE vid = new.vid) AS view\n WHERE vid = new.vid;\nEND;\nCREATE TRIGGER IF NOT EXISTS videos_aul AFTER UPDATE OF download_status ON videos WHEN old.download_status = 0 BEGIN\n DELETE FROM download_list WHERE vid = new.vid;\nEND;\nCREATE TRIGGER IF NOT EXISTS channels_ad AFTER DELETE ON channels BEGIN\n DELETE FROM fts_channels WHERE cid = old.cid;\nEND;\nCREATE TRIGGER IF NOT EXISTS channels_ai AFTER INSERT ON channels BEGIN\n INSERT INTO fts_channels(document, cid) SELECT * FROM fts_channels_view WHERE cid = new.cid;\nEND;\nCREATE TRIGGER IF NOT EXISTS channels_au AFTER UPDATE OF name, description ON channels BEGIN\n UPDATE fts_channels\n SET document = view.document\n FROM (SELECT document FROM fts_channels_view WHERE cid = new.cid) AS view\n WHERE cid = new.cid;\nEND;\n", "describe": { "columns": [], "parameters": { "Right": 0 }, "nullable": [] } }, "b596ef403dad992a0910755e95f273dff66430197a02f926cbd78f734101a5fd": { "query": "SELECT v.vid, v.title, \"\" AS \"channel!: _\", 0 AS \"like!: _\", 0 AS \"download_status!: _\" FROM videos v\nWHERE v.vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel!: _", "ordinal": 2, "type_info": "Text" }, { "name": "like!: _", "ordinal": 3, "type_info": "Int64" }, { "name": "download_status!: _", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, false, false, false ] } }, "b7b2395a08d614a36a70186131272e43e21b1ea813d3ac7325679213162a3e19": { "query": "UPDATE videos\n SET download_status = 3\n WHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } }, "ba2c7b53f6861cd5aae1f196ebdcd956eea3d9e5b4d5c37e5015f54a81fb6464": { "query": "UPDATE videos\n SET \"like\" = ?\n WHERE vid = ?", "describe": { "columns": [], "parameters": { "Right": 2 }, "nullable": [] } }, "cd6c389d8393cb9fc6ad14b9686115009a1602d4e0139126aa5efd3a4290d3e3": { "query": "SELECT *\nFROM download_like_list\nWHERE \"like\" IS NULL", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel", "ordinal": 2, "type_info": "Text" }, { "name": "download_status", "ordinal": 3, "type_info": "Int64" }, { "name": "like", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 0 }, "nullable": [ false, false, false, false, true ] } }, "d780e2fc55324914e8003832940c6410b4c67c3c8020af9245fbda000e8956be": { "query": "SELECT *\nFROM download_like_list\nWHERE vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel", "ordinal": 2, "type_info": "Text" }, { "name": "download_status", "ordinal": 3, "type_info": "Int64" }, { "name": "like", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, false, false, true ] } }, "dea9b97e7bcf926750a7d585288afd1cb9fc5ddede56a260ad01939b4f8f9f15": { "query": "SELECT v.vid, v.title, \"\" AS \"channel!: _\", 0 AS \"like!: _\", 0 AS \"download_status!: _\" FROM download_list d\nINNER JOIN videos v on d.vid = v.vid\nORDER BY d.id", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "channel!: _", "ordinal": 2, "type_info": "Text" }, { "name": "like!: _", "ordinal": 3, "type_info": "Int64" }, { "name": "download_status!: _", "ordinal": 4, "type_info": "Int64" } ], "parameters": { "Right": 0 }, "nullable": [ false, false, false, false, false ] } }, "ec902fff36578fbdea71cf9eae7eab86dbe76fd61e536c7bf4a723fd2009a873": { "query": "INSERT INTO videos\n(vid, url, title, description, cid, likes, dislikes, views, duration, comments, thumbnail_url, download_status, published)\nVALUES (?, ?, ?, ?, 'yt:channel:' || ?, ?, ?, ?, ?, ?, ?, ?, ?)\nON CONFLICT (vid)\nDO UPDATE SET\n title=excluded.title,\n description=excluded.description,\n likes=excluded.likes,\n dislikes=excluded.dislikes,\n views=excluded.views,\n comments=excluded.comments;\n", "describe": { "columns": [], "parameters": { "Right": 13 }, "nullable": [] } }, "f0287f3b82b399cc637c1c6c81485cee9297648d04188d5fbdf95b96562ab8d7": { "query": "SELECT *\nFROM popup_content\nWHERE vid = ?", "describe": { "columns": [ { "name": "vid", "ordinal": 0, "type_info": "Text" }, { "name": "title", "ordinal": 1, "type_info": "Text" }, { "name": "description", "ordinal": 2, "type_info": "Text" }, { "name": "url", "ordinal": 3, "type_info": "Text" }, { "name": "cid", "ordinal": 4, "type_info": "Text" }, { "name": "path", "ordinal": 5, "type_info": "Text" }, { "name": "subscribed", "ordinal": 6, "type_info": "Bool" }, { "name": "likes", "ordinal": 7, "type_info": "Int64" }, { "name": "views", "ordinal": 8, "type_info": "Int64" }, { "name": "comments", "ordinal": 9, "type_info": "Int64" }, { "name": "duration", "ordinal": 10, "type_info": "Int64" } ], "parameters": { "Right": 1 }, "nullable": [ false, false, false, false, false, true, false, false, false, false, false ] } }, "fef7df7d93c3d7eb31731a3bd68059d13175d4c43607575be14106fe0dcd04c4": { "query": "DELETE FROM download_list\nWHERE download_list.vid = ?", "describe": { "columns": [], "parameters": { "Right": 1 }, "nullable": [] } } }