To simplify the playlist handling, enforce that the indices are always formatted to the same length (5, which allows for 100000 entries, that should be enough). Then make the position stored in the Playlist object be a simple integer instead of a database key. This simplifies the code, and will make implementing shuffle much easier. Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
26 lines
543 B
Python
26 lines
543 B
Python
# SPDX-License-Identifier: MIT
|
|
# Copyright (c) 2025 Matthias Blankertz <matthias@blankertz.org>
|
|
|
|
from typing import Iterable
|
|
|
|
|
|
class BTree:
|
|
def close(self): ...
|
|
|
|
def values(self, start_key: str | bytes, end_key: str | bytes | None = None, flags=None) -> Iterable[str | bytes]:
|
|
pass
|
|
|
|
def __setitem__(self, key: str | bytes, val: str | bytes): ...
|
|
|
|
def flush(self): ...
|
|
|
|
def get(self, key: str | bytes, default: str | bytes | None = None) -> str | bytes: ...
|
|
|
|
|
|
def open(dbfile) -> BTree:
|
|
pass
|
|
|
|
|
|
DESC = 1
|
|
INCL = 2
|