mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	clean up VOD endpoint
This commit is contained in:
		
							parent
							
								
									055bd22138
								
							
						
					
					
						commit
						78a0b5e6c9
					
				@ -564,19 +564,12 @@ def recordings(camera_name):
 | 
				
			|||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@bp.route("/vod/<path:path>")
 | 
					@bp.route("/vod/<year_month>/<day>/<hour>/<camera>")
 | 
				
			||||||
def vod(path):
 | 
					def vod(year_month, day, hour, camera):
 | 
				
			||||||
    # Make sure we actually have recordings
 | 
					    start_date = datetime.strptime(f"{year_month}-{day} {hour}", "%Y-%m-%d %H")
 | 
				
			||||||
    if not os.path.isdir(f"{RECORD_DIR}/{path}"):
 | 
					 | 
				
			||||||
        return "Recordings not found.", 404
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Break up path
 | 
					 | 
				
			||||||
    parts = path.split("/")
 | 
					 | 
				
			||||||
    start_date = datetime.strptime(f"{parts[0]}-{parts[1]} {parts[2]}", "%Y-%m-%d %H")
 | 
					 | 
				
			||||||
    end_date = start_date + timedelta(hours=1)
 | 
					    end_date = start_date + timedelta(hours=1)
 | 
				
			||||||
    start_ts = start_date.timestamp()
 | 
					    start_ts = start_date.timestamp()
 | 
				
			||||||
    end_ts = end_date.timestamp()
 | 
					    end_ts = end_date.timestamp()
 | 
				
			||||||
    camera = parts[3]
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Select all recordings where either the start or end dates fall in the requested hour
 | 
					    # Select all recordings where either the start or end dates fall in the requested hour
 | 
				
			||||||
    recordings = (
 | 
					    recordings = (
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user