Skip to content

Commit 0549dfc

Browse files
committed
[general] Cleanup unused properties
1 parent e89bc18 commit 0549dfc

6 files changed

Lines changed: 6 additions & 35 deletions

File tree

scenedetect/_cli/config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,23 +739,23 @@ def get_init_log(self):
739739
self._init_log = []
740740
return init_log
741741

742-
def _log(self, log_level, log_str):
742+
def _log(self, log_level: int, log_str: str) -> None:
743743
self._init_log.append((log_level, log_str))
744744

745745
def _load_from_disk(self, path=None):
746746
# Validate `path`, or if not provided, use CONFIG_FILE_PATH if it exists.
747747
if path:
748-
self._init_log.append((logging.INFO, f"Loading config from file:\n {path}"))
748+
self._log(logging.INFO, f"Loading config from file:\n {path}")
749749
if not os.path.exists(path):
750-
self._init_log.append((logging.ERROR, f"File not found: {path}"))
750+
self._log(logging.ERROR, f"File not found: {path}")
751751
raise ConfigLoadFailure(self._init_log)
752752
else:
753753
# Gracefully handle the case where there isn't a user config file.
754754
if not os.path.exists(CONFIG_FILE_PATH):
755-
self._init_log.append((logging.DEBUG, "User config file not found."))
755+
self._log(logging.DEBUG, "User config file not found.")
756756
return
757757
path = CONFIG_FILE_PATH
758-
self._init_log.append((logging.INFO, f"Loading user config file:\n {path}"))
758+
self._log(logging.INFO, f"Loading user config file:\n {path}")
759759
# Try to load and parse the config file at `path`.
760760
config = ConfigParser()
761761
try:
@@ -770,7 +770,7 @@ def _load_from_disk(self, path=None):
770770
# the parsed options (i.e. that the options have valid values).
771771
(config, logs) = _parse_config(config)
772772
for verbosity, message in logs:
773-
self._init_log.append((verbosity, message))
773+
self._log(verbosity, message)
774774
if config is None:
775775
raise ConfigLoadFailure(self._init_log)
776776
self._config = config

scenedetect/backends/pyav.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def __init__(
9696
self._path = ""
9797
self._frame: av.VideoFrame | None = None
9898
self._decoder: ty.Generator | None = None
99-
self._decode_count: int = 0
10099
self._reopened = True
101100

102101
if threading_mode:
@@ -280,7 +279,6 @@ def seek(self, target: TimecodeLike) -> None:
280279
)
281280
self._frame = None
282281
self._decoder = None
283-
self._decode_count = 0
284282
self._container.seek(target_pts, stream=self._video_stream)
285283
if not beginning:
286284
self.read(decode=False)
@@ -293,7 +291,6 @@ def reset(self):
293291
self._container.close()
294292
self._frame = None
295293
self._decoder = None
296-
self._decode_count = 0
297294
try:
298295
self._container = av.open(self._path if self._path else self._io)
299296
except Exception as ex:
@@ -309,7 +306,6 @@ def read(self, decode: bool = True) -> np.ndarray | bool:
309306
last_frame = self._frame
310307
assert self._decoder is not None
311308
self._frame = next(self._decoder)
312-
self._decode_count += 1
313309
except av.error.EOFError: # type: ignore[attr-defined]
314310
self._frame = last_frame
315311
if self._handle_eof():

scenedetect/common.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -476,27 +476,6 @@ def _seconds_to_frames(self, seconds: float) -> int:
476476
assert self._rate is not None
477477
return round(seconds * self._rate)
478478

479-
def _parse_timecode_number(self, timecode: int | float) -> int:
480-
"""Parse a timecode number, storing it as the exact number of frames.
481-
Can be passed as frame number (int), seconds (float)
482-
483-
Raises:
484-
TypeError, ValueError
485-
"""
486-
# Process the timecode value, storing it as an exact number of frames.
487-
# Exact number of frames N
488-
if isinstance(timecode, int):
489-
if timecode < 0:
490-
raise ValueError("Timecode frame number must be positive and greater than zero.")
491-
return timecode
492-
# Number of seconds S
493-
elif isinstance(timecode, float):
494-
if timecode < 0.0:
495-
raise ValueError("Timecode value must be positive and greater than zero.")
496-
return self._seconds_to_frames(timecode)
497-
else:
498-
raise TypeError("Timecode format/type unrecognized.")
499-
500479
def _timecode_to_seconds(self, input: str) -> float:
501480
"""Parses a string based on the three possible forms (in timecode format, as an integer
502481
number of frames, or floating-point seconds, ending with 's'). Exact frame numbers (int)

scenedetect/detectors/content_detector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def __init__(
127127
"""
128128
super().__init__()
129129
self._threshold: float = threshold
130-
self._last_above_threshold: int | None = None
131130
self._last_frame: ContentDetector._FrameData | None = None
132131
self._weights: ContentDetector.Components = weights
133132
if luma_only:

scenedetect/detectors/threshold_detector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def __init__(
9393
"type": None, # type of fade, can be either 'in' or 'out'
9494
}
9595
self._metric_keys = [ThresholdDetector.THRESHOLD_VALUE_KEY]
96-
self._time_base = None
9796

9897
def get_metrics(self) -> list[str]:
9998
return self._metric_keys

scenedetect/scene_manager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ def __init__(
226226
# Interpolation method to use when downscaling. Defaults to linear interpolation
227227
# as a good balance between quality and performance.
228228
self._interpolation: Interpolation = Interpolation.LINEAR
229-
# Boolean indicating if we have only seen EventType.CUT events so far.
230-
self._only_cuts: bool = True
231229
# Set by decode thread when an exception occurs.
232230
self._exception_info = None
233231
self._stop = threading.Event()

0 commit comments

Comments
 (0)