Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri May 26, 2017 1:03 pm

All times are UTC




Post new topic  Reply to topic  [ 17 posts ]  Go to page 1 2 Next
Author Message
PostPosted: Sun Jan 17, 2010 12:46 am 
Offline
Mostly Harmless
Mostly Harmless

Joined: Sun Jan 17, 2010 12:38 am
Posts: 2
Hi,
Just installed the game, getting to know the commands and the like, but cannot for the life of me get the game to integrate with iTunes. I have the 3 suggested playlists created and populated with songs, iTunes open, Oolite open, no sound. The reference suggests i/tunes integration should be switched 'ON', but i cannot find this in the options, only a toggle for Music.

Running Snow Leopard on iMac, Oolite 1.73.4

Any help gratefully received.


Top
   
 Post subject:
PostPosted: Sun Jan 17, 2010 1:37 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
The Music switch has three settings (under Mac OS X): Off, On and iTunes. (Although switching to iTunes freezes it for several seconds under Snow Leopard, I just discovered.)

_________________
E-mail: jens@oolite.org


Top
   
 Post subject:
PostPosted: Sun Jan 17, 2010 12:42 pm 
Offline
Mostly Harmless
Mostly Harmless

Joined: Sun Jan 17, 2010 12:38 am
Posts: 2
Sorted thanks, although initially Oolite was closing iTunes! Got some Pink Floyd in there now, gonna try some practice docking on the object that you're first presented with when leaving 'In Dock'. Presume that's why it's there (?).
Love your ranking Ahruman :D


Top
   
PostPosted: Tue Mar 19, 2013 1:08 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Dec 20, 2009 11:50 am
Posts: 361
Location: (northern) Germany
Did anything change meanwhile? I can't get it to work at all.
I have three playlists that worked before - Oolite-Docked, Oolite-Docking and Oolite-Inflight - and I'm trying it with vanilla Oolite in case an OXP breaks it. Music is set to iTunes, I quit iTunes and started it in case something like a half-played song stops the integration from working.
Oolite 1.77
iTune 11.0.2 (26)
Mac OS X 10.8.2

Here's what I find in the log about it:
Quote:
14:08:24.867 [sound.music.iTunesIntegration.failed]: ootunes returned :{
NSAppleScriptErrorAppName = iTunes;
NSAppleScriptErrorBriefMessage = "Can\U2019t set song repeat of user playlist id 44877 of source id 73 to all.";
NSAppleScriptErrorMessage = "iTunes got an error: Can\U2019t set song repeat of user playlist id 44877 of source id 73 to all.";
NSAppleScriptErrorNumber = "-10006";
NSAppleScriptErrorRange = "NSRange: {157, 37}";


Top
   
PostPosted: Tue Mar 19, 2013 1:16 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Sep 22, 2009 11:07 am
Posts: 2988
Location: Enfield, Middlesex
Is there any chance of getting iTunes integration for Windows users?

_________________
JazHaz

Quote:
Quote:
£4,500 though! :shock: <Faints>
Cheers,
Drew.
Maybe you could start a Kickstarter Campaign to found your £4500 pledge. 8)
Thanks to Gimi, I got an eBook in my inbox tonight (31st May 2014 - Release of Elite Reclamation)!


Top
   
PostPosted: Tue Mar 19, 2013 1:23 pm 
Offline
Dangerous
Dangerous

Joined: Fri Mar 01, 2013 3:01 am
Posts: 88
Quote:
Is there any chance of getting iTunes integration for Windows users?
I dunno... integration in apple probably runs an applescript to communicate with iTunes, so unlikely. Unless I'm wrong :wink:


Top
   
PostPosted: Tue Mar 19, 2013 5:13 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
Did anything change meanwhile? I can't get it to work at all.

Oolite 1.77
iTune 11.0.2 (26)
Mac OS X 10.8.2
Same in my log with Oolite 1.77 and OSX 10.6:
Code:
[sound.music.iTunesIntegration.failed]: ootunes returned :{
    NSAppleScriptErrorAppName = iTunes;
    NSAppleScriptErrorBriefMessage = "AppleEvent timed out.";
    NSAppleScriptErrorMessage = "iTunes got an error: AppleEvent timed out.";
    NSAppleScriptErrorNumber = "-1712";
    NSAppleScriptErrorRange = "NSRange: {68, 26}";
}
[sound.music.iTunesIntegration.failed]: ootunes returned :{
    NSAppleScriptErrorAppName = iTunes;
    NSAppleScriptErrorBriefMessage = "Can\U2019t set song repeat of user playlist id 1821 of source id 73 to all.";
    NSAppleScriptErrorMessage = "iTunes got an error: Can\U2019t set song repeat of user playlist id 1821 of source id 73 to all.";
    NSAppleScriptErrorNumber = "-10006";
    NSAppleScriptErrorRange = "NSRange: {157, 37}";
}
Oolite is sending simple AppleScript commands to iTunes. I can't remember any Oolite change lately, but big changes in iTunes. I had other programs that no longer connected correct with iTunes 11.

EDIT:
I get the same errors in the log with Oolite 1.74. With that version, I am sure it always worked. Meaning that the problem is iTunes 11 that is no longer accepting the old commands.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Tue Mar 19, 2013 5:28 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Any AppleScript experts on board? The whole current code used by Oolite is:
Code:
- (void) playiTunesPlaylist:(NSString *)playlistName
{
	NSString *ootunesScriptString =
		[NSString stringWithFormat:
		@"with timeout of 1 second\n"
		 "    tell application \"iTunes\"\n"
		 "        copy playlist \"%@\" to thePlaylist\n"
		 "        if thePlaylist exists then\n"
		 "            set song repeat of thePlaylist to all\n"
		 "            set shuffle of thePlaylist to true\n"
		 "            play some track of thePlaylist\n"
		 "        end if\n"
		 "    end tell\n"
		 "end timeout",
		 playlistName];
	
	NSAppleScript *ootunesScript = [[[NSAppleScript alloc] initWithSource:ootunesScriptString] autorelease];
	NSDictionary *errDict = nil;
	
	[ootunesScript executeAndReturnError:&errDict];
	if (errDict)
		OOLog(@"sound.music.iTunesIntegration.failed", @"ootunes returned :%@", errDict);
}

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Tue Mar 19, 2013 7:56 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
It is probably 20 Years ago that I tried to write something in AppleScript. Above code reads in short:
Code:
tell application "iTunes"
	copy playlist "Oolite-Docked" to thePlaylist
	if thePlaylist exists then
		set song repeat of thePlaylist to all
		set shuffle of thePlaylist to true
		play some track of thePlaylist
	end if
end tell
But when executing in the AppleScipt editor I get:
Code:
tell application "iTunes"
	get playlist "Oolite-Docked"
		--> user playlist id 1789 of source id 72
	exists user playlist id 1789 of source id 72
		--> true
	set song repeat of user playlist id 1789 of source id 72 to all
		--> error number -1708
Resultaat:
error "iTunes kreeg een fout: song repeat of user playlist id 1789 of source id 72 kan niet worden ingesteld op all." number -10006 from song repeat of user playlist id 1789 of source id 72
It goes wrong with the 'all' parameter. But when opening the iTunes library I see:
Code:
song repeat (off/one/all) : playback repeat mode
So it seems a correct syntax, and always was with iTunes. I know to little off AppleScript to see if this is a change of syntax, or simply a bug in iTunes itself. Any takers?

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Sat Dec 07, 2013 11:22 am 
Offline
Harmless
Harmless

Joined: Sat Dec 07, 2013 11:19 am
Posts: 1
In OOMusicController.m the code:-
Code:
NSString *ootunesScriptString =
[NSString stringWithFormat:
@"with timeout of 1 second\n"
" tell application \"iTunes\"\n"
" copy playlist \"%@\" to thePlaylist\n"
" if thePlaylist exists then\n"
" set song repeat of thePlaylist to all\n"
" set shuffle of thePlaylist to true\n"
" play some track of thePlaylist\n"
" end if\n"
" end tell\n"
"end timeout",
playlistName];
throws errors but this could be changed to something like:-
Code:
[NSString stringWithFormat:
@"with timeout of 1 second\n"
" tell application \"iTunes\"\n"
" stop\n"
" copy \"%@\" to ThePlayList\n"
" if playlist ThePlayList exists then\n"
" play playlist ThePlayList\n"
" tell application \"System Events\" to tell process \"iTunes\"\'s menu bar 1\'s menu bar item \"Controls\"\'s menu 1\'s menu item \"Repeat\"\'s menu 1\n"
" perform action \"AXPress\" of menu item \"All\"\n"
" end tell\n"
" else\n"
" set newalias to location of some track of playlist 1\n"
" set newlist to make new playlist\n"
" set name of newlist to ThePlayList\n"
" tell application \"System Events\" to tell process \"iTunes\"\'s menu bar 1\'s menu bar item \"Controls\"\'s menu 1\'s menu item \"Repeat\"\'s menu 1\n"
" perform action \"AXPress\" of menu item \"All\"\n"
" end tell\n"
" tell application \"System Events\" to perform action \"AXPress\" of (first menu item of process \"iTunes\"\'s menu bar 1\'s menu bar item \"Controls\"\'s menu 1\'s menu item \"Shuffle\"\'s menu 1 whose name ends with \"Shuffle\")\n"
" add newalias to newlist\n"
" play newlist\n"
" end if\n"
" end tell\n"
"end timeout",
playlistName];
Which works (although it requires access for assistive devices to be enables in system preferences )

