Skip to main content

shelfinventory

pip install shelfinventory

Export an Audiobookshelf library to CSV, one row per book, with the columns people actually asked for on the upstream request thread. It reads over the HTTP API and writes nothing back to your server.

Why it exists: the request thread advplyr/audiobookshelf#2085 asks for a CSV inventory of what is really in the library. The workarounds described there are exporting from another tool, which reflects a different catalog, or opening the SQLite database with a generic client. This does the same job in one command, through the API, without touching the database file.

Use

Set a token, then run it.

export AUDIOBOOKSHELF_TOKEN=your-api-token
shelfinventory --url https://abs.example

That prints the CSV on standard output. To write a file instead:

shelfinventory --url https://abs.example --out books.csv

The token is the API token from your Audiobookshelf account settings. It is read from the environment only, never from an argument, so it does not land in your shell history. The server address can also come from AUDIOBOOKSHELF_URL.

Titles contain commas, so the delimiter is yours to choose:

shelfinventory --url https://abs.example --delimiter tab

--delimiter takes one character, or one of comma, semicolon, tab, pipe, colon. Fields are quoted properly whatever you pick, so a comma inside a title never splits a row.

Columns

Eighteen columns, in this order:

  • title
  • subtitle
  • authors
  • narrators
  • series_name
  • series_sequence
  • genres
  • tags
  • published_date
  • published_year
  • publisher
  • asin
  • isbn
  • duration
  • date_added
  • library_name
  • relative_path
  • explicit

That list is not mine. It is the list written on the request thread, in the same order, with one change: the single "published date or year" entry became two columns, because the server stores those as two separate fields and merging them would throw one away.

Multiple genres, tags or series are joined with ; inside one cell. Multiple authors and narrators get that same ; join only when you pass --exact; without it, they keep whatever separator the server itself used to join them. duration is H:MM:SS by default, or a number of seconds with --duration seconds. date_added is an ISO 8601 instant in UTC.

Every run, unless you pass --quiet, prints a short report on standard error saying how many books were exported and which columns your server left empty for every one of them. That report is the honest answer to whether your library really carries this metadata, and it never mixes into the CSV.

With no --library, every book library goes into the same CSV, and the library_name column says which one each row came from.

Series sequences, and one honest caveat

The paginated library endpoint does not expose a series sequence as its own field. It exposes one joined string per book, built by the server as "<name> #<sequence>" entries separated by a comma. This tool splits that back apart, which is a guess and not a reading: a series whose own name contains a comma cannot be recovered that way.

If exact series and author fields matter to you, use:

shelfinventory --url https://abs.example --exact

That reads each book a second time, through the endpoint that returns real lists, so nothing has to be split. It costs one extra request per book, which is why it is not the default.

Other options

  • --library NAME picks one library by name or id, and repeats.
  • --list-libraries prints what the token can read, then stops.
  • --page-size N sets how many books are fetched per request.
  • --timeout SECONDS sets the request timeout.
  • --quiet drops the column report.

Podcast libraries are never exported. The columns above are book columns.

What is not verified

Being plain about this matters more than looking finished:

  • No real Audiobookshelf instance has been read with this tool. The response shapes it expects come from the upstream public source code, read on 2026-09-30: server/models/Book.js, server/models/LibraryItem.js and server/controllers/LibraryController.js.
  • The tests run on sample payloads written for the tests, not on captured traffic from a live server.
  • Whether your server fills all eighteen columns is not something anyone has measured. The report printed on standard error is there so you can see it for yourself on the first run.

If you run it on a real library, please say so on the issue tracker, whether it worked or not. The paragraph above gets corrected the day someone reports a first-hand result.

Requirements

Python 3.9 or newer. The standard library only, no dependencies.

License

MIT. Built with AI assistance, reviewed and tested by me.

Younes Z.

Metadata

Release files for shelfinventory 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shelfinventory 0.1.0
File Size Uploaded Provenance Actions
shelfinventory-0.1.0.tar.gz 16.1 kB Without provenance Details for shelfinventory-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shelfinventory 0.1.0
File Interpreter ABI Platform Actions
shelfinventory-0.1.0-py3-none-any.whl Python 3 none any Details for shelfinventory-0.1.0-py3-none-any.whl

Total release size: 28.1 kB

Release files / shelfinventory-0.1.0.tar.gz

Download URL shelfinventory-0.1.0.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
05210e6b6da9a28bdbd74c8de6ae3264d7da6872cf56f1c95b0d638d9f82709b
BLAKE2b-256 checksum
How to use checksums
6a347776c6435472386b38d9a1544a3ff6323f24ea1320d1a19009c2af8540a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / shelfinventory-0.1.0-py3-none-any.whl

Download URL shelfinventory-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58d63258f5fc7d75a28364a8db6a0665089fc62b78fbf618062abe3c8f2b5744
BLAKE2b-256 checksum
How to use checksums
695f891c93c9e8f8c23c338860a94b1d83397dadb133e47ed86a7be7adad9a30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for shelfinventory 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page