tytd-server/Server/Models/InfoType.cs

48 lines
1.4 KiB
C#

using YoutubeExplode.Channels;
using YoutubeExplode.Playlists;
using YoutubeExplode.Videos;
namespace youtube_downloader.Server.Models
{
public enum InfoType
{
Video=0,
Playlist=1,
Channel=2,
User=3,
ClosedCaptions=4
}
public class IDResolutionTypeTriplet
{
public string Id { get; set; }
public InfoType Type { get; set; }
public TessesYoutubeDownloader.Server.Models.Resolution Resolution { get; set; }
public InfomationQueueItem ToInfomationQueueItem(bool download=true)
{
switch(Type)
{
case InfoType.Video:
VideoId vid = Id;
return new InfomationQueueItem(vid, Resolution, download);
case InfoType.Playlist:
PlaylistId pid = Id;
return new InfomationQueueItem(pid, Resolution, download);
case InfoType.Channel:
ChannelId cid = Id;
return new InfomationQueueItem(cid, Resolution, download);
case InfoType.User:
UserName user = Id;
return new InfomationQueueItem(user, Resolution, download);
}
return null;
}
}
}