Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Optional Progress Bar in cuts/detect_scenes #587

Merged

Conversation

scherroman
Copy link
Contributor

Progress bar was previously hard-coded to True.

@coveralls
Copy link

coveralls commented Jun 14, 2017

Coverage Status

Coverage remained the same at 54.081% when pulling 453aba7 on scherroman:cuts-luminosities-optional-progress-bar into 6ba12d0 on Zulko:master.

@scherroman scherroman closed this Jun 14, 2017
@scherroman scherroman reopened this Jun 15, 2017
Progress bar was previously hard-coded to True.
@scherroman scherroman force-pushed the cuts-luminosities-optional-progress-bar branch from 453aba7 to 719739f Compare June 15, 2017 06:41
@coveralls
Copy link

coveralls commented Jun 15, 2017

Coverage Status

Coverage remained the same at 54.081% when pulling 719739f on scherroman:cuts-luminosities-optional-progress-bar into 6ba12d0 on Zulko:master.

@coveralls
Copy link

coveralls commented Jun 15, 2017

Coverage Status

Coverage remained the same at 54.081% when pulling 719739f on scherroman:cuts-luminosities-optional-progress-bar into 6ba12d0 on Zulko:master.

@tburrows13
Copy link
Collaborator

Thanks, this looks great! If you can confirm that you've tested it and it all runs fine, I'd be happy to merge.

Copy link
Collaborator

@mbeacom mbeacom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: lgtm - We should consider better handling for the progress bar over all. ☹️

@mbeacom mbeacom added this to the Release v0.2.3.3 milestone Jun 15, 2017
@mbeacom mbeacom added enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. LGTM Passed inspection by maintainers. mergable labels Jun 15, 2017
@scherroman
Copy link
Contributor Author

I can confirm this works on my end.

It seems like an odd thing to try and write a test for the presence/absence of a progress bar for detect_scenes, given that there's no actual test for detect_scenes yet.

I did try, but had trouble getting the test case to run properly:

def test_PR_587(capsys):
    red = ColorClip((640, 480), color=(255, 0, 0)).set_duration(1)
    green = ColorClip((640, 480), color=(0, 200, 0)).set_duration(1)
    video = concatenate_videoclips([red, green])

    cuts, luminosities = detect_scenes(video, fps=10, progress_bar=True)
    out, err = capsys.readouterr()
    assert len(err) != 0

    cuts, luminosities = detect_scenes(video, fps=10, progress_bar=False)
    out, err = capsys.readouterr()
    assert len(err) == 0

Normally, pytest should be able to capture any output to stdout and stderr during the execution of a test, so we'd be able to tell if the progress bar was actually being shown or not. However, pytest only seemed to capture the output once the test had completed:

screen shot 2017-06-15 at 11 14 53 pm

@scherroman
Copy link
Contributor Author

In any case, I think this would be a good general test case to add for detect_scenes:

from moviepy.editor import ColorClip, concatenate_videoclips
from moviepy.video.tools.cuts import detect_scenes

def test_detect_scenes():
    red = ColorClip((640, 480), color=(255,0,0)).set_duration(1)
    green = ColorClip((640, 480), color=(0,200,0)).set_duration(1)
    video = concatenate_videoclips([red, green])

    cuts, luminosities = detect_scenes(video, fps=10, progress_bar=False)

    assert len(cuts) == 2

I could open up a new pull request with this test, but I'm a little unsure where the test case should live. Perhaps test_compositing.py, or perhaps a new file test_video_tools.py?

Feels like the test suite could benefit from a folder structure mirroring the library. That way one could add a test for detect_scenes under tests/video/tools/test_cuts.py.

@mbeacom
Copy link
Collaborator

mbeacom commented Jun 16, 2017

👍 for tests/video/tools/test_cuts.py

Copy link
Contributor

@kencochrane kencochrane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. LGTM Passed inspection by maintainers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants