Stable: 2.5.2
Development: 2.6-alpha3
Is it possible to link a simple database to mocp?
I would like to search in my collection by author, title, performer and then to have this and some additional information displayed during reproduction.
I would like not to use Id3 tags or other tagging methods but to use a separate database file.
Thanks for your help.
Antonio
lenoch
Fri, 2010-02-05 17:00
Permalink
Not simple, I guess
Hi, MOC uses a database to cache files' tags.
There are two possibilities how to tie your database to MOC, depending on its format/engine.
Either, you can always convert it to MOC's (Berkeley DB's) format; or make MOC understand your database, i.e. write support for it.
A separate pane/screen for displaying metadata would have to be written, but I would love it.
PS: Another approach is to hack on/reimplement tagsfs (http://home.gna.org/tagsfs/ - website down at the moment), which I'm intending to do one day. tagsfs basically generates a virtual filesystem with your music divided by author, title, album, and then alphabetically. It also supports some sort of searching.
PS2: By no means I foresee MOC having a music library. MPD is there for this purpose.
palama
Fri, 2010-02-05 18:10
Permalink
In fact, despite I have been
In fact, despite I have been using moc for a long time and I like it's user interface better than mpd's one, my first idea was to use mpd which has a builtin database. I asked the developers mailing list and they answered that, by design, mpd's database can use only information from the id3 tags.
I will take a look at the database file and try to figure out how to add information to it.
Is there an option to tell mocp not to modify the database file?
lenoch
Fri, 2010-02-05 18:44
Permalink
Static database
I think making the database file read-only suffices :-), although there might be some errors when MOC tried to write data.
What is your DB engine? MySQL or similar? If so, db_sql tool might be of use: http://freshmeat.net/projects/berkeleydb/releases/311912
palama
Mon, 2010-02-15 13:38
Permalink
I was able to open the
I was able to open the database file using db_create() and bdp->open() of libdb4.6. Now it seems I need information on the sruct used for the data, I was not able to find it in the moc sources.
Could you give me a pointer to the routine in which the database file is written?
lenoch
Mon, 2010-02-15 15:02
Permalink
Tags cache
Metadata handling is done in tags_cache.c.
Almost at the beginning you have the structure:
56: struct cache_record
57: {
58: time_t mod_time; /* last modification time of the file */
59: time_t atime; /* Time of last access. */
60: struct file_tags *tags;
61: };
And later on, you find serializing functions:
171: static char *cache_record_serialize (const struct cache_record *rec, int *len)
231: static int cache_record_deserialize (struct cache_record *rec,
232: const char *serialized, const size_t size,
233: const int skip_tags)
Hope this helps.
palama
Mon, 2010-02-15 22:56
Permalink
I am afraid I am looking at
I am afraid I was looking at the wrong MOC version (2.4.4), there is no cache_record structure but there is a cache_list_node struct which looks similar.
I downloaded 2.5.0-alpha4 and cache_record is there.
Thanks