fix add video

This commit is contained in:
Demetria Lovato 2021-06-25 03:31:14 -07:00
parent 64ed154f03
commit a6537ca17d
6 changed files with 19 additions and 12 deletions

Binary file not shown.

View File

@ -402,11 +402,17 @@ namespace youtube_downloader.Server.Functions
} }
public static void Download(string id,Resolution res) public static void Download(string id,Resolution res)
{ {
bool hasForwardSlash = false;
if (!string.IsNullOrEmpty(id))
{
hasForwardSlash = id.Contains("/");
}
VideoId? vid= VideoId.TryParse(id); VideoId? vid= VideoId.TryParse(id);
ChannelId? cid = ChannelId.Parse(id); ChannelId? cid = ChannelId.Parse(id);
UserName? uid = UserName.TryParse(id); UserName? uid = UserName.TryParse(id);
PlaylistId? pid = PlaylistId.Parse(id); PlaylistId? pid = PlaylistId.Parse(id);
if (pid.HasValue) if (pid.HasValue && hasForwardSlash) // check for forward slash so we dont get confused
{ {
//Is Playlist //Is Playlist
var v = pid.Value; var v = pid.Value;
@ -416,16 +422,8 @@ namespace youtube_downloader.Server.Functions
DL.infoQueue.Insert(0, item); DL.infoQueue.Insert(0, item);
} }
} }
else if (cid.HasValue)
{ else if (vid.HasValue) //support 11 char id alone so dont check here
var v = cid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
else if (vid.HasValue)
{ {
var v = vid.Value; var v = vid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true); InfomationQueueItem item = new InfomationQueueItem(v, res, true);
@ -434,7 +432,16 @@ namespace youtube_downloader.Server.Functions
DL.infoQueue.Insert(0, item); DL.infoQueue.Insert(0, item);
} }
} }
else else if (cid.HasValue && hasForwardSlash)
{
var v = cid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true);
lock (DL.infoQueue)
{
DL.infoQueue.Insert(0, item);
}
}
else if(uid.HasValue && hasForwardSlash)
{ {
var v = uid.Value; var v = uid.Value;
InfomationQueueItem item = new InfomationQueueItem(v, res, true); InfomationQueueItem item = new InfomationQueueItem(v, res, true);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.