Skip to content

Commit

Permalink
[cli] Only print cut list when list-scenes is specified
Browse files Browse the repository at this point in the history
Ensures cut list can be suppressed when using `list-scenes --quiet`.

Fixes #356.
  • Loading branch information
Breakthrough committed Dec 9, 2023
1 parent 09caa3c commit 2be19fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scenedetect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# Used for module identification and when printing version & about info
# (e.g. calling `scenedetect version` or `scenedetect about`).
__version__ = '0.6.2'
__version__ = '0.6.3.dev0'

init_logger()
logger = getLogger('pyscenedetect')
Expand Down
9 changes: 4 additions & 5 deletions scenedetect/_cli/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,16 @@ def _list_scenes(context: CliContext, scene_list: List[Tuple[FrameTimecode, Fram
| Scene # | Start Frame | Start Time | End Frame | End Time |
-----------------------------------------------------------------------
%s
-----------------------------------------------------------------------
""", '\n'.join([
-----------------------------------------------------------------------""", '\n'.join([
' | %5d | %11d | %s | %11d | %s |' %
(i + 1, start_time.get_frames() + 1, start_time.get_timecode(),
end_time.get_frames(), end_time.get_timecode())
for i, (start_time, end_time) in enumerate(scene_list)
]))

if cut_list:
logger.info('Comma-separated timecode list:\n %s',
','.join([cut.get_timecode() for cut in cut_list]))
if cut_list:
logger.info('Comma-separated timecode list:\n %s',
','.join([cut.get_timecode() for cut in cut_list]))


def _save_images(
Expand Down
3 changes: 3 additions & 0 deletions scenedetect/video_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def split_video_mkvmerge(
def split_video_ffmpeg(
input_video_path: str,
scene_list: Iterable[TimecodePair],
output_dir: Optional[str] = None,
output_file_template: str = '$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4',
video_name: Optional[str] = None,
arg_override: str = DEFAULT_FFMPEG_ARGS,
Expand All @@ -193,6 +194,8 @@ def split_video_ffmpeg(
input_video_path: Path to the video to be split.
scene_list (List[Tuple[FrameTimecode, FrameTimecode]]): List of scenes
(pairs of FrameTimecodes) denoting the start/end frames of each scene.
output_dir: Directory to output videos. If not set, the output is created in the working
directory.
output_file_template (str): Template to use for generating the output filenames.
Can use $VIDEO_NAME and $SCENE_NUMBER in this format, for example:
`$VIDEO_NAME - Scene $SCENE_NUMBER.mp4`
Expand Down
5 changes: 5 additions & 0 deletions website/pages/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Releases
**Program Changes:**

- [bugfix] Fix crash for some WebM videos when using `save-images` with `--backend pyav` [#355](https://github.com/Breakthrough/PySceneDetect/issues/355)
- [general] Comma-separated timecode list is now only printed when the `list-scenes` command is specified [#356](https://github.com/Breakthrough/PySceneDetect/issues/356)
- TODO: [general] Add `output-format` option under `[list-scenes]` to configure output of `list-scenes`
- Valid values: `scenes`, `cuts`, `both`
- TODO: [general] Add `cut-format` option under `[list-scenes]` to configure cut list format for `list-scenes` [#349](https://github.com/Breakthrough/PySceneDetect/issues/349)
- Valid values: `frames`, `timecode`, `seconds`

**API Changes:**

Expand Down

0 comments on commit 2be19fe

Please sign in to comment.