C# 클래스 OnlineVideos.Sites.SiteUtilBase

The abstract base class for all sites. Instances might be hosted in a seperate AppDomain than the main application, so it can be unloaded at runtime.
상속: UserConfigurable
파일 보기 프로젝트 열기: offbyoneBB/mp-onlinevideos2 1 사용 예제들

공개 메소드들

메소드 설명
DiscoverDynamicCategories ( ) : int

If the site's categories can be retrieved dynamically, then it should be done in the implementation of this method. The categories must be added to the SiteSettings retrieved from the Settings property of this class. Once the categories are added you should set SiteSettings.DynamicCategoriesDiscovered to true, so this method won't be called each time the user enters this site in the GUI (unless you want that behavior).
default: sets SiteSettings.DynamicCategoriesDiscovered to true

DiscoverNextPageCategories ( NextPageCategory category ) : int

Override this method in your derived Util when you need paging in a list of Categorys. It will be called when the last item in that list is a NextPageCategory.

DiscoverSubCategories ( Category parentCategory ) : int

If a category has sub-categories this function will be called when the user selects a category in the GUI. This happens only when Category.HasSubCategories is true and Category.SubCategoriesDiscovered is false.

ExecuteContextMenuEntry ( Category selectedCategory, System.VideoInfo selectedItem, OnlineVideos.Sites.ContextMenuEntry choice ) : OnlineVideos.Sites.ContextMenuExecutionResult

This function is called when one of the custom contextmenu entries was selected by the user. Override it to handle the entries you added with GetContextMenuEntries.

GetContextMenuEntries ( Category selectedCategory, System.VideoInfo selectedItem ) : List

This function will be called when a contextmenu for a video or category is to be shown in the GUI. Override it to add your own entries (which should be localized).

GetCurrentVideosTitle ( ) : string

Should return the title of the current page, which will be put in #header.label at state=videos when showing videos returned from a search

GetFileNameForDownload ( System.VideoInfo video, Category category, string url ) : string

