[Banshee-List] TV-show



Hello all,

To help the review of tv-show patch, (where I need review before going further), Gabriel ask me to do a small design description.
So here we go:

1) Goal of this patch:
- Wrap video source as an extension
- Get a cover view (as album cover for music) for tv-show/ movies. This cover view must regroup serie together with a single artwork.
- Manage Season/ Episode for serie
- show metadata about movies/Tv-show in a context panel

2) Implementation

First, the code is here : https://github.com/dufoli/banshee/tree/video

2.0) Video As an extension

All is done in this commit :
https://github.com/dufoli/banshee/commit/9ee66f743344ebb3292d543c74ecc1dddcfc406f

So, I remove the load of VideoLibrary in src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
And I Add an extension which load this source and move the VideoLibrarySource in that Extension.
I remove the direct access in SourceManager and Implement a new function named GetBestSourceForTrack which will select the best source for a track based on the trackMedia attributes of the track and of the source.
This function is more flexible to manage importation. So we can imagine in futur, used it to import podcast. If we see that the folder is the folder of podcast, we can tag all the video as podcast and add it in the PodcastSource. This is just an example, anyway, it make the video totaly independent of core.

File chooser dialog is now more generic by not having only video and music lib  sourche but all source inherited of LibrarySource.
Basicly:
- I translate all test on videoLib by test on Video media attribute
- I remove all list hardcoded of music lib and video lib and replaced it with a dynamic list of library (ServiceManager.SourceManager.FindSources<LibrarySource>)

This part will maybe need work to made the importer working for podcast/audiobook library. Else have to find a way with a bool flag or an attribute to not get this library in list of Library. ==> Open to advice Feedback here.

2.1) Metadata & Web service

I use TheMoviedb and tvdb which are 2 big site to provide a free/open API.
The restriction for both are that we have to store result to avoid to send multiple time query.
Basicly, this use XML (not JSON) and have to parse it to store data in a database.
Both provide Cover/Image/poster.

I have use the code of web service for music. It have one disadvantage, I have to filter webservice to avoid query music with video web service and vice versa. So that part is fixed but the other one is not: webservice is only call when we play music/video. And I want to have a solution to load a job on the full library. Maybe something exists for music but do not found. Because, can be useful for both (music and video).

To query the tvdb webservice, I use a regexp on file name to get episode/serie.

2.2) Database design

At start, I have think to use current table, but when I see the web-service, there is so much things which mean to totally twist the current DB model to fit the video needs. So I create a clean new database area with only 2 tables:
The webService depend on your language, So have to store language

VideoInfo:
int dbid;
string imdb_id;//Imdb.com Index
DateTime release_date = DateTime.MinValue;
string language;
string title;//title in language of user
string original_title;//title in VO
string alternative_title;// 2cd title
string info_url;
string homepage_url;
string trailer_url;
string summary;//short summary
string studios;// list of studios which produce the movie/serie
string country;//origin country
int parent;//read bottom for that
string external_video_id;//video id in the webservice (tmdb id or tvdb id)
int video_type; //read bottom for that

As you see we have a parent id which provide to store hierarchy in this table.
Useful for serie because we need a hierarchy:
serie --- season ---- episode

And we have quite the same data needed to be stored for serie and episode. 
But is is not always the same, because we can have a guest in an episode, the summary of the episode is not the same than the one of the serie.
So I use the same table and use parent to do the link.
For moment, I just link serie and episode but we can used the table to store season too.

CastingMember is a small table:
int videoId// it is the dbid of the VideoInfo table
string name
string job
string character

Goal is to manage actors, guest stars, directors, writers,... in the same table.
And we can used it later to see all movies where we have someone in the video lib.

2.3) Cover View for Video

Model for cover view is:
"FROM Videos WHERE EXISTS
(SELECT * FROM CoreTracks, CoreCache{0}
WHERE Videos.ParentId = 0
AND CoreTracks.ExternalID = Videos.VideoID
AND CoreCache.ModelID = {1} AND CoreCache.ItemId = {2} {3}
)
OR EXISTS
(SELECT * FROM Videos AS episode, CoreTracks, CoreCache{0}
WHERE episode.ParentId != 0
AND episode.ParentId = Videos.VideoID
AND CoreTracks.ExternalID = episode.VideoID
AND CoreCache.ModelID = {1} AND CoreCache.ItemId = {2} {3}
)"

it will only show cover for serie (regroup episode) and movie.

At start, we have one video info by track and we fill all with webservice.


2.4) Context panel

The context panel is the last part of the patch, It add a new context page witch just show the content of the Video Info/Casting members.
The remain issue with that is that context panel content is only filled when video is played whereas I need to update it whith selection in video cover view/ video track view.

As you see there are some room for improvement but before going further, I need to know if I am in the right direction or If I need some refactoring step.

PS: Sorry for the long mail but prefer to be Christal clear than to get back to push more infos. If you need precision, you can always read the code most is in the extension.

cheers,
Olivier Dufour



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