Upping version.
This commit is contained in:
parent
287807a550
commit
7ceb5b7ed7
|
@ -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
|
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
|
cd docker/prod
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
|
@ -21,4 +21,4 @@ docker tag dev_torrents-csv:latest dessalines/torrents-csv:$new_tag
|
||||||
docker push dessalines/torrents-csv:$new_tag
|
docker push dessalines/torrents-csv:$new_tag
|
||||||
|
|
||||||
# SSH and pull it
|
# 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"
|
||||||
|
|
|
@ -2,7 +2,7 @@ version: '3.7'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
torrents-csv:
|
torrents-csv:
|
||||||
image: dessalines/torrents-csv:v0.0.6
|
image: dessalines/torrents-csv:v0.0.7
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8902:8080"
|
- "8902:8080"
|
||||||
|
|
|
@ -2,6 +2,18 @@
|
||||||
csv_file="../torrents.csv"
|
csv_file="../torrents.csv"
|
||||||
torrent_files_csv="../torrent_files.csv"
|
torrent_files_csv="../torrent_files.csv"
|
||||||
db_file="${TORRENTS_CSV_DB_FILE:-../torrents.db}"
|
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..."
|
echo "Creating temporary torrents.db file..."
|
||||||
|
|
||||||
|
@ -31,6 +43,7 @@ UPDATE torrents SET completed=NULL WHERE completed = '';
|
||||||
EOF
|
EOF
|
||||||
rm torrents_removed_quotes.csv
|
rm torrents_removed_quotes.csv
|
||||||
|
|
||||||
|
if $build_files ; then
|
||||||
# Cache torrent files
|
# Cache torrent files
|
||||||
echo "Building files DB from $torrent_files_csv ..."
|
echo "Building files DB from $torrent_files_csv ..."
|
||||||
|
|
||||||
|
@ -84,5 +97,5 @@ EOF
|
||||||
rm torrent_files_temp
|
rm torrent_files_temp
|
||||||
|
|
||||||
mv db_tmp $db_file
|
mv db_tmp $db_file
|
||||||
|
fi
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# export TORRENTS_CSV_FRONT_END_DIR=`pwd`/../ui/dist
|
# export TORRENTS_CSV_FRONT_END_DIR=`pwd`/../ui/dist
|
||||||
|
|
||||||
# Build the sqlite db from the CSV
|
# Build the sqlite db from the CSV
|
||||||
./build_sqlite.sh
|
./build_sqlite.sh -f
|
||||||
|
|
||||||
# Build front end
|
# Build front end
|
||||||
cd ../server/ui
|
cd ../server/ui
|
||||||
|
|
|
@ -92,7 +92,8 @@ fn search_query(
|
||||||
conn: r2d2::PooledConnection<SqliteConnectionManager>,
|
conn: r2d2::PooledConnection<SqliteConnectionManager>,
|
||||||
) -> Result<Value, Error> {
|
) -> 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()));
|
return Err(format_err!("{{\"error\": \"{}\"}}", "Empty query".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,14 +104,14 @@ fn search_query(
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"query = {}, type = {}, page = {}, size = {}",
|
"query = {}, type = {}, page = {}, size = {}",
|
||||||
query.q, type_, page, size
|
q, type_, page, size
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = if type_ == "file" {
|
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()
|
serde_json::to_value(&results).unwrap()
|
||||||
} else {
|
} else {
|
||||||
let results = torrent_search(conn, &query.q, size, offset)?;
|
let results = torrent_search(conn, q, size, offset)?;
|
||||||
serde_json::to_value(&results).unwrap()
|
serde_json::to_value(&results).unwrap()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue