25 lines
533 B
Bash
25 lines
533 B
Bash
|
# Remove quotes
|
||
|
sed 's/\"//g' ../torrents.csv > torrents_removed_quotes.csv
|
||
|
|
||
|
rm ../torrents.db
|
||
|
|
||
|
sqlite3 -batch ../torrents.db <<"EOF"
|
||
|
create table torrents(
|
||
|
"infohash" TEXT,
|
||
|
"name" TEXT,
|
||
|
"size_bytes" INTEGER,
|
||
|
"created_unix" INTEGER,
|
||
|
"seeders" INTEGER,
|
||
|
"leechers" INTEGER,
|
||
|
"completed" INTEGER,
|
||
|
"scraped_date" INTEGER
|
||
|
);
|
||
|
.separator ";"
|
||
|
.import torrents_removed_quotes.csv torrents
|
||
|
UPDATE torrents SET completed=NULL WHERE completed = '';
|
||
|
create index name_index on torrents (name);
|
||
|
EOF
|
||
|
rm torrents_removed_quotes.csv
|
||
|
|
||
|
|