add ping move to boxes etc
This commit is contained in:
		
							parent
							
								
									f0e6aaa7e5
								
							
						
					
					
						commit
						979120383a
					
				
					 7 changed files with 426 additions and 256 deletions
				
			
		| 
						 | 
				
			
			@ -20,14 +20,17 @@ def report_state(id: str):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def load_video(url: str, file_path: str, id: str):
 | 
			
		||||
    opts = {
 | 
			
		||||
        "format": 'best[height<=480][ext=mp4]',
 | 
			
		||||
        "quiet": True,
 | 
			
		||||
        "outtmpl": file_path,
 | 
			
		||||
        "progress_hooks": [report_state(id)]
 | 
			
		||||
    }
 | 
			
		||||
    with YoutubeDL(opts) as ydl:
 | 
			
		||||
        ydl.download([url])
 | 
			
		||||
    try:
 | 
			
		||||
        opts = {
 | 
			
		||||
            "format": 'best[height<=480][ext=mp4]/bestvideo+bestaudio[ext=mp4]',
 | 
			
		||||
            "quiet": True,
 | 
			
		||||
            "outtmpl": file_path,
 | 
			
		||||
            "progress_hooks": [report_state(id)]
 | 
			
		||||
        }
 | 
			
		||||
        with YoutubeDL(opts) as ydl:
 | 
			
		||||
            ydl.download([url])
 | 
			
		||||
    except Exception:
 | 
			
		||||
        del backgroundJobs[id]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.get("/api/info")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue