Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
monkeydom committed Sep 6, 2018
2 parents f2e8fc2 + d07b823 commit 300437f042c92461a72afbd61c5ece2bfee95a37
@@ -3,7 +3,9 @@
# to install simply copy to somewhere in your path where this script will stay
# and either make sure sightsnap is in your path e.g. /usr/bin or you supply the
# full path here instead of the shorthand
sightsnap = "sightsnap"
# you can find out about the whereabouts in the terminal with 'which <toolname>'
sightsnap = "/usr/local/bin/sightsnap"
ffmpeg = "/usr/local/bin/ffmpeg"
# then run lolsnapcommit-hook.rb --install to install the hook in a repository when inside the repo
# you can run lolsnapcommit-hook.rb to test it for the most recent commit
@@ -65,7 +67,6 @@ def escape_single
end
end
# settings
title = "%s %s:%10s" % [repo_name, branch_name, short_commit]
font = "Impact"
@@ -86,4 +87,4 @@ def escape_single
%x[mkdir -p #{tmpsnappath}]
tmpsnapbasename = File.join(tmpsnappath,'lolcommit')
%x[/Users/domde/bin/sightsnap -poz -k 1 -T '#{title.escape_single}' -C='#{commit_message.escape_single}' -j 0.45 -t 0.2,1.2 -s #{font_size} -f '#{font}' '#{tmpsnapbasename.escape_single}' && ffmpeg -y -r 8 -i #{tmpsnapbasename}-%07d.jpg -vf 'scale=768:-1' '#{snap_path.escape_single}.gif' && open '#{snap_path.escape_single}.gif' && rm -rf #{tmpsnappath}]
%x[#{sightsnap} -poz -T '#{title.escape_single}' -C='#{commit_message.escape_single}' -j 0.45 -t 0.2,1.2 -s #{font_size} -f '#{font}' '#{tmpsnapbasename.escape_single}' && #{ffmpeg} -y -r 8 -i #{tmpsnapbasename}-%07d.jpg -vf 'scale=768:-1' '#{snap_path.escape_single}.gif' && open '#{snap_path.escape_single}.gif' && rm -rf #{tmpsnappath}]
@@ -13,11 +13,11 @@
F21B6C3A1765032C00825BF3 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F21B6C391765032C00825BF3 /* CoreMedia.framework */; };
F21B6C3C1765033300825BF3 /* CoreMediaIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F21B6C3B1765033300825BF3 /* CoreMediaIO.framework */; };
F23D89461712ED3900BCDCAE /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F23D89451712ED3900BCDCAE /* CoreText.framework */; };
F25B168E2141D0FC0065840D /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19194170342C3004B8DCD /* QTKit.framework */; };
F29C65831705A3A0003D2B24 /* TCMCommandLineUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F29C65821705A3A0003D2B24 /* TCMCommandLineUtility.m */; };
F2D19187170341A8004B8DCD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19186170341A8004B8DCD /* Foundation.framework */; };
F2D1918A170341A8004B8DCD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D19189170341A8004B8DCD /* main.m */; };
F2D1918E170341A8004B8DCD /* sightsnap.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = F2D1918D170341A8004B8DCD /* sightsnap.1 */; };
F2D19195170342C3004B8DCD /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19194170342C3004B8DCD /* QTKit.framework */; };
F2D1919917034604004B8DCD /* TCMCaptureManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919817034604004B8DCD /* TCMCaptureManager.m */; };
F2D191C71703576E004B8DCD /* FSAliasRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919D1703572A004B8DCD /* FSAliasRecognizer.m */; };
F2D191C81703576E004B8DCD /* FSAliasToken.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919F1703572A004B8DCD /* FSAliasToken.m */; };
@@ -256,14 +256,14 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F25B168E2141D0FC0065840D /* QTKit.framework in Frameworks */,
F23D89461712ED3900BCDCAE /* CoreText.framework in Frameworks */,
F2D1926E170483E0004B8DCD /* CoreServices.framework in Frameworks */,
F2D1926C170483C5004B8DCD /* ImageIO.framework in Frameworks */,
F2D1926A170483B7004B8DCD /* CoreGraphics.framework in Frameworks */,
F2D192681704839E004B8DCD /* CoreVideo.framework in Frameworks */,
F2D1926717048396004B8DCD /* QuartzCore.framework in Frameworks */,
F2D192661704838E004B8DCD /* Quartz.framework in Frameworks */,
F2D19195170342C3004B8DCD /* QTKit.framework in Frameworks */,
F2D19187170341A8004B8DCD /* Foundation.framework in Frameworks */,
F21B6C331764FF0800825BF3 /* AVFoundation.framework in Frameworks */,
F21B6C38176502E000825BF3 /* AudioToolbox.framework in Frameworks */,
@@ -108,13 +108,10 @@ - (id)initWithFormat:(NSString *)format arguments:(va_list)args
NSAssert([[values objectAtIndex:0] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
NSAssert([[values objectAtIndex:1] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
NSAssert([[values objectAtIndex:3] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
NSNumber * location = [[values objectAtIndex:2] number];
valueRange.location = [location integerValue];
valueRange.length = [location integerValue];
NSNumber * length;
valueRange.location = [(CPKeywordToken *)[values objectAtIndex:2] characterNumber];
valueRange.length = valueRange.location;
if ([[values objectAtIndex:4] isKindOfClass:[CPNumberToken class]]) {
length = [[values objectAtIndex:4] number];
valueRange.length = MAX(valueRange.location, [length integerValue]);
valueRange.length = MAX(valueRange.location, [(CPKeywordToken *)[values objectAtIndex:4] characterNumber]);
} else {
valueRange.length = NSNotFound; // infinite
}
@@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
typedef void (^TCMCaptureQuartzAction)(CGContextRef aContext, CGRect aFrame);
typedef void (^TCMCaptureQuartzAction)(CGContextRef aContext, CGRect aFrame, NSDate *timestampTaken);
@interface TCMCaptureManager : NSObject
@property (nonatomic) CGFloat jpegQuality;
@@ -288,7 +288,7 @@ - (void)didGrabImage {
[context drawImage:coreImage inRect:contextRect fromRect:coreImage.extent];
if (self.drawingBlock) {
CGContextSaveGState(cgContext);
((TCMCaptureQuartzAction)self.drawingBlock)(cgContext, contextRect);
((TCMCaptureQuartzAction)self.drawingBlock)(cgContext, contextRect, [NSDate date]);
CGContextRestoreGState(cgContext);
}
@@ -7,7 +7,7 @@
//
#import "TCMCommandLineUtility.h"
#import <QTKit/QTKit.h>
#import <QTKit/QTKitDefines.h>
#import "TCMCaptureManager.h"
#import "FSArguments.h"
#import "FSArguments_Coalescer_Internal.h"
@@ -215,17 +215,6 @@ static void exception_handler(NSException *anException) {
S_defaultHandler(anException);
}
@interface QTCaptureDevice (SightSnapAdditions)
- (NSString *)localizedUniqueDisplayName;
@end
@implementation QTCaptureDevice (SightSnapAdditions)
- (NSString *)localizedUniqueDisplayName {
NSString *result = [NSString stringWithFormat:@"%@ [%@ - %@]", self.localizedDisplayName, self.modelUniqueID, self.uniqueID];
return result;
}
@end
@interface AVCaptureDevice (SightSnapAdditions)
- (NSString *)localizedUniqueDisplayName;
@end
@@ -374,7 +363,7 @@ - (int)run {
NSInteger terminalWidth = 80;
if ([package booleanValueForSignature:help]) {
puts("sightsnap v0.6 by @monkeydom");
puts("sightsnap v0.6.1 by @monkeydom");
puts("usage: sightsnap [options] [output[.jpg|.png]] [options]");
puts("");
puts("Default output filename is signtsnap.jpg - if no extension is given, jpg is used.\nIf you add directory in front, it will be created.");
@@ -539,41 +528,51 @@ - (NSURL *)nextFrameFileURL {
- (void)captureImage {
self.lastFrameFireDate = [NSDate new];
static NSDateFormatter *dateFormatter = nil;
if (!dateFormatter) {
dateFormatter = [NSDateFormatter new];
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;
}
TCMCaptureManager *captureManager = [TCMCaptureManager captureManager];
if (self.shouldTimeStamp) {
if (!self.timeStampDate) {
BOOL shouldTimeStamp = self.shouldTimeStamp;
if (shouldTimeStamp) {
if (!self.timeStampDate && self.onlyOneTimeStamp) {
self.timeStampDate = [NSDate date];
} else if (!self.onlyOneTimeStamp) {
self.timeStampDate = self.lastFrameFireDate;
}
NSDateFormatter *dateFormatter = [NSDateFormatter new];
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;
self.topLeftText = [dateFormatter stringFromDate:self.timeStampDate];
}
NSDate *timeStampDate = self.timeStampDate;
if (self.topLeftText || self.titleText || self.commentText) {
NSString *fontName = self.fontName;
CGFloat fontSize = self.fontSize;
SIGHTCaption *topLeftCaption;
if (self.topLeftText) {
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.topLeftText position:kSIGHTCaptionPositionTopLeft fontName:self.fontName fontSize:self.fontSize];
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.topLeftText position:kSIGHTCaptionPositionTopLeft fontName:fontName fontSize:fontSize];
topLeftCaption = caption;
}
SIGHTCaption *topRightCaption;
if (self.titleText) {
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.titleText position:kSIGHTCaptionPositionTopRight fontName:self.fontName fontSize:self.fontSize];
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.titleText position:kSIGHTCaptionPositionTopRight fontName:fontName fontSize:fontSize];
topRightCaption = caption;
}
SIGHTCaption *bottomLeftCaption;
if (self.commentText) {
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.commentText position:kSIGHTCaptionPositionBottomLeft fontName:self.fontName fontSize:self.fontSize];
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.commentText position:kSIGHTCaptionPositionBottomLeft fontName:fontName fontSize:fontSize];
bottomLeftCaption = caption;
}
TCMCaptureQuartzAction drawAction = ^(CGContextRef ctx, CGRect aFrame) {
TCMCaptureQuartzAction drawAction = ^(CGContextRef ctx, CGRect aFrame, NSDate *frameTimestampDate) {
CGFloat topRightCaptionFirstLineMargin = 0.0;
if (topLeftCaption) {
topRightCaptionFirstLineMargin = [topLeftCaption drawInContext:ctx frame:aFrame firstLineLessWidth:0];
if (shouldTimeStamp) {
NSDate *date = timeStampDate;
if (!date) {
date = frameTimestampDate;
}
NSString *timeStampString = [dateFormatter stringFromDate:date];
SIGHTCaption *caption = [SIGHTCaption captionWithText:timeStampString position:kSIGHTCaptionPositionTopLeft fontName:fontName fontSize:fontSize];
topRightCaptionFirstLineMargin = [caption drawInContext:ctx frame:aFrame firstLineLessWidth:0];
}
if (topRightCaption) {
[topRightCaption drawInContext:ctx frame:aFrame firstLineLessWidth:topRightCaptionFirstLineMargin];
@@ -600,6 +599,8 @@ - (void)didCaptureImage {
if (!self.firstCapturedFrameDate) {
//[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:[[NSUserNotification alloc] init]];
self.firstCapturedFrameDate = [NSDate date];
// fix the hop at the first frame due to the skipframes
nextScheduleDate = [self.firstCapturedFrameDate dateByAddingTimeInterval:self.grabInterval];
} else {
NSTimeInterval maxGrabDuration = self.maxGrabDuration;
if (maxGrabDuration > 0.0) {

0 comments on commit 300437f

Please sign in to comment.