Re: [Banshee-devel-list] Question about banshee Jobs
- From: Gabriel Burt <gabriel burt gmail com>
- To: banshee-devel-list gnome org
- Subject: Re: [Banshee-devel-list] Question about banshee Jobs
- Date: Thu, 7 Jan 2010 16:47:44 -0800
I'm not sure how many people are on this list. Aaron kind of
deprecated it a year or two back, I think. In the future, just post
to banshee-list.
On Mon, Jan 4, 2010 at 9:09 AM, Christian Martellini
<christian martellini gmail com> wrote:
> Hi guys,
> I start working on a Job to automatically fetch lyrics for all tracks in
> your music library similar to what done by the "CoverArtJob.cs" that
> automatically download the cover for all albums in your library.
>
> I have a few question about banshee jobs:
>
> 1) I want to create a Thread and I think that is a good idea to use a
> SimpleAsyncJob that obtain all the tracks of the music library and
> download lyrics for them. Is it Wrong?
Nope, totally right.
> 2) Which is the better way to obtain all the Music Library tracks?
> Is it better to directly query the db (and in this case could be a good
> idea to use a DBIteratorJob like in the CoverArt plugin) or is there a
> better solution? Can I use the instruction below to get all the music
> library tracks?
> CachedList<DatabaseTrackInfo> list =
> CachedList<DatabaseTrackInfo>.CreateFromModel
> (ServiceManager.SourceManager.MusicLibrary.DatabaseTrackModel);
I would definitely use the DbIteratorJob - it's meant for this kind of
operation - something that needs to be done to many tracks. That code
looks right, but I'd defer to the code in the cover art extension in
general.
> 3) Is there some important things I have to respect while writing the
> Job?
No, not really. The important concepts are that you write it so your
job can be canceled and restarted and that it doesn't try to pull in
all tracks in the db into memory at one time. Using hte DbIteratorJob
should keep you good on both of those.
Gabriel
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]