Skip to content

Commit

Permalink
bump version, update durations in tests, light edits to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
antiboredom committed Oct 31, 2023
1 parent 60a6e26 commit b8d38b4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Videogrep will search for matching `srt` and `vtt` subtitles, as well as `json`

#### `--input [filename(s)] / -i [filename(s)]`

File or files to use as input. Most video or audio formats should work. If specifying multiple input files you can mix audio and video, but the resulting output will only be audio.
File or files to use as input. Most video or audio formats should work. If you mix audio and video input files, the resulting output will only be audio.


#### `--output [filename] / -o [filename]`
Expand Down Expand Up @@ -155,7 +155,7 @@ videogrep -i vid.mp4 --search 'whatever' --export-vtt

#### `--ngrams [num] / -n [num]`

Shows common words and phrases from the video or audio.
Shows common words and phrases from the video or audio file.

```
videogrep -i vid.mp4 --ngrams 1
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "videogrep"
version = "2.1.3"
description = "Videogrep is a command line tool that searches through dialog in video files and makes supercuts based on what it finds. Like grep but for video."
version = "2.2.0"
description = "Videogrep is a command line tool that searches through dialog in video and audio files and makes supercuts based on what it finds. Like grep but for video."
authors = ["Sam Lavigne <[email protected]>"]
license = "Anti-Capitalist"
readme = "README.md"
Expand Down
18 changes: 8 additions & 10 deletions tests/test_videogrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ def get_duration(input_video):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)

# FIX THIS - probably doesn't need float() x2
return float("{:.2f}".format(float(result.stdout)))
return float(result.stdout)


def File(path):
return str(Path(__file__).parent / Path(path))


def test_version():
assert videogrep.__version__ == "2.1.3"
assert videogrep.__version__ == "2.2.0"


def test_srts():
Expand Down Expand Up @@ -260,7 +258,7 @@ def test_export_files():
)
files = glob.glob(File("test_outputs/supercut_clip_audio*.mp3"))
assert len(files) == 4
assert get_duration(File("test_outputs/supercut_clip_audio_00002.mp3")) == approx(0.57)
assert get_duration(File("test_outputs/supercut_clip_audio_00002.mp3")) == approx(0.574694)


def test_videogrep():
Expand Down Expand Up @@ -296,7 +294,7 @@ def test_videogrep():
search_type="fragment",
output=out3,
)
assert get_duration(out3) == approx(4.65)
assert get_duration(out3) == approx(4.649796)

out4 = File("test_outputs/supercut2.mp3")
videogrep.videogrep(
Expand All @@ -306,7 +304,7 @@ def test_videogrep():
output=out4,
padding=0.1,
)
assert get_duration(out4) == approx(6.27)
assert get_duration(out4) == approx(6.269388)


def test_videogrep_vtt_out():
Expand Down Expand Up @@ -341,13 +339,13 @@ def test_videogrep_vtt_out():
# and last line
assert len(lines) == 8 * 4 + 1
assert lines[0].strip() == "WEBVTT"
# first cue"s timespan is on line 4
# first cue timespan is on line 4
# and starts at 0.0
first_cue = lines[3].strip().split()
first_cue_start_sec = videogrep.vtt.timestamp_to_secs(first_cue[0])
assert first_cue_start_sec == approx(0.0)
assert first_cue[1] == "-->"
# last segment"s end time should be the same as the video duration
# last segment end time should be the same as the video duration
print(lines)
last_seg_end_ts = lines[-2].strip().split()[2]
last_seg_end_sec = videogrep.vtt.timestamp_to_secs(last_seg_end_ts)
Expand Down Expand Up @@ -705,4 +703,4 @@ def test_cli():
]
)

assert get_duration(outfile_audio) == approx(0.37)
assert get_duration(outfile_audio) == approx(0.365714)
2 changes: 1 addition & 1 deletion videogrep/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.1.3"
__version__ = "2.2.0"

from . import vtt, srt, sphinx, fcpxml
from .videogrep import (
Expand Down

0 comments on commit b8d38b4

Please sign in to comment.