├── itunescli.png
├── itunescli.xcodeproj
├── xcuserdata
│ └── bart.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── itunescli.xcscheme
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── bart.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── project.pbxproj
├── README.md
├── itunescli
├── main.swift
├── commands.swift
└── bridge.swift
└── LICENSE
/itunescli.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmsimons/itunescli/HEAD/itunescli.png
--------------------------------------------------------------------------------
/itunescli.xcodeproj/xcuserdata/bart.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/itunescli.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/itunescli.xcodeproj/project.xcworkspace/xcuserdata/bart.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bmsimons/itunescli/HEAD/itunescli.xcodeproj/project.xcworkspace/xcuserdata/bart.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | **itunescli**
2 | -------------
3 | A simple command-line utility that talks to iTunes, built using Swift!
4 |
5 | 
6 |
7 | **How to compile**
8 |
9 | First of all, you need Xcode on your Mac to build this. If you got Xcode on your Mac, cd into the root directory of this repository and just run `xcodebuild` to generate an executable.
10 |
--------------------------------------------------------------------------------
/itunescli.xcodeproj/xcuserdata/bart.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | itunescli.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | CCE7ABD41EAFE6CF00966D62
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/itunescli/main.swift:
--------------------------------------------------------------------------------
1 | //
2 | // main.swift
3 | // itunescli
4 | //
5 | // Created by Bart Simons on 25/04/2017.
6 | // Copyright © 2017 Bart Simons. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | let arguments = CommandLine.arguments
12 |
13 | if (arguments.count == 1)
14 | {
15 | printHelp()
16 | }
17 | else if (arguments.count >= 2)
18 | {
19 | if (arguments[1] == "pause")
20 | {
21 | pauseSong()
22 | }
23 |
24 | if (arguments[1] == "play")
25 | {
26 | playSong()
27 | }
28 |
29 | if (arguments[1] == "playlists")
30 | {
31 | getPlaylists()
32 | }
33 |
34 | if (arguments[1] == "info")
35 | {
36 | print(currentSongInfo())
37 | }
38 |
39 | if (arguments[1] == "volume")
40 | {
41 | if (arguments.count == 3)
42 | {
43 | let volumeString: String = arguments[2]
44 | let volumeInteger = Int(volumeString)
45 | if (volumeInteger != nil)
46 | {
47 | setVolume(volume: volumeInteger!)
48 | }
49 | }
50 | else
51 | {
52 | print(getVolume())
53 | }
54 | }
55 |
56 | if (arguments[1] == "delplaylist")
57 | {
58 | delPlaylist(specifiedPlaylist: arguments[2])
59 | }
60 |
61 | if (arguments[1] == "playlisttracks")
62 | {
63 | getPlaylistTracks(specifiedPlaylist: arguments[2])
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/itunescli/commands.swift:
--------------------------------------------------------------------------------
1 | //
2 | // commands.swift
3 | // itunescli
4 | //
5 | // Created by Bart Simons on 25/04/2017.
6 | // Copyright © 2017 Bart Simons. All rights reserved.
7 | //
8 |
9 | import ScriptingBridge
10 |
11 | let app: iTunesApplication = SBApplication(bundleIdentifier: "com.apple.iTunes")!
12 |
13 | func pingCommand() -> String
14 | {
15 | return "Pong!"
16 | }
17 |
18 | func getState() -> Int
19 | {
20 | switch app.playerState!
21 | {
22 | case iTunesEPlS.stopped:
23 | return 1
24 |
25 | case iTunesEPlS.playing:
26 | return 2
27 |
28 | case iTunesEPlS.paused:
29 | return 3
30 |
31 | case iTunesEPlS.fastForwarding:
32 | return 4
33 |
34 | case iTunesEPlS.rewinding:
35 | return 5
36 | }
37 | }
38 |
39 | func printHelp()
40 | {
41 | print("itunescli - Bart Simons, 2017")
42 | print("")
43 | print("Usage: ")
44 | print("")
45 | print("itunescli pause (pause current playing song)")
46 | print("itunescli play (resume current playing song)")
47 | print("itunescli volume {0-100} (set or get volume)")
48 | print("itunescli info (fetch current track info)")
49 | print("itunescli playlists (gets a list of playlists)")
50 | print("itunescli delplaylist (deletes a specified playlist)")
51 | print("itunescli playlisttracks (lists the tracks of a playlist)")
52 | }
53 |
54 | func getPlaylistTracks(specifiedPlaylist: String)
55 | {
56 | let playlists: SBElementArray? = app.playlists!()
57 | for playlist in playlists!
58 | {
59 | let playlist = (playlist as! iTunesPlaylist)
60 | if (playlist.name! == specifiedPlaylist)
61 | {
62 | let tracks: SBElementArray? = playlist.tracks!()
63 | for track in tracks!
64 | {
65 | let track = (track as! iTunesTrack)
66 | print(track.name! + " - " + track.artist!)
67 | }
68 | }
69 | }
70 | }
71 |
72 | func delPlaylist(specifiedPlaylist: String)
73 | {
74 | let playlists: SBElementArray? = app.playlists!()
75 | for playlist in playlists!
76 | {
77 | let playlist = (playlist as! iTunesPlaylist)
78 | if (playlist.name! == specifiedPlaylist)
79 | {
80 | playlist.delete!()
81 | }
82 | }
83 | }
84 |
85 | func getPlaylists()
86 | {
87 | let playlists: SBElementArray? = app.playlists!()
88 | for playlist in playlists!
89 | {
90 | let playlist = (playlist as! iTunesPlaylist)
91 | print(playlist.name!)
92 | }
93 | }
94 |
95 | func currentSongInfo() -> String
96 | {
97 | let currentTrack: iTunesTrack? = app.currentTrack!
98 | let trackName: String? = currentTrack?.name!
99 | let trackArtist: String? = currentTrack?.artist!
100 | return trackName! + " - " + trackArtist!
101 | }
102 |
103 | func pauseSong()
104 | {
105 | let playerState = getState()
106 | if (playerState == 2)
107 | {
108 | app.pause!()
109 | }
110 | }
111 |
112 | func playSong()
113 | {
114 | let playerState = getState()
115 | if (playerState == 1 || playerState == 3)
116 | {
117 | app.playpause!()
118 | }
119 | }
120 |
121 | func getVolume() -> String
122 | {
123 | return String(app.soundVolume!)
124 | }
125 |
126 | func setVolume(volume: Int)
127 | {
128 | app.setSoundVolume!(volume)
129 | }
130 |
--------------------------------------------------------------------------------
/itunescli.xcodeproj/xcuserdata/bart.xcuserdatad/xcschemes/itunescli.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/itunescli.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | CCE7ABD91EAFE6CF00966D62 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE7ABD81EAFE6CF00966D62 /* main.swift */; };
11 | CCE7ABE31EAFE83600966D62 /* bridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE7ABE21EAFE83600966D62 /* bridge.swift */; };
12 | CCE7ABE51EAFEA0D00966D62 /* commands.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCE7ABE41EAFEA0D00966D62 /* commands.swift */; };
13 | /* End PBXBuildFile section */
14 |
15 | /* Begin PBXCopyFilesBuildPhase section */
16 | CCE7ABD31EAFE6CF00966D62 /* CopyFiles */ = {
17 | isa = PBXCopyFilesBuildPhase;
18 | buildActionMask = 2147483647;
19 | dstPath = /usr/share/man/man1/;
20 | dstSubfolderSpec = 0;
21 | files = (
22 | );
23 | runOnlyForDeploymentPostprocessing = 1;
24 | };
25 | /* End PBXCopyFilesBuildPhase section */
26 |
27 | /* Begin PBXFileReference section */
28 | CCE7ABD51EAFE6CF00966D62 /* itunescli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = itunescli; sourceTree = BUILT_PRODUCTS_DIR; };
29 | CCE7ABD81EAFE6CF00966D62 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; };
30 | CCE7ABE21EAFE83600966D62 /* bridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = bridge.swift; sourceTree = ""; };
31 | CCE7ABE41EAFEA0D00966D62 /* commands.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = commands.swift; sourceTree = ""; };
32 | /* End PBXFileReference section */
33 |
34 | /* Begin PBXFrameworksBuildPhase section */
35 | CCE7ABD21EAFE6CF00966D62 /* Frameworks */ = {
36 | isa = PBXFrameworksBuildPhase;
37 | buildActionMask = 2147483647;
38 | files = (
39 | );
40 | runOnlyForDeploymentPostprocessing = 0;
41 | };
42 | /* End PBXFrameworksBuildPhase section */
43 |
44 | /* Begin PBXGroup section */
45 | CCE7ABCC1EAFE6CF00966D62 = {
46 | isa = PBXGroup;
47 | children = (
48 | CCE7ABD71EAFE6CF00966D62 /* itunescli */,
49 | CCE7ABD61EAFE6CF00966D62 /* Products */,
50 | );
51 | sourceTree = "";
52 | };
53 | CCE7ABD61EAFE6CF00966D62 /* Products */ = {
54 | isa = PBXGroup;
55 | children = (
56 | CCE7ABD51EAFE6CF00966D62 /* itunescli */,
57 | );
58 | name = Products;
59 | sourceTree = "";
60 | };
61 | CCE7ABD71EAFE6CF00966D62 /* itunescli */ = {
62 | isa = PBXGroup;
63 | children = (
64 | CCE7ABD81EAFE6CF00966D62 /* main.swift */,
65 | CCE7ABE21EAFE83600966D62 /* bridge.swift */,
66 | CCE7ABE41EAFEA0D00966D62 /* commands.swift */,
67 | );
68 | path = itunescli;
69 | sourceTree = "";
70 | };
71 | /* End PBXGroup section */
72 |
73 | /* Begin PBXNativeTarget section */
74 | CCE7ABD41EAFE6CF00966D62 /* itunescli */ = {
75 | isa = PBXNativeTarget;
76 | buildConfigurationList = CCE7ABDC1EAFE6CF00966D62 /* Build configuration list for PBXNativeTarget "itunescli" */;
77 | buildPhases = (
78 | CCE7ABD11EAFE6CF00966D62 /* Sources */,
79 | CCE7ABD21EAFE6CF00966D62 /* Frameworks */,
80 | CCE7ABD31EAFE6CF00966D62 /* CopyFiles */,
81 | );
82 | buildRules = (
83 | );
84 | dependencies = (
85 | );
86 | name = itunescli;
87 | productName = itunescli;
88 | productReference = CCE7ABD51EAFE6CF00966D62 /* itunescli */;
89 | productType = "com.apple.product-type.tool";
90 | };
91 | /* End PBXNativeTarget section */
92 |
93 | /* Begin PBXProject section */
94 | CCE7ABCD1EAFE6CF00966D62 /* Project object */ = {
95 | isa = PBXProject;
96 | attributes = {
97 | LastSwiftUpdateCheck = 0830;
98 | LastUpgradeCheck = 0830;
99 | ORGANIZATIONNAME = "Bart Simons";
100 | TargetAttributes = {
101 | CCE7ABD41EAFE6CF00966D62 = {
102 | CreatedOnToolsVersion = 8.3;
103 | ProvisioningStyle = Automatic;
104 | };
105 | };
106 | };
107 | buildConfigurationList = CCE7ABD01EAFE6CF00966D62 /* Build configuration list for PBXProject "itunescli" */;
108 | compatibilityVersion = "Xcode 3.2";
109 | developmentRegion = English;
110 | hasScannedForEncodings = 0;
111 | knownRegions = (
112 | en,
113 | );
114 | mainGroup = CCE7ABCC1EAFE6CF00966D62;
115 | productRefGroup = CCE7ABD61EAFE6CF00966D62 /* Products */;
116 | projectDirPath = "";
117 | projectRoot = "";
118 | targets = (
119 | CCE7ABD41EAFE6CF00966D62 /* itunescli */,
120 | );
121 | };
122 | /* End PBXProject section */
123 |
124 | /* Begin PBXSourcesBuildPhase section */
125 | CCE7ABD11EAFE6CF00966D62 /* Sources */ = {
126 | isa = PBXSourcesBuildPhase;
127 | buildActionMask = 2147483647;
128 | files = (
129 | CCE7ABE51EAFEA0D00966D62 /* commands.swift in Sources */,
130 | CCE7ABE31EAFE83600966D62 /* bridge.swift in Sources */,
131 | CCE7ABD91EAFE6CF00966D62 /* main.swift in Sources */,
132 | );
133 | runOnlyForDeploymentPostprocessing = 0;
134 | };
135 | /* End PBXSourcesBuildPhase section */
136 |
137 | /* Begin XCBuildConfiguration section */
138 | CCE7ABDA1EAFE6CF00966D62 /* Debug */ = {
139 | isa = XCBuildConfiguration;
140 | buildSettings = {
141 | ALWAYS_SEARCH_USER_PATHS = NO;
142 | CLANG_ANALYZER_NONNULL = YES;
143 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
144 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
145 | CLANG_CXX_LIBRARY = "libc++";
146 | CLANG_ENABLE_MODULES = YES;
147 | CLANG_ENABLE_OBJC_ARC = YES;
148 | CLANG_WARN_BOOL_CONVERSION = YES;
149 | CLANG_WARN_CONSTANT_CONVERSION = YES;
150 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
151 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
152 | CLANG_WARN_EMPTY_BODY = YES;
153 | CLANG_WARN_ENUM_CONVERSION = YES;
154 | CLANG_WARN_INFINITE_RECURSION = YES;
155 | CLANG_WARN_INT_CONVERSION = YES;
156 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
157 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
158 | CLANG_WARN_UNREACHABLE_CODE = YES;
159 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
160 | CODE_SIGN_IDENTITY = "-";
161 | COPY_PHASE_STRIP = NO;
162 | DEBUG_INFORMATION_FORMAT = dwarf;
163 | ENABLE_STRICT_OBJC_MSGSEND = YES;
164 | ENABLE_TESTABILITY = YES;
165 | GCC_C_LANGUAGE_STANDARD = gnu99;
166 | GCC_DYNAMIC_NO_PIC = NO;
167 | GCC_NO_COMMON_BLOCKS = YES;
168 | GCC_OPTIMIZATION_LEVEL = 0;
169 | GCC_PREPROCESSOR_DEFINITIONS = (
170 | "DEBUG=1",
171 | "$(inherited)",
172 | );
173 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
174 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
175 | GCC_WARN_UNDECLARED_SELECTOR = YES;
176 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
177 | GCC_WARN_UNUSED_FUNCTION = YES;
178 | GCC_WARN_UNUSED_VARIABLE = YES;
179 | MACOSX_DEPLOYMENT_TARGET = 10.12;
180 | MTL_ENABLE_DEBUG_INFO = YES;
181 | ONLY_ACTIVE_ARCH = YES;
182 | SDKROOT = macosx;
183 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
184 | };
185 | name = Debug;
186 | };
187 | CCE7ABDB1EAFE6CF00966D62 /* Release */ = {
188 | isa = XCBuildConfiguration;
189 | buildSettings = {
190 | ALWAYS_SEARCH_USER_PATHS = NO;
191 | CLANG_ANALYZER_NONNULL = YES;
192 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
193 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194 | CLANG_CXX_LIBRARY = "libc++";
195 | CLANG_ENABLE_MODULES = YES;
196 | CLANG_ENABLE_OBJC_ARC = YES;
197 | CLANG_WARN_BOOL_CONVERSION = YES;
198 | CLANG_WARN_CONSTANT_CONVERSION = YES;
199 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
200 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
201 | CLANG_WARN_EMPTY_BODY = YES;
202 | CLANG_WARN_ENUM_CONVERSION = YES;
203 | CLANG_WARN_INFINITE_RECURSION = YES;
204 | CLANG_WARN_INT_CONVERSION = YES;
205 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
206 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
207 | CLANG_WARN_UNREACHABLE_CODE = YES;
208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
209 | CODE_SIGN_IDENTITY = "-";
210 | COPY_PHASE_STRIP = NO;
211 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
212 | ENABLE_NS_ASSERTIONS = NO;
213 | ENABLE_STRICT_OBJC_MSGSEND = YES;
214 | GCC_C_LANGUAGE_STANDARD = gnu99;
215 | GCC_NO_COMMON_BLOCKS = YES;
216 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
217 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
218 | GCC_WARN_UNDECLARED_SELECTOR = YES;
219 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220 | GCC_WARN_UNUSED_FUNCTION = YES;
221 | GCC_WARN_UNUSED_VARIABLE = YES;
222 | MACOSX_DEPLOYMENT_TARGET = 10.12;
223 | MTL_ENABLE_DEBUG_INFO = NO;
224 | SDKROOT = macosx;
225 | };
226 | name = Release;
227 | };
228 | CCE7ABDD1EAFE6CF00966D62 /* Debug */ = {
229 | isa = XCBuildConfiguration;
230 | buildSettings = {
231 | PRODUCT_NAME = "$(TARGET_NAME)";
232 | SWIFT_VERSION = 3.0;
233 | };
234 | name = Debug;
235 | };
236 | CCE7ABDE1EAFE6CF00966D62 /* Release */ = {
237 | isa = XCBuildConfiguration;
238 | buildSettings = {
239 | PRODUCT_NAME = "$(TARGET_NAME)";
240 | SWIFT_VERSION = 3.0;
241 | };
242 | name = Release;
243 | };
244 | /* End XCBuildConfiguration section */
245 |
246 | /* Begin XCConfigurationList section */
247 | CCE7ABD01EAFE6CF00966D62 /* Build configuration list for PBXProject "itunescli" */ = {
248 | isa = XCConfigurationList;
249 | buildConfigurations = (
250 | CCE7ABDA1EAFE6CF00966D62 /* Debug */,
251 | CCE7ABDB1EAFE6CF00966D62 /* Release */,
252 | );
253 | defaultConfigurationIsVisible = 0;
254 | defaultConfigurationName = Release;
255 | };
256 | CCE7ABDC1EAFE6CF00966D62 /* Build configuration list for PBXNativeTarget "itunescli" */ = {
257 | isa = XCConfigurationList;
258 | buildConfigurations = (
259 | CCE7ABDD1EAFE6CF00966D62 /* Debug */,
260 | CCE7ABDE1EAFE6CF00966D62 /* Release */,
261 | );
262 | defaultConfigurationIsVisible = 0;
263 | };
264 | /* End XCConfigurationList section */
265 | };
266 | rootObject = CCE7ABCD1EAFE6CF00966D62 /* Project object */;
267 | }
268 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/itunescli/bridge.swift:
--------------------------------------------------------------------------------
1 | //
2 | // bridge.swift
3 | // itunescli
4 | //
5 | // Created by Bart Simons on 25/04/2017.
6 | // Copyright © 2017 Bart Simons. All rights reserved.
7 | //
8 |
9 | import AppKit
10 | import ScriptingBridge
11 |
12 | @objc public protocol SBObjectProtocol: NSObjectProtocol {
13 | func get() -> Any!
14 | }
15 |
16 | @objc public protocol SBApplicationProtocol: SBObjectProtocol {
17 | func activate()
18 | var delegate: SBApplicationDelegate! { get set }
19 | var running: Bool { @objc(isRunning) get }
20 | }
21 |
22 | // MARK: iTunesEKnd
23 | @objc public enum iTunesEKnd : AEKeyword {
24 | case trackListing = 0x6b54726b /* 'kTrk' */
25 | case albumListing = 0x6b416c62 /* 'kAlb' */
26 | case cdInsert = 0x6b434469 /* 'kCDi' */
27 | }
28 |
29 | // MARK: iTunesEnum
30 | @objc public enum iTunesEnum : AEKeyword {
31 | case standard = 0x6c777374 /* 'lwst' */
32 | case detailed = 0x6c776474 /* 'lwdt' */
33 | }
34 |
35 | // MARK: iTunesEPlS
36 | @objc public enum iTunesEPlS : AEKeyword {
37 | case stopped = 0x6b505353 /* 'kPSS' */
38 | case playing = 0x6b505350 /* 'kPSP' */
39 | case paused = 0x6b505370 /* 'kPSp' */
40 | case fastForwarding = 0x6b505346 /* 'kPSF' */
41 | case rewinding = 0x6b505352 /* 'kPSR' */
42 | }
43 |
44 | // MARK: iTunesERpt
45 | @objc public enum iTunesERpt : AEKeyword {
46 | case off = 0x6b52704f /* 'kRpO' */
47 | case one = 0x6b527031 /* 'kRp1' */
48 | case all = 0x6b416c6c /* 'kAll' */
49 | }
50 |
51 | // MARK: iTunesEShM
52 | @objc public enum iTunesEShM : AEKeyword {
53 | case songs = 0x6b536853 /* 'kShS' */
54 | case albums = 0x6b536841 /* 'kShA' */
55 | case groupings = 0x6b536847 /* 'kShG' */
56 | }
57 |
58 | // MARK: iTunesEVSz
59 | @objc public enum iTunesEVSz : AEKeyword {
60 | case small = 0x6b565353 /* 'kVSS' */
61 | case medium = 0x6b56534d /* 'kVSM' */
62 | case large = 0x6b56534c /* 'kVSL' */
63 | }
64 |
65 | // MARK: iTunesESrc
66 | @objc public enum iTunesESrc : AEKeyword {
67 | case library = 0x6b4c6962 /* 'kLib' */
68 | case iPod = 0x6b506f64 /* 'kPod' */
69 | case audioCD = 0x6b414344 /* 'kACD' */
70 | case mp3CD = 0x6b4d4344 /* 'kMCD' */
71 | case radioTuner = 0x6b54756e /* 'kTun' */
72 | case sharedLibrary = 0x6b536864 /* 'kShd' */
73 | case iTunesStore = 0x6b495453 /* 'kITS' */
74 | case unknown = 0x6b556e6b /* 'kUnk' */
75 | }
76 |
77 | // MARK: iTunesESrA
78 | @objc public enum iTunesESrA : AEKeyword {
79 | case albums = 0x6b53724c /* 'kSrL' */
80 | case all = 0x6b416c6c /* 'kAll' */
81 | case artists = 0x6b537252 /* 'kSrR' */
82 | case composers = 0x6b537243 /* 'kSrC' */
83 | case displayed = 0x6b537256 /* 'kSrV' */
84 | case songs = 0x6b537253 /* 'kSrS' */
85 | }
86 |
87 | // MARK: iTunesESpK
88 | @objc public enum iTunesESpK : AEKeyword {
89 | case none = 0x6b4e6f6e /* 'kNon' */
90 | case books = 0x6b537041 /* 'kSpA' */
91 | case folder = 0x6b537046 /* 'kSpF' */
92 | case genius = 0x6b537047 /* 'kSpG' */
93 | case iTunesU = 0x6b537055 /* 'kSpU' */
94 | case library = 0x6b53704c /* 'kSpL' */
95 | case movies = 0x6b537049 /* 'kSpI' */
96 | case music = 0x6b53705a /* 'kSpZ' */
97 | case podcasts = 0x6b537050 /* 'kSpP' */
98 | case purchasedMusic = 0x6b53704d /* 'kSpM' */
99 | case tvShows = 0x6b537054 /* 'kSpT' */
100 | }
101 |
102 | // MARK: iTunesEMdK
103 | @objc public enum iTunesEMdK : AEKeyword {
104 | case alertTone = 0x6b4d644c /* 'kMdL' */
105 | case audiobook = 0x6b4d6441 /* 'kMdA' */
106 | case book = 0x6b4d6442 /* 'kMdB' */
107 | case homeVideo = 0x6b566448 /* 'kVdH' */
108 | case iTunesU = 0x6b4d6449 /* 'kMdI' */
109 | case movie = 0x6b56644d /* 'kVdM' */
110 | case song = 0x6b4d6453 /* 'kMdS' */
111 | case musicVideo = 0x6b566456 /* 'kVdV' */
112 | case podcast = 0x6b4d6450 /* 'kMdP' */
113 | case ringtone = 0x6b4d6452 /* 'kMdR' */
114 | case tvShow = 0x6b566454 /* 'kVdT' */
115 | case voiceMemo = 0x6b4d644f /* 'kMdO' */
116 | case unknown = 0x6b556e6b /* 'kUnk' */
117 | }
118 |
119 | // MARK: iTunesEVdK
120 | @objc public enum iTunesEVdK : AEKeyword {
121 | case none = 0x6b4e6f6e /* 'kNon' */
122 | case homeVideo = 0x6b566448 /* 'kVdH' */
123 | case movie = 0x6b56644d /* 'kVdM' */
124 | case musicVideo = 0x6b566456 /* 'kVdV' */
125 | case tvShow = 0x6b566454 /* 'kVdT' */
126 | }
127 |
128 | // MARK: iTunesERtK
129 | @objc public enum iTunesERtK : AEKeyword {
130 | case user = 0x6b527455 /* 'kRtU' */
131 | case computed = 0x6b527443 /* 'kRtC' */
132 | }
133 |
134 | // MARK: iTunesEAPD
135 | @objc public enum iTunesEAPD : AEKeyword {
136 | case computer = 0x6b415043 /* 'kAPC' */
137 | case airPortExpress = 0x6b415058 /* 'kAPX' */
138 | case appleTV = 0x6b415054 /* 'kAPT' */
139 | case airPlayDevice = 0x6b41504f /* 'kAPO' */
140 | case unknown = 0x6b415055 /* 'kAPU' */
141 | }
142 |
143 | // MARK: iTunesEClS
144 | @objc public enum iTunesEClS : AEKeyword {
145 | case unknown = 0x6b556e6b /* 'kUnk' */
146 | case purchased = 0x6b507572 /* 'kPur' */
147 | case matched = 0x6b4d6174 /* 'kMat' */
148 | case uploaded = 0x6b55706c /* 'kUpl' */
149 | case ineligible = 0x6b52656a /* 'kRej' */
150 | case removed = 0x6b52656d /* 'kRem' */
151 | case error = 0x6b457272 /* 'kErr' */
152 | case duplicate = 0x6b447570 /* 'kDup' */
153 | case subscription = 0x6b537562 /* 'kSub' */
154 | case noLongerAvailable = 0x6b526576 /* 'kRev' */
155 | case notUploaded = 0x6b557050 /* 'kUpP' */
156 | }
157 |
158 | // MARK: iTunesGenericMethods
159 | @objc public protocol iTunesGenericMethods {
160 | @objc optional func printPrintDialog(_ printDialog: Bool, withProperties: [AnyHashable : Any]!, kind: iTunesEKnd, theme: String!) // Print the specified object(s)
161 | @objc optional func close() // Close an object
162 | @objc optional func delete() // Delete an element from an object
163 | @objc optional func duplicateTo(_ to: SBObject!) -> SBObject // Duplicate one or more object(s)
164 | @objc optional func exists() -> Bool // Verify if an object exists
165 | @objc optional func `open`() // Open the specified object(s)
166 | @objc optional func save() // Save the specified object(s)
167 | @objc optional func playOnce(_ once: Bool) // play the current track or the specified track or file.
168 | @objc optional func select() // select the specified object(s)
169 | }
170 |
171 | // MARK: iTunesApplication
172 | @objc public protocol iTunesApplication: SBApplicationProtocol {
173 | @objc optional func AirPlayDevices() -> SBElementArray
174 | @objc optional func browserWindows() -> SBElementArray
175 | @objc optional func encoders() -> SBElementArray
176 | @objc optional func EQPresets() -> SBElementArray
177 | @objc optional func EQWindows() -> SBElementArray
178 | @objc optional func miniplayerWindows() -> SBElementArray
179 | @objc optional func playlists() -> SBElementArray
180 | @objc optional func playlistWindows() -> SBElementArray
181 | @objc optional func sources() -> SBElementArray
182 | @objc optional func tracks() -> SBElementArray
183 | @objc optional func videoWindows() -> SBElementArray
184 | @objc optional func visuals() -> SBElementArray
185 | @objc optional func windows() -> SBElementArray
186 | @objc optional var AirPlayEnabled: Bool { get } // is AirPlay currently enabled?
187 | @objc optional var converting: Bool { get } // is a track currently being converted?
188 | @objc optional var currentAirPlayDevices: [iTunesAirPlayDevice] { get } // the currently selected AirPlay device(s)
189 | @objc optional var currentEncoder: iTunesEncoder { get } // the currently selected encoder (MP3, AIFF, WAV, etc.)
190 | @objc optional var currentEQPreset: iTunesEQPreset { get } // the currently selected equalizer preset
191 | @objc optional var currentPlaylist: iTunesPlaylist { get } // the playlist containing the currently targeted track
192 | @objc optional var currentStreamTitle: String { get } // the name of the current song in the playing stream (provided by streaming server)
193 | @objc optional var currentStreamURL: String { get } // the URL of the playing stream or streaming web site (provided by streaming server)
194 | @objc optional var currentTrack: iTunesTrack { get } // the current targeted track
195 | @objc optional var currentVisual: iTunesVisual { get } // the currently selected visual plug-in
196 | @objc optional var EQEnabled: Bool { get } // is the equalizer enabled?
197 | @objc optional var fixedIndexing: Bool { get } // true if all AppleScript track indices should be independent of the play order of the owning playlist.
198 | @objc optional var frontmost: Bool { get } // is iTunes the frontmost application?
199 | @objc optional var fullScreen: Bool { get } // are visuals displayed using the entire screen?
200 | @objc optional var name: String { get } // the name of the application
201 | @objc optional var mute: Bool { get } // has the sound output been muted?
202 | @objc optional var playerPosition: Double { get } // the player’s position within the currently playing track in seconds.
203 | @objc optional var playerState: iTunesEPlS { get } // is iTunes stopped, paused, or playing?
204 | @objc optional var selection: SBObject { get } // the selection visible to the user
205 | @objc optional var shuffleEnabled: Bool { get } // are songs played in random order?
206 | @objc optional var shuffleMode: iTunesEShM { get } // the playback shuffle mode
207 | @objc optional var songRepeat: iTunesERpt { get } // the playback repeat mode
208 | @objc optional var soundVolume: Int { get } // the sound output volume (0 = minimum, 100 = maximum)
209 | @objc optional var version: String { get } // the version of iTunes
210 | @objc optional var visualsEnabled: Bool { get } // are visuals currently being displayed?
211 | @objc optional var visualSize: iTunesEVSz { get } // the size of the displayed visual
212 | @objc optional func printPrintDialog(_ printDialog: Bool, withProperties: [AnyHashable : Any]!, kind: iTunesEKnd, theme: String!) // Print the specified object(s)
213 | @objc optional func run() // Run iTunes
214 | @objc optional func quit() // Quit iTunes
215 | @objc optional func add(_ x: [URL]!, to: SBObject!) -> iTunesTrack // add one or more files to a playlist
216 | @objc optional func backTrack() // reposition to beginning of current track or go to previous track if already at start of current track
217 | @objc optional func convert(_ x: [SBObject]!) -> iTunesTrack // convert one or more files or tracks
218 | @objc optional func eject() // eject the specified iPod
219 | @objc optional func fastForward() // skip forward in a playing track
220 | @objc optional func nextTrack() // advance to the next track in the current playlist
221 | @objc optional func pause() // pause playback
222 | @objc optional func playOnce(_ once: Bool) // play the current track or the specified track or file.
223 | @objc optional func playpause() // toggle the playing/paused state of the current track
224 | @objc optional func previousTrack() // return to the previous track in the current playlist
225 | @objc optional func resume() // disable fast forward/rewind and resume playback, if playing.
226 | @objc optional func rewind() // skip backwards in a playing track
227 | @objc optional func stop() // stop playback
228 | @objc optional func subscribe(_ x: String!) // subscribe to a podcast feed
229 | @objc optional func update() // update the specified iPod
230 | @objc optional func updateAllPodcasts() // update all subscribed podcast feeds
231 | @objc optional func updatePodcast() // update podcast feed
232 | @objc optional func openLocation(_ x: String!) // Opens a Music Store or audio stream URL
233 | @objc optional func setCurrentAirPlayDevices(_ currentAirPlayDevices: [iTunesAirPlayDevice]!) // the currently selected AirPlay device(s)
234 | @objc optional func setCurrentEncoder(_ currentEncoder: iTunesEncoder!) // the currently selected encoder (MP3, AIFF, WAV, etc.)
235 | @objc optional func setCurrentEQPreset(_ currentEQPreset: iTunesEQPreset!) // the currently selected equalizer preset
236 | @objc optional func setCurrentVisual(_ currentVisual: iTunesVisual!) // the currently selected visual plug-in
237 | @objc optional func setEQEnabled(_ EQEnabled: Bool) // is the equalizer enabled?
238 | @objc optional func setFixedIndexing(_ fixedIndexing: Bool) // true if all AppleScript track indices should be independent of the play order of the owning playlist.
239 | @objc optional func setFrontmost(_ frontmost: Bool) // is iTunes the frontmost application?
240 | @objc optional func setFullScreen(_ fullScreen: Bool) // are visuals displayed using the entire screen?
241 | @objc optional func setMute(_ mute: Bool) // has the sound output been muted?
242 | @objc optional func setPlayerPosition(_ playerPosition: Double) // the player’s position within the currently playing track in seconds.
243 | @objc optional func setShuffleEnabled(_ shuffleEnabled: Bool) // are songs played in random order?
244 | @objc optional func setShuffleMode(_ shuffleMode: iTunesEShM) // the playback shuffle mode
245 | @objc optional func setSongRepeat(_ songRepeat: iTunesERpt) // the playback repeat mode
246 | @objc optional func setSoundVolume(_ soundVolume: Int) // the sound output volume (0 = minimum, 100 = maximum)
247 | @objc optional func setVisualsEnabled(_ visualsEnabled: Bool) // are visuals currently being displayed?
248 | @objc optional func setVisualSize(_ visualSize: iTunesEVSz) // the size of the displayed visual
249 | }
250 | extension SBApplication: iTunesApplication {}
251 |
252 | // MARK: iTunesItem
253 | @objc public protocol iTunesItem: SBObjectProtocol, iTunesGenericMethods {
254 | @objc optional var container: SBObject { get } // the container of the item
255 | @objc optional func id() -> Int // the id of the item
256 | @objc optional var index: Int { get } // The index of the item in internal application order.
257 | @objc optional var name: String { get } // the name of the item
258 | @objc optional var persistentID: String { get } // the id of the item as a hexadecimal string. This id does not change over time.
259 | @objc optional var properties: [AnyHashable : Any] { get } // every property of the item
260 | @objc optional func download() // download a cloud track or playlist, or a podcast episode
261 | @objc optional func reveal() // reveal and select a track or playlist
262 | @objc optional func setName(_ name: String!) // the name of the item
263 | @objc optional func setProperties(_ properties: [AnyHashable : Any]!) // every property of the item
264 | }
265 | extension SBObject: iTunesItem {}
266 |
267 | // MARK: iTunesAirPlayDevice
268 | @objc public protocol iTunesAirPlayDevice: iTunesItem {
269 | @objc optional var active: Bool { get } // is the device currently being played to?
270 | @objc optional var available: Bool { get } // is the device currently available?
271 | @objc optional var kind: iTunesEAPD { get } // the kind of the device
272 | @objc optional var networkAddress: String { get } // the network (MAC) address of the device
273 | @objc optional func protected() -> Bool // is the device password- or passcode-protected?
274 | @objc optional var selected: Bool { get } // is the device currently selected?
275 | @objc optional var supportsAudio: Bool { get } // does the device support audio playback?
276 | @objc optional var supportsVideo: Bool { get } // does the device support video playback?
277 | @objc optional var soundVolume: Int { get } // the output volume for the device (0 = minimum, 100 = maximum)
278 | @objc optional func setSelected(_ selected: Bool) // is the device currently selected?
279 | @objc optional func setSoundVolume(_ soundVolume: Int) // the output volume for the device (0 = minimum, 100 = maximum)
280 | }
281 | extension SBObject: iTunesAirPlayDevice {}
282 |
283 | // MARK: iTunesArtwork
284 | @objc public protocol iTunesArtwork: iTunesItem {
285 | @objc optional var data: NSImage { get } // data for this artwork, in the form of a picture
286 | @objc optional var objectDescription: String { get } // description of artwork as a string
287 | @objc optional var downloaded: Bool { get } // was this artwork downloaded by iTunes?
288 | @objc optional var format: NSNumber { get } // the data format for this piece of artwork
289 | @objc optional var kind: Int { get } // kind or purpose of this piece of artwork
290 | @objc optional var rawData: Data { get } // data for this artwork, in original format
291 | @objc optional func setData(_ data: NSImage!) // data for this artwork, in the form of a picture
292 | @objc optional func setObjectDescription(_ objectDescription: String!) // description of artwork as a string
293 | @objc optional func setKind(_ kind: Int) // kind or purpose of this piece of artwork
294 | @objc optional func setRawData(_ rawData: Data!) // data for this artwork, in original format
295 | }
296 | extension SBObject: iTunesArtwork {}
297 |
298 | // MARK: iTunesEncoder
299 | @objc public protocol iTunesEncoder: iTunesItem {
300 | @objc optional var format: String { get } // the data format created by the encoder
301 | }
302 | extension SBObject: iTunesEncoder {}
303 |
304 | // MARK: iTunesEQPreset
305 | @objc public protocol iTunesEQPreset: iTunesItem {
306 | @objc optional var band1: Double { get } // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
307 | @objc optional var band2: Double { get } // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB)
308 | @objc optional var band3: Double { get } // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB)
309 | @objc optional var band4: Double { get } // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB)
310 | @objc optional var band5: Double { get } // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB)
311 | @objc optional var band6: Double { get } // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB)
312 | @objc optional var band7: Double { get } // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB)
313 | @objc optional var band8: Double { get } // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB)
314 | @objc optional var band9: Double { get } // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB)
315 | @objc optional var band10: Double { get } // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB)
316 | @objc optional var modifiable: Bool { get } // can this preset be modified?
317 | @objc optional var preamp: Double { get } // the equalizer preamp level (-12.0 dB to +12.0 dB)
318 | @objc optional var updateTracks: Bool { get } // should tracks which refer to this preset be updated when the preset is renamed or deleted?
319 | @objc optional func setBand1(_ band1: Double) // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
320 | @objc optional func setBand2(_ band2: Double) // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB)
321 | @objc optional func setBand3(_ band3: Double) // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB)
322 | @objc optional func setBand4(_ band4: Double) // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB)
323 | @objc optional func setBand5(_ band5: Double) // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB)
324 | @objc optional func setBand6(_ band6: Double) // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB)
325 | @objc optional func setBand7(_ band7: Double) // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB)
326 | @objc optional func setBand8(_ band8: Double) // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB)
327 | @objc optional func setBand9(_ band9: Double) // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB)
328 | @objc optional func setBand10(_ band10: Double) // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB)
329 | @objc optional func setPreamp(_ preamp: Double) // the equalizer preamp level (-12.0 dB to +12.0 dB)
330 | @objc optional func setUpdateTracks(_ updateTracks: Bool) // should tracks which refer to this preset be updated when the preset is renamed or deleted?
331 | }
332 | extension SBObject: iTunesEQPreset {}
333 |
334 | // MARK: iTunesPlaylist
335 | @objc public protocol iTunesPlaylist: iTunesItem {
336 | @objc optional func tracks() -> SBElementArray
337 | @objc optional func artworks() -> SBElementArray
338 | @objc optional var objectDescription: String { get } // the description of the playlist
339 | @objc optional var disliked: Bool { get } // is this playlist disliked?
340 | @objc optional var duration: Int { get } // the total length of all songs (in seconds)
341 | @objc optional var name: String { get } // the name of the playlist
342 | @objc optional var loved: Bool { get } // is this playlist loved?
343 | @objc optional var parent: iTunesPlaylist { get } // folder which contains this playlist (if any)
344 | @objc optional var shuffle: Bool { get } // play the songs in this playlist in random order? (obsolete; always false)
345 | @objc optional var size: Int { get } // the total size of all songs (in bytes)
346 | @objc optional var songRepeat: iTunesERpt { get } // playback repeat mode (obsolete; always off)
347 | @objc optional var specialKind: iTunesESpK { get } // special playlist kind
348 | @objc optional var time: String { get } // the length of all songs in MM:SS format
349 | @objc optional var visible: Bool { get } // is this playlist visible in the Source list?
350 | @objc optional func moveTo(_ to: SBObject!) // Move playlist(s) to a new location
351 | @objc optional func searchFor(_ for_: String!, only: iTunesESrA) -> iTunesTrack // search a playlist for tracks matching the search string. Identical to entering search text in the Search field in iTunes.
352 | @objc optional func setObjectDescription(_ objectDescription: String!) // the description of the playlist
353 | @objc optional func setDisliked(_ disliked: Bool) // is this playlist disliked?
354 | @objc optional func setName(_ name: String!) // the name of the playlist
355 | @objc optional func setLoved(_ loved: Bool) // is this playlist loved?
356 | @objc optional func setShuffle(_ shuffle: Bool) // play the songs in this playlist in random order? (obsolete; always false)
357 | @objc optional func setSongRepeat(_ songRepeat: iTunesERpt) // playback repeat mode (obsolete; always off)
358 | }
359 | extension SBObject: iTunesPlaylist {}
360 |
361 | // MARK: iTunesAudioCDPlaylist
362 | @objc public protocol iTunesAudioCDPlaylist: iTunesPlaylist {
363 | @objc optional func audioCDTracks() -> SBElementArray
364 | @objc optional var artist: String { get } // the artist of the CD
365 | @objc optional var compilation: Bool { get } // is this CD a compilation album?
366 | @objc optional var composer: String { get } // the composer of the CD
367 | @objc optional var discCount: Int { get } // the total number of discs in this CD’s album
368 | @objc optional var discNumber: Int { get } // the index of this CD disc in the source album
369 | @objc optional var genre: String { get } // the genre of the CD
370 | @objc optional var year: Int { get } // the year the album was recorded/released
371 | @objc optional func setArtist(_ artist: String!) // the artist of the CD
372 | @objc optional func setCompilation(_ compilation: Bool) // is this CD a compilation album?
373 | @objc optional func setComposer(_ composer: String!) // the composer of the CD
374 | @objc optional func setDiscCount(_ discCount: Int) // the total number of discs in this CD’s album
375 | @objc optional func setDiscNumber(_ discNumber: Int) // the index of this CD disc in the source album
376 | @objc optional func setGenre(_ genre: String!) // the genre of the CD
377 | @objc optional func setYear(_ year: Int) // the year the album was recorded/released
378 | }
379 | extension SBObject: iTunesAudioCDPlaylist {}
380 |
381 | // MARK: iTunesLibraryPlaylist
382 | @objc public protocol iTunesLibraryPlaylist: iTunesPlaylist {
383 | @objc optional func fileTracks() -> SBElementArray
384 | @objc optional func URLTracks() -> SBElementArray
385 | @objc optional func sharedTracks() -> SBElementArray
386 | }
387 | extension SBObject: iTunesLibraryPlaylist {}
388 |
389 | // MARK: iTunesRadioTunerPlaylist
390 | @objc public protocol iTunesRadioTunerPlaylist: iTunesPlaylist {
391 | @objc optional func URLTracks() -> SBElementArray
392 | }
393 | extension SBObject: iTunesRadioTunerPlaylist {}
394 |
395 | // MARK: iTunesSource
396 | @objc public protocol iTunesSource: iTunesItem {
397 | @objc optional func audioCDPlaylists() -> SBElementArray
398 | @objc optional func libraryPlaylists() -> SBElementArray
399 | @objc optional func playlists() -> SBElementArray
400 | @objc optional func radioTunerPlaylists() -> SBElementArray
401 | @objc optional func subscriptionPlaylists() -> SBElementArray
402 | @objc optional func userPlaylists() -> SBElementArray
403 | @objc optional var capacity: Int64 { get } // the total size of the source if it has a fixed size
404 | @objc optional var freeSpace: Int64 { get } // the free space on the source if it has a fixed size
405 | @objc optional var kind: iTunesESrc { get }
406 | @objc optional func eject() // eject the specified iPod
407 | @objc optional func update() // update the specified iPod
408 | }
409 | extension SBObject: iTunesSource {}
410 |
411 | // MARK: iTunesSubscriptionPlaylist
412 | @objc public protocol iTunesSubscriptionPlaylist: iTunesPlaylist {
413 | @objc optional func fileTracks() -> SBElementArray
414 | @objc optional func URLTracks() -> SBElementArray
415 | }
416 | extension SBObject: iTunesSubscriptionPlaylist {}
417 |
418 | // MARK: iTunesTrack
419 | @objc public protocol iTunesTrack: iTunesItem {
420 | @objc optional func artworks() -> SBElementArray
421 | @objc optional var album: String { get } // the album name of the track
422 | @objc optional var albumArtist: String { get } // the album artist of the track
423 | @objc optional var albumDisliked: Bool { get } // is the album for this track disliked?
424 | @objc optional var albumLoved: Bool { get } // is the album for this track loved?
425 | @objc optional var albumRating: Int { get } // the rating of the album for this track (0 to 100)
426 | @objc optional var albumRatingKind: iTunesERtK { get } // the rating kind of the album rating for this track
427 | @objc optional var artist: String { get } // the artist/source of the track
428 | @objc optional var bitRate: Int { get } // the bit rate of the track (in kbps)
429 | @objc optional var bookmark: Double { get } // the bookmark time of the track in seconds
430 | @objc optional var bookmarkable: Bool { get } // is the playback position for this track remembered?
431 | @objc optional var bpm: Int { get } // the tempo of this track in beats per minute
432 | @objc optional var category: String { get } // the category of the track
433 | @objc optional var cloudStatus: iTunesEClS { get } // the iCloud status of the track
434 | @objc optional var comment: String { get } // freeform notes about the track
435 | @objc optional var compilation: Bool { get } // is this track from a compilation album?
436 | @objc optional var composer: String { get } // the composer of the track
437 | @objc optional var databaseID: Int { get } // the common, unique ID for this track. If two tracks in different playlists have the same database ID, they are sharing the same data.
438 | @objc optional var dateAdded: Date { get } // the date the track was added to the playlist
439 | @objc optional var objectDescription: String { get } // the description of the track
440 | @objc optional var discCount: Int { get } // the total number of discs in the source album
441 | @objc optional var discNumber: Int { get } // the index of the disc containing this track on the source album
442 | @objc optional var disliked: Bool { get } // is this track disliked?
443 | @objc optional var downloaderAppleID: String { get } // the Apple ID of the person who downloaded this track
444 | @objc optional var downloaderName: String { get } // the name of the person who downloaded this track
445 | @objc optional var duration: Double { get } // the length of the track in seconds
446 | @objc optional var enabled: Bool { get } // is this track checked for playback?
447 | @objc optional var episodeID: String { get } // the episode ID of the track
448 | @objc optional var episodeNumber: Int { get } // the episode number of the track
449 | @objc optional var EQ: String { get } // the name of the EQ preset of the track
450 | @objc optional var finish: Double { get } // the stop time of the track in seconds
451 | @objc optional var gapless: Bool { get } // is this track from a gapless album?
452 | @objc optional var genre: String { get } // the music/audio genre (category) of the track
453 | @objc optional var grouping: String { get } // the grouping (piece) of the track. Generally used to denote movements within a classical work.
454 | @objc optional var kind: String { get } // a text description of the track
455 | @objc optional var longDescription: String { get }
456 | @objc optional var loved: Bool { get } // is this track loved?
457 | @objc optional var lyrics: String { get } // the lyrics of the track
458 | @objc optional var mediaKind: iTunesEMdK { get } // the media kind of the track
459 | @objc optional var modificationDate: Date { get } // the modification date of the content of this track
460 | @objc optional var movement: String { get } // the movement name of the track
461 | @objc optional var movementCount: Int { get } // the total number of movements in the work
462 | @objc optional var movementNumber: Int { get } // the index of the movement in the work
463 | @objc optional var playedCount: Int { get } // number of times this track has been played
464 | @objc optional var playedDate: Date { get } // the date and time this track was last played
465 | @objc optional var purchaserAppleID: String { get } // the Apple ID of the person who purchased this track
466 | @objc optional var purchaserName: String { get } // the name of the person who purchased this track
467 | @objc optional var rating: Int { get } // the rating of this track (0 to 100)
468 | @objc optional var ratingKind: iTunesERtK { get } // the rating kind of this track
469 | @objc optional var releaseDate: Date { get } // the release date of this track
470 | @objc optional var sampleRate: Int { get } // the sample rate of the track (in Hz)
471 | @objc optional var seasonNumber: Int { get } // the season number of the track
472 | @objc optional var shufflable: Bool { get } // is this track included when shuffling?
473 | @objc optional var skippedCount: Int { get } // number of times this track has been skipped
474 | @objc optional var skippedDate: Date { get } // the date and time this track was last skipped
475 | @objc optional var show: String { get } // the show name of the track
476 | @objc optional var sortAlbum: String { get } // override string to use for the track when sorting by album
477 | @objc optional var sortArtist: String { get } // override string to use for the track when sorting by artist
478 | @objc optional var sortAlbumArtist: String { get } // override string to use for the track when sorting by album artist
479 | @objc optional var sortName: String { get } // override string to use for the track when sorting by name
480 | @objc optional var sortComposer: String { get } // override string to use for the track when sorting by composer
481 | @objc optional var sortShow: String { get } // override string to use for the track when sorting by show name
482 | @objc optional var size: Int64 { get } // the size of the track (in bytes)
483 | @objc optional var start: Double { get } // the start time of the track in seconds
484 | @objc optional var time: String { get } // the length of the track in MM:SS format
485 | @objc optional var trackCount: Int { get } // the total number of tracks on the source album
486 | @objc optional var trackNumber: Int { get } // the index of the track on the source album
487 | @objc optional var unplayed: Bool { get } // is this track unplayed?
488 | @objc optional var videoKind: iTunesEVdK { get } // kind of video track
489 | @objc optional var volumeAdjustment: Int { get } // relative volume adjustment of the track (-100% to 100%)
490 | @objc optional var work: String { get } // the work name of the track
491 | @objc optional var year: Int { get } // the year the track was recorded/released
492 | @objc optional func setAlbum(_ album: String!) // the album name of the track
493 | @objc optional func setAlbumArtist(_ albumArtist: String!) // the album artist of the track
494 | @objc optional func setAlbumDisliked(_ albumDisliked: Bool) // is the album for this track disliked?
495 | @objc optional func setAlbumLoved(_ albumLoved: Bool) // is the album for this track loved?
496 | @objc optional func setAlbumRating(_ albumRating: Int) // the rating of the album for this track (0 to 100)
497 | @objc optional func setArtist(_ artist: String!) // the artist/source of the track
498 | @objc optional func setBookmark(_ bookmark: Double) // the bookmark time of the track in seconds
499 | @objc optional func setBookmarkable(_ bookmarkable: Bool) // is the playback position for this track remembered?
500 | @objc optional func setBpm(_ bpm: Int) // the tempo of this track in beats per minute
501 | @objc optional func setCategory(_ category: String!) // the category of the track
502 | @objc optional func setComment(_ comment: String!) // freeform notes about the track
503 | @objc optional func setCompilation(_ compilation: Bool) // is this track from a compilation album?
504 | @objc optional func setComposer(_ composer: String!) // the composer of the track
505 | @objc optional func setObjectDescription(_ objectDescription: String!) // the description of the track
506 | @objc optional func setDiscCount(_ discCount: Int) // the total number of discs in the source album
507 | @objc optional func setDiscNumber(_ discNumber: Int) // the index of the disc containing this track on the source album
508 | @objc optional func setDisliked(_ disliked: Bool) // is this track disliked?
509 | @objc optional func setEnabled(_ enabled: Bool) // is this track checked for playback?
510 | @objc optional func setEpisodeID(_ episodeID: String!) // the episode ID of the track
511 | @objc optional func setEpisodeNumber(_ episodeNumber: Int) // the episode number of the track
512 | @objc optional func setEQ(_ EQ: String!) // the name of the EQ preset of the track
513 | @objc optional func setFinish(_ finish: Double) // the stop time of the track in seconds
514 | @objc optional func setGapless(_ gapless: Bool) // is this track from a gapless album?
515 | @objc optional func setGenre(_ genre: String!) // the music/audio genre (category) of the track
516 | @objc optional func setGrouping(_ grouping: String!) // the grouping (piece) of the track. Generally used to denote movements within a classical work.
517 | @objc optional func setLongDescription(_ longDescription: String!)
518 | @objc optional func setLoved(_ loved: Bool) // is this track loved?
519 | @objc optional func setLyrics(_ lyrics: String!) // the lyrics of the track
520 | @objc optional func setMediaKind(_ mediaKind: iTunesEMdK) // the media kind of the track
521 | @objc optional func setMovement(_ movement: String!) // the movement name of the track
522 | @objc optional func setMovementCount(_ movementCount: Int) // the total number of movements in the work
523 | @objc optional func setMovementNumber(_ movementNumber: Int) // the index of the movement in the work
524 | @objc optional func setPlayedCount(_ playedCount: Int) // number of times this track has been played
525 | @objc optional func setPlayedDate(_ playedDate: Date!) // the date and time this track was last played
526 | @objc optional func setRating(_ rating: Int) // the rating of this track (0 to 100)
527 | @objc optional func setSeasonNumber(_ seasonNumber: Int) // the season number of the track
528 | @objc optional func setShufflable(_ shufflable: Bool) // is this track included when shuffling?
529 | @objc optional func setSkippedCount(_ skippedCount: Int) // number of times this track has been skipped
530 | @objc optional func setSkippedDate(_ skippedDate: Date!) // the date and time this track was last skipped
531 | @objc optional func setShow(_ show: String!) // the show name of the track
532 | @objc optional func setSortAlbum(_ sortAlbum: String!) // override string to use for the track when sorting by album
533 | @objc optional func setSortArtist(_ sortArtist: String!) // override string to use for the track when sorting by artist
534 | @objc optional func setSortAlbumArtist(_ sortAlbumArtist: String!) // override string to use for the track when sorting by album artist
535 | @objc optional func setSortName(_ sortName: String!) // override string to use for the track when sorting by name
536 | @objc optional func setSortComposer(_ sortComposer: String!) // override string to use for the track when sorting by composer
537 | @objc optional func setSortShow(_ sortShow: String!) // override string to use for the track when sorting by show name
538 | @objc optional func setStart(_ start: Double) // the start time of the track in seconds
539 | @objc optional func setTrackCount(_ trackCount: Int) // the total number of tracks on the source album
540 | @objc optional func setTrackNumber(_ trackNumber: Int) // the index of the track on the source album
541 | @objc optional func setUnplayed(_ unplayed: Bool) // is this track unplayed?
542 | @objc optional func setVideoKind(_ videoKind: iTunesEVdK) // kind of video track
543 | @objc optional func setVolumeAdjustment(_ volumeAdjustment: Int) // relative volume adjustment of the track (-100% to 100%)
544 | @objc optional func setWork(_ work: String!) // the work name of the track
545 | @objc optional func setYear(_ year: Int) // the year the track was recorded/released
546 | }
547 | extension SBObject: iTunesTrack {}
548 |
549 | // MARK: iTunesAudioCDTrack
550 | @objc public protocol iTunesAudioCDTrack: iTunesTrack {
551 | @objc optional var location: URL { get } // the location of the file represented by this track
552 | }
553 | extension SBObject: iTunesAudioCDTrack {}
554 |
555 | // MARK: iTunesFileTrack
556 | @objc public protocol iTunesFileTrack: iTunesTrack {
557 | @objc optional var location: URL { get } // the location of the file represented by this track
558 | @objc optional func refresh() // update file track information from the current information in the track’s file
559 | @objc optional func setLocation(_ location: URL!) // the location of the file represented by this track
560 | }
561 | extension SBObject: iTunesFileTrack {}
562 |
563 | // MARK: iTunesSharedTrack
564 | @objc public protocol iTunesSharedTrack: iTunesTrack {
565 | }
566 | extension SBObject: iTunesSharedTrack {}
567 |
568 | // MARK: iTunesURLTrack
569 | @objc public protocol iTunesURLTrack: iTunesTrack {
570 | @objc optional var address: String { get } // the URL for this track
571 | @objc optional func setAddress(_ address: String!) // the URL for this track
572 | }
573 | extension SBObject: iTunesURLTrack {}
574 |
575 | // MARK: iTunesUserPlaylist
576 | @objc public protocol iTunesUserPlaylist: iTunesPlaylist {
577 | @objc optional func fileTracks() -> SBElementArray
578 | @objc optional func URLTracks() -> SBElementArray
579 | @objc optional func sharedTracks() -> SBElementArray
580 | @objc optional var shared: Bool { get } // is this playlist shared?
581 | @objc optional var smart: Bool { get } // is this a Smart Playlist?
582 | @objc optional var genius: Bool { get } // is this a Genius Playlist?
583 | @objc optional func setShared(_ shared: Bool) // is this playlist shared?
584 | }
585 | extension SBObject: iTunesUserPlaylist {}
586 |
587 | // MARK: iTunesFolderPlaylist
588 | @objc public protocol iTunesFolderPlaylist: iTunesUserPlaylist {
589 | }
590 | extension SBObject: iTunesFolderPlaylist {}
591 |
592 | // MARK: iTunesVisual
593 | @objc public protocol iTunesVisual: iTunesItem {
594 | }
595 | extension SBObject: iTunesVisual {}
596 |
597 | // MARK: iTunesWindow
598 | @objc public protocol iTunesWindow: iTunesItem {
599 | @objc optional var bounds: NSRect { get } // the boundary rectangle for the window
600 | @objc optional var closeable: Bool { get } // does the window have a close button?
601 | @objc optional var collapseable: Bool { get } // does the window have a collapse button?
602 | @objc optional var collapsed: Bool { get } // is the window collapsed?
603 | @objc optional var fullScreen: Bool { get } // is the window full screen?
604 | @objc optional var position: NSPoint { get } // the upper left position of the window
605 | @objc optional var resizable: Bool { get } // is the window resizable?
606 | @objc optional var visible: Bool { get } // is the window visible?
607 | @objc optional var zoomable: Bool { get } // is the window zoomable?
608 | @objc optional var zoomed: Bool { get } // is the window zoomed?
609 | @objc optional func setBounds(_ bounds: NSRect) // the boundary rectangle for the window
610 | @objc optional func setCollapsed(_ collapsed: Bool) // is the window collapsed?
611 | @objc optional func setFullScreen(_ fullScreen: Bool) // is the window full screen?
612 | @objc optional func setPosition(_ position: NSPoint) // the upper left position of the window
613 | @objc optional func setVisible(_ visible: Bool) // is the window visible?
614 | @objc optional func setZoomed(_ zoomed: Bool) // is the window zoomed?
615 | }
616 | extension SBObject: iTunesWindow {}
617 |
618 | // MARK: iTunesBrowserWindow
619 | @objc public protocol iTunesBrowserWindow: iTunesWindow {
620 | @objc optional var selection: SBObject { get } // the selected songs
621 | @objc optional var view: iTunesPlaylist { get } // the playlist currently displayed in the window
622 | @objc optional func setView(_ view: iTunesPlaylist!) // the playlist currently displayed in the window
623 | }
624 | extension SBObject: iTunesBrowserWindow {}
625 |
626 | // MARK: iTunesEQWindow
627 | @objc public protocol iTunesEQWindow: iTunesWindow {
628 | }
629 | extension SBObject: iTunesEQWindow {}
630 |
631 | // MARK: iTunesMiniplayerWindow
632 | @objc public protocol iTunesMiniplayerWindow: iTunesWindow {
633 | }
634 | extension SBObject: iTunesMiniplayerWindow {}
635 |
636 | // MARK: iTunesPlaylistWindow
637 | @objc public protocol iTunesPlaylistWindow: iTunesWindow {
638 | @objc optional var selection: SBObject { get } // the selected songs
639 | @objc optional var view: iTunesPlaylist { get } // the playlist displayed in the window
640 | }
641 | extension SBObject: iTunesPlaylistWindow {}
642 |
643 | // MARK: iTunesVideoWindow
644 | @objc public protocol iTunesVideoWindow: iTunesWindow {
645 | }
646 | extension SBObject: iTunesVideoWindow {}
647 |
--------------------------------------------------------------------------------