Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 967 Bytes

README.md

File metadata and controls

36 lines (24 loc) · 967 Bytes

Python Audiobookshelf API

This is a python implementation for the API of the popular self hosted Audiobook and Podcast management software Audiobookshelf.

Note

This Libarary is currently still in early development and not ready for use

Example use

Deleting all Authors that have no books associated with them.

from audiobookshelf import ABSClient
import asyncio


ABS_URL = 'https://abs.example.com'
ABS_USER = 'root'
ABS_PASSWORD = 'test123'


async def run_test():
    client = ABSClient(ABS_URL)
    await client.authorize(ABS_USER, ABS_PASSWORD)
    libs = await client.get_libraries()
    for lib in libs:
        authors = await client.get_library_authors(lib['id'])
        for author in authors:
            if author['numBooks'] == 0:
                print(f'{author['name']} in {lib['name']} has no books, deleting...')
                await client.delete_author(author['id'])


asyncio.run(run_test())