generated from pavel.muhortov/template-bash
	edit method annotations
This commit is contained in:
		
							parent
							
								
									8889545d70
								
							
						
					
					
						commit
						840ba7c97d
					
				
							
								
								
									
										22
									
								
								streaming.py
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								streaming.py
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -13,7 +13,7 @@ class Proc:
 | 
			
		|||
    Find a running process from Python
 | 
			
		||||
    """
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _list_windows(cls):
 | 
			
		||||
    def _list_windows(cls) -> list:
 | 
			
		||||
        """
 | 
			
		||||
        Find all running process with wmi
 | 
			
		||||
        :return: list of dictionaries with descriptions of found processes
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ class Proc:
 | 
			
		|||
        return execlist
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _list_linux(cls):
 | 
			
		||||
    def _list_linux(cls) -> list:
 | 
			
		||||
        """
 | 
			
		||||
        Find all running process with ps
 | 
			
		||||
        :return: list of dictionaries with descriptions of found processes
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ class Proc:
 | 
			
		|||
        return execlist
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def list(cls):
 | 
			
		||||
    def list(cls) -> list:
 | 
			
		||||
        """
 | 
			
		||||
        Find all running process
 | 
			
		||||
        :return: list of dictionaries with descriptions of found processes
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ class Proc:
 | 
			
		|||
            return None
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def search(cls, find: str, exclude: str = None):
 | 
			
		||||
    def search(cls, find: str, exclude: str = None) -> list:
 | 
			
		||||
        """
 | 
			
		||||
        Find specified processes
 | 
			
		||||
        :param find: find process pid, name or arguments
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ class Proc:
 | 
			
		|||
                return proc_found
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def kill(cls, pid: int):
 | 
			
		||||
    def kill(cls, pid: int) -> None:
 | 
			
		||||
        """
 | 
			
		||||
        Kill the process by means of the OS
 | 
			
		||||
        :param pid: process ID
 | 
			
		||||
| 
						 | 
				
			
			@ -111,7 +111,7 @@ class FFmpeg:
 | 
			
		|||
    """
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def run(cls, src: str, preset: str = None, fps: int = None, dst: str = None,
 | 
			
		||||
            ffpath: str = None, watchdog: bool = False, sec: int = 5, mono: bool = False):
 | 
			
		||||
            ffpath: str = None, watchdog: bool = False, sec: int = 5, mono: bool = False) -> None:
 | 
			
		||||
        """
 | 
			
		||||
        Running the installed ffmpeg
 | 
			
		||||
        :param src: sources urls (example: "rtsp://user:pass@host:554/Streaming/Channels/101, anull")
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@ class FFmpeg:
 | 
			
		|||
        exit()
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _bin(cls, path_ffmpeg: str):
 | 
			
		||||
    def _bin(cls, path_ffmpeg: str) -> str:
 | 
			
		||||
        """
 | 
			
		||||
        Returns the path to the ffmpeg depending on the OS
 | 
			
		||||
        :param path_ffmpeg: alternative path to bin
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +173,7 @@ class FFmpeg:
 | 
			
		|||
            return None
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _src(cls, sources: str):
 | 
			
		||||
    def _src(cls, sources: str) -> list:
 | 
			
		||||
        """
 | 
			
		||||
        Parsing sources into ffmpeg format
 | 
			
		||||
        :param sources: comma-separated list of sources in string format
 | 
			
		||||
| 
						 | 
				
			
			@ -192,7 +192,7 @@ class FFmpeg:
 | 
			
		|||
        return ' '.join(list_sources)
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _preset(cls, choice: str, fps: int):
 | 
			
		||||
    def _preset(cls, choice: str, fps: int) -> str:
 | 
			
		||||
        """
 | 
			
		||||
        Parsing preset into ffmpeg format
 | 
			
		||||
        :param choice: preset selection
 | 
			
		||||
| 
						 | 
				
			
			@ -227,7 +227,7 @@ class FFmpeg:
 | 
			
		|||
        return ' '.join([tune, video, audio])
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _dst(cls, destination: str):
 | 
			
		||||
    def _dst(cls, destination: str) -> str:
 | 
			
		||||
        """
 | 
			
		||||
        Parsing destination into ffmpeg format
 | 
			
		||||
        :param destination:
 | 
			
		||||
| 
						 | 
				
			
			@ -245,7 +245,7 @@ class FFmpeg:
 | 
			
		|||
        return ' '.join([container, destination, stdout])
 | 
			
		||||
 | 
			
		||||
    @classmethod
 | 
			
		||||
    def _watchdog(cls, pid: int, sec: int = 5, que: Queue = None):
 | 
			
		||||
    def _watchdog(cls, pid: int, sec: int = 5, que: Queue = None) -> None:
 | 
			
		||||
        """
 | 
			
		||||
        If no data arrives in the queue, kill the process
 | 
			
		||||
        :param pid: process ID
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user