Skip to content

Instantly share code, notes, and snippets.

@pudquick
Last active March 9, 2023 20:28
Show Gist options
  • Save pudquick/485c965ad018c280eeec7d632d38b9bf to your computer and use it in GitHub Desktop.
Save pudquick/485c965ad018c280eeec7d632d38b9bf to your computer and use it in GitHub Desktop.
A lot of fun TimeMachine details can be reached with pyobjc on OS X
# Backup destination details are stored in: /Library/Preferences/com.apple.TimeMachine.plist
# 10.11
from Foundation import NSBundle
TMMenu = NSBundle.bundleWithPath_('/System/Library/CoreServices/Menu Extras/TimeMachine.menu')
AppleTMSettings = TMMenu.classNamed_('AppleTMSettings')
settings = AppleTMSettings.sharedSettings()
# @interface AppleTMSettings : NSObject
# {
# NSMutableArray *_destinations;
# }
#
# + (id)sharedSettings;
# @property(readonly, copy) NSArray *destinations; // @synthesize destinations=_destinations;
# - (BOOL)allowSMBDestinations;
# - (BOOL)canModifyRequiresACPower;
# - (BOOL)canChangeWarningWhenCulling;
# - (BOOL)canManuallyBackup;
# - (BOOL)canChooseBackupDevice;
# - (BOOL)canModifyBackupSet;
# - (BOOL)canEnableBackup;
# - (void)unskipItem:(id)arg1;
# - (void)skipItem:(id)arg1;
# - (void)excludeVolume:(id)arg1;
# - (void)includeVolume:(id)arg1;
# - (BOOL)isIgnoredPath:(id)arg1;
# - (id)excludedVolumes;
# - (id)includedVolumes;
# - (void)setShouldSkipSystemFiles:(BOOL)arg1;
# - (BOOL)shouldSkipSystemFiles;
# - (id)skippedPaths;
# - (void)setShowsWarningWhenCulling:(BOOL)arg1;
# - (BOOL)showsWarningWhenCulling;
# - (void)setSuspendHelperActivityTimeStamp:(id)arg1;
# - (id)destinationForNetworkURL:(id)arg1;
# - (id)destinationForMountPoint:(id)arg1;
# - (id)pathsOfMountedLocalDestinationVolumes;
# - (BOOL)hasDestination;
# - (void)_setCurrentDestinationNoSync:(id)arg1;
# - (void)setCurrentDestination:(id)arg1;
# - (id)currentDestination;
# - (id)destinationForID:(id)arg1;
# - (void)removeAllDestinations;
# - (void)removeDestination:(id)arg1;
# - (void)addDestination:(id)arg1;
# - (void)writeDestinations;
# - (id)_lastDestinationID;
# - (void)readDestinations;
# - (id)_updateDestinationFromDictionaryRepresentation:(id)arg1;
# - (void)setRequiresACPower:(BOOL)arg1;
# - (void)_tellHelperAboutPrefChange:(BOOL)arg1;
# - (BOOL)requiresACPower;
# - (void)setMobileTimeMachineEnabled:(BOOL)arg1;
# - (BOOL)isMobileTimeMachineEnabled;
# - (void)setAutoBackupEnabled:(BOOL)arg1;
# - (BOOL)isAutoBackupEnabled;
# - (void)_removeAliasData:(id)arg1 fromArrayForKey:(id)arg2;
# - (void)_removePath:(id)arg1 fromArrayForKey:(id)arg2;
# - (void)_removeString:(id)arg1 fromArrayForKey:(id)arg2;
# - (void)_addString:(id)arg1 toArrayForKey:(id)arg2;
# - (void)_setArray:(id)arg1 forKey:(id)arg2;
# - (id)_arrayForKey:(id)arg1;
# - (void)_syncAndNotifyExclusionsChanged;
# - (void)_syncAndNotifyPrefsChanged;
# - (void)_notifyExclusionsChanged;
# - (void)_notifyPrefsChanged;
# - (void)_sync;
# - (void)_prefsChangedNotification:(id)arg1;
# - (void)dealloc;
# - (id)init;
settings.readDestinations()
current_dest = settings.currentDestination()
# >>> current_dest.aliasVolumeName()
# u'Family Backup'
# @interface TMDestination : NSObject
# {
# NSString *_destinationID;
# NSData *_aliasData;
# NSString *_aliasVolumeName;
# NSArray *_trustedUUIDs;
# NSImage *_icon;
# BOOL _isNetworkDestination;
# NSURL *_networkURL;
# unsigned long long _availableCapacity;
# unsigned long long _totalCapacity;
# NSURL *_mountPoint;
# BOOL _isConfiguredDestination;
# int _backupState;
# unsigned long long _copiedBytes;
# unsigned long long _totalBytes;
# double _percentBackedUp;
# NSArray *_snapshotDates;
# NSDate *_delayedBackupWarningDate;
# NSNumber *_latestBackupResultCode;
# NSArray *_latestBackupResultParameters;
# BOOL _isEncrypted;
# double _percentConverted;
# BOOL _isConverting;
# NSString *_volumeDisplayName;
# NSString *_serverDisplayName;
# NSString *_timeCapsuleDisplayName;
# NSTimer *_updateTimer;
# BOOL _updatePending;
# int _latestBackupResultSeverity;
# unsigned long long _order;
# double _estimatedSecondsRemaining;
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment