Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Kuijt authored and Johan Kuijt committed Jan 25, 2014
2 parents 56b7feb + 36d3320 commit 457e838
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ Trakt Scrobbler for iTunes/AppleTV. Download a binary version [here](http://w3f.

Any feedback or bug reports are welcome. Please use the [`issues`](https://github.com/yo-han/Traktable/issues) page or the feedback option in the app to report your feedback.

## Install

Rename config-example.plist to config.plist and enter a tvdb and trakt api key.

## Changelog

See what's new in the [changelog](https://github.com/yo-han/Traktable/wiki/Changelog)
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions Traktable/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(VLCPlayerStateDidChange) name:@"VLCPlayerStateDidChange" object:nil suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(iTunesSourceSaved:) name:@"com.apple.iTunes.sourceSaved" object:@"com.apple.iTunes.sources" suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];

[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(iTunesSourceSaved:) name:@"com.apple.iTunes.sourceInfo" object:@"com.apple.iTunes.sources" suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
}

- (IBAction)showLog:(id)sender {
Expand Down
25 changes: 23 additions & 2 deletions Traktable/ITLibrary.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ @interface ITLibrary()

- (id)init;
- (void)checkTracks:(NSArray *)tracks;
<<<<<<< HEAD
=======
- (void)createDir:(NSString *)dir;
>>>>>>> 36d3320923f18ac9a8d3e894293a6ad9602a8cdb

@property dispatch_queue_t queue;
@property dispatch_group_t dispatchGroup;
Expand All @@ -28,6 +32,10 @@ - (void)checkTracks:(NSArray *)tracks;
@implementation ITLibrary

@synthesize iTunesBridge;
<<<<<<< HEAD
=======
@synthesize dbQueue=_dbQueue;
>>>>>>> 36d3320923f18ac9a8d3e894293a6ad9602a8cdb
@synthesize dbFilePath;
@synthesize firstImport;

Expand All @@ -36,7 +44,19 @@ - (id)init {
self = [super init];
if (self) {

<<<<<<< HEAD
iTunesBridge = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
=======
[self resetDb];
}

_dbQueue = [FMDatabaseQueue databaseQueueWithPath:dbFilePath];
_queue = dispatch_queue_create("traktable.sync.queue", NULL);
_dispatchGroup = dispatch_group_create();

[self.dbQueue inDatabase:^(FMDatabase *db) {
FMResultSet *s = [db executeQuery:@"SELECT playedCount FROM library"];
>>>>>>> 36d3320923f18ac9a8d3e894293a6ad9602a8cdb

NSString *appSupportPath = [ITConstants applicationSupportFolder];
[ITUtil createDir:appSupportPath];
Expand Down Expand Up @@ -151,6 +171,7 @@ - (void)syncLibrary {
NSArray *shows = [self getVideos:iTunesESpKTVShows noCheck:NO];

firstImport = NO;

[self checkTracks:movies];
[self checkTracks:shows];

Expand All @@ -160,6 +181,7 @@ - (void)syncLibrary {
- (void)checkTracks:(NSArray *)tracks {

__block NSMutableArray *seenVideos = [NSMutableArray array];

ITVideo *video = [ITVideo new];
ITApi *api = [ITApi new];

Expand Down Expand Up @@ -246,9 +268,8 @@ - (void)checkTracks:(NSArray *)tracks {

}


dispatch_group_notify(self.dispatchGroup, self.queue, ^{

if([seenVideos count] > 0)
[api seen:seenVideos type:iTunesEVdKMovie video:nil];
});
Expand Down

0 comments on commit 457e838

Please sign in to comment.