-
Notifications
You must be signed in to change notification settings - Fork 0
/
download.py
724 lines (624 loc) · 28.4 KB
/
download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Encoding: UTF-8
import urllib2, os, shlex, datetime, stat, json
from subprocess import Popen, PIPE
import xml.etree.ElementTree as ET
from misc import (printInfo1, printInfo2, printScores, printWarning, printError,
ffmpegPath, avconvPath, ffprobePath, maxTrys, uid, gid,
bashSuffix, getffmpegPath, getffprobePath, resolveHost, domainToIPno,
numbering, continueWithProcess, runProcess, downloadFile,
onError, mask, group, dlCommentSuccess, dlCommentError, dlCommentExist,
dlCommentNoSub)
from convert import convertDownloads
infoDownloaded = []
############################## before download
def getDuration(stream, checkDuration, verbose):
duration = "0.000"
gotAnswer = False
gotXML = False
noFFmpeg = False
trys = 0
ffprobe = getffprobePath(verbose)
if not ffprobe:
if verbose:
printWarning("Disabling checking of duration")
checkDuration = False
if checkDuration:
if verbose:
printScores()
printInfo2("Probing for duration of stream...")
if ffprobe == ffprobePath:
if verbose:
printInfo2("Using ffprope to determin duration...")
cmd = "%s -loglevel error -show_format -show_streams %s -print_format xml" % (ffprobe, stream)
if verbose:
printInfo1("Command: %s\n" % cmd)
args = shlex.split(cmd)
while True:
trys += 1
if trys > maxTrys:
onError(38, "Giving up after %s trys" % (trys - 1))
printWarning("Setting duration to %s" % duration)
gotAnswer = True
gotXML = True
break
while True:
try:
process = Popen(args, stdout=PIPE, stderr=PIPE)
except OSError as e:
onError(39, "%s\nYou are probably missing ffmpeg" % e)
noFFmpeg = True
break
else:
if verbose:
printInfo1("Got an answer")
output, error = process.communicate()
gotAnswer = True
break
if not noFFmpeg:
try:
xmlRoot = ET.fromstring(output)
except:
onError(43, "Did not receive a valid XML")
printInfo2("Trying again...")
else:
if verbose:
printInfo1("Downloaded a valid XML")
print output
for xmlChild in xmlRoot:
if 'duration' in xmlChild.attrib:
duration = xmlChild.attrib['duration']
if verbose:
printInfo1("Found duration in XML: %s" % duration)
gotXML = True
if not duration and verbose:
printWarning("Could not find duration in XML")
else:
onError(40, "Can not detect duration")
printWarning("Setting duration to %s" % duration)
gotAnswer = True
gotXML = True
if gotAnswer and gotXML:
break
if verbose:
printScores()
else:
printInfo2("Using avprobe to determine duration...")
cmd = "%s -loglevel error -show_format -show_streams %s -of json" % (ffprobe, stream)
if verbose:
printInfo1("Command: %s\n" % cmd)
args = shlex.split(cmd)
while True:
trys += 1
if trys > maxTrys:
onError(38, "Giving up after % trys" % (trys - 1))
gotAnswer = True
gotXML = True
break
while True:
try:
process = Popen(args, stdout=PIPE, stderr=PIPE)
except OSError as e:
onError(39, "%s\nYou are probably missing ffmpeg" % e)
noFFmpeg = True
break
else:
if verbose:
printInfo1("Got an answer")
output, error = process.communicate()
gotAnswer = True
break
if gotAnswer:
break
if gotAnswer:
jsonString = json.loads(output)
if json.dumps(jsonString['format']['duration']):
duration = (json.dumps(jsonString['format']['duration']).strip('"'))
if verbose:
print "Duration: %s" % duration
else:
printWarning("Duration check disabled")
printWarning("Setting duration to %s" % duration)
printInfo1("Duration: %s s (%s)" % (duration.rstrip("0").rstrip("."),
str(datetime.timedelta(seconds=round(float(duration), 2))))
)
return duration
def getSubSize(subAddress, checkDuration, verbose):
subSize = "0"
trys = 0
gotAnswer = False
if checkDuration:
if verbose:
printInfo2("Probing for size of subtitle file...")
while True:
trys += 1
if trys > maxTrys:
onError(26, "Giving up after %s trys" % (trys - 1))
printWarning("Setting subtitle size to %s" % subSize)
gotAnswer = True
break
try:
sub = urllib2.urlopen(subAddress)
except:
printInfo2("Could not get subtitle size")
onError(41, "Undefined error")
printInfo2("Trying again...")
else:
if verbose:
printInfo1("Got an answer")
meta = sub.info()
if meta.getheaders:
subSize = meta.getheaders("Content-Length")[0]
else:
onError(21, "Could not get headers")
printWarning("Setting subsize to %s", subSize)
gotAnswer = True
break
if gotAnswer:
break
else:
printWarning("Subsize check disabled")
printWarning("Setting subsize to %s" % subSize)
printInfo1("Sub size: %s B" % subSize)
return subSize
############################## download
def ffmpegDownloadCommand(line, verbose):
if verbose:
printInfo2("Composing download command...")
ffmpeg = getffmpegPath(verbose)
if resolveHost:
url = domainToIPno(line['address'], verbose)
else:
url = line['address']
if ffmpeg == ffmpegPath:
if verbose:
cmd = (
"%s -i %s"
" -loglevel verbose -acodec copy -vcodec copy -absf aac_adtstoasc -timeout 1000"
" '%s.%s'"
% (ffmpeg,
url,
line['name'].rstrip(), line['suffix'])
)
else:
cmd = (
"%s -i %s"
" -stats -loglevel fatal -acodec copy -vcodec copy -absf aac_adtstoasc -timeout 1000"
" '%s.%s'"
% (ffmpeg,
url,
line['name'].rstrip(), line['suffix'])
)
elif ffmpeg == avconvPath:
if verbose:
cmd = (
"%s -i %s"
" -loglevel verbose -acodec copy -vcodec copy" # -absf aac_adtstoasc"
" '%s.%s'"
% (ffmpeg,
url,
line['name'].rstrip(), line['suffix'])
)
else:
cmd = (
"%s -i %s"
" -acodec copy -vcodec copy" # -absf aac_adtstoasc"
" '%s.%s'"
% (ffmpeg,
url,
line['name'].rstrip(), line['suffix'])
)
else:
onError(16, "You do not have either ffmpeg or avconv on the paths set in your config")
if verbose:
printInfo1("ffmpeg command: %s" % cmd)
return cmd
def rtmpdumpDownloadCommand(line, verbose):
if verbose:
printInfo2("Composing download command...")
if resolveHost:
url = domainToIPno(line['address'], verbose)
else:
url = line['address']
part1 = url.partition(' playpath=')
part2 = part1[2].partition(' swfVfy=1 swfUrl=')
if "kanal5play" in part2[2]:
if verbose:
printInfo1("This is from kanal5play\nAdding --live option to download command")
rtmpdumpOptions = "--realtime"
else:
rtmpdumpOptions = ""
cmd = (
"rtmpdump -o '%s.%s'"
" -r %s"
" -y %s"
" -W %s"
" %s"
% (line['name'].rstrip(), line['suffix'],
part1[0],
part2[0],
part2[2],
rtmpdumpOptions)
)
if verbose:
printInfo1("rtmpdump command: %s" % cmd)
return cmd
def wgetDownloadCommand(line, verbose):
if verbose:
printInfo2("Composing download command...")
if resolveHost:
url = domainToIPno(line['subs'], verbose)
else:
url = line['subs']
cmd = (
"wget -O '%s.srt'"
" %s"
% (line['name'].rstrip(),
url)
)
if verbose:
printInfo1("wget command: %s" % cmd)
return cmd
def getDownloadCommands(line, verbose):
subCmd = ""
if verbose:
printInfo2("Composing download commands for line...")
print line
if line['address'].startswith("http"):
if verbose:
printInfo1("This should be downloaded with ffmpeg")
videoCmd = ffmpegDownloadCommand(line, verbose)
elif line['address'].startswith("rtmp"):
printInfo1("This should be downloaded with rtmpdump")
videoCmd = rtmpdumpDownloadCommand(line, verbose)
if line['subs']:
if verbose:
printInfo1("This should be downloaded with wget")
subCmd = wgetDownloadCommand(line, verbose)
return videoCmd, subCmd
def getVideos(downloads, keepOld, reDownload, checkDuration, verbose):
oldReDownload = reDownload
printInfo2("\nStarting downloads")
for line in downloads:
trys = 0
videoCmd, subCmd = getDownloadCommands(line, verbose)
while True:
trys += 1
if trys > maxTrys:
onError(29, "Tried to download video %s times\nSkipping..." % (trys - 1))
videoComment = dlCommentError
break
print
printInfo2("Downloading stream to %s.%s ..." % (line['name'].rstrip(), line['suffix']))
expectedDuration = round(float(line['duration']), 2)
printInfo1("Expected duration: %s" % str(datetime.timedelta(seconds=expectedDuration)))
printInfo1("%s%s try" % (trys, numbering(trys, verbose)))
printScores()
if continueWithProcess(line['name'].rstrip(), line['suffix'], keepOld, reDownload,
"Will redownload\n", "Keeping old file. No download\n", verbose):
if verbose:
printInfo2("Executing download command...")
print videoCmd
exitCode = runProcess(videoCmd, verbose)
if exitCode != 0:
printScores()
onError(30, "Failed. Process exited on %s" % exitCode)
printInfo2("Trying again...")
reDownload = True
else:
if checkDuration and float(line['duration']) > 0:
durationOK = checkDurations(line, verbose)
else:
if verbose:
printWarning("Not checking duration")
durationOK = True
if os.path.isfile("%s.%s" % (line['name'].rstrip(), line['suffix'])) and durationOK:
printScores()
printInfo1("Finished downloading video")
setPerms("%s.%s" % (line['name'].rstrip(), line['suffix']), verbose)
reDownload = oldReDownload
videoComment = dlCommentSuccess
break
else:
printScores()
if not durationOK:
onError(46, "Durations does not match")
printInfo2("Trying again")
else:
onError(31, "Failed. Video file does not exist")
printInfo2("Trying again...")
reDownload = True
else:
videoComment = dlCommentExist
break
if subCmd:
trys = 0
oldReDownload = reDownload
while True:
trys += 1
if trys > maxTrys:
onError(32, "Tried to download subtitles %s times\nSkipping..." % (trys - 1))
subComment = dlCommentError
break
print
printInfo2("Downloading subtitles %s.srt ..." % line['name'].rstrip())
if verbose:
printInfo1("from %s" % line['subs'])
printInfo1("%s%s try" % (trys, numbering(trys, verbose)))
printScores()
if continueWithProcess(line['name'].rstrip(), "srt", keepOld, reDownload,
"Will redownload\n", "Keeping old file. No download\n", verbose):
if verbose:
printInfo2("Downloading file...")
print line['subs']
print videoCmd
result = downloadFile(line['subs'], "%s.%s" % (line['name'].rstrip(), "srt"), verbose)
if not result:
printScores()
onError(33, "Failed to download subtitles")
printInfo2("Trying again...")
reDownload = True
else:
fileSizeOK = checkFileSize(line, verbose)
if os.path.isfile("%s.srt" % line['name'].rstrip()) and fileSizeOK:
printScores()
printInfo1("Finished downloading subtitles")
setPerms("%s.srt" % line['name'].rstrip(), verbose)
reDownload = oldReDownload
subComment = dlCommentSuccess
break
else:
printScores()
if not fileSizeOK:
onError(47, "Failed. File sizes does not match")
printInfo2("Trying again")
else:
onError(34, "Failed. Subtitle file does not exist")
printInfo2("Trying again")
reDownload = True
else:
subComment = dlCommentExist
break
else:
subComment = dlCommentNoSub
printInfo2("\nGetting file info...")
fileSize = getInfo(line, '--Inform="General;%FileSize%"', verbose)
fileSizeMeasure = getInfo(line, '--Inform="General;%FileSize/String%"', verbose)
duration = getInfo(line, '--Inform="General;%Duration%"', verbose)
durationFormatted = getInfo(line, '--Inform="General;%Duration/String3%"', verbose)
overallBitRate = getInfo(line, '--Inform="General;%OverallBitRate%"', verbose)
overallBitRateMeasure = getInfo(line, '--Inform="General;%OverallBitRate/String%"', verbose)
videoFormat = getInfo(line, '--Inform="Video;%Format%"', verbose)
videoCodecId = getInfo(line, '--Inform="Video;%CodecID%"', verbose)
videoBitRate = getInfo(line, '--Inform="Video;%BitRate%"', verbose)
videoBitRateMeasure = getInfo(line, '--Inform="Video;%BitRate/String%"', verbose)
width = getInfo(line, '--Inform="Video;%Width%"', verbose)
height = getInfo(line, '--Inform="Video;%Height%"', verbose)
frameRate = getInfo(line, '--Inform="Video;%FrameRate%"', verbose)
frameCount = getInfo(line, '--Inform="Video;%FrameCount%"', verbose)
audioFormat = getInfo(line, '--Inform="Audio;%Format%"', verbose)
audioCodecId = getInfo(line, '--Inform="Audio;%CodecID%"', verbose)
audioBitRate = getInfo(line, '--Inform="Audio;%BitRate%"', verbose)
audioBitRateMeasure = getInfo(line, '--Inform="Audio;%BitRate/String%"', verbose)
if line['subs']:
subSize = os.path.getsize("%s.srt" % line['name'].rstrip())
with open("%s.srt" % line['name'].rstrip()) as myfile:
subLines = sum(1 for line in myfile) # number of lines in file
myfile.close() # close file
else:
subSize = "na"
subLines = "na"
infoDownloaded.append({'videoName': "%s.%s" % (line['name'].rstrip(), line['suffix']),
'expectedDuration': line['duration'],
'videoDlComment': videoComment,
'fileSize': fileSize,
'fileSizeMeasure': fileSizeMeasure,
'duration': duration,
'durationFormatted': durationFormatted,
'overallBitRate': overallBitRate,
'overallBitRateMeasure': overallBitRateMeasure,
'videoFormat': videoFormat,
'videoCodecId': videoCodecId,
'videoBitRate': videoBitRate,
'videoBitRateMeasure': videoBitRateMeasure,
'width': width,
'height': height,
'frameRate': frameRate,
'frameCount': frameCount,
'audioFormat': audioFormat,
'audioCodecId': audioCodecId,
'audioBitRate': audioBitRate,
'audioBitRateMeasure': audioBitRateMeasure,
'subName': "%s.srt" % line['name'].rstrip(),
'expectedSubSize': line['subSize'],
'subDlComment': subComment,
'subSize': subSize,
'subLines': subLines})
printScores()
print
return infoDownloaded
############################### after download
def compareDurations(expectedDuration, actualDuration, verbose):
if verbose:
printInfo2("Comparing durations...")
printInfo1("Expected duration: %s s" % expectedDuration)
printInfo1("Actual duration: %s s" % actualDuration)
if expectedDuration == 0:
durationsMatch = True
printWarning("Expected duration was 0\nSkipping checking...")
else:
if actualDuration + 2 > expectedDuration and actualDuration - 2 < expectedDuration:
durationsMatch = True
else:
durationsMatch = False
return durationsMatch
def checkDurations(line, verbose):
printScores()
expectedDuration = round(float(line['duration']), 2)
downloadedDuration = float(getInfo(line, '--Inform="General;%Duration%"', verbose)) / 1000
printInfo1("Expected duration: %d s (%s)" % (expectedDuration, str(datetime.timedelta(seconds=expectedDuration))))
printInfo1("Downloaded duration: %d s (%s)" % (downloadedDuration, str(datetime.timedelta(seconds=downloadedDuration))))
if expectedDuration == 0:
durationsMatch = True
printWarning("Expected duration was 0\nSkipping checking...")
else:
if downloadedDuration + 2 > expectedDuration and downloadedDuration - 2 < expectedDuration:
durationsMatch = True
if verbose:
printInfo1("Durations match")
else:
durationsMatch = False
if verbose:
printWarning("Durations does not match")
return durationsMatch
def checkFileSize(line, verbose):
printScores()
expectedFileSize = int(line['subSize'])
downloadedFileSize = os.path.getsize("%s.srt" % line['name'].rstrip())
printInfo1("Expected file size: %d B" % (expectedFileSize))
printInfo1("Downloaded file size: %d B" % (downloadedFileSize))
if expectedFileSize == 0:
FileSizesMatch = True
printWarning("Expected file size was 0\nSkipping checking...")
else:
if downloadedFileSize + 2 > expectedFileSize and downloadedFileSize - 2 < expectedFileSize:
FileSizesMatch = True
if verbose:
printInfo1("File sizes match")
else:
FileSizesMatch = False
if verbose:
printWarning("File sizes does not match")
return FileSizesMatch
def setPerms(myFile, verbose):
if verbose:
printInfo2("Setting ownership and permissions...")
printInfo2("Changing group to %s" % group)
os.chown(myFile, uid, gid)
printInfo2("Setting write permission for group")
os.chmod(myFile, mask)
# os.chmod(myFile, stat.S_IREAD | stat.S_IWRITE | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH)
print
def getInfo(line, argument, verbose):
cmd = "mediainfo %s '%s.%s'" % (argument, line['name'].rstrip(), line['suffix'])
if verbose:
printInfo1("Command: %s" % cmd)
args = shlex.split(cmd)
process = Popen(args, stdout=PIPE, stderr=PIPE)
output, error = process.communicate()
if verbose:
printInfo1(output.rstrip())
return output.rstrip()
def finish(downloads, keepOld, reDownload, checkDuration, listOnly, convertTo, bashOutFile, verbose):
shouldBeDeleted = []
if not listOnly:
if downloads:
infoDownloaded = getVideos(downloads, keepOld, reDownload, checkDuration, verbose)
if convertTo:
if verbose:
printInfo2("Converting downloads...")
convertDownloads(downloads, convertTo, verbose)
else:
infoDownloaded = ""
onError(17, "Could not find any streams to download")
else:
infoDownloaded = ""
printInfo1("\nListing only")
printScores()
if bashOutFile:
if continueWithProcess(bashOutFile, bashSuffix, True, False,
"Will redownload\n", "Keeping old file. No download\n", verbose):
bashFile = open("%s.%s" % (bashOutFile, bashSuffix), "w")
bashFile.write("#!/bin/bash\n\n")
if downloads:
printInfo1("These files would have been downloaded:")
for line in downloads:
# print line
printInfo1("\nVideo name: %s.%s" % (line['name'].rstrip(), line['suffix']))
printInfo1("Video quality: %s" % line['quality'])
printInfo1("Video address: %s" % line['address'])
if line['subs']:
printInfo1("Subtitles name: %s.srt" % line['name'].rstrip())
printInfo1("Subtitles address: %s" % line['subs'])
else:
printInfo1("No subtitles found")
print "Duration: %s s" % line['duration']
if bashOutFile:
if line['address'].startswith("http"):
cmd = ffmpegDownloadCommand(line, verbose)
bashFile.write("%s\n\n" % cmd)
elif line['address'].startswith("rtmp"):
cmd = rtmpdumpDownloadCommand(line, verbose)
bashFile.write("%s\n\n" % cmd)
if line['subs']:
cmd = wgetDownloadCommand(line, verbose)
bashFile.write("%s\n\n" % cmd)
if bashOutFile:
bashFile.close()
st = os.stat("%s.sh" % bashOutFile)
os.chmod("%s.sh" % bashOutFile, st.st_mode | stat.S_IEXEC)
else:
printWarning("Could not find anything that would have been downloaded")
for line in infoDownloaded:
printInfo1("\nVideo: %s" % line['videoName'])
printScores()
if line['expectedDuration'] != "0.000":
printInfo1("Expected duration: %s" % (str(datetime.timedelta(seconds=round(float(line['expectedDuration']), 2)))))
if verbose:
printInfo1("Duration: %s ms" % line['duration'])
printInfo1("Duration: %s" % line['durationFormatted'])
if line['videoDlComment'] == dlCommentError:
printError(line['videoDlComment'])
shouldBeDeleted.append(line['videoName'])
else:
printInfo2(line['videoDlComment'])
if verbose:
printInfo1("Expected duration: %s s" % line['expectedDuration'])
printInfo1("Actual duration: %s s" % line['duration'])
if not compareDurations(float(line['expectedDuration']), float(line['duration']) / 1000, verbose):
printError("Durations does not match")
shouldBeDeleted.append(line['videoName'])
if verbose:
printInfo1("File size: %s b" % line['fileSize'])
printInfo1("File size: %s" % line['fileSizeMeasure'])
if verbose:
printInfo1("Overall bit rate: %s bps" % line['overallBitRate'])
printInfo1("Overall bit rate: %s" % line['overallBitRateMeasure'])
print
if verbose:
printInfo1("Video format: %s" % line['videoFormat'])
printInfo1("Video codec ID: %s" % line['videoCodecId'])
printInfo1("Video bit rate: %s bps" % line['videoBitRate'])
printInfo1("Video bit rate: %s" % line['videoBitRateMeasure'])
printInfo1("Width: %s px" % line['width'])
printInfo1("Height: %s px" % line['height'])
printInfo1("Frame rate: %s fps" % line['frameRate'])
if verbose:
printInfo1("Frame count: %s" % line['frameCount'])
print
printInfo1("Audio format: %s" % line['audioFormat'])
printInfo1("Audio codec ID: %s" % line['audioCodecId'])
printInfo1("Audio bit rate: %s bps" % line['audioBitRate'])
printInfo1("Audio bit rate: %s" % line['audioBitRateMeasure'])
if line['subLines'] != 'na':
printInfo1("\nSubtitles: %s" % line['subName'])
printScores()
if line['subDlComment'] == dlCommentError:
printError(line['subDlComment'])
shouldBeDeleted.append(line['subName'])
else:
printInfo2(line['subDlComment'])
if line['expectedSubSize'] != "0":
printInfo1("Expected file size: %s B" % line['expectedSubSize'])
printInfo1("File size: %s B" % line['subSize'])
printInfo1("Number of lines: %s" % line['subLines'])
else:
printWarning("\nNo subtitles downloaded")
if shouldBeDeleted:
print
printError("\nThese files should be deleted and re downloaded")
printScores()
for line in shouldBeDeleted:
printWarning(line)
print