From 741ef4c5a9f1709953191745865ff94373bab6db Mon Sep 17 00:00:00 2001 From: NebKi <62897971+NebKi@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:09:17 +0100 Subject: [PATCH] Change SQL command to import all movies and tv categories and skip duplicates --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 00f924f..701909d 100644 --- a/README.md +++ b/README.md @@ -190,9 +190,9 @@ This can be done by running the following command: ``` docker exec -it knightcrawler-postgres-1 psql -d knightcrawler -c " -INSERT INTO ingested_torrents (name, source, category, info_hash, size, seeders, leechers, imdb, processed, \"createdAt\", \"updatedAt\") +INSERT INTO ingested_torrents (name, source, category, info_hash, size, seeders, leechers, imdb, processed, "createdAt", "updatedAt") SELECT title, 'RARBG', cat, hash, size, NULL, NULL, imdb, false, current_timestamp, current_timestamp -FROM items where cat='tv' OR cat='movies';" +FROM items WHERE NOT EXISTS (SELECT info_hash FROM ingested_torrents WHERE ingested_torrents.info_hash = items.hash) AND (cat LIKE 'tv%' OR cat LIKE 'movies%');" ``` You should get a response similar to: