Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#104810 - 12/07/2002 21:48 Known format for "database"?
Tyris
journeyman

Registered: 07/04/2002
Posts: 51
Loc: Texas, USA
Is the format of the database file explained somewhere? I'm working on ways to speed up syncs. I just don't want to spend time figuring it out if people already know. Obviously, I see song names and such, but is there a pattern to all the non-printable hex codes in there? I haven't seen one after looking for only a few seconds, but I'm sure I can find one with time. I looked on riocar.org, but I only saw this type of info for the FIDs. Thanks!
_________________________
Tyris
MkIIa 10gb Blue - 040103702

Top
#104811 - 12/07/2002 22:08 Re: Known format for "database"? [Re: Tyris]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
I believe that the empeg guys have claimed that it's documented in the source code to the Linux command line utilities.
_________________________
Bitt Faulk

Top
#104812 - 12/07/2002 22:16 Re: Known format for "database"? [Re: wfaulk]
Tyris
journeyman

Registered: 07/04/2002
Posts: 51
Loc: Texas, USA
Ah, ok. I'll check it out. Thanks!
_________________________
Tyris
MkIIa 10gb Blue - 040103702

Top
#104813 - 12/07/2002 23:02 Re: Known format for "database"? [Re: wfaulk]
mschrag
pooh-bah

Registered: 09/09/2000
Posts: 2303
Loc: Richmond, VA
I believe you mean "documented" -- in quotes.

Top
#104814 - 13/07/2002 00:14 Re: Known format for "database"? [Re: mschrag]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
True. Or maybe I meant documented by the source code.
_________________________
Bitt Faulk

Top
#104815 - 18/07/2002 12:52 Re: Known format for "database"? [Re: wfaulk]
anti
member

Registered: 10/07/2000
Posts: 117
Loc: BaWue, Germany, Europe
If I'm not totally stupid - or overworked - the command line utilities just _tell_ the player to rebuild the database.
Request::BuildAndSaveDatabase
just send a packet to the player
and the player - AFAIK - is closed source

"Injecting" a new tune onto the player and into the playlists via ftp (hijack) is quite easy (and reliable !!), but I don't gain anything if I have to start jemplode afterwards to rebuild the database.

The format of the database itself doesn't look that complicated,
so please share everything you find out!

_________________________
-------------------- MKII 08000073 40GB BLUE

Top
#104816 - 18/07/2002 14:46 Re: Known format for "database"? [Re: Tyris]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
With a little help from Roger and smu, I have figured out the formats of the database, playlists and tag files.

The next upcoming version of mp3tofid will build these files on your PC, considerably faster than on the player (at least on my PC).

Source will be included. Stay tuned.

Pim

Top
#104817 - 18/07/2002 20:08 Re: Known format for "database"? [Re: pim]
Tyris
journeyman

Registered: 07/04/2002
Posts: 51
Loc: Texas, USA
Well, thanks for saving me the trouble! I was going to add it to your program once I figured out what was going on. Are you able to preserve dynamic database info, like play count?
_________________________
Tyris
MkIIa 10gb Blue - 040103702

Top
#104818 - 18/07/2002 22:37 Re: Known format for "database"? [Re: pim]
anti
member

Registered: 10/07/2000
Posts: 117
Loc: BaWue, Germany, Europe
Great.

That'll save me some trouble reverse engineering ;-)

Can't wait to get my hands on it...

Any ETA ?!
_________________________
-------------------- MKII 08000073 40GB BLUE

Top
#104819 - 19/07/2002 00:33 Re: Known format for "database"? [Re: anti]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5680
Loc: London, UK
Yeah, but they know how to parse it, though. Work backwards from there. Although, as Pim says, his next version of mp3tofid should support it.
_________________________
-- roger

Top
#104820 - 19/07/2002 09:55 Re: Known format for "database"? [Re: Tyris]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
In reply to:

Are you able to preserve dynamic database info, like play count?




No, unfortunately not. AFAIK, the playcount is stored in the dynamic partition, and only written back to the tag files and the database upon a database rebuild.

There's no way to do this if the database is being built off the player.

Pim

Top
#104821 - 19/07/2002 09:59 Re: Known format for "database"? [Re: anti]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
In reply to:

Any ETA ?!




Should be there within two weeks. Basically, everything is working. I just need to do more database and playlist consistency checking. Previously, emplode would do that while rebuilding the database, but now I have to do it all, as emplode is no longer necessary in the sync process.

