OSX Mavericks

Feel free to post bug reports here. I need exact, detailed steps showing me how I can re-create the bug on my machine, so give as much info and detail as possible.
User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

Thanks. I'm still not understanding why the Python script won't recognize the path to my library... :(
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

Do this:
Replace the fifth line with this:
set kJamsPath to "/Users/yourusername/Music/kJams/kJams Library/"

Subbing in your username.
Cut and paste it over the current line, then run.
Last edited by DeusExMachina on Thu Oct 31, 2013 9:04 am, edited 1 time in total.

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

DeusExMachina wrote:Do this:
Replace the fifth line with this:
set kJamsPath to "/Users/yourusername/Music/kJams/kJams Library/"

Subbing in your username.
Cut and paste it over the current line, then run.
Thanks but my library is on an external "/Volumes/DJ Drive/kJams/kJams Library/" ;)
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

There are many errors in the python script. I do NOT know python, but I am attempting to fix it anyway. BBS.

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

If you replace the line in MY applescript with the line above, and then edit it to correspond to your machine, i.e.:
set kJamsPath to "/Volumes/DJ Drive/kJams/kJams Library/"
the AppleScript will work. The Python script will not. The code was just copied into a boilerplate, but it would appear Dave forgot to edit out AppleScript specific syntax for python code. So, for instance, the line you get hung up on:
set kJamsPath to "/Users/yourUserName/Music/kJams/kJams Library/"
should be:
kJamsPath = "/Users/yourUserName/Music/kJams/kJams Library/"
in python.
Likewise, repeat loops should be while loops. Etc..
I have done a partial edit, and it partially works. But I do not know enough about python yet to do the entire thing. Dave can probably hammer it out in a few minutes!

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

DeusExMachina wrote:If you replace the line in MY applescript with the line above, and then edit it to correspond to your machine, i.e.:
set kJamsPath to "/Volumes/DJ Drive/kJams/kJams Library/"
the AppleScript will work. The Python script will not. The code was just copied into a boilerplate, but it would appear Dave forgot to edit out AppleScript specific syntax for python code. So, for instance, the line you get hung up on:
set kJamsPath to "/Users/yourUserName/Music/kJams/kJams Library/"
should be:
kJamsPath = "/Users/yourUserName/Music/kJams/kJams Library/"
in python.
Likewise, repeat loops should be while loops. Etc..
I have done a partial edit, and it partially works. But I do not know enough about python yet to do the entire thing. Dave can probably hammer it out in a few minutes!
Your work is much appreciated, but I cannot get your script to work either...just a straight copy from the site and then changing the path produces "The action 'Run AppleScript' encountered an error.
Thanks!

Scott

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

Expected end of line but found identifier:

kScriptCommand_GET_SHOW_ROTATION_TIME_REMAIN
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

I'll need a bit more info. Open up the script in AppleScript Editor, run it, and tell me what line it bails out on.
Or for now, just paste in the code. Seems there is a copy problem.

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

This is what's working on my backup machine:

Code: Select all

on run {input, parameters}
	
	set kJamsPath to "/Volumes/DJ Drive/kJams/kJams Library/"
	set kJamsLibraryPath to kJamsPath & "Library.xml"
	set XMLfile to (POSIX file (kJamsLibraryPath))
	set Paras to paragraphs of (read XMLfile)
	-- we cycle through the list and extract the portion between the tag we're interested in
	-- we know that the tag we want is immediately after "<key>Current Value</key>"
	set tagValue to {}
	repeat with i from 1 to count of Paras
		if item i of Paras contains "Current Venue" then -- first we find the tag we're interested in
			set tagValue to item (i + 1) of Paras
			exit repeat
		end if
	end repeat
	-- return tagValue
	-- next we extract each value from the found tags knowing that the value is between "<string>" and "</string>
	repeat with i from 1 to count of tagValue
		set thisTag to item i of tagValue
		set thisTagValue to ""
		if thisTag is ">" then
			repeat with k from (i + 1) to count of tagValue
				set thisTag to item k of tagValue
				if thisTag is "<" then exit repeat
				set thisTagValue to thisTagValue & thisTag
			end repeat
			exit repeat
		end if
	end repeat
	thisTagValue
	set kJamsPath to kJamsPath & "Venues/"
	set venuePath to (POSIX file (kJamsPath))
	set singerPath to (POSIX file (kJamsPath & thisTagValue & "/Singers"))
	set Singers to (choose folder default location alias venuePath with prompt "Choose singers to copy to the current venue" with multiple selections allowed) as list
	repeat with i from 1 to count of Singers
		tell application "Finder"
			set Singer to item i of Singers
			make new alias file at singerPath to Singer
		end tell
	end repeat
	set kScriptCommand_RESCAN_VENUE to 19
	tell application "kJams 2"
		docommand kScriptCommand_RESCAN_VENUE
	end tell
	return input