Recompile using Xcode and use result instead of existing Oolite.app.


Top
   
PostPosted: Sat May 10, 2014 2:25 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
megangel1, thanks for the code. I haven't played, nor compiled Oolite for a long time.

Today I added your code to my source and Oolite can use I-Tunes integration again. And as you say, it asks for permission, but it will be quite clear for end-users what to change in the System preferences to give permanent permission.

But, although it now works, it still throws an error in the log:
Code:
16:26:53.003 [sound.music.iTunesIntegration.failed] OOMusicController.m:387: ootunes returned :{
    NSAppleScriptErrorAppName = "System Events";
    NSAppleScriptErrorBriefMessage = "AppleEvent timed out.";
    NSAppleScriptErrorMessage = "System Events got an error: AppleEvent timed out.";
    NSAppleScriptErrorNumber = "-1712";
    NSAppleScriptErrorRange = "NSRange: {297, 47}";
}

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Sat May 10, 2014 2:56 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Interesting. With a timeout of 5 seconds,I get the same errors in the log.

But setting the timeout to 30 seconds , I find in the log:
Code:
16:38:58.189 [sound.music.iTunesIntegration.failed] OOMusicController.m:387: ootunes returned :{
    NSAppleScriptErrorAppName = "System Events";
    NSAppleScriptErrorBriefMessage = "Oolite heeft geen toegang voor hulpapparaten.";
    NSAppleScriptErrorMessage = "System Events got an error: Oolite heeft geen toegang voor hulpapparaten.";
    NSAppleScriptErrorNumber = "-1719";
    NSAppleScriptErrorRange = "NSRange: {296, 47}";
}
So, that is the reason for the time-out. An error in Dutch, meaning Oolite has no access to assistive devices. Even when I see in the preferences that access is granted.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Thu May 15, 2014 10:48 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Now I know why the script of megangel1 is still throwing errors. Selecting menu-items of iTunes by name is language specific. When replacing "Controls" with "Regelaars" and "Turn On Shuffle" by "Schakel shuffle in", Oolite stops throwing errors and really turns on the shuffling option. But this is not a useful method if it is language sensitive.

A bit of googling gives a lots of hits, telling that the "Shuffle" and "Repeat" commands are removed from iTunes 11. And all come up with a variation of the script that uses the language dependent method that megangel1 gives. I could not find an official replacement if these functions. But looking in the apple script library, both methods should still be possible. Bug in iTunes 11?

Anyhow, just removing the two lines in the original script that set shuffle and repeat, makes that the scrips works again in Oolite. Not being able to set shuffle and repeat is not a big problem. iTines will now use the last settings for those.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Fri May 16, 2014 4:25 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon Apr 06, 2009 12:20 pm
Posts: 6176
Location: Aboard the Pitviper S.E. "Blackwidow"
So Apple have language-specific commands hard-coded into different versions of iTunes? Talk about a brain-dead move. :roll:

Coming on top of the "goto bug" security hole, I guess this really does show that some of their programmers are still stuck in the '80s. :mrgreen:

(sorry if this comes across as Apple-bashing, but seriously.. such sloppy coding practice in this day and age is ridiculous)

_________________
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied


Top
   
PostPosted: Fri May 16, 2014 6:08 am 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
So Apple have language-specific commands hard-coded into different versions of iTunes?
It is not Apple doing that. Two functions are removed from the iTunes library (at least are not working) and scripters are replacing that by a method were the system is instructed to activate specific menu items. They just choose to do it by name instead by position in the menu. They just use the hardcoded name instead of position because it is easier to remember. And because 90% of the demoscripts you see around do it in that way.

I'm not familiar with Apple Script, but think that there must be a more sensible method.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 17 posts ]  Go to page 1 2 Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited