Upping version.

This commit is contained in:
Dessalines 2020-01-09 12:13:22 -05:00
parent 287807a550
commit 7ceb5b7ed7
6 changed files with 32 additions and 17 deletions

View File

@ -24,7 +24,8 @@ Made with [Rust](https://www.rust-lang.org), [ripgrep](https://github.com/BurntS
```
git clone https://gitlab.com/dessalines/torrents.csv
cd torrents.csv/scripts && ./build_sqlite.sh && cd ..
cd torrents.csv
cd scripts && ./build_sqlite.sh -f && cd ..
cd docker/prod
docker-compose up -d
```

View File

@ -21,4 +21,4 @@ docker tag dev_torrents-csv:latest dessalines/torrents-csv:$new_tag
docker push dessalines/torrents-csv:$new_tag
# SSH and pull it
ssh tyler@45.55.175.59 "cd ~/git/torrents.csv/docker/prod && git pull && docker-compose up -d"
ssh tyler@45.55.175.59 "cd ~/git/torrents.csv/scripts/ && ./git_update.sh && cd ../docker/prod && git pull && docker-compose up -d"

View File

@ -2,7 +2,7 @@ version: '3.7'
services:
torrents-csv:
image: dessalines/torrents-csv:v0.0.6
image: dessalines/torrents-csv:v0.0.7
restart: always
ports:
- "8902:8080"

View File

@ -2,6 +2,18 @@
csv_file="../torrents.csv"
torrent_files_csv="../torrent_files.csv"
db_file="${TORRENTS_CSV_DB_FILE:-../torrents.db}"
build_files=false
while getopts ":f" opt; do
case $opt in
f)
build_files=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
echo "Creating temporary torrents.db file..."
@ -31,6 +43,7 @@ UPDATE torrents SET completed=NULL WHERE completed = '';
EOF
rm torrents_removed_quotes.csv
if $build_files ; then
# Cache torrent files
echo "Building files DB from $torrent_files_csv ..."
@ -84,5 +97,5 @@ EOF
rm torrent_files_temp
mv db_tmp $db_file
fi
echo "Done."

View File

@ -5,7 +5,7 @@
# export TORRENTS_CSV_FRONT_END_DIR=`pwd`/../ui/dist
# Build the sqlite db from the CSV
./build_sqlite.sh
./build_sqlite.sh -f
# Build front end
cd ../server/ui

View File

@ -92,7 +92,8 @@ fn search_query(
conn: r2d2::PooledConnection<SqliteConnectionManager>,
) -> Result<Value, Error> {
if query.q.is_empty() || query.q.trim() == "*" {
let q = query.q.trim();
if q.is_empty() || q == "*" {
return Err(format_err!("{{\"error\": \"{}\"}}", "Empty query".to_string()));
}
@ -103,14 +104,14 @@ fn search_query(
println!(
"query = {}, type = {}, page = {}, size = {}",
query.q, type_, page, size
q, type_, page, size
);
let res = if type_ == "file" {
let results = torrent_file_search(conn, &query.q, size, offset)?;
let results = torrent_file_search(conn, q, size, offset)?;
serde_json::to_value(&results).unwrap()
} else {
let results = torrent_search(conn, &query.q, size, offset)?;
let results = torrent_search(conn, q, size, offset)?;
serde_json::to_value(&results).unwrap()
};