Yes, it is possible! The `lastimport` plugin is a good example: https://github.com/beetbox/beets/blob/master/beetsplug/lastimport.py#L215-L218 <https://github.com/beetbox/beets/blob/master/beetsplug/lastimport.py#L215-L218>
Basically, you can construct an object from the `dbcore.query` module and pass it to `lib.items` instead of a string. Adrian > On Aug 15, 2016, at 5:01 PM, François-Xavier Thomas <[email protected]> > wrote: > > I quickly whipped together a working prototype in order to see if my idea > works. > > I'm unclear about one thing. I'm doing something like this to match > Subsonic media files with Beets' items : > >>>> query = ( > ... "artist:%s" % artist, > ... "title:%s" % title, > ... "album:%s" % album, > ... ) >>>> matches = lib.items(query) > > Handcrafting a string query seems inefficient ; it also returns > multiple results if a song title is a substring of another (e.g. > "Song" and "Song (Instrumental)"), which is Not Good™. I didn't find > an official way to directly query the Item model in the docs[0], is > there any? > > [0] http://beets.readthedocs.io/en/latest/dev/api.html > > On Mon, Aug 8, 2016 at 12:48 AM, Adrian Sampson <[email protected]> wrote: >> Cool! Transitioning from Subsonic to a beets library seems like a common >> problem. >> >> I believe there are ID3 tags for both play count and star rating. There’s >> more about the rating tag in this thread: >> https://github.com/beetbox/beets/issues/122 >> >> At the moment, beets doesn’t support either, but this shouldn’t be a >> difficult change to make if you’re interested. In the mean time, you can use >> beets’s flexible attributes to store the data in the SQLite database without >> writing it to the files. >> >> These two attributes are exposed by the Subsonic API. The plan is to match >> the results with : >> >> 1) Filesystem path if possible (e.g. if Subsonic and Beets share a music >> collection) >> 2) Album/Artist/Title if there is only one result in the Beets database >> 3) Finally, user choice if there are multiple results >> >> >> This approach sounds great! >> >> Adrian >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "beets" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/beets-users/_imCIAklSJU/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "beets" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "beets" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
