tytd-server/Server/Models/InfoType.cs

52 lines
1.6 KiB
C#
Raw Normal View History

2021-09-25 06:18:12 +00:00
using YoutubeExplode.Channels;
using YoutubeExplode.Playlists;
using YoutubeExplode.Videos;
namespace youtube_downloader.Server.Models
2021-06-25 08:30:45 +00:00
{
public enum InfoType
{
Video=0,
Playlist=1,
Channel=2,
User=3,
ClosedCaptions=4,
FileDownload=5
2021-06-25 08:30:45 +00:00
}
2021-09-25 06:18:12 +00:00
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:
2021-09-25 06:53:44 +00:00
VideoId vid = Id;
return new InfomationQueueItem(vid, Resolution, download);
2021-09-25 06:18:12 +00:00
case InfoType.Playlist:
2021-09-25 06:53:44 +00:00
PlaylistId pid = Id;
return new InfomationQueueItem(pid, Resolution, download);
2021-09-25 06:18:12 +00:00
case InfoType.Channel:
2021-09-25 06:53:44 +00:00
ChannelId cid = Id;
return new InfomationQueueItem(cid, Resolution, download);
2021-09-25 06:18:12 +00:00
case InfoType.User:
2021-09-25 06:53:44 +00:00
UserName user = Id;
return new InfomationQueueItem(user, Resolution, download);
case InfoType.ClosedCaptions:
VideoId vid2 = Id;
return new InfomationQueueItem(vid2);
2021-09-25 06:53:44 +00:00
2021-09-25 06:18:12 +00:00
}
return null;
}
}
2021-06-25 08:30:45 +00:00
}