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
|
Find a running process from Python
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def _list_windows(cls):
|
def _list_windows(cls) -> list:
|
||||||
"""
|
"""
|
||||||
Find all running process with wmi
|
Find all running process with wmi
|
||||||
:return: list of dictionaries with descriptions of found processes
|
:return: list of dictionaries with descriptions of found processes
|
||||||
|
@ -38,7 +38,7 @@ class Proc:
|
||||||
return execlist
|
return execlist
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _list_linux(cls):
|
def _list_linux(cls) -> list:
|
||||||
"""
|
"""
|
||||||
Find all running process with ps
|
Find all running process with ps
|
||||||
:return: list of dictionaries with descriptions of found processes
|
:return: list of dictionaries with descriptions of found processes
|
||||||
|
@ -55,7 +55,7 @@ class Proc:
|
||||||
return execlist
|
return execlist
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def list(cls):
|
def list(cls) -> list:
|
||||||
"""
|
"""
|
||||||
Find all running process
|
Find all running process
|
||||||
:return: list of dictionaries with descriptions of found processes
|
:return: list of dictionaries with descriptions of found processes
|
||||||
|
@ -68,7 +68,7 @@ class Proc:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def search(cls, find: str, exclude: str = None):
|
def search(cls, find: str, exclude: str = None) -> list:
|
||||||
"""
|
"""
|
||||||
Find specified processes
|
Find specified processes
|
||||||
:param find: find process pid, name or arguments
|
:param find: find process pid, name or arguments
|
||||||
|
@ -93,7 +93,7 @@ class Proc:
|
||||||
return proc_found
|
return proc_found
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def kill(cls, pid: int):
|
def kill(cls, pid: int) -> None:
|
||||||
"""
|
"""
|
||||||
Kill the process by means of the OS
|
Kill the process by means of the OS
|
||||||
:param pid: process ID
|
:param pid: process ID
|
||||||
|
@ -111,7 +111,7 @@ class FFmpeg:
|
||||||
"""
|
"""
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, src: str, preset: str = None, fps: int = None, dst: str = None,
|
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
|
Running the installed ffmpeg
|
||||||
:param src: sources urls (example: "rtsp://user:pass@host:554/Streaming/Channels/101, anull")
|
:param src: sources urls (example: "rtsp://user:pass@host:554/Streaming/Channels/101, anull")
|
||||||
|
@ -141,7 +141,7 @@ class FFmpeg:
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _bin(cls, path_ffmpeg: str):
|
def _bin(cls, path_ffmpeg: str) -> str:
|
||||||
"""
|
"""
|
||||||
Returns the path to the ffmpeg depending on the OS
|
Returns the path to the ffmpeg depending on the OS
|
||||||
:param path_ffmpeg: alternative path to bin
|
:param path_ffmpeg: alternative path to bin
|
||||||
|
@ -173,7 +173,7 @@ class FFmpeg:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _src(cls, sources: str):
|
def _src(cls, sources: str) -> list:
|
||||||
"""
|
"""
|
||||||
Parsing sources into ffmpeg format
|
Parsing sources into ffmpeg format
|
||||||
:param sources: comma-separated list of sources in string format
|
:param sources: comma-separated list of sources in string format
|
||||||
|
@ -192,7 +192,7 @@ class FFmpeg:
|
||||||
return ' '.join(list_sources)
|
return ' '.join(list_sources)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _preset(cls, choice: str, fps: int):
|
def _preset(cls, choice: str, fps: int) -> str:
|
||||||
"""
|
"""
|
||||||
Parsing preset into ffmpeg format
|
Parsing preset into ffmpeg format
|
||||||
:param choice: preset selection
|
:param choice: preset selection
|
||||||
|
@ -227,7 +227,7 @@ class FFmpeg:
|
||||||
return ' '.join([tune, video, audio])
|
return ' '.join([tune, video, audio])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _dst(cls, destination: str):
|
def _dst(cls, destination: str) -> str:
|
||||||
"""
|
"""
|
||||||
Parsing destination into ffmpeg format
|
Parsing destination into ffmpeg format
|
||||||
:param destination:
|
:param destination:
|
||||||
|
@ -245,7 +245,7 @@ class FFmpeg:
|
||||||
return ' '.join([container, destination, stdout])
|
return ' '.join([container, destination, stdout])
|
||||||
|
|
||||||
@classmethod
|
@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
|
If no data arrives in the queue, kill the process
|
||||||
:param pid: process ID
|
:param pid: process ID
|
||||||
|
|
Loading…
Reference in New Issue
Block a user