Unoffical empeg BBS

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

Topic Options
#258796 - 23/06/2005 12:36 how to erase player count data?
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Those who use mp3tofid to sync their players will notice the
player count data is - let's call it - inaccurate. Rather than having
random player count data, I'd like to have my player counts reset
to zero after an mp3tofid sync. Then the data will at least have
some meaning.

Also, all the "marked" data needs to be reset. There's nothing
mp3tofid can do with that, and the marks seem to be random.

I would figure a command like this would do the job:

Code:
dd if=/dev/zero of=/dev/hda6 bs=X skip=Y count=Z



Now which X, Y and Z values would do the trick, while
saving things like EQ settings?

Thanks,
Pim

Top
#258797 - 23/06/2005 14:23 Re: how to erase player count data? [Re: pim]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
It's not often I get to FAQ a regular:

Searching the FAQ on 'erase' gave me this link:

Can I reset the number of plays and other statistics?

_________________________
Tony Fabris

Top
#258798 - 23/06/2005 15:39 Re: how to erase player count data? [Re: tfabris]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Uhhh...

That's what you get when you think of a question and take two years to pose it.
Next time I'll check for updates before posting...

Pim

Top
#258799 - 23/06/2005 15:50 Re: how to erase player count data? [Re: pim]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
If you want to do it more surgically and remove specific fields (leaving others, like seek tool data, etc. intact) there is code in emphatic to munge hda3 data and make sure the checksum is valid afterwards (which is necessary.) This may even allow you to make sure the play count isn't random. I'm moving to mp3fid/rsync myself, and may take this challenge on if you don't beat me to it, but if you'd like me to point you at the specific parts where I'm doing this type of stuff, let me know.
_________________________
- Tony C
my empeg stuff

Top
#258800 - 23/06/2005 20:47 Re: how to erase player count data? [Re: tonyc]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
What else could be saved beside seek tool data?

Top
#258801 - 23/06/2005 21:41 Re: how to erase player count data? [Re: pim]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
A nything else that's in the per-FID part of the dynamic data partition. That's play count, skipped count, uh, last played time, and one or two other things. With some work, it could also probably be extended to contain anything else you want, but that'd require some futzing with the kernel changes that Mark made for me.

Is there some piece of this data you're particularly interested in preserving?
_________________________
- Tony C
my empeg stuff

Top
#258802 - 23/06/2005 22:43 Re: how to erase player count data? [Re: tonyc]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Quote:
Is there some piece of this data you're particularly interested in preserving?


No, I'm trying to figure out whether it's worth to save data at all.

The problem with using mp3tofid and rsync is that there is no guarantee that anything in the dynamic database tied to a fid will remain tied to the same fid. So even if we could save something, it will be very hard to move the dynamic data to a different position if a tune has its fid number changed.

When I started developing mp3tofid, tunes would almost never change their fid number. I tag all my tunes myself, and at that time they were id3v1 only. fid numbers were tied to inode numbers, and they wouldn't change if a tag was updated. But nowadays, almost every tag tool creates a new file, unlinks the old one and renames the new file to the old one. This is how libid3 works, sadly. The result is a changed inode number, and thus a new fid number.

Maybe I should pick a new fid number allocation strategy, like rid's instead of inode numbers. But calculating rid's every time is a lot slower than just stat'ing.

Pim


Edited by pim (23/06/2005 22:44)

Top
#258803 - 23/06/2005 23:14 Re: how to erase player count data? [Re: pim]
tonyc
carpal tunnel

Registered: 27/06/1999
Posts: 7058
Loc: Pittsburgh, PA
Quote:

So even if we could save something, it will be very hard to move the dynamic data to a different position if a tune has its fid number changed.


I dunno what part is hard, but as long as you know have the old data and the new fid #, it's pretty simple, since the dynamic data records are on even sector boundaries, and their position is easily calculable from the FID #. Maybe this will add time or whatever, but it's not "hard" from a coding standpoint to save off the data and move it to the new FID's dynamic data sector.
_________________________
- Tony C
my empeg stuff

Top
#258804 - 23/06/2005 23:45 Re: how to erase player count data? [Re: tonyc]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
The problem is that when mp3tofid changes the fid number of a tune for whatever reason, it does so on the PC, not on the player. When you sync the tunes to the player using rsync, there's nothing there that can tell you which fid numbers changed to what.

One approach to this problem would be to have mp3tofid create a log file, containing all fid numbers of new or changed fids. This way, an application on the player could read this file and only reset the data for these fid numbers, leaving data for unchanged fids intact.

Pim


Edited by pim (23/06/2005 23:49)

Top
#258805 - 24/06/2005 02:26 Re: how to erase player count data? [Re: pim]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Well, you could grab the on-player dynamic data as the first step in mp3tofid, grab the plays info for each track and reupload it if it's moved.
_________________________
Bitt Faulk

