From 98388dc3fa056516d73cfd5208f55d8f4207f963 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 4 Oct 2018 16:33:33 -0700 Subject: [PATCH] Renaming to torrents.csv --- README.md | 14 +++++++------- add_torrents.sh | 18 +++++++++--------- find.sh | 2 +- remove_dead_torrents.sh => scrape_and_clean.sh | 0 torrent.csv | 1 - 5 files changed, 17 insertions(+), 18 deletions(-) rename remove_dead_torrents.sh => scrape_and_clean.sh (100%) delete mode 100644 torrent.csv diff --git a/README.md b/README.md index b701e06..f9f7626 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -# Torrent.csv +# Torrents.csv -`Torrent.csv` is a vetted database of torrents, consisting of a single, searchable `torrent.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 that adds your new unique torrents to the file, after checking that they aren't already there, and that they have seeders. To find torrents run `./find.sh "SEARCH"` To contribute: -- [Click here](https://gitlab.com/dessalines/torrent.csv/forks/new) to fork this repo. +- [Click here](https://gitlab.com/dessalines/torrents.csv/forks/new) to fork this repo. ```sh -git clone https://gitlab.com/[MY_USER]/torrent.csv -cd torrent.csv +git clone https://gitlab.com/[MY_USER]/torrents.csv +cd torrents.csv ./add_torrents.sh MY_TORRENTS_DIR # `MY_TORRENTS_DIR` is `~/.local/share/data/qBittorrent/BT_backup/` for qBittorrent on linux, but you can search for where your torrents are stored for your client. git commit -am "Adding my torrents" git push ``` -Then [click here](https://gitlab.com/dessalines/torrent.csv/merge_requests/new) to do a pull/merge request to my branch. +Then [click here](https://gitlab.com/dessalines/torrents.csv/merge_requests/new) to do a pull/merge request to my branch. ## How the file looks ```sh @@ -24,5 +24,5 @@ infohash;name;size_bytes;created_unix;seeders;leechers;completed;scraped_date # torrents here... ``` -`Torrent.csv` will be periodically purged of non-seeded torrents, and potentially sorted. +`Torrents.csv` will be periodically purged of non-seeded torrents, and potentially sorted. diff --git a/add_torrents.sh b/add_torrents.sh index e6560f7..529e5d5 100755 --- a/add_torrents.sh +++ b/add_torrents.sh @@ -1,8 +1,8 @@ # Checking arguments # Help line -torrent_csv_file="`pwd`/torrent.csv" +torrents_csv_file="`pwd`/torrents.csv" -help="Run ./add_torrents.sh [TORRENTS_DIR] \nor goto https://gitlab.com/dessalines/torrent.csv for more help" +help="Run ./add_torrents.sh [TORRENTS_DIR] \nor goto https://gitlab.com/dessalines/torrents.csv for more help" if [ "$1" == "-h" ] || [ -z "$1" ]; then echo -e $help exit 1 @@ -71,15 +71,15 @@ for torrent_file in *.torrent; do add_line="$infohash;$name;$size_bytes;$created_date;$seeders;$leechers;$completed;$scraped_date" # Only add the line if there are seeds, and the infohash doesn't already exist - if (( $seeders > 0 )) && ! grep -q $infohash $torrent_csv_file; then + if (( $seeders > 0 )) && ! grep -q $infohash $torrents_csv_file; then - # TODO edit this logic to do a line replace where its already there + # TODO edit this logic to do a line replace where its already there, to pick up new seeder counts - # Append the add lines to the torrent.csv file - echo -e "\n$add_line" >> $torrent_csv_file - truncate -s -1 $torrent_csv_file # Removing last newline - echo -e "Added $name to $torrent_csv_file" - # head -n1 $torrent_csv_file && sort <(tail -n+2 $torrent_csv_file) > $torrent_csv_file # Sort it + # Append the add lines to the torrents.csv file + echo -e "\n$add_line" >> $torrents_csv_file + truncate -s -1 $torrents_csv_file # Removing last newline + echo -e "Added $name to $torrents_csv_file" + # head -n1 $torrents_csv_file && sort <(tail -n+2 $torrents_csv_file) > $torrents_csv_file # Sort it else echo -e "$name had no seeders, or was already added." fi diff --git a/find.sh b/find.sh index 81a53fd..6144eac 100755 --- a/find.sh +++ b/find.sh @@ -1,4 +1,4 @@ -torrent_csv_file="`pwd`/torrent.csv" +torrent_csv_file="`pwd`/torrents.csv" search=$(grep -i "$1" $torrent_csv_file) diff --git a/remove_dead_torrents.sh b/scrape_and_clean.sh similarity index 100% rename from remove_dead_torrents.sh rename to scrape_and_clean.sh diff --git a/torrent.csv b/torrent.csv deleted file mode 100644 index 7610edc..0000000 --- a/torrent.csv +++ /dev/null @@ -1 +0,0 @@ -infohash;name;size_bytes;created_unix;seeders;leechers;completed;scraped_date \ No newline at end of file