This method will be called before downloading the video from the given url, or before adding it to the favorites. (in that case the url param is null.
By default, the favorite name is the VideoInfo.Title.

GetMultipleVideoUrls ( System.VideoInfo video, bool inPlaylist = false ) : List

This function will be called to get the urls for playback of a video. Use this if your video is split into smaller parts for playback.
By default: returns a list with the result from GetVideoUrl.

GetNextPageVideos ( ) : List

This function should return the videos of the next page. No state is given, so the class implementation has to remember and set the current category and page itself. It will only be called if HasNextPage returned true on the last call and after the user selected the menu entry for "next page".
default: empty list

GetPlaylistItemVideoUrl ( System.VideoInfo clonedVideoInfo, string chosenPlaybackOption, bool inPlaylist = false ) : string

Allows the Util to resolve the url of a playlist item to playback options or a new url directly before playback.

GetSearchableCategories ( ) : string>.Dictionary

Will be called to get the list of categories (names only) that can be chosen to search. The keys will be the names and the value will be given to the Search as parameter.
default: returns empty list, so no category specific search can be done This is also used if HasFilterCategories returns true

GetTrackingInfo ( System.VideoInfo video ) : ITrackingInfo

This method will ask the Util to provide information for a VideoInfo that can be used to identify the video for http://trakt.tv/.

GetVideoUrl ( System.VideoInfo video ) : String

This function will be called when the user selects a video for playback. It should return the absolute url to the video file.
By default, the VideoInfo.VideoUrl fields value will be returned.

GetVideos ( Category category ) : List

This is the only function a subclass has to implement. It's called when a user selects a category in the GUI.
It should return a list of videos for that category, reset the paging indexes, remember this category, whatever is needed to hold state, because a call to HasNextPage and GetNextPageVideos will not give any parameter.

Initialize ( SiteSettings siteSettings ) : void

You should always call this implementation, even when overriding it. It is called after the instance has been created in order to configure settings from the xml for this util.

IsPossibleVideo ( string fsUrl ) : bool

This function checks a given string, if it points to a file that is a valid video. It will check for protocol and known and supported video extensions.

OnDownloadEnded ( System.VideoInfo video, string url, double percent, bool stoppedByUser ) : void

This method will be called after download of a video from this site was stopped or has ended.

OnPlaybackEnded ( System.VideoInfo video, string url, double percent, bool stoppedByUser ) : void

This method will be called after playback of a video from this site was stopped or has ended.

Search ( string query, string category = null ) : List

Should return a list of VideoInfo or Category for the given query - limited to the given category if not null.
All items in the list must be of the same type!
default: returns empty list

ToString ( ) : string

비공개 메소드들

메소드 설명
GetConfigurationKey ( string fieldName ) : string

메소드 상세

DiscoverDynamicCategories() 공개 메소드

If the site's categories can be retrieved dynamically, then it should be done in the implementation of this method. The categories must be added to the SiteSettings retrieved from the Settings property of this class. Once the categories are added you should set SiteSettings.DynamicCategoriesDiscovered to true, so this method won't be called each time the user enters this site in the GUI (unless you want that behavior).
default: sets SiteSettings.DynamicCategoriesDiscovered to true
public DiscoverDynamicCategories ( ) : int
리턴 int

DiscoverNextPageCategories() 공개 메소드

Override this method in your derived Util when you need paging in a list of Categorys. It will be called when the last item in that list is a NextPageCategory.
public DiscoverNextPageCategories ( NextPageCategory category ) : int
category NextPageCategory The category item that you used to store info about how to get the next page categories.
리턴 int

DiscoverSubCategories() 공개 메소드

If a category has sub-categories this function will be called when the user selects a category in the GUI. This happens only when Category.HasSubCategories is true and Category.SubCategoriesDiscovered is false.
public DiscoverSubCategories ( Category parentCategory ) : int
parentCategory Category the category that was selected by the user
리턴 int

ExecuteContextMenuEntry() 공개 메소드

This function is called when one of the custom contextmenu entries was selected by the user. Override it to handle the entries you added with GetContextMenuEntries.
public ExecuteContextMenuEntry ( Category selectedCategory, System.VideoInfo selectedItem, OnlineVideos.Sites.ContextMenuEntry choice ) : OnlineVideos.Sites.ContextMenuExecutionResult
selectedCategory Category either the the context menu was shown for, or the of the video the context menu was shown for
selectedItem System.VideoInfo when this is null the context menu was called on the otherwise on the
choice OnlineVideos.Sites.ContextMenuEntry the that was chosen by the user
리턴 OnlineVideos.Sites.ContextMenuExecutionResult

GetContextMenuEntries() 공개 메소드

This function will be called when a contextmenu for a video or category is to be shown in the GUI. Override it to add your own entries (which should be localized).
public GetContextMenuEntries ( Category selectedCategory, System.VideoInfo selectedItem ) : List
selectedCategory Category either the to show the context menu for, or the of the video to show the context menu for
selectedItem System.VideoInfo when this is null the context menu is called on the otherwise on the
리턴 List

GetCurrentVideosTitle() 공개 메소드

Should return the title of the current page, which will be put in #header.label at state=videos when showing videos returned from a search
public GetCurrentVideosTitle ( ) : string
리턴 string

GetFileNameForDownload() 공개 메소드

This method will be called before downloading the video from the given url, or before adding it to the favorites. (in that case the url param is null.
By default, the favorite name is the VideoInfo.Title.
public GetFileNameForDownload ( System.VideoInfo video, Category category, string url ) : string
video System.VideoInfo The object that can be used to get some more info.
category Category The that this video comes from.
url string The url from which the download will take place. If null, a favorite name should be returned.
리턴 string

GetMultipleVideoUrls() 공개 메소드

This function will be called to get the urls for playback of a video. Use this if your video is split into smaller parts for playback.
By default: returns a list with the result from GetVideoUrl.
public GetMultipleVideoUrls ( System.VideoInfo video, bool inPlaylist = false ) : List
video System.VideoInfo The object, for which to get a list of urls.
inPlaylist bool
리턴 List

GetNextPageVideos() 공개 메소드

This function should return the videos of the next page. No state is given, so the class implementation has to remember and set the current category and page itself. It will only be called if HasNextPage returned true on the last call and after the user selected the menu entry for "next page".
default: empty list
public GetNextPageVideos ( ) : List
리턴 List

GetPlaylistItemVideoUrl() 공개 메소드

Allows the Util to resolve the url of a playlist item to playback options or a new url directly before playback.
public GetPlaylistItemVideoUrl ( System.VideoInfo clonedVideoInfo, string chosenPlaybackOption, bool inPlaylist = false ) : string
clonedVideoInfo System.VideoInfo A clone of the original object, given in , with the VideoUrl set to one of the urls returned.
chosenPlaybackOption string the key from the of the first video chosen by the user
inPlaylist bool
리턴 string

GetSearchableCategories() 공개 메소드

Will be called to get the list of categories (names only) that can be chosen to search. The keys will be the names and the value will be given to the Search as parameter.
default: returns empty list, so no category specific search can be done This is also used if HasFilterCategories returns true
public GetSearchableCategories ( ) : string>.Dictionary
리턴 string>.Dictionary

GetTrackingInfo() 공개 메소드

This method will ask the Util to provide information for a VideoInfo that can be used to identify the video for http://trakt.tv/.
public GetTrackingInfo ( System.VideoInfo video ) : ITrackingInfo
video System.VideoInfo The to get info for.
리턴 ITrackingInfo

GetVideoUrl() 공개 메소드

This function will be called when the user selects a video for playback. It should return the absolute url to the video file.
By default, the VideoInfo.VideoUrl fields value will be returned.
public GetVideoUrl ( System.VideoInfo video ) : String
video System.VideoInfo The from the list of displayed videos that were returned by this instance previously.
리턴 String

GetVideos() 공개 추상적인 메소드

This is the only function a subclass has to implement. It's called when a user selects a category in the GUI.
It should return a list of videos for that category, reset the paging indexes, remember this category, whatever is needed to hold state, because a call to HasNextPage and GetNextPageVideos will not give any parameter.
public abstract GetVideos ( Category category ) : List
category Category The that was selected by the user.
리턴 List

Initialize() 공개 메소드

You should always call this implementation, even when overriding it. It is called after the instance has been created in order to configure settings from the xml for this util.
public Initialize ( SiteSettings siteSettings ) : void
siteSettings SiteSettings
리턴 void

IsPossibleVideo() 공개 메소드

This function checks a given string, if it points to a file that is a valid video. It will check for protocol and known and supported video extensions.
public IsPossibleVideo ( string fsUrl ) : bool
fsUrl string the string to check which should be a valid URI.
리턴 bool

OnDownloadEnded() 공개 메소드

This method will be called after download of a video from this site was stopped or has ended.
public OnDownloadEnded ( System.VideoInfo video, string url, double percent, bool stoppedByUser ) : void
video System.VideoInfo
url string
percent double
stoppedByUser bool
리턴 void

OnPlaybackEnded() 공개 메소드

This method will be called after playback of a video from this site was stopped or has ended.
public OnPlaybackEnded ( System.VideoInfo video, string url, double percent, bool stoppedByUser ) : void
video System.VideoInfo
url string
percent double
stoppedByUser bool
리턴 void

Search() 공개 메소드

Should return a list of VideoInfo or Category for the given query - limited to the given category if not null.
All items in the list must be of the same type!
default: returns empty list
public Search ( string query, string category = null ) : List
query string The user entered query.
category string The category to search in, can be null to indicate a global search - not limited to a category.
리턴 List

ToString() 공개 메소드

public ToString ( ) : string
리턴 string