Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added manual library management option ui

  • Loading branch information...
commit d44d9fbb234138adfbc8e0015641630bc71e53e8 1 parent bda718a
Alex Ehlke authored
View
238 English.lproj/MainMenu.xib
@@ -3,16 +3,16 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10C540</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
+ <string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">762</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="29"/>
+ <integer value="453"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -44,7 +44,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="694149608">
<reference key="NSMenu" ref="649796088"/>
- <string key="NSTitle">iTunes Loader</string>
+ <string key="NSTitle">Download to iTunes</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -63,7 +63,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="238522557">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">About itunesloader</string>
+ <string key="NSTitle">About Download to iTunes</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="715147791"/>
@@ -82,6 +82,8 @@
</object>
<object class="NSMenuItem" id="609285721">
<reference key="NSMenu" ref="110575045"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsHidden">YES</bool>
<string key="NSTitle">Preferences…</string>
<string key="NSKeyEquiv">,</string>
<int key="NSKeyEquivModMask">1048576</int>
@@ -89,6 +91,38 @@
<reference key="NSOnImage" ref="715147791"/>
<reference key="NSMixedImage" ref="897496305"/>
</object>
+ <object class="NSMenuItem" id="493771298">
+ <reference key="NSMenu" ref="110575045"/>
+ <string key="NSTitle">Preferences</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="715147791"/>
+ <reference key="NSMixedImage" ref="897496305"/>
+ <string key="NSAction">submenuAction:</string>
+ <object class="NSMenu" key="NSSubmenu" id="269324606">
+ <string key="NSTitle">Menu</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMenuItem" id="1063068003">
+ <reference key="NSMenu" ref="269324606"/>
+ <string key="NSTitle">iTunes manages my library</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="715147791"/>
+ <reference key="NSMixedImage" ref="897496305"/>
+ </object>
+ <object class="NSMenuItem" id="1023961764">
+ <reference key="NSMenu" ref="269324606"/>
+ <string key="NSTitle">Set iTunes library location...</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="715147791"/>
+ <reference key="NSMixedImage" ref="897496305"/>
+ </object>
+ </object>
+ </object>
+ </object>
<object class="NSMenuItem" id="481834944">
<reference key="NSMenu" ref="110575045"/>
<bool key="NSIsDisabled">YES</bool>
@@ -130,7 +164,7 @@
</object>
<object class="NSMenuItem" id="755159360">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Hide itunesloader</string>
+ <string key="NSTitle">Hide Download to iTunes</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -168,7 +202,7 @@
</object>
<object class="NSMenuItem" id="632727374">
<reference key="NSMenu" ref="110575045"/>
- <string key="NSTitle">Quit itunesloader</string>
+ <string key="NSTitle">Quit Download to iTunes</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
@@ -230,6 +264,9 @@
<object class="NSCustomObject" id="15635064">
<string key="NSClassName">NSFontManager</string>
</object>
+ <object class="NSCustomObject" id="288178953">
+ <string key="NSClassName">controller</string>
+ </object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
@@ -290,6 +327,70 @@
</object>
<int key="connectionID">374</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">toggleITunesManagesMyLibrary:</string>
+ <reference key="source" ref="288178953"/>
+ <reference key="destination" ref="1063068003"/>
+ </object>
+ <int key="connectionID">457</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: iTunesManagesMyLibrary</string>
+ <reference key="source" ref="1063068003"/>
+ <reference key="destination" ref="288178953"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="1063068003"/>
+ <reference key="NSDestination" ref="288178953"/>
+ <string key="NSLabel">value: iTunesManagesMyLibrary</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">iTunesManagesMyLibrary</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">472</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">iTunesManagesMyLibraryMenuItem</string>
+ <reference key="source" ref="288178953"/>
+ <reference key="destination" ref="1063068003"/>
+ </object>
+ <int key="connectionID">475</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">setLibraryLocation:</string>
+ <reference key="source" ref="288178953"/>
+ <reference key="destination" ref="1023961764"/>
+ </object>
+ <int key="connectionID">476</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">iTunesLibraryLocationMenuItem</string>
+ <reference key="source" ref="288178953"/>
+ <reference key="destination" ref="1023961764"/>
+ </object>
+ <int key="connectionID">477</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">enabled: iTunesLibraryLocationMenuItemEnabled</string>
+ <reference key="source" ref="1023961764"/>
+ <reference key="destination" ref="288178953"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="1023961764"/>
+ <reference key="NSDestination" ref="288178953"/>
+ <string key="NSLabel">enabled: iTunesLibraryLocationMenuItemEnabled</string>
+ <string key="NSBinding">enabled</string>
+ <string key="NSKeyPath">iTunesLibraryLocationMenuItemEnabled</string>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">478</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -379,6 +480,7 @@
<reference ref="1046388886"/>
<reference ref="1056857174"/>
<reference ref="342932134"/>
+ <reference ref="493771298"/>
</object>
<reference key="parent" ref="694149608"/>
</object>
@@ -473,6 +575,40 @@
<reference key="object" ref="15635064"/>
<reference key="parent" ref="0"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">449</int>
+ <reference key="object" ref="493771298"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="269324606"/>
+ </object>
+ <reference key="parent" ref="110575045"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">450</int>
+ <reference key="object" ref="269324606"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="1023961764"/>
+ <reference ref="1063068003"/>
+ </object>
+ <reference key="parent" ref="493771298"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">452</int>
+ <reference key="object" ref="1063068003"/>
+ <reference key="parent" ref="269324606"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">453</int>
+ <reference key="object" ref="1023961764"/>
+ <reference key="parent" ref="269324606"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">454</int>
+ <reference key="object" ref="288178953"/>
+ <reference key="parent" ref="0"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -523,6 +659,13 @@
<string>371.NSWindowTemplate.visibleAtLaunch</string>
<string>371.editorWindowContentRectSynchronizationRect</string>
<string>372.IBPluginDependency</string>
+ <string>449.IBPluginDependency</string>
+ <string>450.IBEditorWindowLastContentRect</string>
+ <string>450.IBPluginDependency</string>
+ <string>452.IBPluginDependency</string>
+ <string>453.IBPluginDependency</string>
+ <string>454.IBAttributePlaceholdersKey</string>
+ <string>454.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
@@ -545,7 +688,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{680, 598}, {64, 6}}</string>
+ <string>{{731, 578}, {64, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{436, 809}, {64, 6}}</string>
@@ -567,7 +710,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{448, 664}, {194, 20}}</string>
+ <string>{{448, 664}, {236, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
@@ -579,8 +722,21 @@
<string>{{238, 285}, {480, 360}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>{{731, 571}, {242, 43}}</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{460, 481}, {220, 183}}</string>
+ <string>{{460, 461}, {271, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{23, 794}, {245, 183}}</string>
@@ -604,12 +760,46 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">448</int>
+ <int key="maxID">478</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">controller</string>
+ <string key="superclassName">NSWindowController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>setLibraryLocation:</string>
+ <string>toggleITunesManagesMyLibrary:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>iTunesLibraryLocationMenuItem</string>
+ <string>iTunesManagesMyLibraryMenuItem</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">controller.py</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">itunesloaderAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -991,9 +1181,22 @@
<string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string>
</object>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSWindowController</string>
+ <string key="superclassName">NSResponder</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">showWindow:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBFrameworkSource</string>
+ <string key="minorKey">AppKit.framework/Headers/NSWindowController.h</string>
+ </object>
+ </object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
@@ -1009,5 +1212,18 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../itunesloader.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSMenuCheckmark</string>
+ <string>NSMenuMixedState</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>{9, 8}</string>
+ <string>{7, 2}</string>
+ </object>
+ </object>
</data>
</archive>
View
77 config.py
@@ -0,0 +1,77 @@
+
+
+#from configobj import ConfigObj
+#import ConfigParser
+#import json
+import pickle
+
+import sys
+from os import path, environ, makedirs
+
+APP_NAME = "Download To iTunes"
+CONFIG_FILENAME = 'config.cfg'
+
+DEFAULTS = {'iTunesManagesMyLibrary': 1}
+
+def data_path():
+ #if sys.platform == 'darwin':
+ from AppKit import NSSearchPathForDirectoriesInDomains
+ # http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/NSSearchPathForDirectoriesInDomains
+ # NSApplicationSupportDirectory = 14
+ # NSUserDomainMask = 1
+ # True for expanding the tilde into a fully qualified path
+ ret = path.join(NSSearchPathForDirectoriesInDomains(14, 1, True)[0], APP_NAME)
+ if not path.exists(ret):
+ makedirs(ret)
+ return ret
+
+def config_file_path():
+ data_dir = data_path()
+ return path.join(data_dir, CONFIG_FILENAME)
+
+
+def get_config():
+ #return ConfigObj(config_file_path())
+ #config2 = ConfigParser.RawConfigParser()
+ #config2.read(config_file_path())
+ #return config2
+ try:
+ f = open(config_file_path())
+ s = f.read()
+ f.close()
+ except IOError:
+ return {}
+ if s:
+ #return json.loads(s)
+ return pickle.loads(s)
+ else:
+ return {}
+
+
+def save_config(config_obj):
+ #config_obj.write(config_file_path())
+ f = file(config_file_path(), 'w')
+ #s = json.dumps(config_obj)
+ s = pickle.dumps(config_obj)
+ f.write(s)
+ f.close()
+
+def set_config_option(key, value):
+ '''Sets and saves option.'''
+ config_obj = get_config()
+ #config_obj[key] = value
+ config_obj[key] = value
+ save_config(config_obj)
+
+def get_config_option(key):
+ config_obj = get_config()
+ return config_obj.get(key, DEFAULTS.get(key, None))
+
+
+
+
+#elif sys.platform == 'win32':
+# appdata = path.join(environ['APPDATA'], APPNAME)
+#else:
+# appdata = path.expanduser(path.join("~", "." + APPNAME))
+
View
88 controller.py
@@ -0,0 +1,88 @@
+#
+# controller.py
+# itunesloader
+#
+# Created by Alex Ehlke on 5/30/10.
+# Copyright (c) 2010 __MyCompanyName__. All rights reserved.
+#
+
+from objc import YES, NO, IBAction, IBOutlet, ivar, accessor
+from Foundation import *
+from AppKit import *
+
+import config
+
+
+
+class controller(NSWindowController):
+ iTunesManagesMyLibrary = ivar('iTunesManagesMyLibrary')
+ #iTunesManagesMyLibrary = ivar()
+ iTunesManagesMyLibraryMenuItem = IBOutlet()
+ iTunesLibraryLocationMenuItem = IBOutlet()
+ iTunesLibraryLocationMenuItemEnabled = ivar('iTunesLibraryLocationMenuItemEnabled')
+
+ def awakeFromNib(self):
+ #NSLog('awakeFromNib')
+ self.iTunesManagesMyLibrary = config.get_config_option('iTunesManagesMyLibrary')
+ self.iTunesManagesMyLibraryMenuItem.setState_(self.iTunesManagesMyLibrary)
+ self.refreshMenuEnable()
+
+ #@accessor
+ #def iTunesManagesMyLibraryValue(self):
+ # return self.iTunesManagesMyLibrary
+
+ @accessor
+ def setITunesManagesMyLibrary_(self, value):
+ #NSLog('setITunesManagesMyLibrary_')
+ self.iTunesManagesMyLibrary = value
+ #NSLog(str(self.iTunesManagesMyLibrary))
+ config.set_config_option('iTunesManagesMyLibrary', value)
+ self.refreshMenuEnable()
+
+ @IBAction
+ def setLibraryLocation_(self, sender):
+ #NSLog('setLibraryLocation_')
+ panel = NSOpenPanel.openPanel()
+ panel.setCanChooseDirectories_(YES)
+ panel.setAllowsMultipleSelection_(NO)
+ panel.setCanChooseFiles_(NO)
+ old_path = config.get_config_option('iTunesLibraryLocation')
+ ret = panel.runModalForDirectory_file_types_(old_path, None, None)
+ #NSLog(str(ret))
+ if ret:
+ path = panel.filenames()[0]
+ config.set_config_option('iTunesLibraryLocation', path)
+ else:
+ # Canceled
+ pass
+
+ def refreshMenuEnable(self):
+ #NSLog('refreshMenuEnable')
+ if self.iTunesManagesMyLibrary:
+ #NSLog('NO')
+ #self.iTunesLibraryLocationMenuItem.setEnabled_(NO)
+ self.iTunesLibraryLocationMenuItemEnabled = NO
+ else:
+ #NSLog('YES')
+ #self.iTunesLibraryLocationMenuItem.setEnabled_(YES)
+ self.iTunesLibraryLocationMenuItemEnabled = YES
+
+ @IBAction
+ def toggleITunesManagesMyLibrary_(self, sender):
+ #NSLog('toggleITunesManagesMyLibrary_')
+ #self.refreshMenuEnable()
+ pass
+ #NSLog('tog action')
+ #self.iTunesLibraryLocationMenuItem.setEnabled_(self.iTunesManagesMyLibrary == 0)
+ #pass
+
+ #NSLog(sender.state())
+ #NSLog(dir(self).__repr__())#self.iTunesManagesMyLibrary).__repr__())
+ #self.toggleITunesManagesMyLibrary_.setState_(0)
+ #NSLog(dir(self.toggleITunesManagesMyLibrary).__repr__())
+ #toggleITunesManagesMyLibrary_.setEnabled(false)
+
+ #self.iTunesManagesMyLibrary.setState_(0)
+ #self.iTunesManagesMyLibrary.setEnabled(false)
+
+
View
35 itunesloader.xcodeproj/jehlke.mode1v3
@@ -229,6 +229,8 @@
<key>Layout</key>
<array>
<dict>
+ <key>BecomeActive</key>
+ <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
@@ -277,12 +279,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
- <integer>21</integer>
- <integer>20</integer>
+ <integer>10</integer>
+ <integer>7</integer>
+ <integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
- <string>{{0, 81}, {186, 445}}</string>
+ <string>{{0, 0}, {186, 445}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@@ -317,7 +320,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20306471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>Info.plist</string>
+ <string>main.py</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@@ -325,22 +328,23 @@
<key>PBXProjectModuleGUID</key>
<string>1CE0B20406471E060097A5F4</string>
<key>PBXProjectModuleLabel</key>
- <string>Info.plist</string>
+ <string>main.py</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
- <string>B82BC13D11B2E27A00C8B0FE</string>
+ <string>B82BC14C11B2F71200C8B0FE</string>
<key>history</key>
<array>
- <string>B87CEEB4110843DC00C4D1EA</string>
- <string>B87CEEB5110843DC00C4D1EA</string>
<string>B87CEEB6110843DC00C4D1EA</string>
- <string>B82BC12411B2E17A00C8B0FE</string>
- <string>B82BC12511B2E17A00C8B0FE</string>
<string>B82BC12611B2E17A00C8B0FE</string>
- <string>B82BC12711B2E17A00C8B0FE</string>
<string>B82BC13B11B2E27A00C8B0FE</string>
- <string>B82BC13C11B2E27A00C8B0FE</string>
+ <string>B82BC14511B2F71200C8B0FE</string>
+ <string>B82BC14611B2F71200C8B0FE</string>
+ <string>B82BC14711B2F71200C8B0FE</string>
+ <string>B82BC14811B2F71200C8B0FE</string>
+ <string>B82BC14911B2F71200C8B0FE</string>
+ <string>B82BC14A11B2F71200C8B0FE</string>
+ <string>B82BC14B11B2F71200C8B0FE</string>
</array>
</dict>
<key>SplitCount</key>
@@ -362,8 +366,6 @@
<string>260pt</string>
</dict>
<dict>
- <key>BecomeActive</key>
- <true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
@@ -540,6 +542,9 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
+ <string>B82BC14E11B2F71200C8B0FE</string>
+ <string>B82BC14F11B2F71200C8B0FE</string>
+ <string>1C78EAAD065D492600B07095</string>
<string>1CD10A99069EF8BA00B06720</string>
<string>B87CEE831108407D00C4D1EA</string>
<string>/Users/jehlke/workspace/pyobjc/itunesloader/itunesloader.xcodeproj</string>
@@ -912,7 +917,7 @@
<key>TableOfContents</key>
<array>
<string>1C78EAAD065D492600B07095</string>
- <string>B8EA6D6D110912A400203C30</string>
+ <string>B82BC14D11B2F71200C8B0FE</string>
<string>1C78EAAC065D492600B07095</string>
</array>
<key>ToolbarConfiguration</key>
View
103 itunesloader.xcodeproj/jehlke.pbxuser
@@ -161,6 +161,14 @@
B82BC13B11B2E27A00C8B0FE /* PBXTextBookmark */ = B82BC13B11B2E27A00C8B0FE /* PBXTextBookmark */;
B82BC13C11B2E27A00C8B0FE /* PlistBookmark */ = B82BC13C11B2E27A00C8B0FE /* PlistBookmark */;
B82BC13D11B2E27A00C8B0FE /* PlistBookmark */ = B82BC13D11B2E27A00C8B0FE /* PlistBookmark */;
+ B82BC14511B2F71200C8B0FE /* PlistBookmark */ = B82BC14511B2F71200C8B0FE /* PlistBookmark */;
+ B82BC14611B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14611B2F71200C8B0FE /* PBXTextBookmark */;
+ B82BC14711B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14711B2F71200C8B0FE /* PBXTextBookmark */;
+ B82BC14811B2F71200C8B0FE /* PBXBookmark */ = B82BC14811B2F71200C8B0FE /* PBXBookmark */;
+ B82BC14911B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14911B2F71200C8B0FE /* PBXTextBookmark */;
+ B82BC14A11B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14A11B2F71200C8B0FE /* PBXTextBookmark */;
+ B82BC14B11B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14B11B2F71200C8B0FE /* PBXTextBookmark */;
+ B82BC14C11B2F71200C8B0FE /* PBXTextBookmark */ = B82BC14C11B2F71200C8B0FE /* PBXTextBookmark */;
B87CEEA41108433F00C4D1EA = B87CEEA41108433F00C4D1EA /* PBXTextBookmark */;
B87CEEB4110843DC00C4D1EA = B87CEEB4110843DC00C4D1EA /* PBXTextBookmark */;
B87CEEB5110843DC00C4D1EA = B87CEEB5110843DC00C4D1EA /* PBXTextBookmark */;
@@ -175,9 +183,9 @@
};
29B97316FDCFA39411CA2CEA /* main.m */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {950, 702}}";
+ sepNavIntBoundsRect = "{{0, 0}, {1398, 650}}";
sepNavSelRange = "{0, 0}";
- sepNavVisRange = "{0, 536}";
+ sepNavVisRange = "{1209, 607}";
};
};
32CA4F630368D1EE00C91783 /* itunesloader_Prefix.pch */ = {
@@ -189,16 +197,16 @@
};
77631A3E0C0748CF005415CB /* main.py */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {621, 273}}";
+ sepNavIntBoundsRect = "{{0, 0}, {621, 364}}";
sepNavSelRange = "{0, 0}";
- sepNavVisRange = "{2, 417}";
+ sepNavVisRange = "{0, 386}";
};
};
7790198E0C07548A00326F66 /* itunesloaderAppDelegate.py */ = {
uiCtxt = {
- sepNavIntBoundsRect = "{{0, 0}, {519, 637}}";
+ sepNavIntBoundsRect = "{{0, 0}, {635, 1053}}";
sepNavSelRange = "{593, 0}";
- sepNavVisRange = "{142, 459}";
+ sepNavVisRange = "{141, 543}";
};
};
8D1107260486CEB800E47090 /* iTunes Loader */ = {
@@ -371,6 +379,89 @@
rLen = 0;
rLoc = 9223372036854775807;
};
+ B82BC14511B2F71200C8B0FE /* PlistBookmark */ = {
+ isa = PlistBookmark;
+ fRef = 8D1107310486CEB800E47090 /* Info.plist */;
+ fallbackIsa = PBXBookmark;
+ isK = 0;
+ kPath = (
+ CFBundleIdentifier,
+ );
+ name = /Users/jehlke/workspace/pyobjc/itunesloader/Info.plist;
+ rLen = 0;
+ rLoc = 9223372036854775807;
+ };
+ B82BC14611B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B87CEEC311084C0A00C4D1EA /* downloadtoitunes.py */;
+ name = "downloadtoitunes.py: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 328;
+ vrLoc = 0;
+ };
+ B82BC14711B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = B87CEEC211084C0A00C4D1EA /* addToITunesLibrary */;
+ name = "addToITunesLibrary: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 178;
+ vrLoc = 0;
+ };
+ B82BC14811B2F71200C8B0FE /* PBXBookmark */ = {
+ isa = PBXBookmark;
+ fRef = B82BC13111B2E1A700C8B0FE /* icon.icns */;
+ };
+ B82BC14911B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 29B97316FDCFA39411CA2CEA /* main.m */;
+ name = "main.m: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 607;
+ vrLoc = 1209;
+ };
+ B82BC14A11B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 7790198E0C07548A00326F66 /* itunesloaderAppDelegate.py */;
+ name = "itunesloaderAppDelegate.py: 25";
+ rLen = 0;
+ rLoc = 593;
+ rType = 0;
+ vrLen = 543;
+ vrLoc = 141;
+ };
+ B82BC14B11B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 77631A3E0C0748CF005415CB /* main.py */;
+ name = "main.py: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 387;
+ vrLoc = 0;
+ };
+ B82BC14C11B2F71200C8B0FE /* PBXTextBookmark */ = {
+ isa = PBXTextBookmark;
+ fRef = 77631A3E0C0748CF005415CB /* main.py */;
+ name = "main.py: 1";
+ rLen = 0;
+ rLoc = 0;
+ rType = 0;
+ vrLen = 386;
+ vrLoc = 0;
+ };
+ B82BC15411B2F81B00C8B0FE /* controller.py */ = {
+ uiCtxt = {
+ sepNavIntBoundsRect = "{{0, 0}, {643, 780}}";
+ sepNavSelRange = "{1181, 0}";
+ sepNavVisRange = "{0, 348}";
+ };
+ };
B87CEE7C1108407800C4D1EA /* iTunes Loader */ = {
isa = PBXExecutable;
activeArgIndices = (
View
8 itunesloader.xcodeproj/project.pbxproj
@@ -30,6 +30,8 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
B82BC10F11B2E07100C8B0FE /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = B82BC10E11B2E07100C8B0FE /* icon.png */; };
B82BC13211B2E1A700C8B0FE /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = B82BC13111B2E1A700C8B0FE /* icon.icns */; };
+ B82BC15511B2F81B00C8B0FE /* controller.py in Resources */ = {isa = PBXBuildFile; fileRef = B82BC15411B2F81B00C8B0FE /* controller.py */; };
+ B82BC1BB11B318DA00C8B0FE /* config.py in Resources */ = {isa = PBXBuildFile; fileRef = B82BC1BA11B318DA00C8B0FE /* config.py */; };
B87CEEC511084C0A00C4D1EA /* addToITunesLibrary in Resources */ = {isa = PBXBuildFile; fileRef = B87CEEC211084C0A00C4D1EA /* addToITunesLibrary */; };
B87CEEC611084C0A00C4D1EA /* downloadtoitunes.py in Resources */ = {isa = PBXBuildFile; fileRef = B87CEEC311084C0A00C4D1EA /* downloadtoitunes.py */; };
B87CEEC711084C0A00C4D1EA /* e in Resources */ = {isa = PBXBuildFile; fileRef = B87CEEC411084C0A00C4D1EA /* e */; };
@@ -51,6 +53,8 @@
8D1107320486CEB800E47090 /* Download to iTunes.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Download to iTunes.app"; sourceTree = BUILT_PRODUCTS_DIR; };
B82BC10E11B2E07100C8B0FE /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = "<group>"; };
B82BC13111B2E1A700C8B0FE /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
+ B82BC15411B2F81B00C8B0FE /* controller.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = controller.py; sourceTree = "<group>"; };
+ B82BC1BA11B318DA00C8B0FE /* config.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = config.py; sourceTree = "<group>"; };
B87CEEC211084C0A00C4D1EA /* addToITunesLibrary */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = addToITunesLibrary; sourceTree = "<group>"; };
B87CEEC311084C0A00C4D1EA /* downloadtoitunes.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = downloadtoitunes.py; sourceTree = "<group>"; };
B87CEEC411084C0A00C4D1EA /* e */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = e; sourceTree = "<group>"; };
@@ -126,6 +130,8 @@
32CA4F630368D1EE00C91783 /* itunesloader_Prefix.pch */,
29B97316FDCFA39411CA2CEA /* main.m */,
77631A3E0C0748CF005415CB /* main.py */,
+ B82BC15411B2F81B00C8B0FE /* controller.py */,
+ B82BC1BA11B318DA00C8B0FE /* config.py */,
);
name = "Other Sources";
sourceTree = "<group>";
@@ -203,6 +209,8 @@
B87CEEC711084C0A00C4D1EA /* e in Resources */,
B82BC10F11B2E07100C8B0FE /* icon.png in Resources */,
B82BC13211B2E1A700C8B0FE /* icon.icns in Resources */,
+ B82BC15511B2F81B00C8B0FE /* controller.py in Resources */,
+ B82BC1BB11B318DA00C8B0FE /* config.py in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
44 itunesloaderAppDelegate.py
@@ -14,19 +14,57 @@
import os
#import appscript
-def osascript(cmd_text):
+#import controller
+import config
+
+def osascript(script, *args):
cmd = '/usr/bin/osascript -e \'' + cmd_text + '\''
- p = subprocess.Popen(cmd, shell=True)
+ p = subprocess.Popen(['arch', '-i386', 'osascript', '-e', script] +
+ [unicode(arg) for arg in args],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)#cmd, shell=True)
+ err = p.wait()
+ if err:
+ raise RuntimeError(err, p.stderr.read()[:-1].decode('utf8'))
+ return p.stdout.read()[:-1].decode('utf8')
+
+
+
+def prompt_dialog(query, default=''):
+ '''prompts the user for text input and returns string response, or None if Cancel.'''
+ #tell application "System Events"
+ # activate
+ #end tell
+ script = """on run {querystr, defstr}
+ tell application "System Events"
+ display dialog querystr default answer defstr buttons {"Cancel", "OK"} default button 2
+ end tell
+ if button returned of the result is equal to "OK" then
+ return text returned of the result
+ else
+ return ""
+ end if
+ end run"""
+ ret = osascript(script, query, default)
+ return ret
+
+
class itunesloaderAppDelegate(NSObject):
+ #iTunesManagesMyLibrary = objc.ivar()
def applicationDidFinishLaunching_(self, sender):
- NSLog("Application did finish launching.")
+ #NSLog("Application did finish launching.")
NSApp.setServicesProvider_(self)
@objc.signature('v@:@@o^@')
def doString_userData_error_(self, pboard, userData, error):
# download the archive and add to itunes
pboardString = pboard.stringForType_(NSStringPboardType)
+
+ iTunesManagesMyLibrary = config.get_config_option('iTunesManagesMyLibrary')
+ NSLog(str(iTunesManagesMyLibrary))
+ #NSLog(dir(controller).__repr__())
+ return
+
#NSLog(pboardString)
#NSLog(u'%s' % pboardString)
if pboardString[:7] in ['http://', 'https:/']:
View
11 main.py
@@ -11,10 +11,15 @@
import Foundation
import AppKit
-from PyObjCTools import AppHelper
+from PyObjCTools import AppHelper, NibClassBuilder
# import modules containing classes required to start application and load MainMenu.nib
import itunesloaderAppDelegate
-# pass control to AppKit
-AppHelper.runEventLoop()
+import controller
+
+
+
+if __name__ == '__main__':
+ # pass control to AppKit
+ AppHelper.runEventLoop()
Please sign in to comment.
Something went wrong with that request. Please try again.