[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cplay-dev] Re: better mpc code
From: |
Ulf Betlehem |
Subject: |
[cplay-dev] Re: better mpc code |
Date: |
12 Feb 2005 23:36:33 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Han Boetes <address@hidden> writes:
| Hi Ulf,
|
| After some hours of hacking on the wrong problem I came up with
| the following code for mppdec:
|
| class FrameOffsetPlayerMpp(Player):
| re_progress = re.compile(".*\s(\d+):(\d+).*\s(\d+):(\d+)")
| def parse_buf(self):
| match = self.re_progress.search(self.buf)
| if match:
| m1, s1, m2, s2 = map(string.atoi, match.groups())
| head = m1*60+s1
| tail = (m2*60+s2) - head
| self.set_position(head, head+tail , [head, tail])
|
| FrameOffsetPlayerMpp("mppdec --gain 2 --start %d %s /dev/audio", "\.mp[cp+]$")
|
|
| Seems somewhat simpler to me.
|
| /dev/audio is more portable than /dev/esd and --gain 2 is
| track-replaygain instead of album-replaygain
|
| Hard choice of course. The only way to decide between album and
| track RG is to detect wether you play concurrent tracks.
|
| I couldn't find the email-address of Artur [Ar't] Polaczynski,
| otherwise I would have Cc'ed him.
|
|
|
| # Han
Hi,
Good work. Vanilla cplay-1.50 really should have mpc support.
Optimally, the command-line for mppdec should not contain a device at
all as I think it has / should have a sane default set at compile-
time. I tested mppdec without /dev/audio and it works for me.
It has been a while and I find the current player-framework a little
confusing myself now. In a perfect world there should be one generic
TimeOffsetPlayer and one FrameOffsetPlayer with the ability parse most
formats. Hmm, or perhaps it would be a good idea to go back to
something like the "one class per player" framework used in cplay a
long time ago. For example, I really hate passing "38.28" to the
constructor of some FrameOffsetPlayer's. At one time I just became
obsessed with making the cplay source shorter.
--
ulf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cplay-dev] Re: better mpc code,
Ulf Betlehem <=