[Banshee-List] development tips for Hyena query



Heya,

I am not confident with the Hyena system for DB and I face to a design issue.

Souce TrackAdded is even do not contain newly created track and we can have more than one track added with the event.

My issue, is that, I need to create a new VideoInfo db table with contain summary, casting, ...
So I have a design but not sure if it is the good one for branshee.

My current idea:
TrackAdded in source trigger a call to 
1) Create all new VideoInfo
2) RefreshMetadata thread.
1)This thread will loop on all track not ever in VideoInfo and will use a litle regexp to know if serie or movie and set it up in TrackMediaAtributes.

HyenaSqliteCommand insert_video_command = new HyenaSqliteCommand (String.Format (@"
    INSERT INTO Videos (VideoID, TrackID, Title)
        SELECT null, TrackID, Title FROM CoreTracks WHERE PrimarySourceID = {0} AND ExternalID = 0", videoSource.DbId
));

Is this request OK? Does the VideoId primary key will automaticly iterate on each record?
My issue how setup the ExternalId of DBTrackInfo in mass?

Else I have to do:
DatabaseTrackInfo.Provider.FetchAll ("PrimarySourceID = ? AND ExternalID = 0", videoSource.DbId);
And for each trackinfo 
HyenaSqliteCommand insert_video_command = new HyenaSqliteCommand (String.Format (@"
    INSERT INTO Videos (VideoID, TrackID, Title)
        SELECT ?, ?, ? FROM CoreTracks WHERE PrimarySourceID = {0} AND ExternalID = 0", videoSource.DbId
));
and set 
index, track.Id, track.Title in the loop and set ExternalId = index
and manage my index in code...

2) Get on webservice data and try to merge similar VideoInfo (I mean similar tv/show).
When we get response we fill the VideoInfo db record and save it.
If we have a new tv show episode setup a new VideoInfo as parent (tv show) and link the episode videoInfo.parentId to tv/show.

The new View will be based on VideoInfo not on track.
- I need to only have tv/show and not episode so filter episode out but I need to keep episode data
- So I need VideoInfo since the track is added. Another solution is done like music do for album : an unknow Album record which contain all orphelan.

thanks for any help.
Hope I have been christal clear ;)

Olivier Dufour


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]