Skip to content

Commit

Permalink
docs: add README
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mitchell committed Oct 2, 2022
1 parent 6c98142 commit 7a1925f
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ description = "A CLI batch downloader for your Bandcamp collection"
authors = ["Michael Mitchell <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/Ovyerus/bandsnatch"
repository = "https://github.com/Ovyerus/bandsnatch"
keywords = ["cli", "bandcamp", "music", "downloader", "bulk"]
keywords = ["cli", "bandcamp", "music", "downloader", "bcdl"]
categories = ["command-line-utilities", "multimedia::audio"]
default-run = "bs"

Expand Down
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright 2022 Ovyerus

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# bandsnatch

> A CLI batch downloader for your Bandcamp collection.
## State of the Project

This tool is still currently a work in progress, so bugs and other weirdness may
occur. If anything weird happens or something breaks, please open an issue about
it with information and reproduction steps if possible.

If you're a developer poking around in the code, please note that this is my
first proper project written using Rust, so code quality may be subpar,
especially in terms of memory usage. If you have any ideas to improve the
project in general I'd love to hear them.

## Usage

The most basic usage is along the lines of `bandsnatch -f <format> <username>`,
as it will try to automatically fetch cookies from a local `cookies.json` or
from Firefox. But if this fails you can provide the `-c` option with a path to a
cookies file to use.

(NB: you can use `bs` instead of `bandsnatch` as the command name in most cases,
makes it faster to type ;) )

For more advanced usage, you can run `bandsnatch -h` to get output similar to
the following.

```
bandsnatch 0.1.0
A CLI batch downloader for your Bandcamp collection
USAGE:
bandsnatch [OPTIONS] --format <AUDIO_FORMAT> <USER>
ARGS:
<USER> Name of the user to download releases from (must be logged in through cookies)
[env: BS_USER=]
OPTIONS:
-c, --cookies <COOKIES_FILE> [env: BS_COOKIES=]
-f, --format <AUDIO_FORMAT> The audio format to download the files in. Supported formats
are: flac, wav, aac-hi, mp3-320, aiff-lossless, vorbis, mp3-v0,
alac [env: BS_FORMAT=]
-F, --force Perform a trial run without changing anything on the filesystem.
Delete's any found cache file and does a from-scratch download
run [env: BS_FORCE=]
-h, --help Print help information
-j, --jobs <JOBS> The amount of parallel jobs (threads) to use [env: BS_JOBS=]
[default: 4]
-n, --limit <LIMIT> Maximum number of releases to download. Useful for testing [env:
BS_LIMIT=]
-o, --output-folder <FOLDER> The folder to extract downloaded releases to [env:
BS_OUTPUT_FOLDER=] [default: ./]
-V, --version Print version information
```

Besides these options, you can also use environment variables with the option
name in `SCREAMING_SNAKE_CASE`, prefixed with `BS_`, so that if set up correctly
you can just run `bs` and have it automatically download your collection to the
folder you want.

### Exmaple

```
bs -c ./cookies.json -f flac -o ./Music ovyerus
```

this

## Authentication

Because Bandsnatch does not manage logging into Bandcamp itself, you need to
provide it the authentication cookies. For Firefox users, you can extract a
`cookies.json` with the
[Cookie Quick Manager extension](https://addons.mozilla.org/en-US/firefox/addon/cookie-quick-manager/),
and on Chrome, you can use the
[Get cookies.txt extension](https://chrome.google.com/webstore/detail/get-cookiestxt/bgaddhkoddajcdgocldbbfleckgcbcid/),
to extract the cookies in the Netscape format, which Bandsnatch also supports.

If you don't provide the `--cookies` option, Bandsnatch will attempt to
automatically find a file named `cookies.json` or `cookies.txt` in the local
directory and load it. Failing that, if you use Firefox on Windows or Linux,
bandsnatch will try to automatically load the cookies from there if possible.

## Installing

Currently, you need to pull this repository and build the binary manually using
`cargo build --release`.

Packages/releases with binaries coming soon.

## License

This program is licensed under the MIT license (see [LICENSE](./LICENSE) or
https://opensource.org/licenses/MIT).
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ struct Args {
default_value = "./",
env = "BS_OUTPUT_FOLDER"
)]
// TODO: parse `~` with shellexpand or smth
output_folder: String,

/// Name of the user to download releases from (must be logged in through cookies).
Expand Down

0 comments on commit 7a1925f

Please sign in to comment.