end run
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

Are you using that in Automator, or just as a script? Either way, use this version:

Code: Select all

set kJamsPath to "/Volumes/DJ Drive/kJams/kJams Library/"
set kJamsLibraryPath to kJamsPath & "Library.xml"
set XMLfile to (POSIX file (kJamsLibraryPath))
set Paras to paragraphs of (read XMLfile)

-- we cycle through the list and extract the portion between the tag we're interested in
-- we know that the tag we want is immediately after "<key>Current Venue</key>"
set tagValue to {}
repeat with i from 1 to count of Paras
	if item i of Paras contains "Current Venue" then -- first we find the tag we're interested in
		set tagValue to item (i + 1) of Paras
		exit repeat
	end if
end repeat

-- next we extract each value from the found tags knowing that the value is between "<string>" and "</string>
repeat with i from 1 to count of tagValue
	set thisTag to item i of tagValue
	set venueName to ""
	if thisTag is ">" then
		repeat with k from (i + 1) to count of tagValue
			set thisTag to item k of tagValue
			if thisTag is "<" then exit repeat
			set venueName to venueName & thisTag
		end repeat
		exit repeat
	end if
end repeat

set kJamsPath to kJamsPath & "Venues/"
set venuePath to (POSIX file (kJamsPath))
set singerPath to (POSIX file (kJamsPath & venueName & "/Singers"))
set Singers to (choose folder default location alias venuePath with prompt "Choose singers to copy to the current venue" with multiple selections allowed) as list

tell application "Finder"
	make new alias file at singerPath to Singers
end tell

set kCurSongTime_REMAINING to 2
set kScriptCommand_RESCAN_VENUE to 19
set kScriptCommand_SHOW_ROTATION to 20
set kScriptCommand_HIDE_SHOWSCREEN to 21
set kScriptCommand_IS_SHOWSCREEN_SHOWING to 22
set kScriptCommand_GET_SHOW_ROTATION_TIME_REMAIN to 23
tell application "kJams 2"
	set rotationCueTime to docommand kScriptCommand_GET_SHOW_ROTATION_TIME_REMAIN
	set timeRemaining to get time kCurSongTime_REMAINING
	set showScreenIsShowing to docommand kScriptCommand_IS_SHOWSCREEN_SHOWING
	
	if showScreenIsShowing = 0 then
		if rotationCueTime is equal to timeRemaining then docommand kScriptCommand_SHOW_ROTATION
		
	end if
	docommand kScriptCommand_RESCAN_VENUE
end tell

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

I am using the Automator...and SONOVA-B...it worked! ;)

THANK YOU!
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

Okay, so here's the OFFICIAL word:
That copy singers python script was NOT supposed to have been in there! It was abandoned after the decision was made to fold the functionality into kJams itself. So for now, we're stuck with the Apple Script (which is fine, since I have gotten that working on Mavericks, anyway).

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

No problem. And this version is a little smarter, in that it eliminates a few lines of code AND smartly puts up the Rotation screen if you happen to run it at the appropriate time.

User avatar
way2fst4u
Posts: 164
Joined: Thu May 17, 2012 12:10 pm

Re: OSX Mavericks

Post by way2fst4u »

Now a serious question. Should I only run that script BETWEEN singers?
Thanks!

Scott

DeusExMachina
Posts: 1293
Joined: Sun Apr 20, 2008 9:57 am
Location: Pittsburgh, PA
Contact:

Re: OSX Mavericks

Post by DeusExMachina »

Actually, that is the worst time, IMO. Since the switch over can take a good while with a large venue, and since you lose all control over the app during the switch, I try to do it RIGHT after I start a track. Then I have the duration of the playback for it to do the work, hopefully regaining control before the track finishes.
For you, though, this might not matter, if you only have a few score singers. For me, with thousands of singers saved over like five years, it can take upward of five minutes! Also, since I use server almost exclusively, and since the server goes down during the switch, while I am copying users, I can not take song submissions, so I also have to time it so that no one is on my computers or on their phones while I do the copy.

Post Reply