-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add unit tests, refactor, new slideshow feature, other improvements #55
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eclipse metadata, Emacs *~ and .pyc are now ignored.
Tested functions: * findStaffLinesInImage() Tested classes: * VideoFrameWriter: - image handling methods: . isLineBlank() . getTopAndBottomMarginSizes() . getCropTopAndBottom() . cropFrame() - time handling methods: . ticksToSecs() . secsElapsedForTempoChanges()
To maintain the code more easily, the program will be split into several modules. setDebug() and setRunDir() functions are handling global var DEBUG and runDir.
Move VideoFrameWriter and some image scanning functions into a new 'video' module. Update unit tests.
Avoid an 'undefined var' at execution?
…avelling Some VideoFrameWriter methods are now moved to this class. The getCropTopAndBottomMarginSizes() method is replaced by the topCroppable() and bottomCroppable() methods which respectivly return the number of pixels the image can be cropped on top an bottom. An instance is now used by VideoFrameWriter. Some unused code has been removed in VideoFrameWriter (write and secsElapsedForTempoChanges)
Update the tests for the new class ScoreImage. The tests of image handling methods are moved to the ScoreImageTest test class. Tested functions: * findStaffLinesInImage() Tested classes: * VideoFrameWriter: . ticksToSecs() . secsElapsedForTempoChanges() * ScoreImage . __isLineBlank() . __setCropTopAndBottom() . __cropFrame() . topCroppable() . bottomCroppable() . makeFrame()
...instead of image notes indexes. Less dependant from the scoreImage class.
The ScoreImage instance of VideoFrameWriter can now be set as a public property. Some parameters of the VideoFrameWriter constructor are removed and the write() method has now no parameter. These parameters are attached to the ScoreImage instance.
Implements a measure cursor that is slightly less intrusive than the line cursor following each note. Updates writeSpaceTimeDumper() function the measures bars positions. New function getMeasuresIndices().
These options are added to be more coherent with --measure-cursor, and to allow no cursor at all.
… video VideoFrameWriter is now able to push up medias.
This cursor can be used when the slide show displays some structure diagram. Some hard coded values should be set by command line options...
Deletes height and width in VideoFrameWriter constructor (No height limit, score)
Tested classes: * VideoFrameWriter: . push() . scoreImageSetter()
Time handling methods are moved to this class. The design pattern 'Observer' is used. New 'synchro' module.
Add tests for the new class TimeCode, update some tests. Some new fonctional tests (testCompleteFollowing) Tested classes: * TimeCode: . ticksToSecs() . secsElapsedForTempoChanges() . nbFramesToNextNote() . goToNextNote() . atEnd() * ScoreImage: . currentXposition . moveToNextNote() . cropFrame()
As of Python 2.7, optparse is deprecated in favour of argparse.
This looks like excellent work to me - I'm really delighted by the high quality of every commit I looked at. Unfortunately I have still not managed to find time to review it thoroughly, so I think the best thing to do is merge it, and if other users encounter any issues with the updated code, we can deal with them individually. Thank you again for this amazing contribution! |
aspiers
added a commit
that referenced
this pull request
Aug 6, 2014
Add unit tests, refactor, new slideshow feature, other improvements
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull requests adds unit tests, refactors the ly2video into several modules and classes and adds new features.
New major features:
--slide-show
), allowing to put fixed pictures into one zoneExamples: with a slide show and with several score scrolling modes
Other new features and improvements:
--measure-cursor
) (but issue cursor scrolling should be sensitive to bar lines #22 applies as well)Before I began to code I made some unit tests (see issue #25) for the
VideoFrameWriter
class. The tested methods were:ticksToSecs()
,secsElapsedForTempoChanges()
isLineBlank()
,getTopAndBottomMarginSizes()
,findStaffLinesInImage()
,cropFrame()
The code of methods
write()
andwriteVideoFrames()
were difficult to test because they don't return any value. They just put image files on disk. But some code was able to be tested when isolated into methods:First of all the
video.ScoreImage
class has been created. This class manages:currentXposition()
,travelToNextNote()
,moveToNextNote()
,notesXpositions
makeFrame()
The
sychro.Timecode
class handles the synchronisation data:atEnd()
,gotToNextNote()
,nbFramesToNextNote()
methods. I have used the Observer design pattern to produce frames. The timecode object is a kind of 'conductor' of the process.video.ScoreImage
inherits thevideo.Media
class and theVideoFrameWriter
can now manage severals medias. So the push method can be used to stack medias one above the other. I added the new mediavideo.SlideShow
to be able to run a slide show composed of several pictures as the music is playing. A horizontal line cursor can be added if needed.The very first unit tests had been conserved along all the commits although the code architecture has evolved. This new architecture permits to create near to 50 unit tests for the frame writing part of ly2video.