Performing an Action Before a Certain Track Plays

Ian Monroe ian at monroe.nu
Fri Aug 1 08:50:00 CEST 2008


On Fri, Aug 1, 2008 at 1:28 AM, Maximilian Kossick
<maximilian.kossick at googlemail.com> wrote:
> On Thu, Jul 31, 2008 at 8:48 PM, Alejandro Wainzinger
> <aikawarazuni at gmail.com> wrote:
>> Since MTP devices can't be played directly off of, the only way to
>> play their tracks would be to copy them to a KTemporaryFile for
>> playing.  However, this would mean that the entire device of songs
>> would have to be copied off in order to play without problems.  A
>> solution I would want is to just keep a list of KTemporaryFiles with
>> the proposed paths/urls, and to only perform the copy to these files
>> right before attempting to play them.  Is there a way that I can
>> detect when a song is about to be played, stop the song from being
>> played until it's done copying, and then give the go-ahead signal to
>> keep playing?
>
> No. The only way to detect when a song is about to be played is a call
> to playableUrl() (I can't remember whether it is used in other places
> in lieu of a prettyUrl() method (I can't even remember if we have a
> method like that). If you do not want to or cannot do the downloading
> of the file in playableUrl(), you might have to add an
> aboutToBePlayed() method to Meta::Track which would be called a few
> seconds before we need the file.

Doing so is more complicated then it sounds since we don't always know
when some files are about to end. But it would work 90% of the
probably.

If you can get the AbstractMediaSource working, I could help you find
a solution to make it work with the EngineController.

Ian


More information about the Amarok-devel mailing list