Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
amogh09 committed Jan 3, 2023
1 parent 2b690e3 commit 8e68f5b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
60 changes: 47 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,66 @@
# wallhaven-sync
wallhaven-sync is a command-line tool for syncing your favorite wallpapers from Wallhaven's Favorites page to a local directory on your computer. wallhaven-sync can also detect wallpapers in your local sync directory that are not favorite on Wallhaven anymore and delete them.

## Installation
### Using prebuilt binaries
Prebuilt binaries are provided on [Github Releases](https://github.com/amogh09/wallhaven-sync/releases) for Linux and MacOS platforms. Download the relevant binary for your platform from the Releases page and they should be ready for use.

### Installing from source
Follow the steps below to build `wallhaven-sync` from source. You will need a working [cabal](https://www.haskell.org/cabal/download.html) tool with GHC 9.2.4 for the build.

1. Download the source from one of the [releases](https://github.com/amogh09/wallhaven-sync/releases).
1. Inside the source directory, invoke `cabal install`.
1. `wallhaven-sync` will be installed in your `.cabal/bin` directory.

## Usage
`wallhaven-sync` requires your Wallhaven authentication token in order to fetch your favorite wallpapers from Wallhaven. The tool will look for the authentication token in `WALLHAVEN_COOKIE` environment variable. You need to set this environment variable with your authentication token value.
`wallhaven-sync` requires your Wallhaven API Key.

1. Log into your [Wallhaven](https://wallhaven.cc/) account and then open the [Account Settings](https://wallhaven.cc/settings/account) page.
1. Your API key will be shown under "API Key" section as shown in the image below.
![Wallhaven API Key](/assets/images/api_key.png "Wallhaven API Key")

Usage instructions can be printed by invoking `wallhaven-sync --help`. The help output is reproduced below.

```
wallhaven-sync
Usage: wallhaven-sync [--wallpaper-dir DIRECTORY] [--num-parallel-downloads NUM]
[--num-retries NUM] [--retry-delay NUM] [--delete-unliked]
Usage: wallhaven-sync [--wallpaper-dir DIRECTORY] [--delete-unliked]
--wallhaven-username USERNAME --wallhaven-api-key API_KEY
[--collection-label LABEL] [--debug]
Sync wallpapers from Wallhaven favorites
Sync wallpapers from a Wallhaven collection
Available options:
--wallpaper-dir DIRECTORY
Directory where wallpapers will be saved
(default: "/Users/home/wallpapers")
--num-parallel-downloads NUM
Number of wallpapers to download in parallel
(default: 5)
--num-retries NUM Number of retries to perform when downloading a
wallpaper (default: 5)
--retry-delay NUM Number of seconds to wait between retries
(default: 3)
--delete-unliked Delete unliked wallpapers
--wallhaven-username USERNAME
Wallhaven username
--wallhaven-api-key API_KEY
Wallhaven API key
--collection-label LABEL Label of the collection to sync (default: "Default")
--debug Debug mode
-h,--help Show this help text
```
```

### Options
| Option | Description | Default value | Required |
| ------ | ----------- | ------------- | -------- |
| `--wallpaper-dir` | Local directory to use for downloading the wallpapers. | `/Users/home/wallpapers` | No |
| `--wallhaven-username` | Username of the collection owner. | | Yes |
| `--collection-label` | Name of the collection to download. | Default | No |
| `wallhaven-api-key` | Your wallhaven API key. | | Yes |
| `--delete-unliked` | If this flag is present then `wallhaven-sync` will delete wallpapers that are in the local directory but not in the specified collection. This option is useful for deleting wallpapers that were unliked from your collection. | NA | No |

### For downloading your Wallhaven favorites to default directory
`wallhaven-sync --wallhaven-username USERNAME --wallhaven-api-key API_KEY`

### For downloading your wallhaven favorites to ~/wallhaven directory
`wallhaven-sync --wallhaven-username USERNAME --wallhaven-api-key API_KEY --wallpaper-dir ~/wallhaven`

### For syncing (deleting unliked wallpapers from local directory and downloading wallpapers from the collection) Wallhaven favorites to default directory
`wallhaven-sync --wallhaven-username USERNAME --wallhaven-api-key API_KEY --delete-unliked`

All options have sensible defaults and invoking `wallhaven-sync` command will download all your favorite wallpapers from Wallhaven to `/Users/home/wallpapers` directory. The directory will be created if it does not exist.
### For downloading a collection named "nature" under account "my-account" to default directory
`wallhaven-sync --wallhaven-username my-account --collection-label nature --wallhaven-api-key API_KEY`
Binary file added assets/images/api_key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8e68f5b

Please sign in to comment.