]> git.sesse.net Git - vlc/blob - modules/gui/macosx/iTunes.h
cdae69be241bda1f3ccb6ccaa0c42f1df59188ba
[vlc] / modules / gui / macosx / iTunes.h
1 /*
2  * iTunes.h
3  */
4
5 #import <AppKit/AppKit.h>
6 #import <ScriptingBridge/ScriptingBridge.h>
7
8
9 @class iTunesPrintSettings, iTunesApplication, iTunesItem, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesTrack, iTunesAudioCDTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesPlaylistWindow;
10
11 enum iTunesEKnd {
12         iTunesEKndTrackListing = 'kTrk' /* a basic listing of tracks within a playlist */,
13         iTunesEKndAlbumListing = 'kAlb' /* a listing of a playlist grouped by album */,
14         iTunesEKndCdInsert = 'kCDi' /* a printout of the playlist for jewel case inserts */
15 };
16 typedef enum iTunesEKnd iTunesEKnd;
17
18 enum iTunesEnum {
19         iTunesEnumStandard = 'lwst' /* Standard PostScript error handling */,
20         iTunesEnumDetailed = 'lwdt' /* print a detailed report of PostScript errors */
21 };
22 typedef enum iTunesEnum iTunesEnum;
23
24 enum iTunesEPlS {
25         iTunesEPlSStopped = 'kPSS',
26         iTunesEPlSPlaying = 'kPSP',
27         iTunesEPlSPaused = 'kPSp',
28         iTunesEPlSFastForwarding = 'kPSF',
29         iTunesEPlSRewinding = 'kPSR'
30 };
31 typedef enum iTunesEPlS iTunesEPlS;
32
33 enum iTunesERpt {
34         iTunesERptOff = 'kRpO',
35         iTunesERptOne = 'kRp1',
36         iTunesERptAll = 'kAll'
37 };
38 typedef enum iTunesERpt iTunesERpt;
39
40 enum iTunesEVSz {
41         iTunesEVSzSmall = 'kVSS',
42         iTunesEVSzMedium = 'kVSM',
43         iTunesEVSzLarge = 'kVSL'
44 };
45 typedef enum iTunesEVSz iTunesEVSz;
46
47 enum iTunesESrc {
48         iTunesESrcLibrary = 'kLib',
49         iTunesESrcIPod = 'kPod',
50         iTunesESrcAudioCD = 'kACD',
51         iTunesESrcMP3CD = 'kMCD',
52         iTunesESrcRadioTuner = 'kTun',
53         iTunesESrcSharedLibrary = 'kShd',
54         iTunesESrcUnknown = 'kUnk'
55 };
56 typedef enum iTunesESrc iTunesESrc;
57
58 enum iTunesESrA {
59         iTunesESrAAlbums = 'kSrL' /* albums only */,
60         iTunesESrAAll = 'kAll' /* all text fields */,
61         iTunesESrAArtists = 'kSrR' /* artists only */,
62         iTunesESrAComposers = 'kSrC' /* composers only */,
63         iTunesESrADisplayed = 'kSrV' /* visible text fields */,
64         iTunesESrASongs = 'kSrS' /* song names only */
65 };
66 typedef enum iTunesESrA iTunesESrA;
67
68 enum iTunesESpK {
69         iTunesESpKNone = 'kNon',
70         iTunesESpKBooks = 'kSpA',
71         iTunesESpKFolder = 'kSpF',
72         iTunesESpKGenius = 'kSpG',
73         iTunesESpKITunesU = 'kSpU',
74         iTunesESpKLibrary = 'kSpL',
75         iTunesESpKMovies = 'kSpI',
76         iTunesESpKMusic = 'kSpZ',
77         iTunesESpKPodcasts = 'kSpP',
78         iTunesESpKPurchasedMusic = 'kSpM',
79         iTunesESpKTVShows = 'kSpT'
80 };
81 typedef enum iTunesESpK iTunesESpK;
82
83 enum iTunesEVdK {
84         iTunesEVdKNone = 'kNon' /* not a video or unknown video kind */,
85         iTunesEVdKMovie = 'kVdM' /* movie track */,
86         iTunesEVdKMusicVideo = 'kVdV' /* music video track */,
87         iTunesEVdKTVShow = 'kVdT' /* TV show track */
88 };
89 typedef enum iTunesEVdK iTunesEVdK;
90
91 enum iTunesERtK {
92         iTunesERtKUser = 'kRtU' /* user-specified rating */,
93         iTunesERtKComputed = 'kRtC' /* iTunes-computed rating */
94 };
95 typedef enum iTunesERtK iTunesERtK;
96
97
98
99 /*
100  * Standard Suite
101  */
102
103 @interface iTunesPrintSettings : SBObject
104
105 @property (readonly) NSInteger copies;  // the number of copies of a document to be printed
106 @property (readonly) BOOL collating;  // Should printed copies be collated?
107 @property (readonly) NSInteger startingPage;  // the first page of the document to be printed
108 @property (readonly) NSInteger endingPage;  // the last page of the document to be printed
109 @property (readonly) NSInteger pagesAcross;  // number of logical pages laid across a physical page
110 @property (readonly) NSInteger pagesDown;  // number of logical pages laid out down a physical page
111 @property (readonly) iTunesEnum errorHandling;  // how errors are handled
112 @property (copy, readonly) NSDate *requestedPrintTime;  // the time at which the desktop printer should print the document
113 @property (copy, readonly) NSArray *printerFeatures;  // printer specific options
114 @property (copy, readonly) NSString *faxNumber;  // for fax number
115 @property (copy, readonly) NSString *targetPrinter;  // for target printer
116
117 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
118 - (void) close;  // Close an object
119 - (void) delete;  // Delete an element from an object
120 - (SBObject *) duplicateTo:(SBObject *)to;  // Duplicate one or more object(s)
121 - (BOOL) exists;  // Verify if an object exists
122 - (void) open;  // open the specified object(s)
123 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
124
125 @end
126
127
128
129 /*
130  * iTunes Suite
131  */
132
133 // The application program
134 @interface iTunesApplication : SBApplication
135
136 - (SBElementArray *) browserWindows;
137 - (SBElementArray *) encoders;
138 - (SBElementArray *) EQPresets;
139 - (SBElementArray *) EQWindows;
140 - (SBElementArray *) playlistWindows;
141 - (SBElementArray *) sources;
142 - (SBElementArray *) visuals;
143 - (SBElementArray *) windows;
144
145 @property (copy) iTunesEncoder *currentEncoder;  // the currently selected encoder (MP3, AIFF, WAV, etc.)
146 @property (copy) iTunesEQPreset *currentEQPreset;  // the currently selected equalizer preset
147 @property (copy, readonly) iTunesPlaylist *currentPlaylist;  // the playlist containing the currently targeted track
148 @property (copy, readonly) NSString *currentStreamTitle;  // the name of the current song in the playing stream (provided by streaming server)
149 @property (copy, readonly) NSString *currentStreamURL;  // the URL of the playing stream or streaming web site (provided by streaming server)
150 @property (copy, readonly) iTunesTrack *currentTrack;  // the current targeted track
151 @property (copy) iTunesVisual *currentVisual;  //  the currently selected visual plug-in
152 @property BOOL EQEnabled;  // is the equalizer enabled?
153 @property BOOL fixedIndexing;  // true if all AppleScript track indices should be independent of the play order of the owning playlist.
154 @property BOOL frontmost;  // is iTunes the frontmost application?
155 @property BOOL fullScreen;  // are visuals displayed using the entire screen?
156 @property (copy, readonly) NSString *name;  // the name of the application
157 @property BOOL mute;  // has the sound output been muted?
158 @property NSInteger playerPosition;  // the player’s position within the currently playing track in seconds.
159 @property (readonly) iTunesEPlS playerState;  // is iTunes stopped, paused, or playing?
160 @property (copy, readonly) SBObject *selection;  // the selection visible to the user
161 @property NSInteger soundVolume;  // the sound output volume (0 = minimum, 100 = maximum)
162 @property (copy, readonly) NSString *version;  // the version of iTunes
163 @property BOOL visualsEnabled;  // are visuals currently being displayed?
164 @property iTunesEVSz visualSize;  // the size of the displayed visual
165
166 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
167 - (void) run;  // run iTunes
168 - (void) quit;  // quit iTunes
169 - (iTunesTrack *) add:(NSArray *)x to:(SBObject *)to;  // add one or more files to a playlist
170 - (void) backTrack;  // reposition to beginning of current track or go to previous track if already at start of current track
171 - (iTunesTrack *) convert:(NSArray *)x;  // convert one or more files or tracks
172 - (void) fastForward;  // skip forward in a playing track
173 - (void) nextTrack;  // advance to the next track in the current playlist
174 - (void) pause;  // pause playback
175 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
176 - (void) playpause;  // toggle the playing/paused state of the current track
177 - (void) previousTrack;  // return to the previous track in the current playlist
178 - (void) resume;  // disable fast forward/rewind and resume playback, if playing.
179 - (void) rewind;  // skip backwards in a playing track
180 - (void) stop;  // stop playback
181 - (void) update;  // update the specified iPod
182 - (void) eject;  // eject the specified iPod
183 - (void) subscribe:(NSString *)x;  // subscribe to a podcast feed
184 - (void) updateAllPodcasts;  // update all subscribed podcast feeds
185 - (void) updatePodcast;  // update podcast feed
186 - (void) openLocation:(NSString *)x;  // Opens a Music Store or audio stream URL
187
188 @end
189
190 // an item
191 @interface iTunesItem : SBObject
192
193 @property (copy, readonly) SBObject *container;  // the container of the item
194 - (NSInteger) id;  // the id of the item
195 @property (readonly) NSInteger index;  // The index of the item in internal application order.
196 @property (copy) NSString *name;  // the name of the item
197 @property (copy, readonly) NSString *persistentID;  // the id of the item as a hexadecimal string. This id does not change over time.
198
199 - (void) printPrintDialog:(BOOL)printDialog withProperties:(iTunesPrintSettings *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme;  // Print the specified object(s)
200 - (void) close;  // Close an object
201 - (void) delete;  // Delete an element from an object
202 - (SBObject *) duplicateTo:(SBObject *)to;  // Duplicate one or more object(s)
203 - (BOOL) exists;  // Verify if an object exists
204 - (void) open;  // open the specified object(s)
205 - (void) playOnce:(BOOL)once;  // play the current track or the specified track or file.
206 - (void) reveal;  // reveal and select a track or playlist
207
208 @end
209
210 // a piece of art within a track
211 @interface iTunesArtwork : iTunesItem
212
213 @property (copy) NSImage *data;  // data for this artwork, in the form of a picture
214 @property (copy) NSString *objectDescription;  // description of artwork as a string
215 @property (readonly) BOOL downloaded;  // was this artwork downloaded by iTunes?
216 @property (copy, readonly) NSNumber *format;  // the data format for this piece of artwork
217 @property NSInteger kind;  // kind or purpose of this piece of artwork
218 @property (copy) NSData *rawData;  // data for this artwork, in original format
219
220
221 @end
222
223 // converts a track to a specific file format
224 @interface iTunesEncoder : iTunesItem
225
226 @property (copy, readonly) NSString *format;  // the data format created by the encoder
227
228
229 @end
230
231 // equalizer preset configuration
232 @interface iTunesEQPreset : iTunesItem
233
234 @property double band1;  // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
235 @property double band2;  // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB)
236 @property double band3;  // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB)
237 @property double band4;  // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB)
238 @property double band5;  // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB)
239 @property double band6;  // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB)
240 @property double band7;  // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB)
241 @property double band8;  // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB)
242 @property double band9;  // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB)
243 @property double band10;  // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB)
244 @property (readonly) BOOL modifiable;  // can this preset be modified?
245 @property double preamp;  // the equalizer preamp level (-12.0 dB to +12.0 dB)
246 @property BOOL updateTracks;  // should tracks which refer to this preset be updated when the preset is renamed or deleted?
247
248
249 @end
250
251 // a list of songs/streams
252 @interface iTunesPlaylist : iTunesItem
253
254 - (SBElementArray *) tracks;
255
256 @property (readonly) NSInteger duration;  // the total length of all songs (in seconds)
257 @property (copy) NSString *name;  // the name of the playlist
258 @property (copy, readonly) iTunesPlaylist *parent;  // folder which contains this playlist (if any)
259 @property BOOL shuffle;  // play the songs in this playlist in random order?
260 @property (readonly) long long size;  // the total size of all songs (in bytes)
261 @property iTunesERpt songRepeat;  // playback repeat mode
262 @property (readonly) iTunesESpK specialKind;  // special playlist kind
263 @property (copy, readonly) NSString *time;  // the length of all songs in MM:SS format
264 @property (readonly) BOOL visible;  // is this playlist visible in the Source list?
265
266 - (void) moveTo:(SBObject *)to;  // Move playlist(s) to a new location
267 - (iTunesTrack *) searchFor:(NSString *)for_ only:(iTunesESrA)only;  // search a playlist for tracks matching the search string. Identical to entering search text in the Search field in iTunes.
268
269 @end
270
271 // a playlist representing an audio CD
272 @interface iTunesAudioCDPlaylist : iTunesPlaylist
273
274 - (SBElementArray *) audioCDTracks;
275
276 @property (copy) NSString *artist;  // the artist of the CD
277 @property BOOL compilation;  // is this CD a compilation album?
278 @property (copy) NSString *composer;  // the composer of the CD
279 @property NSInteger discCount;  // the total number of discs in this CD’s album
280 @property NSInteger discNumber;  // the index of this CD disc in the source album
281 @property (copy) NSString *genre;  // the genre of the CD
282 @property NSInteger year;  // the year the album was recorded/released
283
284
285 @end
286
287 // the master music library playlist
288 @interface iTunesLibraryPlaylist : iTunesPlaylist
289
290 - (SBElementArray *) fileTracks;
291 - (SBElementArray *) URLTracks;
292 - (SBElementArray *) sharedTracks;
293
294
295 @end
296
297 // the radio tuner playlist
298 @interface iTunesRadioTunerPlaylist : iTunesPlaylist
299
300 - (SBElementArray *) URLTracks;
301
302
303 @end
304
305 // a music source (music library, CD, device, etc.)
306 @interface iTunesSource : iTunesItem
307
308 - (SBElementArray *) audioCDPlaylists;
309 - (SBElementArray *) libraryPlaylists;
310 - (SBElementArray *) playlists;
311 - (SBElementArray *) radioTunerPlaylists;
312 - (SBElementArray *) userPlaylists;
313
314 @property (readonly) long long capacity;  // the total size of the source if it has a fixed size
315 @property (readonly) long long freeSpace;  // the free space on the source if it has a fixed size
316 @property (readonly) iTunesESrc kind;
317
318 - (void) update;  // update the specified iPod
319 - (void) eject;  // eject the specified iPod
320
321 @end
322
323 // playable audio source
324 @interface iTunesTrack : iTunesItem
325
326 - (SBElementArray *) artworks;
327
328 @property (copy) NSString *album;  // the album name of the track
329 @property (copy) NSString *albumArtist;  // the album artist of the track
330 @property NSInteger albumRating;  // the rating of the album for this track (0 to 100)
331 @property (readonly) iTunesERtK albumRatingKind;  // the rating kind of the album rating for this track
332 @property (copy) NSString *artist;  // the artist/source of the track
333 @property (readonly) NSInteger bitRate;  // the bit rate of the track (in kbps)
334 @property double bookmark;  // the bookmark time of the track in seconds
335 @property BOOL bookmarkable;  // is the playback position for this track remembered?
336 @property NSInteger bpm;  // the tempo of this track in beats per minute
337 @property (copy) NSString *category;  // the category of the track
338 @property (copy) NSString *comment;  // freeform notes about the track
339 @property BOOL compilation;  // is this track from a compilation album?
340 @property (copy) NSString *composer;  // the composer of the track
341 @property (readonly) NSInteger databaseID;  // the common, unique ID for this track. If two tracks in different playlists have the same database ID, they are sharing the same data.
342 @property (copy, readonly) NSDate *dateAdded;  // the date the track was added to the playlist
343 @property (copy) NSString *objectDescription;  // the description of the track
344 @property NSInteger discCount;  // the total number of discs in the source album
345 @property NSInteger discNumber;  // the index of the disc containing this track on the source album
346 @property (readonly) double duration;  // the length of the track in seconds
347 @property BOOL enabled;  // is this track checked for playback?
348 @property (copy) NSString *episodeID;  // the episode ID of the track
349 @property NSInteger episodeNumber;  // the episode number of the track
350 @property (copy) NSString *EQ;  // the name of the EQ preset of the track
351 @property double finish;  // the stop time of the track in seconds
352 @property BOOL gapless;  // is this track from a gapless album?
353 @property (copy) NSString *genre;  // the music/audio genre (category) of the track
354 @property (copy) NSString *grouping;  // the grouping (piece) of the track. Generally used to denote movements within a classical work.
355 @property (copy, readonly) NSString *kind;  // a text description of the track
356 @property (copy) NSString *longDescription;
357 @property (copy) NSString *lyrics;  // the lyrics of the track
358 @property (copy, readonly) NSDate *modificationDate;  // the modification date of the content of this track
359 @property NSInteger playedCount;  // number of times this track has been played
360 @property (copy) NSDate *playedDate;  // the date and time this track was last played
361 @property (readonly) BOOL podcast;  // is this track a podcast episode?
362 @property NSInteger rating;  // the rating of this track (0 to 100)
363 @property (readonly) iTunesERtK ratingKind;  // the rating kind of this track
364 @property (copy, readonly) NSDate *releaseDate;  // the release date of this track
365 @property (readonly) NSInteger sampleRate;  // the sample rate of the track (in Hz)
366 @property NSInteger seasonNumber;  // the season number of the track
367 @property BOOL shufflable;  // is this track included when shuffling?
368 @property NSInteger skippedCount;  // number of times this track has been skipped
369 @property (copy) NSDate *skippedDate;  // the date and time this track was last skipped
370 @property (copy) NSString *show;  // the show name of the track
371 @property (copy) NSString *sortAlbum;  // override string to use for the track when sorting by album
372 @property (copy) NSString *sortArtist;  // override string to use for the track when sorting by artist
373 @property (copy) NSString *sortAlbumArtist;  // override string to use for the track when sorting by album artist
374 @property (copy) NSString *sortName;  // override string to use for the track when sorting by name
375 @property (copy) NSString *sortComposer;  // override string to use for the track when sorting by composer
376 @property (copy) NSString *sortShow;  // override string to use for the track when sorting by show name
377 @property (readonly) NSInteger size;  // the size of the track (in bytes)
378 @property double start;  // the start time of the track in seconds
379 @property (copy, readonly) NSString *time;  // the length of the track in MM:SS format
380 @property NSInteger trackCount;  // the total number of tracks on the source album
381 @property NSInteger trackNumber;  // the index of the track on the source album
382 @property BOOL unplayed;  // is this track unplayed?
383 @property iTunesEVdK videoKind;  // kind of video track
384 @property NSInteger volumeAdjustment;  // relative volume adjustment of the track (-100% to 100%)
385 @property NSInteger year;  // the year the track was recorded/released
386
387
388 @end
389
390 // a track on an audio CD
391 @interface iTunesAudioCDTrack : iTunesTrack
392
393 @property (copy, readonly) NSURL *location;  // the location of the file represented by this track
394
395
396 @end
397
398 // a track representing an audio file (MP3, AIFF, etc.)
399 @interface iTunesFileTrack : iTunesTrack
400
401 @property (copy) NSURL *location;  // the location of the file represented by this track
402
403 - (void) refresh;  // update file track information from the current information in the track’s file
404
405 @end
406
407 // a track residing in a shared library
408 @interface iTunesSharedTrack : iTunesTrack
409
410
411 @end
412
413 // a track representing a network stream
414 @interface iTunesURLTrack : iTunesTrack
415
416 @property (copy) NSString *address;  // the URL for this track
417
418 - (void) download;  // download podcast episode
419
420 @end
421
422 // custom playlists created by the user
423 @interface iTunesUserPlaylist : iTunesPlaylist
424
425 - (SBElementArray *) fileTracks;
426 - (SBElementArray *) URLTracks;
427 - (SBElementArray *) sharedTracks;
428
429 @property BOOL shared;  // is this playlist shared?
430 @property (readonly) BOOL smart;  // is this a Smart Playlist?
431
432
433 @end
434
435 // a folder that contains other playlists
436 @interface iTunesFolderPlaylist : iTunesUserPlaylist
437
438
439 @end
440
441 // a visual plug-in
442 @interface iTunesVisual : iTunesItem
443
444
445 @end
446
447 // any window
448 @interface iTunesWindow : iTunesItem
449
450 @property NSRect bounds;  // the boundary rectangle for the window
451 @property (readonly) BOOL closeable;  // does the window have a close box?
452 @property (readonly) BOOL collapseable;  // does the window have a collapse (windowshade) box?
453 @property BOOL collapsed;  // is the window collapsed?
454 @property NSPoint position;  // the upper left position of the window
455 @property (readonly) BOOL resizable;  // is the window resizable?
456 @property BOOL visible;  // is the window visible?
457 @property (readonly) BOOL zoomable;  // is the window zoomable?
458 @property BOOL zoomed;  // is the window zoomed?
459
460
461 @end
462
463 // the main iTunes window
464 @interface iTunesBrowserWindow : iTunesWindow
465
466 @property BOOL minimized;  // is the small player visible?
467 @property (copy, readonly) SBObject *selection;  // the selected songs
468 @property (copy) iTunesPlaylist *view;  // the playlist currently displayed in the window
469
470
471 @end
472
473 // the iTunes equalizer window
474 @interface iTunesEQWindow : iTunesWindow
475
476 @property BOOL minimized;  // is the small EQ window visible?
477
478
479 @end
480
481 // a sub-window showing a single playlist
482 @interface iTunesPlaylistWindow : iTunesWindow
483
484 @property (copy, readonly) SBObject *selection;  // the selected songs
485 @property (copy, readonly) iTunesPlaylist *view;  // the playlist displayed in the window
486
487
488 @end
489