Pim

Top
#104822 - 19/07/2002 10:44 Re: Known format for "database"? [Re: pim]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5680
Loc: London, UK
It's not supposed to be in the tag files at all. As long as you leave the FIDs alone, the play counts should stay correct.
_________________________
-- roger

Top
#104823 - 04/09/2002 09:39 Re: Known format for "database"? [Re: pim]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
Any word on this? A format for playlists would be super right about now.

Greg
_________________________

Top
#104824 - 10/09/2002 16:55 Re: Known format for "database"? [Re: grgcombs]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
I've just announce mp3tofid 2.00 in the programming forum.


But perhaps it's easier to explain the database files
in English than in C code.

The database files are probably also much easier to
write than to parse.

The playlists file is simply a concatenation
of all playlist files in FID order. This is easily
seen as the first part of playlists is exactly the
same as the root playlist (/drive*/fids/100).

The tags file and the database file are
tightly related. tags is a text file containing all tag
names in all tag files (/drive*/fids/*1). Order does
not seem to matter, though I guess "type" needs to
be on the first line. The tags file needs to be padded
with newlines until it is 256 lines long.

database is a binary file, containing all tag values
for all FID's in FID order. All nonexisting FID's
until the FID with the highest FID number need to be
included, as an empty record, closed by 0xFF.

Nonempty records consist of one byte being an index into
the tags file, one byte stating the length of the tag
value and then the tag value itself. The record is
terminated with a 0xFF character, just like the
nonexisting FID's.

FID 0 is special and needs to be in the database,
even though it does not exist in the fids dirs.
FID 0 has just one tag: "type=illegal"

This all means tag values may not be longer than 255
characters, and may not contain newlines. This
currently is not enforced by mp3tofid.

Pim

Top
#104825 - 10/09/2002 21:09 Re: Known format for "database"? [Re: pim]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
Tags and Database I know have working with success, thanks to Frank's very handy efforts in education.

The playlists file seems to more more obscure than it should be.

I would expect a playlist fid in the playlist file would be followed by all the track fids and sub-playlist fids immediately afterwards. But this doesn't seem to be the case, at least for me.

Last time I looked at it, a playlist and it's contents would be separated by a long list of other unrelated fids.

Any help in grasping the ability to identify all the fids associated with a given playlist would be a super plus.

Greg
_________________________

Top
#104826 - 11/09/2002 02:40 Re: Known format for "database"? [Re: grgcombs]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Well, the playlists is probably much harder to parse than to create. Like I said, it's a concatenation of all playlist tags in FID order.

So to find subplaylists, you will need to calculate the offset in the playlists file for your subplaylist.

To do that, you wil have to look up all the lengths of all playlists in the database file and build an offset table from there.

That's why it's very important that the length tag for playlists is correct.

Pim

Top
#104827 - 11/09/2002 05:30 Re: Known format for "database"? [Re: pim]
anti
member

Registered: 10/07/2000
Posts: 117
Loc: BaWue, Germany, Europe
Thanks.

Your code saved me some time.

I wrote this small util (attached) to check if I understood the format.
Nothing fancy - or clean, but easy to understand.

Question:
Who decides when if there should be a play_count tag in the database or not ?
I have a few for some songs, but they are wrong.


Attachments
114037-dump.c (94 downloads)

_________________________
-------------------- MKII 08000073 40GB BLUE

Top
#104828 - 11/09/2002 07:03 Re: Known format for "database"? [Re: pim]
image
old hand

Registered: 28/04/2002
Posts: 770
Loc: Los Angeles, CA
for the database, if you're not using emplode, is it possible to recreate it using different field lengths? i ask because before, i asked about the ability to lengthen the comment field from 256 to something like 1024 for the purpose of having a whole tracklist of a one mp3 album. [mostly mixed compilations].


Top
#104829 - 11/09/2002 07:43 Re: Known format for "database"? [Re: image]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5680
Loc: London, UK
No. The length limitation is because of the single byte used to express it.
_________________________
-- roger

Top
#104830 - 11/09/2002 07:58 Re: Known format for "database"? [Re: pim]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
If it's just a concatenation of playlist tags in FID order, then where do we get the offset that tells you how far away our subplaylist is? A playlist entry doesn't have an offset tag to tell you where it is from it's parent, unfortunately. As for looking at the lengths of the playlists in the database file to figure out the offset, this doesn't seem to work for a number of cases ... the following is an example.

I've got a playlist called Webb Wilder (17c1, length 52). It's original contents have long been deleted, as of now it only contains one subplaylist a really long ways away: Acres of Suede (13c01, length 48). Other than my personal knowledge that these two are parent and child, I can find no other relationship in any of the database files. There's no offset tag for the playlists, and the length of the parent list isn't even close to the real offset between it and the child.

Greg
_________________________

Top
#104831 - 11/09/2002 08:22 Re: Known format for "database"? [Re: grgcombs]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5680
Loc: London, UK
It's not a catenation of playlist FIDs. It's a catenation of the contents of the playlist FID files. It lists the children of each playlist.
_________________________
-- roger

Top
#104832 - 11/09/2002 09:32 Re: Known format for "database"? [Re: Roger]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
Ok ... I think I'm getting the picture now. So to get this working you have to:

1. Note the order of the playlist entries in the database file, and their length tags.
2. If you want to find what fids are children of a given playlist (X), you sum up all the lengths of playlists (1) to (X) to make an offset (Y).
3. You open up the playlists file, go to offset (Y), and read in (length of playlist X) fids.

I guess the main assumption I'm making is that fid lists in the playlist file appear in the same order as their parent fids in the database file. Does this pseudo-code sound right?

Greg
_________________________

Top
#104833 - 11/09/2002 11:04 Re: Known format for "database"? [Re: grgcombs]
grgcombs
addict

Registered: 03/07/2001
Posts: 663
Loc: Dallas, TX
This appears to work. Maybe we'll have a RioPlay showing the real playlists from the empeg soon.

Greg
_________________________

Top
#104834 - 11/09/2002 11:04 Re: Known format for "database"? [Re: grgcombs]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5680
Loc: London, UK
Yes.
_________________________
-- roger

Top
#104835 - 11/09/2002 11:20 Re: Known format for "database"? [Re: anti]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
In reply to:


Question:
Who decides when if there should be a play_count tag in the database or not ?
I have a few for some songs, but they are wrong.




I think playlist counts are stored in the dynamic partition, on a secret location, using FID numbers as offset. This means if you delete a tune, a next tune might be stored with the same FID number, and thus inherit the playcount of your old tune.

Pim

Top
#104836 - 11/09/2002 11:33 Re: Known format for "database"? [Re: image]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
The player database does not allow tag values longer than 255 chars, because there's only one byte to indicate the tag value length.

But there are some options. Currently, mp3tofid does not include the comment field into the database to save on size. So in theory, its length in the tag file should not matter. But if you ever would recreate the database using the player and/or emplode, bad things could happen.

And you also have the option to include custom tags. mp3tofid uses two custom tags: "loadfrom" to remember the location of the tune on the host PC, and "frames", an MP3 frame count. Both of these tags will not go into the database built by mp3tofid. You could create your own custom tags, and split the data like you suggested.

If you keep the tag values short enough, the player should happily stuff them into the database shoud it decide to rebuild it. But bear in mind that as the database size increases, free memory on the player decreases.

Pim

Top
#104837 - 11/09/2002 11:35 Re: Known format for "database"? [Re: Roger]
image
old hand

Registered: 28/04/2002
Posts: 770
Loc: Los Angeles, CA
will it be possible to express the comment field as two bytes in later versions of emplode? would it break anything?

Top
#104838 - 11/09/2002 11:41 Re: Known format for "database"? [Re: pim]
image
old hand

Registered: 28/04/2002
Posts: 770
Loc: Los Angeles, CA
In reply to:

If you keep the tag values short enough, the player should happily stuff them into the database shoud it decide to rebuild it. But bear in mind that as the database size increases, free memory on the player decreases.




yah, tony and i had a discussion about this 1st time around.. and my point was that one big tag is better than N amount of little tags re-iterating some stuff (album name, year, artist, genre, etc).

its not like i'm going to store 65535 bytes of data in there or something. just annoying when i want to know what song is playing and my comment field cuts off.


Edited by iMaGe (11/09/2002 11:43)

Top
#104839 - 11/09/2002 13:37 Re: Known format for "database"? [Re: image]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
In theory, this is very possible. But it would change the database format which needs to be interpreted by the player. So the player would need to be able to distinguish old-style and new-style databases.

I don't think it's very likely this change will ever happen.

Pim

Top