-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHachidoriScripting.m
44 lines (40 loc) · 1.32 KB
/
HachidoriScripting.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// HachidoriScripting.m
// Hachidori
//
// Created by Tail Red on 6/19/15.
// Copyright 2015 MAL Updater OS X Group and James Moy All rights reserved. Code licensed under New BSD License
//
#import "HachidoriScripting.h"
#import "AppDelegate.h"
@implementation ScriptingGetStatus
// AppleScript command for GetStatus
- (id)performDefaultImplementation {
AppDelegate * delegate = (AppDelegate *)[NSApplication sharedApplication].delegate;
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[delegate getNowPlaying] options:0 error:&error];
if (!jsonData) {}
else {
NSString *JSONString = [[NSString alloc] initWithBytes:jsonData.bytes length:jsonData.length encoding:NSUTF8StringEncoding];
// Output JSON
return JSONString;
}
return @"";
}
@end
@implementation ScriptingScrobbleNow
// AppleScript command for ScrobbleNow
- (id)performDefaultImplementation {
AppDelegate * delegate = (AppDelegate *)[NSApplication sharedApplication].delegate;
[delegate updatenow:nil];
return nil;
}
@end
@implementation ScriptingToggleAutoScrobble
// AppleScript command for ToggleAutoScrobble
- (id)performDefaultImplementation{
AppDelegate * delegate = (AppDelegate *)[NSApplication sharedApplication].delegate;
[delegate toggletimer:nil];
return nil;
}
@end