@@ -44,24 +44,24 @@ public List<string> GetInfo(string url)
44
44
{
45
45
string [ ] args = { "--encoding utf-8 --skip-download --get-title --no-warnings " + url , "--encoding utf-8 --skip-download --list-thumbnails --no-warnings " + url } ;
46
46
List < string > response = new List < string > ( ) ;
47
- string info = "N.A." ;
48
47
bool isThumb = false ;
49
48
bool isNext = false ;
50
49
51
50
foreach ( string argument in args )
52
51
{
53
52
ytbDLInfo . Arguments = argument ;
54
53
ytbDL = Process . Start ( ytbDLInfo ) ;
54
+ string info = null ;
55
55
56
56
ytbDL . OutputDataReceived += new DataReceivedEventHandler (
57
57
( s , f ) =>
58
58
{
59
59
string output = f . Data ?? "null" ;
60
60
if ( isThumb )
61
61
{
62
- if ( isNext )
62
+ if ( isNext && info == null )
63
63
{
64
- info = output == "null" ? info : output . Substring ( output . LastIndexOf ( ' ' ) + 1 ) ;
64
+ info = output == "null" || output . Contains ( "No thumbnail" ) ? info : output . Substring ( output . LastIndexOf ( ' ' ) + 1 ) ;
65
65
}
66
66
else
67
67
{
@@ -218,8 +218,14 @@ public void DownloadChannel(string ID, string filename, string path, string file
218
218
219
219
}
220
220
221
- public void ModifyQueue ( string title , string thumbURL , string ID , string filename , string path , string filetype , Dictionary < string , string > formats )
221
+ public void ModifyQueue ( string title , string thumbURL , string ID , string filename , string path , string filetype , Dictionary < string , string > formats )
222
222
{
223
+ if ( filetype == null )
224
+ {
225
+ MessageBox . Show ( "Please select a filetype" ) ;
226
+ return ;
227
+ }
228
+
223
229
string fullpath = filename == "%(title)s.%(ext)s" ? path + title + "." + formats [ filetype ] : path + filename + "." + formats [ filetype ] ;
224
230
if ( File . Exists ( fullpath ) )
225
231
{
@@ -245,16 +251,16 @@ public void ModifyQueue(string title, string thumbURL, string ID, string filenam
245
251
}
246
252
else
247
253
{
248
- Video video = new Video ( ) ;
249
- video . ID = ID ;
250
- video . Name = filename ;
251
- video . Path = path ;
252
- video . SelectedFormat = filetype ;
253
- video . ThumbURL = thumbURL ;
254
- video . Title = title ;
255
- video . AvailableFormats = formats . ToList ( ) ;
256
-
257
- Videos . Add ( video ) ;
254
+ Video video = new Video ( ) ;
255
+ video . ID = ID ;
256
+ video . Name = filename ;
257
+ video . Path = path ;
258
+ video . SelectedFormat = filetype ;
259
+ video . ThumbURL = thumbURL ;
260
+ video . Title = title ;
261
+ video . AvailableFormats = formats . ToList ( ) ;
262
+
263
+ Videos . Add ( video ) ;
258
264
}
259
265
}
260
266
else
@@ -264,7 +270,6 @@ public void ModifyQueue(string title, string thumbURL, string ID, string filenam
264
270
case 0 :
265
271
throw new QueueException ( Localization . Strings . InvalidURL ) ;
266
272
default :
267
-
268
273
Video videoNonYoutube = new Video ( ) ;
269
274
videoNonYoutube . ID = ID ;
270
275
videoNonYoutube . Name = filename ;
@@ -278,7 +283,6 @@ public void ModifyQueue(string title, string thumbURL, string ID, string filenam
278
283
break ;
279
284
}
280
285
}
281
-
282
286
}
283
287
}
284
288
}
0 commit comments