Metadata-Version: 2.1
Name: spcache
Version: 1.0.1
Summary: Ensure Spotify's cache size doesn't exceed a specified threshold.
Home-page: https://github.com/Qwerty-133/spcache
License: MIT
Author: Qwerty-133
Author-email: 74311372+Qwerty-133@users.noreply.github.com
Requires-Python: >=3.8.1,<3.12
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: Flake8
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Internet
Classifier: Topic :: System :: Shells
Classifier: Topic :: Terminals
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Dist: click (>=8.1.3,<9.0.0)
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
Project-URL: Repository, https://github.com/Qwerty-133/spcache
Description-Content-Type: text/markdown

<!-- markdownlint-disable-next-line first-line-heading -->
<div align="center">
  <h1>spcache</h1>
  A simple CLI tool to set a limit on Spotify's cache size.
</div>

<p align="center">
  <a href="LICENSE">
    <img alt="License" src="https://img.shields.io/github/license/Qwerty-133/spcache">
  </a>
  <a href="https://github.com/Qwerty-133/spcache/releases/latest">
    <img alt="Release" src="https://img.shields.io/github/v/release/Qwerty-133/spcache">
  </a>
  <a href="https://pypi.org/project/spcache/">
    <img alt="PyPI" src="https://img.shields.io/pypi/v/spcache">
  </a>
</p>

## Installation

> See [Installing a Specific Version](#installing-a-specific-version) for additional options.

### Windows

> Open PowerShell. You can do this by searching for "PowerShell" in the Start menu.

Paste the following and hit enter:

```powershell
Invoke-WebRequest -UseBasicParsing https://qwertie.pages.dev/install_spcache.ps1 | Invoke-Expression
```

### MacOS/Linux

```bash
curl -sSL https://qwertie.pages.dev/install_spcache.sh | bash -s -
```

> If the above script fails, please install spcache using Python. See [Installing From PyPI](#installing-from-pypi).

## Usage

-   Set the cache size limit to 1GB:

    ```bash
    spcache set --size 1000
    ```

    spcache will try to detect your Spotify prefs file and set the cache size to the specified value in megabytes (MB).

-   Specify the path to your prefs file manually:

    ```bash
    spcache set --size 1000 --file /path/to/prefs
    ```

-   View the current cache size limit:

    ```bash
    spcache get
    ```

-   View more options:

    ```bash
    spcache --help
    ```

## How It Works

spcache works by changing the value of `storage.size` in your Spotify prefs file.

> :warning: Changes are applied when the Spotify app is restarted.

To restart Spotify:

- On Windows, right-click the Spotify icon in the system tray and click "Quit".
- On MacOS, right-click the Spotify icon in the dock and click "Quit".

Then open Spotify again.

Spotify displays the current cache size inside the Storage section in the Settings page.

## Uninstallation

### Windows

```powershell
Invoke-WebRequest -UseBasicParsing https://qwertie.pages.dev/uninstall_spcache.ps1 | Invoke-Expression
```

This will remove the spcache files and remove spcache from your PATH.

### MacOS/Linux

spcache is installed in `~/.local/share/spcache`, unless `$XDG_DATA_HOME` is set.

```bash
rm -r ~/.local/share/spcache || rm -r "${XDG_DATA_HOME}/spcache"
```

## Installing a Specific Version

> Available versions are listed here <https://github.com/Qwerty-133/spcache/releases>.

### Windows

Installing a specific version of spcache:

```powershell
$script = [scriptblock]::Create((iwr -useb "https://qwertie.pages.dev/install_spcache.ps1").Content)
& $script -Version 1.0.1
```

### MacOS/Linux

Installing a specific version of spcache:

```bash
curl -sSL https://qwertie.pages.dev/install_spcache.sh | bash -s - -v 1.0.1
```

## Installing from PyPI

spcache is also available on PyPI <https://pypi.org/project/spcache/>.
If you have Python 3.8+ installed, you can install spcache using pip:

-   On Windows:

    1. Check your Python version with `py --version`
    2. Run `py -m pip install spcache` to install spcache.
    3. Use `py -m spcache` instead of `spcache`.

-   On MacOS/Linux:

    1. Check your Python version with `python3 --version`
    2. Run `python3 -m pip install spcache` to install spcache.
    3. Use `python3 -m spcache` if `spcache` doesn't work.

To install a specific version of spcache, use `pip install spcache==1.0.1` instead.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

