mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	* recordings data pub/sub * function to process recording stream frames * model runner * lpr model runner * refactor to mixin class and use model runner * separate out realtime and post processors * move model and mixin folders * basic postprocessor * clean up * docs * postprocessing logic * clean up * return none if recordings are disabled * run postprocessor handle_requests too * tweak expansion * add put endpoint * postprocessor tweaks with endpoint
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
"""Local or remote processors to handle post processing."""
 | 
						|
 | 
						|
import logging
 | 
						|
from abc import ABC, abstractmethod
 | 
						|
 | 
						|
from frigate.config import FrigateConfig
 | 
						|
 | 
						|
from ..types import DataProcessorMetrics, DataProcessorModelRunner, PostProcessDataEnum
 | 
						|
 | 
						|
logger = logging.getLogger(__name__)
 | 
						|
 | 
						|
 | 
						|
class PostProcessorApi(ABC):
 | 
						|
    @abstractmethod
 | 
						|
    def __init__(
 | 
						|
        self,
 | 
						|
        config: FrigateConfig,
 | 
						|
        metrics: DataProcessorMetrics,
 | 
						|
        model_runner: DataProcessorModelRunner,
 | 
						|
    ) -> None:
 | 
						|
        self.config = config
 | 
						|
        self.metrics = metrics
 | 
						|
        self.model_runner = model_runner
 | 
						|
        pass
 | 
						|
 | 
						|
    @abstractmethod
 | 
						|
    def process_data(
 | 
						|
        self, data: dict[str, any], data_type: PostProcessDataEnum
 | 
						|
    ) -> None:
 | 
						|
        """Processes the data of data type.
 | 
						|
        Args:
 | 
						|
            data (dict): containing data about the input.
 | 
						|
            data_type (enum): Describing the data that is being processed.
 | 
						|
 | 
						|
        Returns:
 | 
						|
            None.
 | 
						|
        """
 | 
						|
        pass
 | 
						|
 | 
						|
    @abstractmethod
 | 
						|
    def handle_request(self, request_data: dict[str, any]) -> dict[str, any] | None:
 | 
						|
        """Handle metadata requests.
 | 
						|
        Args:
 | 
						|
            request_data (dict): containing data about requested change to process.
 | 
						|
 | 
						|
        Returns:
 | 
						|
            None if request was not handled, otherwise return response.
 | 
						|
        """
 | 
						|
        pass
 |