@@ -36,19 +36,16 @@ def __init__(self, inifn: Path, site: str, **kwargs):
36
36
self .site : str = site
37
37
self .vidsource = kwargs .get ("vidsource" )
38
38
39
- if kwargs .get ("image" ):
40
- self .image = Path (kwargs ["image" ]).expanduser ()
41
- else :
42
- self .image = None
39
+ self .image = Path (kwargs ["image" ]).expanduser () if kwargs .get ("image" ) else None
43
40
44
- self .loop : bool = kwargs .get ("loop" )
41
+ self .loop : bool = kwargs .get ("loop" , False )
45
42
46
43
self .infn = Path (kwargs ["infn" ]).expanduser () if kwargs .get ("infn" ) else None
47
44
self .yes : list [str ] = self .F .YES if kwargs .get ("yes" ) else []
48
45
49
46
self .queue : list [str ] = [] # self.F.QUEUE
50
47
51
- self .caption : str = kwargs .get ("caption" )
48
+ self .caption : str = kwargs .get ("caption" , "" )
52
49
53
50
self .timelimit : list [str ] = self .F .timelimit (kwargs .get ("timeout" ))
54
51
@@ -80,7 +77,7 @@ def osparam(self, fn: Path) -> None:
80
77
81
78
if self .vidsource == "camera" :
82
79
self .res : list [str ] = C .get ("camera_size" )
83
- self .fps : float = C .get ("camera_fps" )
80
+ self .fps : float | None = C .get ("camera_fps" )
84
81
self .movingimage = self .staticimage = False
85
82
elif self .vidsource == "screen" :
86
83
self .res = C .get ("screencap_size" )
@@ -94,10 +91,10 @@ def osparam(self, fn: Path) -> None:
94
91
self .res = utils .get_resolution (self .infn , self .probeexe )
95
92
self .fps = utils .get_framerate (self .infn , self .probeexe )
96
93
else : # audio-only
97
- self .res = None
94
+ self .res = []
98
95
self .fps = None
99
96
100
- if self .res is not None and len (self .res ) != 2 :
97
+ if self .res and len (self .res ) != 2 :
101
98
raise ValueError (f"need height, width of video resolution, I have: { self .res } " )
102
99
103
100
self .audio_rate : str = C .get ("audio_rate" )
@@ -236,7 +233,7 @@ def video_bitrate(self) -> None:
236
233
if self .video_kbps : # per-site override
237
234
return
238
235
239
- if self .res is not None :
236
+ if self .res :
240
237
x : int = int (self .res [1 ])
241
238
elif self .vidsource is None or self .vidsource == "file" :
242
239
logging .info ("assuming 480p input." )
0 commit comments