Adding humanized size output to search. Fixes #1
This commit is contained in:
parent
ad8bd076e9
commit
e767fe77fb
21
README.md
21
README.md
|
@ -2,13 +2,20 @@
|
||||||
|
|
||||||
`Torrents.csv` is a vetted database of torrents, consisting of a single, searchable `torrents.csv` file.
|
`Torrents.csv` is a vetted database of torrents, consisting of a single, searchable `torrents.csv` file.
|
||||||
|
|
||||||
An *upload*, consists of making a pull request after running the `add_torrents.sh` script, which adds torrents from a directory to the `.csv` file, after checking that they aren't already there, and that they have seeders.
|
## Searching
|
||||||
|
To find torrents run `./search.sh "frasier s01"`
|
||||||
To find torrents run `./search.sh "SEARCH"`
|
```
|
||||||
|
Frasier S01-S11 (1993-)
|
||||||
|
seeders: 33
|
||||||
|
size: 13.43 GB
|
||||||
|
link: magnet:?xt=urn:btih:3cc5142d0d139bcc9ea9925239a142770b98cf74
|
||||||
|
```
|
||||||
|
|
||||||
To add your own torrents, run `./add_torrents.sh MY_TORRENTS_DIR`
|
To add your own torrents, run `./add_torrents.sh MY_TORRENTS_DIR`
|
||||||
|
|
||||||
## Instructions
|
## Uploading
|
||||||
|
|
||||||
|
An *upload*, consists of making a pull request after running the `add_torrents.sh` script, which adds torrents from a directory to the `.csv` file, after checking that they aren't already there, and that they have seeders.
|
||||||
|
|
||||||
[Click here](https://gitlab.com/dessalines/torrents.csv/forks/new) to fork this repo.
|
[Click here](https://gitlab.com/dessalines/torrents.csv/forks/new) to fork this repo.
|
||||||
```sh
|
```sh
|
||||||
|
@ -27,6 +34,8 @@ infohash;name;size_bytes;created_unix;seeders;leechers;completed;scraped_date
|
||||||
# torrents here...
|
# torrents here...
|
||||||
```
|
```
|
||||||
|
|
||||||
`Torrents.csv` will be periodically purged of non-seeded torrents, and sorted by seeders descending.
|
## Other info
|
||||||
|
|
||||||
<!-- https://github.com/danfolkes/Magnet2Torrent -->
|
`Torrents.csv` will only store torrents with at least one seeder to keep the file small, and will be periodically purged of non-seeded torrents, and sorted by seeders descending.
|
||||||
|
|
||||||
|
Its initially populated with a January 2017 backup of the pirate bay, but eventually scripts will be written that pull in new torrents daily.
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
torrent_csv_file="`pwd`/torrents.csv"
|
torrent_csv_file="`pwd`/torrents.csv"
|
||||||
|
|
||||||
search_string=${1// /.*} # turn multiple string regexes into i.*am.*spartacus
|
search_string=${1// /.*} # turn multiple string regexes into i.*am.*spartacus
|
||||||
|
@ -16,9 +17,11 @@ else
|
||||||
magnet_link="magnet:?xt=urn:btih:$infohash"
|
magnet_link="magnet:?xt=urn:btih:$infohash"
|
||||||
name=$(echo -e "$line" | cut -d ';' -f2)
|
name=$(echo -e "$line" | cut -d ';' -f2)
|
||||||
seeders=$(echo -e "$line" | cut -d ';' -f5)
|
seeders=$(echo -e "$line" | cut -d ';' -f5)
|
||||||
|
size_bytes=$(echo -e "$line" | cut -d ';' -f3)
|
||||||
|
size=$(~/.local/bin/humanfriendly -s $size_bytes) # This slows down the results a bit
|
||||||
|
|
||||||
# Construct the search result
|
# Construct the search result
|
||||||
result="$name\n\tseeders: $seeders\n\tlink: $magnet_link"
|
result="$name\n\tseeders: $seeders\n\tsize: $size\n\tlink: $magnet_link"
|
||||||
echo -e "$result"
|
echo -e "$result"
|
||||||
done <<< "$search"
|
done <<< "$search"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue