Skip to content

Commit 300437f

Browse files
committed
Merge branch 'develop'
2 parents f2e8fc2 + d07b823 commit 300437f

File tree

6 files changed

+41
-42
lines changed

6 files changed

+41
-42
lines changed

examples/lolsnapcommit-hook.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# to install simply copy to somewhere in your path where this script will stay
44
# and either make sure sightsnap is in your path e.g. /usr/bin or you supply the
55
# full path here instead of the shorthand
6-
sightsnap = "sightsnap"
6+
# you can find out about the whereabouts in the terminal with 'which <toolname>'
7+
sightsnap = "/usr/local/bin/sightsnap"
8+
ffmpeg = "/usr/local/bin/ffmpeg"
79

810
# then run lolsnapcommit-hook.rb --install to install the hook in a repository when inside the repo
911
# you can run lolsnapcommit-hook.rb to test it for the most recent commit
@@ -65,7 +67,6 @@ def escape_single
6567
end
6668
end
6769

68-
6970
# settings
7071
title = "%s %s:%10s" % [repo_name, branch_name, short_commit]
7172
font = "Impact"
@@ -86,4 +87,4 @@ def escape_single
8687
%x[mkdir -p #{tmpsnappath}]
8788
tmpsnapbasename = File.join(tmpsnappath,'lolcommit')
8889

89-
%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}]
90+
%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}]

