2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2006-2022 Transmission authors and contributors.
|
|
|
|
// It may be used under the MIT (SPDX: MIT) license.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-06-29 00:15:52 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
2009-09-05 01:58:13 +00:00
|
|
|
#import <Quartz/Quartz.h>
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2018-09-30 10:37:30 +00:00
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
|
2008-10-12 13:22:13 +00:00
|
|
|
@class FileListNode;
|
|
|
|
|
2021-08-07 07:27:56 +00:00
|
|
|
typedef NS_ENUM(unsigned int, TorrentDeterminationType) {
|
2017-01-24 17:53:16 +00:00
|
|
|
TorrentDeterminationAutomatic = 0,
|
|
|
|
TorrentDeterminationUserSpecified
|
2021-08-07 07:27:56 +00:00
|
|
|
};
|
2012-10-30 00:22:10 +00:00
|
|
|
|
|
|
|
#define kTorrentDidChangeGroupNotification @"TorrentDidChangeGroup"
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@interface Torrent : NSObject<NSCopying, QLPreviewItem>
|
2021-08-07 07:27:56 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (instancetype)initWithPath:(NSString*)path
|
|
|
|
location:(NSString*)location
|
|
|
|
deleteTorrentFile:(BOOL)torrentDelete
|
|
|
|
lib:(tr_session*)lib;
|
|
|
|
- (instancetype)initWithTorrentStruct:(tr_torrent*)torrentStruct location:(NSString*)location lib:(tr_session*)lib;
|
|
|
|
- (instancetype)initWithMagnetAddress:(NSString*)address location:(NSString*)location lib:(tr_session*)lib;
|
2022-03-02 23:11:04 +00:00
|
|
|
- (void)setResumeStatusForTorrent:(Torrent*)torrent withHistory:(NSDictionary*)history forcePause:(BOOL)pause;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSDictionary* history;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)closeRemoveTorrent:(BOOL)trashFiles;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)changeDownloadFolderBeforeUsing:(NSString*)folder determinationType:(TorrentDeterminationType)determinationType;
|
2009-10-21 13:01:14 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSString* currentDirectory;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)getAvailability:(int8_t*)tab size:(NSInteger)size;
|
|
|
|
- (void)getAmountFinished:(float*)tab size:(NSInteger)size;
|
|
|
|
@property(nonatomic) NSIndexSet* previousFinishedPieces;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)update;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)startTransferIgnoringQueue:(BOOL)ignoreQueue;
|
|
|
|
- (void)startTransferNoQueue;
|
|
|
|
- (void)startTransfer;
|
|
|
|
- (void)stopTransfer;
|
2022-07-23 06:04:34 +00:00
|
|
|
- (void)startQueue;
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)sleep;
|
|
|
|
- (void)wakeUp;
|
2022-07-23 06:04:34 +00:00
|
|
|
- (void)idleLimitHit;
|
|
|
|
- (void)ratioLimitHit;
|
|
|
|
- (void)metadataRetrieved;
|
|
|
|
- (void)completenessChange:(tr_completeness)status wasRunning:(BOOL)wasRunning;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) NSUInteger queuePosition;
|
2011-08-02 12:43:26 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)manualAnnounce;
|
|
|
|
@property(nonatomic, readonly) BOOL canManualAnnounce;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)resetCache;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, getter=isMagnet, readonly) BOOL magnet;
|
|
|
|
@property(nonatomic, readonly) NSString* magnetLink;
|
2009-11-25 05:04:19 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) CGFloat ratio;
|
|
|
|
@property(nonatomic) tr_ratiolimit ratioSetting;
|
|
|
|
@property(nonatomic) CGFloat ratioLimit;
|
|
|
|
@property(nonatomic, readonly) CGFloat progressStopRatio;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) tr_idlelimit idleSetting;
|
|
|
|
@property(nonatomic) NSUInteger idleLimitMinutes;
|
2010-07-16 03:12:57 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (BOOL)usesSpeedLimit:(BOOL)upload;
|
|
|
|
- (void)setUseSpeedLimit:(BOOL)use upload:(BOOL)upload;
|
2022-05-14 05:31:24 +00:00
|
|
|
- (NSUInteger)speedLimit:(BOOL)upload;
|
|
|
|
- (void)setSpeedLimit:(NSUInteger)limit upload:(BOOL)upload;
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) BOOL usesGlobalSpeedLimit;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) uint16_t maxPeerConnect;
|
2007-12-22 05:21:25 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) BOOL removeWhenFinishSeeding;
|
2012-07-07 01:47:12 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) BOOL waitingToStart;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic) tr_priority_t priority;
|
2009-04-20 02:45:27 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
+ (BOOL)trashFile:(NSString*)path error:(NSError**)error;
|
|
|
|
- (void)moveTorrentDataFileTo:(NSString*)folder;
|
|
|
|
- (void)copyTorrentFileTo:(NSString*)path;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2022-06-29 04:20:42 +00:00
|
|
|
@property(nonatomic, readonly) BOOL alertForRemainingDiskSpace;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSImage* icon;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSString* name;
|
|
|
|
@property(nonatomic, getter=isFolder, readonly) BOOL folder;
|
|
|
|
@property(nonatomic, readonly) uint64_t size;
|
|
|
|
@property(nonatomic, readonly) uint64_t sizeLeft;
|
2008-02-22 01:36:30 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSMutableArray* allTrackerStats;
|
2022-04-29 22:51:40 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<NSString*>* allTrackersFlat; //used by GroupRules
|
2021-08-15 09:41:48 +00:00
|
|
|
- (BOOL)addTrackerToNewTier:(NSString*)tracker;
|
|
|
|
- (void)removeTrackers:(NSSet*)trackers;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSString* comment;
|
|
|
|
@property(nonatomic, readonly) NSString* creator;
|
|
|
|
@property(nonatomic, readonly) NSDate* dateCreated;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSInteger pieceSize;
|
|
|
|
@property(nonatomic, readonly) NSInteger pieceCount;
|
|
|
|
@property(nonatomic, readonly) NSString* hashString;
|
|
|
|
@property(nonatomic, readonly) BOOL privateTorrent;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSString* torrentLocation;
|
|
|
|
@property(nonatomic, readonly) NSString* dataLocation;
|
|
|
|
- (NSString*)fileLocation:(FileListNode*)node;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)renameTorrent:(NSString*)newName completionHandler:(void (^)(BOOL didRename))completionHandler;
|
|
|
|
- (void)renameFileNode:(FileListNode*)node
|
|
|
|
withName:(NSString*)newName
|
|
|
|
completionHandler:(void (^)(BOOL didRename))completionHandler;
|
2013-01-22 00:09:48 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) CGFloat progress;
|
|
|
|
@property(nonatomic, readonly) CGFloat progressDone;
|
|
|
|
@property(nonatomic, readonly) CGFloat progressLeft;
|
|
|
|
@property(nonatomic, readonly) CGFloat checkingProgress;
|
2021-08-07 07:27:56 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) CGFloat availableDesired;
|
2021-08-07 07:27:56 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, getter=isActive, readonly) BOOL active;
|
|
|
|
@property(nonatomic, getter=isSeeding, readonly) BOOL seeding;
|
|
|
|
@property(nonatomic, getter=isChecking, readonly) BOOL checking;
|
|
|
|
@property(nonatomic, getter=isCheckingWaiting, readonly) BOOL checkingWaiting;
|
|
|
|
@property(nonatomic, readonly) BOOL allDownloaded;
|
|
|
|
@property(nonatomic, getter=isComplete, readonly) BOOL complete;
|
|
|
|
@property(nonatomic, getter=isFinishedSeeding, readonly) BOOL finishedSeeding;
|
|
|
|
@property(nonatomic, getter=isError, readonly) BOOL error;
|
|
|
|
@property(nonatomic, getter=isAnyErrorOrWarning, readonly) BOOL anyErrorOrWarning;
|
|
|
|
@property(nonatomic, readonly) NSString* errorMessage;
|
|
|
|
|
2022-04-29 22:51:40 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<NSDictionary*>* peers;
|
2021-08-15 09:41:48 +00:00
|
|
|
|
|
|
|
@property(nonatomic, readonly) NSUInteger webSeedCount;
|
2022-04-29 22:51:40 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<NSDictionary*>* webSeeds;
|
2021-08-15 09:41:48 +00:00
|
|
|
|
|
|
|
@property(nonatomic, readonly) NSString* progressString;
|
|
|
|
@property(nonatomic, readonly) NSString* statusString;
|
|
|
|
@property(nonatomic, readonly) NSString* shortStatusString;
|
|
|
|
@property(nonatomic, readonly) NSString* remainingTimeString;
|
|
|
|
|
|
|
|
@property(nonatomic, readonly) NSString* stateString;
|
2022-05-14 05:31:24 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersConnected;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersTracker;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersIncoming;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersCache;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersPex;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersDHT;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersLocal;
|
|
|
|
@property(nonatomic, readonly) NSUInteger totalPeersLTEP;
|
|
|
|
|
|
|
|
@property(nonatomic, readonly) NSUInteger peersSendingToUs;
|
|
|
|
@property(nonatomic, readonly) NSUInteger peersGettingFromUs;
|
2021-08-15 09:41:48 +00:00
|
|
|
|
|
|
|
@property(nonatomic, readonly) CGFloat downloadRate;
|
|
|
|
@property(nonatomic, readonly) CGFloat uploadRate;
|
|
|
|
@property(nonatomic, readonly) CGFloat totalRate;
|
|
|
|
@property(nonatomic, readonly) uint64_t haveVerified;
|
|
|
|
@property(nonatomic, readonly) uint64_t haveTotal;
|
|
|
|
@property(nonatomic, readonly) uint64_t totalSizeSelected;
|
|
|
|
@property(nonatomic, readonly) uint64_t downloadedTotal;
|
|
|
|
@property(nonatomic, readonly) uint64_t uploadedTotal;
|
|
|
|
@property(nonatomic, readonly) uint64_t failedHash;
|
|
|
|
|
|
|
|
@property(nonatomic, readonly) NSInteger groupValue;
|
|
|
|
- (void)setGroupValue:(NSInteger)groupValue determinationType:(TorrentDeterminationType)determinationType;
|
|
|
|
;
|
|
|
|
@property(nonatomic, readonly) NSInteger groupOrderValue;
|
|
|
|
- (void)checkGroupValueForRemoval:(NSNotification*)notification;
|
|
|
|
|
2022-04-29 22:51:40 +00:00
|
|
|
@property(nonatomic, readonly) NSArray<FileListNode*>* fileList;
|
|
|
|
@property(nonatomic, readonly) NSArray<FileListNode*>* flatFileList;
|
2022-05-14 05:31:24 +00:00
|
|
|
@property(nonatomic, readonly) NSUInteger fileCount;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
//methods require fileStats to have been updated recently to be accurate
|
2021-08-15 09:41:48 +00:00
|
|
|
- (CGFloat)fileProgress:(FileListNode*)node;
|
|
|
|
- (BOOL)canChangeDownloadCheckForFile:(NSUInteger)index;
|
|
|
|
- (BOOL)canChangeDownloadCheckForFiles:(NSIndexSet*)indexSet;
|
|
|
|
- (NSInteger)checkForFiles:(NSIndexSet*)indexSet;
|
|
|
|
- (void)setFileCheckState:(NSInteger)state forIndexes:(NSIndexSet*)indexSet;
|
|
|
|
- (void)setFilePriority:(tr_priority_t)priority forIndexes:(NSIndexSet*)indexSet;
|
|
|
|
- (BOOL)hasFilePriority:(tr_priority_t)priority forIndexes:(NSIndexSet*)indexSet;
|
|
|
|
- (NSSet*)filePrioritiesForIndexes:(NSIndexSet*)indexSet;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSDate* dateAdded;
|
|
|
|
@property(nonatomic, readonly) NSDate* dateCompleted;
|
|
|
|
@property(nonatomic, readonly) NSDate* dateActivity;
|
|
|
|
@property(nonatomic, readonly) NSDate* dateActivityOrAdd;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSInteger secondsDownloading;
|
|
|
|
@property(nonatomic, readonly) NSInteger secondsSeeding;
|
2010-12-23 20:07:41 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSInteger stalledMinutes;
|
|
|
|
@property(nonatomic, getter=isStalled, readonly) BOOL stalled;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
- (void)updateTimeMachineExclude;
|
2009-10-21 22:20:43 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) NSInteger stateSortKey;
|
|
|
|
@property(nonatomic, readonly) NSString* trackerSortKey;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
@property(nonatomic, readonly) tr_torrent* torrentStruct;
|
2007-09-16 01:02:06 +00:00
|
|
|
|
|
|
|
@end
|