removed unnecessary /usr/bin/envs -> script works on win32 based systems
This commit is contained in:
		
							
								
								
									
										14
									
								
								coub-dl.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								coub-dl.py
									
									
									
									
									
								
							@@ -48,14 +48,14 @@ def getDuration(ffprobe_output):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def downloadStreams():
 | 
					def downloadStreams():
 | 
				
			||||||
    print_opt('Downloading audio stream... ', end='', flush=True)
 | 
					    print_opt('Downloading audio stream... ', end='', flush=True)
 | 
				
			||||||
    call(('/usr/bin/env', 'youtube-dl', '--ignore-config',
 | 
					    call(('youtube-dl', '--ignore-config',
 | 
				
			||||||
                        '--extract-audio',
 | 
					                        '--extract-audio',
 | 
				
			||||||
                        '--output', '{}.%(ext)s'.format(FILES[Stream.AUDIO]),
 | 
					                        '--output', '{}.%(ext)s'.format(FILES[Stream.AUDIO]),
 | 
				
			||||||
          URL),
 | 
					          URL),
 | 
				
			||||||
         stdout=DEVNULL, stderr=DEVNULL)
 | 
					         stdout=DEVNULL, stderr=DEVNULL)
 | 
				
			||||||
    print_opt('Done!')
 | 
					    print_opt('Done!')
 | 
				
			||||||
    print_opt('Downloading video stream... ', end='', flush=True)
 | 
					    print_opt('Downloading video stream... ', end='', flush=True)
 | 
				
			||||||
    call(('/usr/bin/env', 'youtube-dl', '--ignore-config',
 | 
					    call(('youtube-dl', '--ignore-config',
 | 
				
			||||||
                        '--output', '{}.%(ext)s'.format(FILES[Stream.VIDEO]),
 | 
					                        '--output', '{}.%(ext)s'.format(FILES[Stream.VIDEO]),
 | 
				
			||||||
          URL),
 | 
					          URL),
 | 
				
			||||||
         stdout=DEVNULL, stderr=DEVNULL)
 | 
					         stdout=DEVNULL, stderr=DEVNULL)
 | 
				
			||||||
@@ -97,7 +97,7 @@ URL = args.url
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# fetch video title
 | 
					# fetch video title
 | 
				
			||||||
FILES[File.OUTPUT] = check_output(('/usr/bin/env', 'youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + args.extension
 | 
					FILES[File.OUTPUT] = check_output(('youtube-dl', '--get-title', args.url)).decode('utf-8').strip() + args.extension
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ask what to do if output exists
 | 
					# ask what to do if output exists
 | 
				
			||||||
if exists(FILES[File.OUTPUT]):
 | 
					if exists(FILES[File.OUTPUT]):
 | 
				
			||||||
@@ -113,8 +113,8 @@ downloadStreams()
 | 
				
			|||||||
readExtensions()
 | 
					readExtensions()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# get stream lengths via ffprobe
 | 
					# get stream lengths via ffprobe
 | 
				
			||||||
audioData= getDuration(getCmdStdErr(('/usr/bin/env', 'ffprobe', FILES[Stream.AUDIO]))).split(':')
 | 
					audioData= getDuration(getCmdStdErr(('ffprobe', FILES[Stream.AUDIO]))).split(':')
 | 
				
			||||||
videoData = getDuration(getCmdStdErr(('/usr/bin/env', 'ffprobe', FILES[Stream.VIDEO]))).split(':')
 | 
					videoData = getDuration(getCmdStdErr(('ffprobe', FILES[Stream.VIDEO]))).split(':')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
audioLen = timedelta(hours=float(audioData[0]), minutes=float(audioData[1]), seconds=float(audioData[2]))
 | 
					audioLen = timedelta(hours=float(audioData[0]), minutes=float(audioData[1]), seconds=float(audioData[2]))
 | 
				
			||||||
videoLen = timedelta(hours=float(videoData[0]), minutes=float(videoData[1]), seconds=float(videoData[2]))
 | 
					videoLen = timedelta(hours=float(videoData[0]), minutes=float(videoData[1]), seconds=float(videoData[2]))
 | 
				
			||||||
@@ -134,13 +134,13 @@ with open(FILES[File.LIST], 'w') as f:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# loop shorter stream
 | 
					# loop shorter stream
 | 
				
			||||||
print_opt('Looping shorter stream... ', end='', flush=True)
 | 
					print_opt('Looping shorter stream... ', end='', flush=True)
 | 
				
			||||||
call(('/usr/bin/env', 'ffmpeg', '-f', 'concat', '-i', FILES[File.LIST], '-c', 'copy', FILES[File.LOOP]),
 | 
					call(('ffmpeg', '-f', 'concat', '-i', FILES[File.LIST], '-c', 'copy', FILES[File.LOOP]),
 | 
				
			||||||
     stdout=DEVNULL, stderr=DEVNULL)
 | 
					     stdout=DEVNULL, stderr=DEVNULL)
 | 
				
			||||||
print_opt('Done!')
 | 
					print_opt('Done!')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# mux with audio
 | 
					# mux with audio
 | 
				
			||||||
print_opt('Muxing streams... ', end='', flush=True)
 | 
					print_opt('Muxing streams... ', end='', flush=True)
 | 
				
			||||||
call(('/usr/bin/env', 'ffmpeg', '-i', FILES[File.LOOP],
 | 
					call(('ffmpeg', '-i', FILES[File.LOOP],
 | 
				
			||||||
                '-i', FILES[Stream.AUDIO],
 | 
					                '-i', FILES[Stream.AUDIO],
 | 
				
			||||||
                '-map', '0:v:0', '-map', '1:a:0',
 | 
					                '-map', '0:v:0', '-map', '1:a:0',
 | 
				
			||||||
                '-c', 'copy', FILES[File.OUTPUT]),
 | 
					                '-c', 'copy', FILES[File.OUTPUT]),
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user