@@ -204,13 +204,13 @@ def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.'):
204204 """str, str->True
205205 WARNING: NOT THE SAME PARMS AS OTHER FUNCTIONS!!!!!!
206206 You can basicly download anything with this function
207- but better leave it alone with
207+ but better leave it alone with
208208 """
209209 output = title + '.' + ext
210-
210+
211211 if not (output_dir == '.' ):
212212 output = output_dir + '/' + output
213-
213+
214214 ffmpeg_params = []
215215 #should these exist...
216216 if params is not None :
@@ -219,58 +219,20 @@ def ffmpeg_download_stream(files, title, ext, params={}, output_dir='.'):
219219 ffmpeg_params .append (k )
220220 ffmpeg_params .append (v )
221221
222-
222+
223223 print ('Downloading streaming content with FFmpeg, press q to stop recording...' )
224224 ffmpeg_params = [FFMPEG ] + ['-y' , '-re' , '-i' ]
225225 ffmpeg_params .append (files ) #not the same here!!!!
226-
226+
227227 if FFMPEG == 'avconv' : #who cares?
228228 ffmpeg_params += ['-c' , 'copy' , output ]
229229 else :
230230 ffmpeg_params += ['-c' , 'copy' , '-bsf:a' , 'aac_adtstoasc' ]
231-
232- ffmpeg_params .append (output )
233-
234- print (' ' .join (ffmpeg_params ))
235-
236- try :
237- a = subprocess .Popen (ffmpeg_params , stdin = subprocess .PIPE )
238- a .communicate ()
239- except KeyboardInterrupt :
240- try :
241- a .stdin .write ('q' .encode ('utf-8' ))
242- except :
243- pass
244231
245- return True
246-
247- #
248- #To be refactor
249- #Direct copy of rtmpdump.py
250- #
251- def ffmpeg_play_stream (player , url , params = {}):
252- ffmpeg_params = []
253- #should these exist...
254- if params is not None :
255- if len (params ) > 0 :
256- for k , v in params :
257- ffmpeg_params .append (k )
258- ffmpeg_params .append (v )
232+ ffmpeg_params .append (output )
259233
260-
261- print ('Playing streaming content with FFmpeg, press 1 to stop recording...' )
262- ffmpeg_params = [FFMPEG ] + LOGLEVEL + ['-y' , '-re' , '-i' ]
263- ffmpeg_params .append (url ) #not the same here!!!!
264-
265- if FFMPEG == 'avconv' : #who cares?
266- ffmpeg_params += ['-c' , 'copy' , '|' ]
267- else :
268- ffmpeg_params += ['-c' , 'copy' , '-bsf:a' , 'aac_adtstoasc' , '|' ]
269-
270- ffmpeg_params += [player , '-' ]
271-
272234 print (' ' .join (ffmpeg_params ))
273-
235+
274236 try :
275237 a = subprocess .Popen (ffmpeg_params , stdin = subprocess .PIPE )
276238 a .communicate ()
@@ -280,4 +242,4 @@ def ffmpeg_play_stream(player, url, params={}):
280242 except :
281243 pass
282244
283- return True
245+ return True
0 commit comments