-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Hachidori.h
116 lines (111 loc) · 4.48 KB
/
Hachidori.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// Hachidori.h
// Hachidori
//
// Created by James M. on 8/7/10.
// Copyright 2009-2018 MAL Updater OS X Group and James Moy All rights reserved. Code licensed under New BSD License
//
#import <Cocoa/Cocoa.h>
#import <CocoaOniguruma/OnigRegexp.h>
#import <CocoaOniguruma/OnigRegexpUtility.h>
#import <AFNetworking/AFOAuth2Manager.h>
#import "AniListConstants.h"
#import "DiscordManager.h"
#import "DetectedScrobbleStatus.h"
#import "LastScrobbleStatus.h"
#import "HachidoriTwitterManager.h"
#import "AniListUpdateManager.h"
#import "KitsuUpdateManager.h"
#import "MALUpdateManager.h"
@class Reachability;
@class Detection;
@class AFHTTPSessionManager;
@class HachidoriTwitterManager;
@interface Hachidori : NSObject
typedef NS_ENUM(unsigned int, ScrobbleStatus) {
ScrobblerNothingPlaying = 0,
ScrobblerSameEpisodePlaying = 1,
ScrobblerUpdateNotNeeded = 2,
ScrobblerConfirmNeeded = 3,
ScrobblerDetectedMedia = 4,
ScrobblerAddTitleSuccessful = 21,
ScrobblerUpdateSuccessful = 22,
ScrobblerOfflineQueued = 23,
ScrobblerTitleNotFound = 51,
ScrobblerAddTitleFailed = 52,
ScrobblerUpdateFailed = 53,
ScrobblerFailed = 54,
ScrobblerRefreshTokenFailed = 55,
ScrobblerInvalidScrobble = 58
};
typedef NS_ENUM(unsigned int, ratingType) {
ratingSimple = 0,
ratingStandard = 1,
ratingAdvanced = 2
};
typedef NS_ENUM(unsigned int, anilistRatingType) {
ratingPoint100 = 0,
ratingPoint10Decimal = 1,
ratingPoint10 = 2,
ratingPoint5 = 3,
ratingPoint3 = 4
};
typedef NS_ENUM(unsigned int, hachidoriservice) {
serviceKitsu = 0,
serviceAniList = 1,
serviceMAL = 2
};
@property (strong) AFHTTPSessionManager *syncmanager;
@property (strong) AFHTTPSessionManager *asyncmanager;
@property (strong) NSString *username;
@property (strong) NSString *malusername;
@property BOOL _online;
@property BOOL testing;
@property (getter=getSuccess) BOOL Success;
@property (strong) NSString *MALID;
@property (strong) NSString *MALApiUrl;
@property BOOL correcting;
@property BOOL unittesting;
@property (strong) Reachability* reach;
@property (strong, setter=setManagedObjectContext:) NSManagedObjectContext *managedObjectContext;
@property (getter=getOnlineStatus) bool online;
@property (getter=getRatingType) int ratingtype;
@property (strong) Detection *detection;
@property (strong) HachidoriTwitterManager *twittermanager;
@property (strong) DiscordManager *discordmanager;
@property (strong) AniListUpdateManager *anilistmanager;
@property (strong) KitsuUpdateManager *kitsumanager;
@property (strong) MALUpdateManager *malmanger;
- (void)setManagedObjectContext:(NSManagedObjectContext *)context;
- (int)getQueueCount;
+ (long)currentService;
+ (NSString *)currentServiceName;
+ (NSString *)serviceNameWithServiceID:(int)service;
+ (AFOAuthCredential *)getCurrentFirstAccount;
+ (AFOAuthCredential *)getFirstAccount:(long)service;
+ (NSString *)getUserid:(int)service;
- (int)startscrobbling;
- (NSDictionary *)scrobblefromqueue;
- (int)scrobbleagain:(NSString *)showtitle Episode:(NSString *)episode correctonce:(BOOL)onetime;
- (int)scrobble;
- (BOOL)confirmupdate;
- (NSDictionary *)checkexpired;
- (void)refreshtokenwithdictionary:(NSDictionary *)servicedict successHandler:(void (^)(bool success, int numfailed, NSArray *failedservices)) successHandler;
- (void)refreshtokenWithService:(int)service successHandler:(void (^)(bool success)) successHandler;
- (void)retrieveUserID:(void (^)(int userid, NSString *username, NSString *scoreformat)) completionHandler error:(void (^)(NSError * error)) errorHandler withService:(int)service;
- (void)retrieveUserID:(void (^)(int userid, NSString *username, NSString *scoreformat)) completionHandler error:(void (^)(NSError * error)) errorHandler withService:(int)service withCredential:(AFOAuthCredential *)cred;
- (void)resetinfo;
- (int)getUserRatingType;
- (void)setNotifier;
- (void)sendDiscordPresence:(LastScrobbleStatus *)lscrobble;
// Unit Testing Only
- (NSDictionary *)runUnitTest:(NSString *)title episode:(NSString *)episode season:(int)season group:(NSString *)group type:(NSString *)type;
// Scrobble Status
- (DetectedScrobbleStatus *)getDetectedScrobbleForService:(int)service;
- (void)setDetectedScrobbleStatus:(DetectedScrobbleStatus *)dscrobble withService:(int)service;
- (LastScrobbleStatus *)getLastScrobbleForService:(int)service;
- (void)setLastScrobbleStatus:(LastScrobbleStatus *)lscrobble withService:(int)service;
- (void)resetDetected;
- (LastScrobbleStatus *)lastscrobble;
- (DetectedScrobbleStatus *)detectedscrobble;
@end