mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-25 08:01:39 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecef95469d | ||
|
|
55d30d5e4b | ||
|
|
2d5502cc2f | ||
|
|
5cda4a1eb4 | ||
|
|
812b914b70 | ||
|
|
9b870ad863 | ||
|
|
0f250ac92d | ||
|
|
552e6b7836 | ||
|
|
28f70b281b | ||
|
|
32d9b573c0 | ||
|
|
fc76a843d5 | ||
|
|
06607aabb2 |
@@ -15,7 +15,8 @@ cocoa/*/build
|
|||||||
cocoa/*/dg_cocoa.plugin
|
cocoa/*/dg_cocoa.plugin
|
||||||
qt/base/*_rc.py
|
qt/base/*_rc.py
|
||||||
qt/base/*_ui.py
|
qt/base/*_ui.py
|
||||||
qt/se/*_ui.py
|
qt/*/*_ui.py
|
||||||
|
qt/pe/modules/block/block.c
|
||||||
help_se/dupeguru_help
|
help_se/dupeguru_help
|
||||||
help_me/dupeguru_me_help
|
help_me/dupeguru_me_help
|
||||||
help_pe/dupeguru_pe_help
|
help_pe/dupeguru_pe_help
|
||||||
2
.hgtags
2
.hgtags
@@ -5,3 +5,5 @@ a8f232f880b6f9ada565d472996a627ebf69b6e9 before-tiger-drop
|
|||||||
321d15e818cf9a3f1fc037543090bb2fca2cccd7 me5.7.0
|
321d15e818cf9a3f1fc037543090bb2fca2cccd7 me5.7.0
|
||||||
adc73ccd14b1386cb04dee773c53a2d126800e31 se2.9.0
|
adc73ccd14b1386cb04dee773c53a2d126800e31 se2.9.0
|
||||||
cbcf9c80fee4c908ef2efbf1c143c9e47676c9b2 pe1.8.0
|
cbcf9c80fee4c908ef2efbf1c143c9e47676c9b2 pe1.8.0
|
||||||
|
61c4101851bdea3cb37dfb76f0d404c78c7c594c se2.9.1
|
||||||
|
0e923897a3389331d4ab3debbc40b8dd616199d9 pe1.8.1
|
||||||
|
|||||||
9
build.py
9
build.py
@@ -23,7 +23,10 @@ def main():
|
|||||||
edition = conf['edition']
|
edition = conf['edition']
|
||||||
ui = conf['ui']
|
ui = conf['ui']
|
||||||
dev = conf['dev']
|
dev = conf['dev']
|
||||||
|
build64 = conf['build64']
|
||||||
print "Building dupeGuru {0} with UI {1}".format(edition.upper(), ui)
|
print "Building dupeGuru {0} with UI {1}".format(edition.upper(), ui)
|
||||||
|
if build64:
|
||||||
|
print "If possible, 64-bit builds will be made"
|
||||||
if dev:
|
if dev:
|
||||||
print "Building in Dev mode"
|
print "Building in Dev mode"
|
||||||
add_to_pythonpath('.')
|
add_to_pythonpath('.')
|
||||||
@@ -78,7 +81,11 @@ def main():
|
|||||||
open(pthpath, 'w').write(op.abspath('.'))
|
open(pthpath, 'w').write(op.abspath('.'))
|
||||||
os.chdir(cocoa_project_path)
|
os.chdir(cocoa_project_path)
|
||||||
print "Building the XCode project"
|
print "Building the XCode project"
|
||||||
os.system('xcodebuild')
|
args = []
|
||||||
|
if build64:
|
||||||
|
args.append('ARCHS="x86_64 i386 ppc"')
|
||||||
|
args = ' '.join(args)
|
||||||
|
os.system('xcodebuild {0}'.format(args))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
elif ui == 'qt':
|
elif ui == 'qt':
|
||||||
os.chdir(op.join('qt', edition))
|
os.chdir(op.join('qt', edition))
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[cell addItemWithTitle:@"Normal"];
|
[cell addItemWithTitle:@"Normal"];
|
||||||
[cell addItemWithTitle:@"Reference"];
|
[cell addItemWithTitle:@"Reference"];
|
||||||
[cell addItemWithTitle:@"Excluded"];
|
[cell addItemWithTitle:@"Excluded"];
|
||||||
for (int i=0;i<[[cell itemArray] count];i++)
|
for (NSInteger i=0;i<[[cell itemArray] count];i++)
|
||||||
{
|
{
|
||||||
NSMenuItem *mi = [[cell itemArray] objectAtIndex:i];
|
NSMenuItem *mi = [[cell itemArray] objectAtIndex:i];
|
||||||
[mi setTarget:self];
|
[mi setTarget:self];
|
||||||
@@ -135,8 +135,8 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int state = n2i([[node buffer] objectAtIndex:1]);
|
NSInteger state = n2i([[node buffer] objectAtIndex:1]);
|
||||||
int newState = state == 2 ? 0 : 2; // If excluded, put it back
|
NSInteger newState = state == 2 ? 0 : 2; // If excluded, put it back
|
||||||
[_py setDirectory:p2a([node indexPath]) state:i2n(newState)];
|
[_py setDirectory:p2a([node indexPath]) state:i2n(newState)];
|
||||||
[node resetAllBuffers];
|
[node resetAllBuffers];
|
||||||
[directories display];
|
[directories display];
|
||||||
@@ -153,7 +153,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (void)addDirectory:(NSString *)directory
|
- (void)addDirectory:(NSString *)directory
|
||||||
{
|
{
|
||||||
int r = [[_py addDirectory:directory] intValue];
|
NSInteger r = [[_py addDirectory:directory] intValue];
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
NSString *m;
|
NSString *m;
|
||||||
@@ -186,7 +186,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
}
|
}
|
||||||
[removeButton setEnabled:YES];
|
[removeButton setEnabled:YES];
|
||||||
OVNode *node = [directories itemAtRow:[directories selectedRow]];
|
OVNode *node = [directories itemAtRow:[directories selectedRow]];
|
||||||
int state = n2i([[node buffer] objectAtIndex:1]);
|
NSInteger state = n2i([[node buffer] objectAtIndex:1]);
|
||||||
NSString *buttonText = state == 2 ? @"Put Back" : @"Remove";
|
NSString *buttonText = state == 2 ? @"Put Back" : @"Remove";
|
||||||
[removeButton setTitle:buttonText];
|
[removeButton setTitle:buttonText];
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
||||||
{
|
{
|
||||||
OVNode *node = item;
|
OVNode *node = item;
|
||||||
int state = n2i([[node buffer] objectAtIndex:1]);
|
NSInteger state = n2i([[node buffer] objectAtIndex:1]);
|
||||||
if ([cell isKindOfClass:[NSTextFieldCell class]])
|
if ([cell isKindOfClass:[NSTextFieldCell class]])
|
||||||
{
|
{
|
||||||
NSTextFieldCell *textCell = cell;
|
NSTextFieldCell *textCell = cell;
|
||||||
|
|||||||
@@ -62,5 +62,5 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (void)setDisplayDeltaValues:(NSNumber *)display_delta_values;
|
- (void)setDisplayDeltaValues:(NSNumber *)display_delta_values;
|
||||||
- (void)setEscapeFilterRegexp:(NSNumber *)escape_filter_regexp;
|
- (void)setEscapeFilterRegexp:(NSNumber *)escape_filter_regexp;
|
||||||
- (void)setRemoveEmptyFolders:(NSNumber *)remove_empty_folders;
|
- (void)setRemoveEmptyFolders:(NSNumber *)remove_empty_folders;
|
||||||
- (void)setSizeThreshold:(int)size_threshold;
|
- (void)setSizeThreshold:(NSInteger)size_threshold;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
}
|
}
|
||||||
/* Helpers */
|
/* Helpers */
|
||||||
- (void)fillColumnsMenu;
|
- (void)fillColumnsMenu;
|
||||||
- (NSTableColumn *)getColumnForIdentifier:(int)aIdentifier title:(NSString *)aTitle width:(int)aWidth refCol:(NSTableColumn *)aColumn;
|
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;
|
||||||
- (NSArray *)getColumnsOrder;
|
- (NSArray *)getColumnsOrder;
|
||||||
- (NSDictionary *)getColumnsWidth;
|
- (NSDictionary *)getColumnsWidth;
|
||||||
- (NSArray *)getSelected:(BOOL)aDupesOnly;
|
- (NSArray *)getSelected:(BOOL)aDupesOnly;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
{
|
{
|
||||||
unichar key = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
|
unichar key = [[theEvent charactersIgnoringModifiers] characterAtIndex:0];
|
||||||
// get flags and strip the lower 16 (device dependant) bits
|
// get flags and strip the lower 16 (device dependant) bits
|
||||||
unsigned int flags = ( [theEvent modifierFlags] & 0x00FF );
|
NSUInteger flags = ( [theEvent modifierFlags] & 0x00FF );
|
||||||
if (((key == NSDeleteFunctionKey) || (key == NSDeleteCharacter)) && (flags == 0))
|
if (((key == NSDeleteFunctionKey) || (key == NSDeleteCharacter)) && (flags == 0))
|
||||||
[self sendAction:@selector(removeSelected:) to:[self delegate]];
|
[self sendAction:@selector(removeSelected:) to:[self delegate]];
|
||||||
else
|
else
|
||||||
@@ -85,9 +85,9 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[mi setTarget:self];
|
[mi setTarget:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSTableColumn *)getColumnForIdentifier:(int)aIdentifier title:(NSString *)aTitle width:(int)aWidth refCol:(NSTableColumn *)aColumn
|
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn
|
||||||
{
|
{
|
||||||
NSNumber *n = [NSNumber numberWithInt:aIdentifier];
|
NSNumber *n = [NSNumber numberWithInteger:aIdentifier];
|
||||||
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:[n stringValue]];
|
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:[n stringValue]];
|
||||||
[col setWidth:aWidth];
|
[col setWidth:aWidth];
|
||||||
[col setEditable:NO];
|
[col setEditable:NO];
|
||||||
@@ -123,7 +123,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
while (col = [e nextObject])
|
while (col = [e nextObject])
|
||||||
{
|
{
|
||||||
colId = [col identifier];
|
colId = [col identifier];
|
||||||
width = [NSNumber numberWithFloat:[col width]];
|
width = [NSNumber numberWithDouble:[col width]];
|
||||||
[result setObject:width forKey:colId];
|
[result setObject:width forKey:colId];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -136,7 +136,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
NSIndexSet *indexes = [matches selectedRowIndexes];
|
NSIndexSet *indexes = [matches selectedRowIndexes];
|
||||||
NSMutableArray *nodeList = [NSMutableArray array];
|
NSMutableArray *nodeList = [NSMutableArray array];
|
||||||
OVNode *node;
|
OVNode *node;
|
||||||
int i = [indexes firstIndex];
|
NSInteger i = [indexes firstIndex];
|
||||||
while (i != NSNotFound)
|
while (i != NSNotFound)
|
||||||
{
|
{
|
||||||
node = [matches itemAtRow:i];
|
node = [matches itemAtRow:i];
|
||||||
@@ -238,7 +238,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (IBAction)copyMarked:(id)sender
|
- (IBAction)copyMarked:(id)sender
|
||||||
{
|
{
|
||||||
int mark_count = [[py getMarkCount] intValue];
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
||||||
if (!mark_count)
|
if (!mark_count)
|
||||||
return;
|
return;
|
||||||
NSOpenPanel *op = [NSOpenPanel openPanel];
|
NSOpenPanel *op = [NSOpenPanel openPanel];
|
||||||
@@ -257,7 +257,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (IBAction)deleteMarked:(id)sender
|
- (IBAction)deleteMarked:(id)sender
|
||||||
{
|
{
|
||||||
int mark_count = [[py getMarkCount] intValue];
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
||||||
if (!mark_count)
|
if (!mark_count)
|
||||||
return;
|
return;
|
||||||
if ([Dialogs askYesNo:[NSString stringWithFormat:@"You are about to send %d files to Trash. Continue?",mark_count]] == NSAlertSecondButtonReturn) // NO
|
if ([Dialogs askYesNo:[NSString stringWithFormat:@"You are about to send %d files to Trash. Continue?",mark_count]] == NSAlertSecondButtonReturn) // NO
|
||||||
@@ -269,7 +269,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (IBAction)expandAll:(id)sender
|
- (IBAction)expandAll:(id)sender
|
||||||
{
|
{
|
||||||
for (int i=0;i < [matches numberOfRows];i++)
|
for (NSInteger i=0;i < [matches numberOfRows];i++)
|
||||||
[matches expandItem:[matches itemAtRow:i]];
|
[matches expandItem:[matches itemAtRow:i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (IBAction)moveMarked:(id)sender
|
- (IBAction)moveMarked:(id)sender
|
||||||
{
|
{
|
||||||
int mark_count = [[py getMarkCount] intValue];
|
NSInteger mark_count = [[py getMarkCount] intValue];
|
||||||
if (!mark_count)
|
if (!mark_count)
|
||||||
return;
|
return;
|
||||||
NSOpenPanel *op = [NSOpenPanel openPanel];
|
NSOpenPanel *op = [NSOpenPanel openPanel];
|
||||||
@@ -313,8 +313,8 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
{
|
{
|
||||||
// It might look like a complicated way to get the length of the current dupe list on the py side
|
// It might look like a complicated way to get the length of the current dupe list on the py side
|
||||||
// but after a lot of fussing around, believe it or not, it actually is.
|
// but after a lot of fussing around, believe it or not, it actually is.
|
||||||
int matchesTag = _powerMode ? 2 : 0;
|
NSInteger matchesTag = _powerMode ? 2 : 0;
|
||||||
int startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count];
|
NSInteger startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count];
|
||||||
[self performPySelection:[self getSelectedPaths:YES]];
|
[self performPySelection:[self getSelectedPaths:YES]];
|
||||||
[py makeSelectedReference];
|
[py makeSelectedReference];
|
||||||
// In some cases (when in a filtered view in Power Marker mode, it's possible that the demoted
|
// In some cases (when in a filtered view in Power Marker mode, it's possible that the demoted
|
||||||
@@ -384,7 +384,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (void)jobCompleted:(NSNotification *)aNotification
|
- (void)jobCompleted:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:ResultsChangedNotification object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:ResultsChangedNotification object:self];
|
||||||
int r = n2i([py getOperationalErrorCount]);
|
NSInteger r = n2i([py getOperationalErrorCount]);
|
||||||
id lastAction = [[ProgressController mainProgressController] jobId];
|
id lastAction = [[ProgressController mainProgressController] jobId];
|
||||||
if ([lastAction isEqualTo:jobCopy]) {
|
if ([lastAction isEqualTo:jobCopy]) {
|
||||||
if (r > 0)
|
if (r > 0)
|
||||||
|
|||||||
@@ -82,6 +82,16 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (PyDupeGuru *)py { return (PyDupeGuru *)py; }
|
- (PyDupeGuru *)py { return (PyDupeGuru *)py; }
|
||||||
|
|
||||||
//Delegate
|
//Delegate
|
||||||
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||||
|
{
|
||||||
|
NSMenu *actionsMenu = [[[NSApp mainMenu] itemWithTitle:@"Actions"] submenu];
|
||||||
|
// index 3 is just after "Export Results to XHTML"
|
||||||
|
NSMenuItem *mi = [actionsMenu insertItemWithTitle:@"Remove Dead Tracks in iTunes"
|
||||||
|
action:@selector(removeDeadTracks:) keyEquivalent:@"" atIndex:3];
|
||||||
|
[mi setTarget:result];
|
||||||
|
[super applicationDidFinishLaunching:aNotification];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
if (![[result window] isVisible])
|
if (![[result window] isVisible])
|
||||||
@@ -95,7 +105,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[ud setObject: [result getColumnsWidth] forKey:@"columnsWidth"];
|
[ud setObject: [result getColumnsWidth] forKey:@"columnsWidth"];
|
||||||
[py saveIgnoreList];
|
[py saveIgnoreList];
|
||||||
[py saveResults];
|
[py saveResults];
|
||||||
int sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"];
|
NSInteger sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"];
|
||||||
if (sc >= 10)
|
if (sc >= 10)
|
||||||
{
|
{
|
||||||
sc = -1;
|
sc = -1;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>hsft</string>
|
<string>hsft</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>5.7.0</string>
|
<string>5.7.1</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (void)enable:(NSNumber *)enable scanForTag:(NSString *)tag;
|
- (void)enable:(NSNumber *)enable scanForTag:(NSString *)tag;
|
||||||
- (void)scanDeadTracks;
|
- (void)scanDeadTracks;
|
||||||
- (void)removeDeadTracks;
|
- (void)removeDeadTracks;
|
||||||
- (int)deadTrackCount;
|
- (NSInteger)deadTrackCount;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
/* Actions */
|
/* Actions */
|
||||||
- (IBAction)clearIgnoreList:(id)sender
|
- (IBAction)clearIgnoreList:(id)sender
|
||||||
{
|
{
|
||||||
int i = n2i([py getIgnoreListCount]);
|
NSInteger i = n2i([py getIgnoreListCount]);
|
||||||
if (!i)
|
if (!i)
|
||||||
return;
|
return;
|
||||||
if ([Dialogs askYesNo:[NSString stringWithFormat:@"Do you really want to remove all %d items from the ignore list?",i]] == NSAlertSecondButtonReturn) // NO
|
if ([Dialogs askYesNo:[NSString stringWithFormat:@"Do you really want to remove all %d items from the ignore list?",i]] == NSAlertSecondButtonReturn) // NO
|
||||||
@@ -139,8 +139,8 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (IBAction)renameSelected:(id)sender
|
- (IBAction)renameSelected:(id)sender
|
||||||
{
|
{
|
||||||
int col = [matches columnWithIdentifier:@"0"];
|
NSInteger col = [matches columnWithIdentifier:@"0"];
|
||||||
int row = [matches selectedRow];
|
NSInteger row = [matches selectedRow];
|
||||||
[matches editColumn:col row:row withEvent:[NSApp currentEvent] select:YES];
|
[matches editColumn:col row:row withEvent:[NSApp currentEvent] select:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[_py setWordWeighting:[ud objectForKey:@"wordWeighting"]];
|
[_py setWordWeighting:[ud objectForKey:@"wordWeighting"]];
|
||||||
[_py setMixFileKind:[ud objectForKey:@"mixFileKind"]];
|
[_py setMixFileKind:[ud objectForKey:@"mixFileKind"]];
|
||||||
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
[_py setMatchSimilarWords:[ud objectForKey:@"matchSimilarWords"]];
|
||||||
int r = n2i([py doScan]);
|
NSInteger r = n2i([py doScan]);
|
||||||
[matches reloadData];
|
[matches reloadData];
|
||||||
[self refreshStats];
|
[self refreshStats];
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
@@ -272,7 +272,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
id lastAction = [[ProgressController mainProgressController] jobId];
|
id lastAction = [[ProgressController mainProgressController] jobId];
|
||||||
if ([lastAction isEqualTo:jobScanDeadTracks])
|
if ([lastAction isEqualTo:jobScanDeadTracks])
|
||||||
{
|
{
|
||||||
int deadTrackCount = [(PyDupeGuru *)py deadTrackCount];
|
NSInteger deadTrackCount = [(PyDupeGuru *)py deadTrackCount];
|
||||||
if (deadTrackCount > 0)
|
if (deadTrackCount > 0)
|
||||||
{
|
{
|
||||||
NSString *msg = @"Your iTunes Library contains %d dead tracks ready to be removed. Continue?";
|
NSString *msg = @"Your iTunes Library contains %d dead tracks ready to be removed. Continue?";
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
# http://www.hardcoded.net/licenses/hs_license
|
# http://www.hardcoded.net/licenses/hs_license
|
||||||
|
|
||||||
import objc
|
import objc
|
||||||
from AppKit import *
|
from Foundation import NSObject
|
||||||
|
|
||||||
|
from hsutil.cocoa import signature
|
||||||
|
|
||||||
from core_me.app_cocoa import DupeGuruME
|
from core_me.app_cocoa import DupeGuruME
|
||||||
from core.scanner import (SCAN_TYPE_FILENAME, SCAN_TYPE_FIELDS, SCAN_TYPE_FIELDS_NO_ORDER,
|
from core.scanner import (SCAN_TYPE_FILENAME, SCAN_TYPE_FIELDS, SCAN_TYPE_FIELDS_NO_ORDER,
|
||||||
@@ -133,7 +135,7 @@ class PyDupeGuru(PyApp):
|
|||||||
self.app.sort_groups(key,asc)
|
self.app.sort_groups(key,asc)
|
||||||
|
|
||||||
#---Information
|
#---Information
|
||||||
@objc.signature('i@:')
|
@signature('i@:')
|
||||||
def deadTrackCount(self):
|
def deadTrackCount(self):
|
||||||
return len(self.app.dead_tracks)
|
return len(self.app.dead_tracks)
|
||||||
|
|
||||||
@@ -150,11 +152,11 @@ class PyDupeGuru(PyApp):
|
|||||||
return self.app.last_op_error_count
|
return self.app.last_op_error_count
|
||||||
|
|
||||||
#---Data
|
#---Data
|
||||||
@objc.signature('i@:i')
|
@signature('i@:i')
|
||||||
def getOutlineViewMaxLevel_(self, tag):
|
def getOutlineViewMaxLevel_(self, tag):
|
||||||
return self.app.GetOutlineViewMaxLevel(tag)
|
return self.app.GetOutlineViewMaxLevel(tag)
|
||||||
|
|
||||||
@objc.signature('@@:i@')
|
@signature('@@:i@')
|
||||||
def getOutlineView_childCountsForPath_(self, tag, node_path):
|
def getOutlineView_childCountsForPath_(self, tag, node_path):
|
||||||
return self.app.GetOutlineViewChildCounts(tag, node_path)
|
return self.app.GetOutlineViewChildCounts(tag, node_path)
|
||||||
|
|
||||||
@@ -231,11 +233,11 @@ class PyDupeGuru(PyApp):
|
|||||||
def demoLimitDescription(self):
|
def demoLimitDescription(self):
|
||||||
return self.app.DEMO_LIMIT_DESC
|
return self.app.DEMO_LIMIT_DESC
|
||||||
|
|
||||||
@objc.signature('i@:')
|
@signature('i@:')
|
||||||
def isRegistered(self):
|
def isRegistered(self):
|
||||||
return self.app.registered
|
return self.app.registered
|
||||||
|
|
||||||
@objc.signature('i@:@@')
|
@signature('i@:@@')
|
||||||
def isCodeValid_withEmail_(self, code, email):
|
def isCodeValid_withEmail_(self, code, email):
|
||||||
return self.app.is_code_valid(code, email)
|
return self.app.is_code_valid(code, email)
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
CE381C9509914ACE003581CE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; };
|
CE381C9509914ACE003581CE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; };
|
||||||
CE381C9A09914ADF003581CE /* ResultWindow.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = ResultWindow.m; sourceTree = SOURCE_ROOT; };
|
CE381C9A09914ADF003581CE /* ResultWindow.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = ResultWindow.m; sourceTree = SOURCE_ROOT; };
|
||||||
CE381C9B09914ADF003581CE /* ResultWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ResultWindow.h; sourceTree = SOURCE_ROOT; };
|
CE381C9B09914ADF003581CE /* ResultWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ResultWindow.h; sourceTree = SOURCE_ROOT; };
|
||||||
CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = dg_cocoa.plugin; sourceTree = SOURCE_ROOT; };
|
CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; path = dg_cocoa.plugin; sourceTree = SOURCE_ROOT; };
|
||||||
CE3FBDD11094637800B72D77 /* DetailsPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DetailsPanel.xib; path = ../../base/xib/DetailsPanel.xib; sourceTree = "<group>"; };
|
CE3FBDD11094637800B72D77 /* DetailsPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DetailsPanel.xib; path = ../../base/xib/DetailsPanel.xib; sourceTree = "<group>"; };
|
||||||
CE3FBDD21094637800B72D77 /* DirectoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DirectoryPanel.xib; path = ../../base/xib/DirectoryPanel.xib; sourceTree = "<group>"; };
|
CE3FBDD21094637800B72D77 /* DirectoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DirectoryPanel.xib; path = ../../base/xib/DirectoryPanel.xib; sourceTree = "<group>"; };
|
||||||
CE49DEF20FDFEB810098617B /* BRSingleLineFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BRSingleLineFormatter.h; path = ../../cocoalib/brsinglelineformatter/BRSingleLineFormatter.h; sourceTree = SOURCE_ROOT; };
|
CE49DEF20FDFEB810098617B /* BRSingleLineFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BRSingleLineFormatter.h; path = ../../cocoalib/brsinglelineformatter/BRSingleLineFormatter.h; sourceTree = SOURCE_ROOT; };
|
||||||
@@ -456,9 +456,10 @@
|
|||||||
C01FCF5008A954540054247B /* Release */ = {
|
C01FCF5008A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
|
ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)";
|
||||||
ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
|
ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64;
|
||||||
GCC_C_LANGUAGE_STANDARD = c99;
|
GCC_C_LANGUAGE_STANDARD = c99;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>hsft</string>
|
<string>hsft</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.8.0</string>
|
<string>1.8.1</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# http://www.hardcoded.net/licenses/hs_license
|
# http://www.hardcoded.net/licenses/hs_license
|
||||||
|
|
||||||
import objc
|
import objc
|
||||||
from AppKit import *
|
from Foundation import NSObject
|
||||||
|
|
||||||
from core_pe import app_cocoa as app_pe_cocoa
|
from core_pe import app_cocoa as app_pe_cocoa
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class PyDupeGuru(PyApp):
|
|||||||
self.app.scanner.ignore_list.Clear()
|
self.app.scanner.ignore_list.Clear()
|
||||||
|
|
||||||
def clearPictureCache(self):
|
def clearPictureCache(self):
|
||||||
self.app.scanner.cached_blocks.clear()
|
self.app.scanner.clear_picture_cache()
|
||||||
|
|
||||||
def doScan(self):
|
def doScan(self):
|
||||||
return self.app.start_scanning()
|
return self.app.start_scanning()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# http://www.hardcoded.net/licenses/hs_license
|
# http://www.hardcoded.net/licenses/hs_license
|
||||||
|
|
||||||
import objc
|
import objc
|
||||||
from AppKit import *
|
from Foundation import NSObject
|
||||||
|
|
||||||
from core_se.app_cocoa import DupeGuru
|
from core_se.app_cocoa import DupeGuru
|
||||||
from core import scanner
|
from core import scanner
|
||||||
|
|||||||
@@ -12,17 +12,20 @@ from optparse import OptionParser
|
|||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
def main(edition, ui, dev):
|
def main(edition, ui, dev, build64):
|
||||||
if edition not in ('se', 'me', 'pe'):
|
if edition not in ('se', 'me', 'pe'):
|
||||||
edition = 'se'
|
edition = 'se'
|
||||||
if ui not in ('cocoa', 'qt'):
|
if ui not in ('cocoa', 'qt'):
|
||||||
ui = 'cocoa' if sys.platform == 'darwin' else 'qt'
|
ui = 'cocoa' if sys.platform == 'darwin' else 'qt'
|
||||||
build_type = 'Dev' if dev else 'Release'
|
build_type = 'Dev' if dev else 'Release'
|
||||||
print "Configuring dupeGuru {0} for UI {1} ({2})".format(edition.upper(), ui, build_type)
|
print "Configuring dupeGuru {0} for UI {1} ({2})".format(edition.upper(), ui, build_type)
|
||||||
|
if build64:
|
||||||
|
print "If possible, 64-bit builds will be made"
|
||||||
conf = {
|
conf = {
|
||||||
'edition': edition,
|
'edition': edition,
|
||||||
'ui': ui,
|
'ui': ui,
|
||||||
'dev': dev,
|
'dev': dev,
|
||||||
|
'build64': build64,
|
||||||
}
|
}
|
||||||
yaml.dump(conf, open('conf.yaml', 'w'))
|
yaml.dump(conf, open('conf.yaml', 'w'))
|
||||||
|
|
||||||
@@ -35,5 +38,7 @@ if __name__ == '__main__':
|
|||||||
help="Type of UI to build. 'qt' or 'cocoa'. Default is determined by your system.")
|
help="Type of UI to build. 'qt' or 'cocoa'. Default is determined by your system.")
|
||||||
parser.add_option('--dev', action='store_true', dest='dev', default=False,
|
parser.add_option('--dev', action='store_true', dest='dev', default=False,
|
||||||
help="If this flag is set, will configure for dev builds.")
|
help="If this flag is set, will configure for dev builds.")
|
||||||
|
parser.add_option('--64bit', action='store_false', dest='build64', default=False,
|
||||||
|
help="Build 64-bit app if possible.")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
main(options.edition, options.ui, options.dev)
|
main(options.edition, options.ui, options.dev, options.build64)
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
# http://www.hardcoded.net/licenses/hs_license
|
# http://www.hardcoded.net/licenses/hs_license
|
||||||
|
|
||||||
import objc
|
import objc
|
||||||
from Foundation import *
|
from Foundation import (NSNotificationCenter, NSUserDefaults, NSSearchPathForDirectoriesInDomains,
|
||||||
from AppKit import *
|
NSApplicationSupportDirectory, NSUserDomainMask)
|
||||||
import logging
|
import logging
|
||||||
import os.path as op
|
import os.path as op
|
||||||
|
|
||||||
from hsutil import io, cocoa, job
|
from hsutil import cocoa, job
|
||||||
from hsutil.cocoa import install_exception_hook
|
from hsutil.cocoa import install_exception_hook
|
||||||
from hsutil.misc import stripnone
|
from hsutil.misc import stripnone
|
||||||
from hsutil.reg import RegistrationRequired
|
from hsutil.reg import RegistrationRequired
|
||||||
@@ -53,6 +53,8 @@ class DupeGuru(app.DupeGuru):
|
|||||||
#--- Override
|
#--- Override
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _recycle_dupe(dupe):
|
def _recycle_dupe(dupe):
|
||||||
|
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||||
|
from AppKit import NSWorkspace, NSWorkspaceRecycleOperation
|
||||||
directory = unicode(dupe.path[:-1])
|
directory = unicode(dupe.path[:-1])
|
||||||
filename = dupe.name
|
filename = dupe.name
|
||||||
if objc.__version__ == '1.4': # For a while, we have to support this.
|
if objc.__version__ == '1.4': # For a while, we have to support this.
|
||||||
@@ -114,6 +116,8 @@ class DupeGuru(app.DupeGuru):
|
|||||||
self.make_reference(self.selected_dupes)
|
self.make_reference(self.selected_dupes)
|
||||||
|
|
||||||
def OpenSelected(self):
|
def OpenSelected(self):
|
||||||
|
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||||
|
from AppKit import NSWorkspace
|
||||||
if self.selected_dupes:
|
if self.selected_dupes:
|
||||||
path = unicode(self.selected_dupes[0].path)
|
path = unicode(self.selected_dupes[0].path)
|
||||||
NSWorkspace.sharedWorkspace().openFile_(path)
|
NSWorkspace.sharedWorkspace().openFile_(path)
|
||||||
@@ -149,6 +153,8 @@ class DupeGuru(app.DupeGuru):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def RevealSelected(self):
|
def RevealSelected(self):
|
||||||
|
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||||
|
from AppKit import NSWorkspace
|
||||||
if self.selected_dupes:
|
if self.selected_dupes:
|
||||||
path = unicode(self.selected_dupes[0].path)
|
path = unicode(self.selected_dupes[0].path)
|
||||||
NSWorkspace.sharedWorkspace().selectFile_inFileViewerRootedAtPath_(path,'')
|
NSWorkspace.sharedWorkspace().selectFile_inFileViewerRootedAtPath_(path,'')
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ import logging
|
|||||||
import plistlib
|
import plistlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from Foundation import *
|
from Foundation import NSBundle, NSUserDefaults, NSURL
|
||||||
from AppKit import *
|
|
||||||
from appscript import app, k, CommandError
|
from appscript import app, k, CommandError
|
||||||
|
|
||||||
from hsutil import io
|
from hsutil import io
|
||||||
@@ -23,7 +22,7 @@ from hsutil.cocoa import as_fetch
|
|||||||
from core import fs
|
from core import fs
|
||||||
from core import app_cocoa, directories
|
from core import app_cocoa, directories
|
||||||
from . import data
|
from . import data
|
||||||
from .cache import string_to_colors, Cache
|
from .cache import string_to_colors
|
||||||
from .scanner import ScannerPE
|
from .scanner import ScannerPE
|
||||||
|
|
||||||
mainBundle = NSBundle.mainBundle()
|
mainBundle = NSBundle.mainBundle()
|
||||||
@@ -74,7 +73,7 @@ def get_iphoto_database_path():
|
|||||||
|
|
||||||
def get_iphoto_pictures(plistpath):
|
def get_iphoto_pictures(plistpath):
|
||||||
if not io.exists(plistpath):
|
if not io.exists(plistpath):
|
||||||
raise InvalidPath(self)
|
return []
|
||||||
s = io.open(plistpath).read()
|
s = io.open(plistpath).read()
|
||||||
# There was a case where a guy had 0x10 chars in his plist, causing expat errors on loading
|
# There was a case where a guy had 0x10 chars in his plist, causing expat errors on loading
|
||||||
s = s.replace('\x10', '')
|
s = s.replace('\x10', '')
|
||||||
@@ -124,8 +123,7 @@ class Directories(directories.Directories):
|
|||||||
|
|
||||||
def add_path(self, path):
|
def add_path(self, path):
|
||||||
if path == Path('iPhoto Library'):
|
if path == Path('iPhoto Library'):
|
||||||
if path in self:
|
if path not in self:
|
||||||
raise AlreadyThereError()
|
|
||||||
self._dirs.append(path)
|
self._dirs.append(path)
|
||||||
else:
|
else:
|
||||||
directories.Directories.add_path(self, path)
|
directories.Directories.add_path(self, path)
|
||||||
@@ -136,8 +134,7 @@ class DupeGuruPE(app_cocoa.DupeGuru):
|
|||||||
app_cocoa.DupeGuru.__init__(self, data, 'dupeGuru Picture Edition', appid=5)
|
app_cocoa.DupeGuru.__init__(self, data, 'dupeGuru Picture Edition', appid=5)
|
||||||
self.scanner = ScannerPE()
|
self.scanner = ScannerPE()
|
||||||
self.directories = Directories()
|
self.directories = Directories()
|
||||||
p = op.join(self.appdata, 'cached_pictures.db')
|
self.scanner.cache_path = op.join(self.appdata, 'cached_pictures.db')
|
||||||
self.scanner.cached_blocks = Cache(p)
|
|
||||||
|
|
||||||
def _do_delete(self, j):
|
def _do_delete(self, j):
|
||||||
def op(dupe):
|
def op(dupe):
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import sqlite3 as sqlite
|
import sqlite3 as sqlite
|
||||||
|
|
||||||
import hsutil.sqlite
|
|
||||||
|
|
||||||
from _cache import string_to_colors
|
from _cache import string_to_colors
|
||||||
|
|
||||||
def colors_to_string(colors):
|
def colors_to_string(colors):
|
||||||
@@ -35,31 +33,10 @@ def colors_to_string(colors):
|
|||||||
class Cache(object):
|
class Cache(object):
|
||||||
"""A class to cache picture blocks.
|
"""A class to cache picture blocks.
|
||||||
"""
|
"""
|
||||||
def __init__(self, db=':memory:', threaded=True):
|
def __init__(self, db=':memory:'):
|
||||||
def create_tables():
|
|
||||||
sql = "create table pictures(path TEXT, blocks TEXT)"
|
|
||||||
self.con.execute(sql);
|
|
||||||
sql = "create index idx_path on pictures (path)"
|
|
||||||
self.con.execute(sql)
|
|
||||||
|
|
||||||
self.dbname = db
|
self.dbname = db
|
||||||
if threaded:
|
self.con = None
|
||||||
self.con = hsutil.sqlite.ThreadedConn(db, True)
|
self._create_con()
|
||||||
else:
|
|
||||||
self.con = sqlite.connect(db, isolation_level=None)
|
|
||||||
try:
|
|
||||||
self.con.execute("select * from pictures where 1=2")
|
|
||||||
except sqlite.OperationalError: # new db
|
|
||||||
create_tables()
|
|
||||||
except sqlite.DatabaseError, e: # corrupted db
|
|
||||||
logging.warning('Could not create picture cache because of an error: %s', str(e))
|
|
||||||
self.con.close()
|
|
||||||
os.remove(db)
|
|
||||||
if threaded:
|
|
||||||
self.con = hsutil.sqlite.ThreadedConn(db, True)
|
|
||||||
else:
|
|
||||||
self.con = sqlite.connect(db, isolation_level=None)
|
|
||||||
create_tables()
|
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
sql = "select count(*) from pictures where path = ?"
|
sql = "select count(*) from pictures where path = ?"
|
||||||
@@ -108,10 +85,37 @@ class Cache(object):
|
|||||||
except sqlite.DatabaseError, e:
|
except sqlite.DatabaseError, e:
|
||||||
logging.warning('DatabaseError while setting %r for key %r: %s', value, key, str(e))
|
logging.warning('DatabaseError while setting %r for key %r: %s', value, key, str(e))
|
||||||
|
|
||||||
def clear(self):
|
def _create_con(self, second_try=False):
|
||||||
sql = "delete from pictures"
|
def create_tables():
|
||||||
|
sql = "create table pictures(path TEXT, blocks TEXT)"
|
||||||
|
self.con.execute(sql);
|
||||||
|
sql = "create index idx_path on pictures (path)"
|
||||||
self.con.execute(sql)
|
self.con.execute(sql)
|
||||||
|
|
||||||
|
self.con = sqlite.connect(self.dbname, isolation_level=None)
|
||||||
|
try:
|
||||||
|
self.con.execute("select * from pictures where 1=2")
|
||||||
|
except sqlite.OperationalError: # new db
|
||||||
|
create_tables()
|
||||||
|
except sqlite.DatabaseError, e: # corrupted db
|
||||||
|
if second_try:
|
||||||
|
raise # Something really strange is happening
|
||||||
|
logging.warning('Could not create picture cache because of an error: %s', str(e))
|
||||||
|
self.con.close()
|
||||||
|
os.remove(self.dbname)
|
||||||
|
self._create_con(second_try=True)
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.close()
|
||||||
|
if self.dbname != ':memory:':
|
||||||
|
os.remove(self.dbname)
|
||||||
|
self._create_con()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
if self.con is not None:
|
||||||
|
self.con.close()
|
||||||
|
self.con = None
|
||||||
|
|
||||||
def filter(self, func):
|
def filter(self, func):
|
||||||
to_delete = [key for key in self if not func(key)]
|
to_delete = [key for key in self if not func(key)]
|
||||||
for key in to_delete:
|
for key in to_delete:
|
||||||
|
|||||||
@@ -26,20 +26,21 @@ BLOCK_COUNT_PER_SIDE = 15
|
|||||||
# collection made by the main process.
|
# collection made by the main process.
|
||||||
RESULTS_QUEUE_LIMIT = multiprocessing.cpu_count() * 2
|
RESULTS_QUEUE_LIMIT = multiprocessing.cpu_count() * 2
|
||||||
|
|
||||||
def prepare_pictures(pictures, cached_blocks, j=job.nulljob):
|
def prepare_pictures(pictures, cache_path, j=job.nulljob):
|
||||||
# The MemoryError handlers in there use logging without first caring about whether or not
|
# The MemoryError handlers in there use logging without first caring about whether or not
|
||||||
# there is enough memory left to carry on the operation because it is assumed that the
|
# there is enough memory left to carry on the operation because it is assumed that the
|
||||||
# MemoryError happens when trying to read an image file, which is freed from memory by the
|
# MemoryError happens when trying to read an image file, which is freed from memory by the
|
||||||
# time that MemoryError is raised.
|
# time that MemoryError is raised.
|
||||||
|
cache = Cache(cache_path)
|
||||||
prepared = [] # only pictures for which there was no error getting blocks
|
prepared = [] # only pictures for which there was no error getting blocks
|
||||||
try:
|
try:
|
||||||
for picture in j.iter_with_progress(pictures, 'Analyzed %d/%d pictures'):
|
for picture in j.iter_with_progress(pictures, 'Analyzed %d/%d pictures'):
|
||||||
picture.dimensions
|
picture.dimensions
|
||||||
picture.unicode_path = unicode(picture.path)
|
picture.unicode_path = unicode(picture.path)
|
||||||
try:
|
try:
|
||||||
if picture.unicode_path not in cached_blocks:
|
if picture.unicode_path not in cache:
|
||||||
blocks = picture.get_blocks(BLOCK_COUNT_PER_SIDE)
|
blocks = picture.get_blocks(BLOCK_COUNT_PER_SIDE)
|
||||||
cached_blocks[picture.unicode_path] = blocks
|
cache[picture.unicode_path] = blocks
|
||||||
prepared.append(picture)
|
prepared.append(picture)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logging.warning(unicode(e))
|
logging.warning(unicode(e))
|
||||||
@@ -49,6 +50,7 @@ def prepare_pictures(pictures, cached_blocks, j=job.nulljob):
|
|||||||
raise
|
raise
|
||||||
except MemoryError:
|
except MemoryError:
|
||||||
logging.warning('Ran out of memory while preparing pictures')
|
logging.warning('Ran out of memory while preparing pictures')
|
||||||
|
cache.close()
|
||||||
return prepared
|
return prepared
|
||||||
|
|
||||||
def get_match(first, second, percentage):
|
def get_match(first, second, percentage):
|
||||||
@@ -57,7 +59,7 @@ def get_match(first, second, percentage):
|
|||||||
return Match(first, second, percentage)
|
return Match(first, second, percentage)
|
||||||
|
|
||||||
def async_compare(ref_id, other_ids, dbname, threshold):
|
def async_compare(ref_id, other_ids, dbname, threshold):
|
||||||
cache = Cache(dbname, threaded=False)
|
cache = Cache(dbname)
|
||||||
limit = 100 - threshold
|
limit = 100 - threshold
|
||||||
ref_blocks = cache[ref_id]
|
ref_blocks = cache[ref_id]
|
||||||
pairs = cache.get_multiple(other_ids)
|
pairs = cache.get_multiple(other_ids)
|
||||||
@@ -70,10 +72,10 @@ def async_compare(ref_id, other_ids, dbname, threshold):
|
|||||||
percentage = 0
|
percentage = 0
|
||||||
if percentage >= threshold:
|
if percentage >= threshold:
|
||||||
results.append((ref_id, other_id, percentage))
|
results.append((ref_id, other_id, percentage))
|
||||||
cache.con.close()
|
cache.close()
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def getmatches(pictures, cached_blocks, threshold=75, match_scaled=False, j=job.nulljob):
|
def getmatches(pictures, cache_path, threshold=75, match_scaled=False, j=job.nulljob):
|
||||||
def empty_out_queue(queue, into):
|
def empty_out_queue(queue, into):
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
@@ -82,9 +84,9 @@ def getmatches(pictures, cached_blocks, threshold=75, match_scaled=False, j=job.
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
j = j.start_subjob([3, 7])
|
j = j.start_subjob([3, 7])
|
||||||
pictures = prepare_pictures(pictures, cached_blocks, j)
|
pictures = prepare_pictures(pictures, cache_path, j)
|
||||||
j = j.start_subjob([9, 1], 'Preparing for matching')
|
j = j.start_subjob([9, 1], 'Preparing for matching')
|
||||||
cache = cached_blocks
|
cache = Cache(cache_path)
|
||||||
id2picture = {}
|
id2picture = {}
|
||||||
dimensions2pictures = defaultdict(set)
|
dimensions2pictures = defaultdict(set)
|
||||||
for picture in pictures:
|
for picture in pictures:
|
||||||
@@ -95,6 +97,7 @@ def getmatches(pictures, cached_blocks, threshold=75, match_scaled=False, j=job.
|
|||||||
dimensions2pictures[picture.dimensions].add(picture)
|
dimensions2pictures[picture.dimensions].add(picture)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
cache.close()
|
||||||
pictures = [p for p in pictures if hasattr(p, 'cache_id')]
|
pictures = [p for p in pictures if hasattr(p, 'cache_id')]
|
||||||
pool = multiprocessing.Pool()
|
pool = multiprocessing.Pool()
|
||||||
async_results = []
|
async_results = []
|
||||||
@@ -108,7 +111,7 @@ def getmatches(pictures, cached_blocks, threshold=75, match_scaled=False, j=job.
|
|||||||
others = [pic for pic in others if not pic.is_ref]
|
others = [pic for pic in others if not pic.is_ref]
|
||||||
if others:
|
if others:
|
||||||
cache_ids = [f.cache_id for f in others]
|
cache_ids = [f.cache_id for f in others]
|
||||||
args = (ref.cache_id, cache_ids, cached_blocks.dbname, threshold)
|
args = (ref.cache_id, cache_ids, cache_path, threshold)
|
||||||
async_results.append(pool.apply_async(async_compare, args))
|
async_results.append(pool.apply_async(async_compare, args))
|
||||||
if len(async_results) > RESULTS_QUEUE_LIMIT:
|
if len(async_results) > RESULTS_QUEUE_LIMIT:
|
||||||
result = async_results.pop(0)
|
result = async_results.pop(0)
|
||||||
|
|||||||
@@ -10,12 +10,18 @@
|
|||||||
from core.scanner import Scanner
|
from core.scanner import Scanner
|
||||||
|
|
||||||
from . import matchbase
|
from . import matchbase
|
||||||
|
from .cache import Cache
|
||||||
|
|
||||||
class ScannerPE(Scanner):
|
class ScannerPE(Scanner):
|
||||||
cached_blocks = None
|
cache_path = None
|
||||||
match_scaled = False
|
match_scaled = False
|
||||||
threshold = 75
|
threshold = 75
|
||||||
|
|
||||||
def _getmatches(self, files, j):
|
def _getmatches(self, files, j):
|
||||||
return matchbase.getmatches(files, self.cached_blocks, self.threshold, self.match_scaled, j)
|
return matchbase.getmatches(files, self.cache_path, self.threshold, self.match_scaled, j)
|
||||||
|
|
||||||
|
def clear_picture_cache(self):
|
||||||
|
cache = Cache(self.cache_path)
|
||||||
|
cache.clear()
|
||||||
|
cache.close()
|
||||||
|
|
||||||
|
|||||||
@@ -137,18 +137,3 @@ class TCCacheSQLEscape(TestCase):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
self.fail()
|
self.fail()
|
||||||
|
|
||||||
|
|
||||||
class TCCacheThreaded(TestCase):
|
|
||||||
def test_access_cache(self):
|
|
||||||
def thread_run():
|
|
||||||
try:
|
|
||||||
c['foo'] = [(1,2,3)]
|
|
||||||
except sqlite.ProgrammingError:
|
|
||||||
self.fail()
|
|
||||||
|
|
||||||
c = Cache()
|
|
||||||
t = threading.Thread(target=thread_run)
|
|
||||||
t.start()
|
|
||||||
t.join()
|
|
||||||
self.assertEqual([(1,2,3)], c['foo'])
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ from __future__ import unicode_literals
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import objc
|
import objc
|
||||||
from AppKit import *
|
from AppKit import NSWorkspace
|
||||||
|
|
||||||
from hsutil import io
|
from hsutil import io
|
||||||
from hsutil.path import Path
|
from hsutil.path import Path
|
||||||
from hsutil.str import get_file_ext
|
|
||||||
|
|
||||||
from core import fs
|
from core import fs
|
||||||
from core.app_cocoa import DupeGuru as DupeGuruBase
|
from core.app_cocoa import DupeGuru as DupeGuruBase
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
- date: 2010-01-19
|
||||||
|
version: 5.7.1
|
||||||
|
description: |
|
||||||
|
* The Mac OS X version of dupeGuru ME is now 64-bit!
|
||||||
|
* Improved memory usage for Contents scans. (#75)
|
||||||
|
* Improved scanning speed when ref directories are involved. (#77)
|
||||||
|
* Show a message dialog at the end of the scan if no duplicates are found. (#81)
|
||||||
|
* Re-added the "Remove Dead Tracks in iTunes" menu item which got lost in 5.7.0.
|
||||||
- date: 2009-12-18
|
- date: 2009-12-18
|
||||||
version: 5.7.0
|
version: 5.7.0
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
- date: 2010-01-15
|
||||||
|
version: 1.8.1
|
||||||
|
description: |
|
||||||
|
* Improved scanning speed when ref directories are involved. (#77)
|
||||||
|
* Show a message dialog at the end of the scan if no duplicates are found. (#81)
|
||||||
|
* Fixed a crash when adding the iPhoto library twice. [Mac OS X] (#80)
|
||||||
- date: 2009-12-16
|
- date: 2009-12-16
|
||||||
version: 1.8.0
|
version: 1.8.0
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from preferences_dialog import PreferencesDialog
|
|||||||
class DupeGuru(DupeGuruBase):
|
class DupeGuru(DupeGuruBase):
|
||||||
LOGO_NAME = 'logo_me'
|
LOGO_NAME = 'logo_me'
|
||||||
NAME = 'dupeGuru Music Edition'
|
NAME = 'dupeGuru Music Edition'
|
||||||
VERSION = '5.7.0'
|
VERSION = '5.7.1'
|
||||||
DELTA_COLUMNS = frozenset([2, 3, 4, 5, 7, 8])
|
DELTA_COLUMNS = frozenset([2, 3, 4, 5, 7, 8])
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class File(fs.File):
|
|||||||
class DupeGuru(DupeGuruBase):
|
class DupeGuru(DupeGuruBase):
|
||||||
LOGO_NAME = 'logo_pe'
|
LOGO_NAME = 'logo_pe'
|
||||||
NAME = 'dupeGuru Picture Edition'
|
NAME = 'dupeGuru Picture Edition'
|
||||||
VERSION = '1.8.0'
|
VERSION = '1.8.1'
|
||||||
DELTA_COLUMNS = frozenset([2, 5, 6])
|
DELTA_COLUMNS = frozenset([2, 5, 6])
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -65,7 +65,7 @@ class DupeGuru(DupeGuruBase):
|
|||||||
def _setup(self):
|
def _setup(self):
|
||||||
self.scanner = ScannerPE()
|
self.scanner = ScannerPE()
|
||||||
self.directories.fileclasses = [File]
|
self.directories.fileclasses = [File]
|
||||||
self.scanner.cached_blocks = Cache(op.join(self.appdata, 'cached_pictures.db'))
|
self.scanner.cache_path = op.join(self.appdata, 'cached_pictures.db')
|
||||||
DupeGuruBase._setup(self)
|
DupeGuruBase._setup(self)
|
||||||
|
|
||||||
def _update_options(self):
|
def _update_options(self):
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ class MainWindow(MainWindowBase):
|
|||||||
title = "Clear Picture Cache"
|
title = "Clear Picture Cache"
|
||||||
msg = "Do you really want to remove all your cached picture analysis?"
|
msg = "Do you really want to remove all your cached picture analysis?"
|
||||||
if self._confirm(title, msg, QMessageBox.No):
|
if self._confirm(title, msg, QMessageBox.No):
|
||||||
self.app.scanner.cached_blocks.clear()
|
self.app.scanner.clear_picture_cache()
|
||||||
QMessageBox.information(self, title, "Picture cache cleared.")
|
QMessageBox.information(self, title, "Picture cache cleared.")
|
||||||
|
|
||||||
Reference in New Issue
Block a user