sightsnap.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
F21B6C3A1765032C00825BF3 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F21B6C391765032C00825BF3 /* CoreMedia.framework */; };
1414
F21B6C3C1765033300825BF3 /* CoreMediaIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F21B6C3B1765033300825BF3 /* CoreMediaIO.framework */; };
1515
F23D89461712ED3900BCDCAE /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F23D89451712ED3900BCDCAE /* CoreText.framework */; };
16+
F25B168E2141D0FC0065840D /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19194170342C3004B8DCD /* QTKit.framework */; };
1617
F29C65831705A3A0003D2B24 /* TCMCommandLineUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F29C65821705A3A0003D2B24 /* TCMCommandLineUtility.m */; };
1718
F2D19187170341A8004B8DCD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19186170341A8004B8DCD /* Foundation.framework */; };
1819
F2D1918A170341A8004B8DCD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D19189170341A8004B8DCD /* main.m */; };
1920
F2D1918E170341A8004B8DCD /* sightsnap.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = F2D1918D170341A8004B8DCD /* sightsnap.1 */; };
20-
F2D19195170342C3004B8DCD /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F2D19194170342C3004B8DCD /* QTKit.framework */; };
2121
F2D1919917034604004B8DCD /* TCMCaptureManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919817034604004B8DCD /* TCMCaptureManager.m */; };
2222
F2D191C71703576E004B8DCD /* FSAliasRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919D1703572A004B8DCD /* FSAliasRecognizer.m */; };
2323
F2D191C81703576E004B8DCD /* FSAliasToken.m in Sources */ = {isa = PBXBuildFile; fileRef = F2D1919F1703572A004B8DCD /* FSAliasToken.m */; };
@@ -256,14 +256,14 @@
256256
isa = PBXFrameworksBuildPhase;
257257
buildActionMask = 2147483647;
258258
files = (
259+
F25B168E2141D0FC0065840D /* QTKit.framework in Frameworks */,
259260
F23D89461712ED3900BCDCAE /* CoreText.framework in Frameworks */,
260261
F2D1926E170483E0004B8DCD /* CoreServices.framework in Frameworks */,
261262
F2D1926C170483C5004B8DCD /* ImageIO.framework in Frameworks */,
262263
F2D1926A170483B7004B8DCD /* CoreGraphics.framework in Frameworks */,
263264
F2D192681704839E004B8DCD /* CoreVideo.framework in Frameworks */,
264265
F2D1926717048396004B8DCD /* QuartzCore.framework in Frameworks */,
265266
F2D192661704838E004B8DCD /* Quartz.framework in Frameworks */,
266-
F2D19195170342C3004B8DCD /* QTKit.framework in Frameworks */,
267267
F2D19187170341A8004B8DCD /* Foundation.framework in Frameworks */,
268268
F21B6C331764FF0800825BF3 /* AVFoundation.framework in Frameworks */,
269269
F21B6C38176502E000825BF3 /* AudioToolbox.framework in Frameworks */,

sightsnap/3rdParty/ArgumentParser/FSArgumentSignature.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,10 @@ - (id)initWithFormat:(NSString *)format arguments:(va_list)args
108108
NSAssert([[values objectAtIndex:0] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
109109
NSAssert([[values objectAtIndex:1] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
110110
NSAssert([[values objectAtIndex:3] isKindOfClass:[CPKeywordToken class]], @"expecting keyword token");
111-
NSNumber * location = [[values objectAtIndex:2] number];
112-
valueRange.location = [location integerValue];
113-
valueRange.length = [location integerValue];
114-
NSNumber * length;
111+
valueRange.location = [(CPKeywordToken *)[values objectAtIndex:2] characterNumber];
112+
valueRange.length = valueRange.location;
115113
if ([[values objectAtIndex:4] isKindOfClass:[CPNumberToken class]]) {
116-
length = [[values objectAtIndex:4] number];
117-
valueRange.length = MAX(valueRange.location, [length integerValue]);
114+
valueRange.length = MAX(valueRange.location, [(CPKeywordToken *)[values objectAtIndex:4] characterNumber]);
118115
} else {
119116
valueRange.length = NSNotFound; // infinite
120117
}

sightsnap/Classes/TCMCaptureManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import <Foundation/Foundation.h>
1010
#import <AVFoundation/AVFoundation.h>
1111

12-
typedef void (^TCMCaptureQuartzAction)(CGContextRef aContext, CGRect aFrame);
12+
typedef void (^TCMCaptureQuartzAction)(CGContextRef aContext, CGRect aFrame, NSDate *timestampTaken);
1313

1414
@interface TCMCaptureManager : NSObject
1515
@property (nonatomic) CGFloat jpegQuality;

sightsnap/Classes/TCMCaptureManager.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ - (void)didGrabImage {
288288
[context drawImage:coreImage inRect:contextRect fromRect:coreImage.extent];
289289
if (self.drawingBlock) {
290290
CGContextSaveGState(cgContext);
291-
((TCMCaptureQuartzAction)self.drawingBlock)(cgContext, contextRect);
291+
((TCMCaptureQuartzAction)self.drawingBlock)(cgContext, contextRect, [NSDate date]);
292292
CGContextRestoreGState(cgContext);
293293
}
294294

sightsnap/TCMCommandLineUtility.m

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "TCMCommandLineUtility.h"
10-
#import <QTKit/QTKit.h>
10+
#import <QTKit/QTKitDefines.h>
1111
#import "TCMCaptureManager.h"
1212
#import "FSArguments.h"
1313
#import "FSArguments_Coalescer_Internal.h"
@@ -215,17 +215,6 @@ static void exception_handler(NSException *anException) {
215215
S_defaultHandler(anException);
216216
}
217217

218-
@interface QTCaptureDevice (SightSnapAdditions)
219-
- (NSString *)localizedUniqueDisplayName;
220-
@end
221-
222-
@implementation QTCaptureDevice (SightSnapAdditions)
223-
- (NSString *)localizedUniqueDisplayName {
224-
NSString *result = [NSString stringWithFormat:@"%@ [%@ - %@]", self.localizedDisplayName, self.modelUniqueID, self.uniqueID];
225-
return result;
226-
}
227-
@end
228-
229218
@interface AVCaptureDevice (SightSnapAdditions)
230219
- (NSString *)localizedUniqueDisplayName;
231220
@end
@@ -374,7 +363,7 @@ - (int)run {
374363

375364
NSInteger terminalWidth = 80;
376365
if ([package booleanValueForSignature:help]) {
377-
puts("sightsnap v0.6 by @monkeydom");
366+
puts("sightsnap v0.6.1 by @monkeydom");
378367
puts("usage: sightsnap [options] [output[.jpg|.png]] [options]");
379368
puts("");
380369
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 {
539528

540529
- (void)captureImage {
541530
self.lastFrameFireDate = [NSDate new];
542-
531+
static NSDateFormatter *dateFormatter = nil;
532+
if (!dateFormatter) {
533+
dateFormatter = [NSDateFormatter new];
534+
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
535+
dateFormatter.dateStyle = NSDateFormatterShortStyle;
536+
}
543537
TCMCaptureManager *captureManager = [TCMCaptureManager captureManager];
544-
if (self.shouldTimeStamp) {
545-
if (!self.timeStampDate) {
538+
BOOL shouldTimeStamp = self.shouldTimeStamp;
539+
if (shouldTimeStamp) {
540+
if (!self.timeStampDate && self.onlyOneTimeStamp) {
546541
self.timeStampDate = [NSDate date];
547-
} else if (!self.onlyOneTimeStamp) {
548-
self.timeStampDate = self.lastFrameFireDate;
549542
}
550-
NSDateFormatter *dateFormatter = [NSDateFormatter new];
551-
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
552-
dateFormatter.dateStyle = NSDateFormatterShortStyle;
553-
self.topLeftText = [dateFormatter stringFromDate:self.timeStampDate];
554543
}
544+
NSDate *timeStampDate = self.timeStampDate;
545+
555546
if (self.topLeftText || self.titleText || self.commentText) {
556-
547+
NSString *fontName = self.fontName;
548+
CGFloat fontSize = self.fontSize;
549+
557550
SIGHTCaption *topLeftCaption;
558551
if (self.topLeftText) {
559-
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.topLeftText position:kSIGHTCaptionPositionTopLeft fontName:self.fontName fontSize:self.fontSize];
552+
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.topLeftText position:kSIGHTCaptionPositionTopLeft fontName:fontName fontSize:fontSize];
560553
topLeftCaption = caption;
561554
}
562555
SIGHTCaption *topRightCaption;
563556
if (self.titleText) {
564-
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.titleText position:kSIGHTCaptionPositionTopRight fontName:self.fontName fontSize:self.fontSize];
557+
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.titleText position:kSIGHTCaptionPositionTopRight fontName:fontName fontSize:fontSize];
565558
topRightCaption = caption;
566559
}
567560

568561
SIGHTCaption *bottomLeftCaption;
569562
if (self.commentText) {
570-
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.commentText position:kSIGHTCaptionPositionBottomLeft fontName:self.fontName fontSize:self.fontSize];
563+
SIGHTCaption *caption = [SIGHTCaption captionWithText:self.commentText position:kSIGHTCaptionPositionBottomLeft fontName:fontName fontSize:fontSize];
571564
bottomLeftCaption = caption;
572565
}
573-
TCMCaptureQuartzAction drawAction = ^(CGContextRef ctx, CGRect aFrame) {
566+
TCMCaptureQuartzAction drawAction = ^(CGContextRef ctx, CGRect aFrame, NSDate *frameTimestampDate) {
574567
CGFloat topRightCaptionFirstLineMargin = 0.0;
575-
if (topLeftCaption) {
576-
topRightCaptionFirstLineMargin = [topLeftCaption drawInContext:ctx frame:aFrame firstLineLessWidth:0];
568+
if (shouldTimeStamp) {
569+
NSDate *date = timeStampDate;
570+
if (!date) {
571+
date = frameTimestampDate;
572+
}
573+
NSString *timeStampString = [dateFormatter stringFromDate:date];
574+
SIGHTCaption *caption = [SIGHTCaption captionWithText:timeStampString position:kSIGHTCaptionPositionTopLeft fontName:fontName fontSize:fontSize];
575+
topRightCaptionFirstLineMargin = [caption drawInContext:ctx frame:aFrame firstLineLessWidth:0];
577576
}
578577
if (topRightCaption) {
579578
[topRightCaption drawInContext:ctx frame:aFrame firstLineLessWidth:topRightCaptionFirstLineMargin];
@@ -600,6 +599,8 @@ - (void)didCaptureImage {
600599
if (!self.firstCapturedFrameDate) {
601600
//[[NSUserNotificationCenter defaultUserNotificationCenter] scheduleNotification:[[NSUserNotification alloc] init]];
602601
self.firstCapturedFrameDate = [NSDate date];
602+
// fix the hop at the first frame due to the skipframes
603+
nextScheduleDate = [self.firstCapturedFrameDate dateByAddingTimeInterval:self.grabInterval];
603604
} else {
604605
NSTimeInterval maxGrabDuration = self.maxGrabDuration;
605606
if (maxGrabDuration > 0.0) {

0 commit comments

Comments
 (0)