Jump to content
IGNORED

Using iTunes to control Audirvana on a remote computer: need some advice


wgscott

Recommended Posts

I've managed to create a shell script that allows me to control Audirvana on my playback computer using iTunes on another computer, removing the requirement for VNC.

 

One problem is vexing me:

 

iTunes changes a directory name that would end with a period to an underscore. (It also does so with colons, but in the case of the period [or full-stop], it only does it with one in the final position of the directoryname. Anyone know the syntax or regexp to allow me to specifically substitute only that period?

Link to comment
This seems to work,

 

zsh-% JUNK=R.E.M.
zsh-% print ${JUNK}| perl -p -e 's|\.$|_|g'

 

but I would like to use something like this, which doesn't:

 

print ${JUNK/\.$/_}  

 

print ${JUNK/%./_}  

is what I needed. I learned shell patterns ≠ regexps

Link to comment

Bill, as I understand it, your script requires the albums to be stored according to a particular hierarchy.

 

Here's an AppleScript that is indifferent to the file organization and that allows you to play an arbitrary selection of tracks instead of an entire album. I have never tried it from a remote machine using SSH, but I assume you could do so by embedding my entire AppleScript in an osascript statement within a shell script that is executed by SSH.

 

Because the file references are within AppleScript commands rather than shell commands, this script should eliminate your problems with trailing periods and other special characters.

 

 

set trkPaths to {}

-- Audirvana hangs if not running & fully initialized
-- before attempt to add track:
if application "Audirvana Plus" is not running then
tell application "Audirvana Plus" to activate
tell application "iTunes" to activate --"Display dialog" displays in iTunes environment.
display dialog "Re-run script after Audirvana Plus completes startup & building playlist." buttons {"OK"} default button 1
return -- Quit.
end if

set AudirPath to path to application "Audirvana Plus"


display dialog "Overwrite, Add or Cancel?" buttons {"Overwrite", "Add", "Cancel"} default button 1 --Cancel exits script.
set decision to the button returned of the result


if decision is "Overwrite" then -- Delete playlist.
tell application "Audirvana Plus" to activate
tell application "System Events"
	tell menu bar 1 of process "Audirvana Plus"
		tell menu "Play" of menu bar item "Play" to click menu item "Stop"
		tell menu "Edit" of menu bar item "Edit" to click menu item "Select All"
		tell menu "Edit" of menu bar item "Edit" to click menu item "Delete"
	end tell
end tell
end if


-- Both Overwrite and Add:
tell application "iTunes"
activate
set trackList to selection
repeat with track1 in trackList
	try
		tell application "iTunes" to set trkPath1 to (location of track1) as text
		copy trkPath1 to end of trkPaths
	on error
		--display dialog trkPath --Troubleshooting.
		try
			tell application "iTunes" to refresh track1 --Flags orphan track.
		end try
	end try
end repeat
end tell


tell application "Finder"
repeat with trkPath2 in trkPaths
	open alias trkPath2 using AudirPath
end repeat
end tell

HQPlayer (on 3.8 GHz 8-core i7 iMac 2020) > NAA (on 2012 Mac Mini i7) > RME ADI-2 v2 > Benchmark AHB-2 > Thiel 3.7

Link to comment

I discovered that my scheme requires iTunes on the remote laptop to use the iTunes Library on the music server as its own iTunes Library rather than accessing it as an iTunes Shared Library. iTunes does not reveal the file path for any track in an iTunes Shared Library.

 

Bill, are you accessing it as a shared library or as the laptop's own iTunes library?

 

As far as I can tell, a disadvantage of a shared library is that iTunes seems to forget the preferred browser column display when you disconnect and reconnect to the shared library.

HQPlayer (on 3.8 GHz 8-core i7 iMac 2020) > NAA (on 2012 Mac Mini i7) > RME ADI-2 v2 > Benchmark AHB-2 > Thiel 3.7

Link to comment
iTunes does not reveal the file path for any track in an iTunes Shared Library.

 

I found that out the hard way, too.

 

Bill, are you accessing it as a shared library or as the laptop's own iTunes library?

 

It works either way.

 

As far as I can tell, a disadvantage of a shared library is that iTunes seems to forget the preferred browser column display when you disconnect and reconnect to the shared library.

 

That is an advantage of doing it the other way. Another is there is then no requirement to have iTunes open on the music server (which some people don't like).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...