Top
#258806 - 08/07/2005 10:00 Re: how to erase player count data? [Re: pim]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
So, as per the FAQ, I added
Code:
dd if=/dev/zero bs=512 skip=4096 count=28672 of=/dev/hda3


to my rsync script on the player

Quote:
This should erase the per-song dynamic data without harming the player settings such as the tuner and EQ presets.


Not quite, it has both pleasant and unpleasant side effects.

The pleasant side effect:
booting (that is, database loading) is sooo much faster. It went from 1:30 to 10 or 20 seconds. I have no idea what the relation is. Maybe the player had to do all sorts of unnecessary reads in the dynamic partition? I use mp3tofid, so the dynamic partition is no longer being maintained by emplode.

The unpleasant side effect:
My tuner and EQ presets are wiped! Maybe the dd command line only applies to player v2 dynamic partitions. I use player v3a8.

Pim

Top
#258807 - 08/07/2005 10:17 Re: how to erase player count data? [Re: pim]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4180
Loc: Cambridge, England
Quote:
So, as per the FAQ, I added
Code:
dd if=/dev/zero bs=512 skip=4096 count=28672 of=/dev/hda3


to my rsync script on the player

The unpleasant side effect:
My tuner and EQ presets are wiped! Maybe the dd command line only applies to player v2 dynamic partitions. I use player v3a8.

That command-line is incorrect: "skip=N" seeks in the input, not the output. It should be "seek" instead of "skip". The aim is to leave the first 2Mbytes (4096 sectors) of /dev/hda3 intact, and zero the remaining 14Mbytes (28672 sectors).

Edit: Oops, I've just done a BBS search and it was me who got it wrong to start with. Sorry about that.

Peter

Top
#258808 - 08/07/2005 13:27 Re: how to erase player count data? [Re: peter]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
Quote:
Edit: Oops, I've just done a BBS search and it was me who got it wrong to start with. Sorry about that.

Okay, heading off to correct the FAQ now. Please let me know if the current FAQ entry has the correct command line.
_________________________
Tony Fabris

Top
#258809 - 08/07/2005 13:31 Re: how to erase player count data? [Re: pim]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31600
Loc: Seattle, WA
Quote:
booting (that is, database loading) is sooo much faster. It went from 1:30 to 10 or 20 seconds.

It should never have taken a long time to boot unless there was a problem. Long database builds at every boot should be completely unrelated to the dynamic data partition. In theory.
_________________________
Tony Fabris

Top
#258810 - 08/07/2005 14:09 Re: how to erase player count data? [Re: tfabris]
peter
carpal tunnel

Registered: 13/07/2000
Posts: 4180
Loc: Cambridge, England
Quote:
Please let me know if the current FAQ entry has the correct command line.

Yeah, that looks better, thanks...

Peter

Top
#258811 - 14/07/2005 16:10 Re: how to erase player count data? [Re: tfabris]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Quote:

It should never have taken a long time to boot unless there was a problem.


No, it wasn't rebuilding the database. That would have shown on the display. Instead, it just sat there loading the database for more than a minute. I always figured it was this problem.

Quote:
Long database builds at every boot should be completely unrelated to the dynamic data partition. In theory.


At the meet, Roger also confirmed to me that the database loading routines do not involve anything on the dynamic partition.

Still, it bugs me what could have caused this speedup (cq the previous slowdown). The only other thing that I did around the time of speedup was to try an emplode synchronisation. Normally, I use mp3tofid. The emplode sync failed, and I repaired it with another rsync run. Maybe the one emplode run did something magical on my player.

Pim

Top
#258812 - 22/07/2005 15:05 Re: how to erase player count data? [Re: pim]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Quoting Peter from the "v3a10 bugs" thread:

Quote:
Quote:
/drive0/var/database3 is read with 512 bytes per read() system call. A larger buffer would speed up the database load.

The actual problem was the dynamic data partition, not database3 (which is read with a single system call). FITNR.


Ah, so there is a relation between loading the databases and the dynamic partition.

Pim

Top
#258813 - 09/09/2005 14:53 Re: how to erase player count data? [Re: peter]
pim
addict

Registered: 14/11/2000
Posts: 474
Loc: The Hague, the Netherlands
Quote:
Code:
dd if=/dev/zero bs=512 seek=4096 count=28672 of=/dev/hda3



The aim is to leave the first 2Mbytes (4096 sectors) of /dev/hda3 intact, and zero the remaining 14Mbytes (28672 sectors).



After running set_empeg_max_fid, would this number 28672 still be correct?
Would it be safe to just leave out the count, so dd would wipe the disk until the end of the partition?

Pim

Top
#258814 - 09/09/2005 18:54 Re: how to erase player count data? [Re: pim]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14496
Loc: Canada
I think one should just omit the count=nn and have it do what you suggest -- overwrite through to the end of the partition, regardless of the partition size.

-ml

Top