C# Class Business.DownloadBusiness

ファイルを表示 Open project: mysteryx93/NaturalGroundingPlayer Class Usage Examples

Public Properties

Property Type Description
DownloadedExtensions string[]

Public Methods

Method Description
DownloadVideoAsync ( Media video, int queuePos, EventHandler callback ) : Task

Downloads specified video from YouTube.

DownloadVideoAsync ( Media video, int queuePos, bool upgradeAudio, EventHandler callback ) : Task

Downloads specified video from YouTube.

GetAudioExtension ( AudioType audio ) : string

Returns the file extension for specified audio type.

GetCodecExtension ( VideoType video ) : string

Returns the file extension for specified video codec type. To avoid conflicting file names, the codec extension must be different than the final extension.

GetDownloadUrlsAsync ( string url ) : Task>

Returns the list of download URLs from YouTube.

GetFinalExtension ( VideoType video, AudioType audio ) : string

Returns the file extension for specified video type. To avoid conflicting file names, the codec extension must be different than the final extension.

GetFinalExtension ( string video, string audio ) : string

Returns the file extension for specified video type. To avoid conflicting file names, the codec extension must be different than the final extension.

IsDownloadDuplicate ( Media request ) : bool
SelectBestAudio ( IEnumerable list ) : VideoInfo

Selects OGG (Vorbis) audio if available, otherwise AAC.

SelectBestFormat ( IEnumerable list ) : BestFormatInfo

Returns the best format from the list in this order of availability: WebM, Mp4 or Flash. Mp4 will be chosen if WebM is over 35% smaller.

Private Methods

Method Description
DownloadCanceled ( Business.DownloadItem downloadInfo ) : void
DownloadCompletedAsync ( Business.DownloadItem downloadInfo ) : Task
DownloadFilesAsync ( Business.DownloadItem downloadInfo, EventHandler callback ) : Task

Downloads the specified list of files.

DownloadVideoAsync ( Business.DownloadItem downloadInfo, Business.DownloadItem fileInfo, EventHandler callback ) : Task
FileHasContent ( string fileName ) : bool

Returns whether specified file exists and contains data (at least 500KB).

RaiseCallback ( Business.DownloadItem downloadInfo ) : void
StartDownloadAsync ( Business.DownloadItem downloadInfo ) : Task
StartNextDownloadAsync ( ) : Task

Method Details

DownloadVideoAsync() public method

Downloads specified video from YouTube.
public DownloadVideoAsync ( Media video, int queuePos, EventHandler callback ) : Task
video DataAccess.Media The video to download.
queuePos int The position in the queue to auto-play, or -1.
callback EventHandler The method to call once download is completed.
return Task

DownloadVideoAsync() public method

Downloads specified video from YouTube.
public DownloadVideoAsync ( Media video, int queuePos, bool upgradeAudio, EventHandler callback ) : Task
video DataAccess.Media The video to download.
queuePos int The position in the queue to auto-play, or -1.
upgradeAudio bool If true, only the audio will be downloaded and it will be merged with the local video file.
callback EventHandler The method to call once download is completed.
return Task

GetAudioExtension() public method

Returns the file extension for specified audio type.
public GetAudioExtension ( AudioType audio ) : string
audio AudioType The audio type to get file extension for.
return string

GetCodecExtension() public method

Returns the file extension for specified video codec type. To avoid conflicting file names, the codec extension must be different than the final extension.
public GetCodecExtension ( VideoType video ) : string
video VideoType The video type to get file extension for.
return string

GetDownloadUrlsAsync() public static method

Returns the list of download URLs from YouTube.
public static GetDownloadUrlsAsync ( string url ) : Task>
url string The YouTube video URL to query.
return Task>

GetFinalExtension() public method

Returns the file extension for specified video type. To avoid conflicting file names, the codec extension must be different than the final extension.
public GetFinalExtension ( VideoType video, AudioType audio ) : string
video VideoType The video type to get file extension for.
audio AudioType
return string

GetFinalExtension() public method

Returns the file extension for specified video type. To avoid conflicting file names, the codec extension must be different than the final extension.
public GetFinalExtension ( string video, string audio ) : string
video string The video type to get file extension for.
audio string
return string

IsDownloadDuplicate() public method

public IsDownloadDuplicate ( Media request ) : bool
request DataAccess.Media
return bool

SelectBestAudio() public static method

Selects OGG (Vorbis) audio if available, otherwise AAC.
public static SelectBestAudio ( IEnumerable list ) : VideoInfo
list IEnumerable The list of available audios.
return VideoInfo

SelectBestFormat() public static method

Returns the best format from the list in this order of availability: WebM, Mp4 or Flash. Mp4 will be chosen if WebM is over 35% smaller.
public static SelectBestFormat ( IEnumerable list ) : BestFormatInfo
list IEnumerable The list of videos to chose from.
return BestFormatInfo

Property Details

DownloadedExtensions public_oe static_oe property

public static string[] DownloadedExtensions
return string[]