emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add a source for beets library databases


From: Daniel Semyonov
Subject: Re: [PATCH] Add a source for beets library databases
Date: Sun, 17 Dec 2023 12:21:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

>>>>> Yoni Rabkin writes:

    > Daniel Semyonov <daniel@dsemy.com> writes:
    >> Attached is a patch which adds a source which reads a beets
    >> library database using Emacs' built-in SQLite support.

    > Does beets provide a stable api to access its SQL database
    > directly?

There is documentation for the internal (Python) API used to access
the database, and several plugins seems to use it, however...

    > Can a future (or old) version of beets on someone's
    > machine break the Emms code by having tables in different place or
    > different keys?

    > If beets is built to expect other programs to access its database
    > directly then this would work.

I don't think it is, unfortunately.
    
    > Otherwise, I'm unsure of how the beets code may react to something
    > altering the contents of its SQL tables behind its back. You also
    > don't want Emms to break beets by editing its tables in a way that
    > version of beets isn't expecting.
    
Nothing I've read indicates any guarantee of stability in the actual
format of the database, so it's probably a bad idea to modify it
without going through the Python (not a good idea IMO) or command
line interface (probably slow and might not be a stable interface).

    > Does it make more sense to either:

    >    * Use the "official" beets interface to access the contents of
    > the database instead.

    >    * Use the SQLite support in Emacs to import/update an Emms SQL
    > database from the beets one. This mirroring will mean that the
    > beets database can change, or even go away, and the Emms database
    > will remain.

    >      This second option is effectively equivallent to Emms
    > implementing its cache in SQLite.

I've thought about this, and I think the best way forward would be
to offer read-only access to the database.  As long as as the beets
database contains an 'items' table whose columns are metadata fields
(which is documented and seems very likely), my source should
continue to work.  And since the source already populates the cache,
there is no need to implement the Emms cache in SQLite.

If in the future Emms adds an alternative cache which uses SQLite, it
should then be fairly easy to write a beets plugin which writes an
Emms-compatible cache directly.  I might try to implement this, but
since I have almost no experience with SQLite I can't promise anything.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]