Refresh Tags From Shared Files

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

bishopdonmiguel

New member
Joined
Jun 21, 2006
Messages
5
Points
0
Looked around a bit but can't find a solution anywhere. Hoping someone here has some advice.

I have a Mac with multiple user accounts. Each account has it's own iTunes library (and personal storage area) but the majority of each library points to a files in a central repository. One user "owns" the shared files and all others have read-only access. The "owner" imports all tracks, buys iTunes, maintains all tag info, etc. From time-to-time each user will "Add Files To Library" to retrieve any new shared content from the repository (I guess this could be scripted to occur automatically at startup but I haven't looked for that).

For the most part, this setup works very well because each user can maintain separate ratings, etc., without any file duplication. Unfortunately, when tags are edited by the "owner," changes do not appear in the library until the track is manually selected. With several thousand songs, it isn't feasible to refresh the tag information in any "user" library without wiping and adding. Unfortunately, while refreshing the tags, this destroys ratings, etc.

What I'd like to do is periodically allow users to scan through the library and update changed tags. Is there a script that does this? If not, any hints as to what script commands might do this and I'll give it a shot.

Thanks in advance.
 

MikeM

New member
Administrator
Joined
May 7, 2003
Messages
4,655
Points
0
Age
42
Location
ME, USA
I think I'm following but let me just ask for some clarification/verification. For the tags to get updated by someone who isn't the owner, they only need to select the file? As in simply clicking on it? Does Select All work?

Also, have you looked over at http://www.dougscripts.com to see if there's anything to help you?
 

bishopdonmiguel

New member
Joined
Jun 21, 2006
Messages
5
Points
0
I did check Doug's Scripts before seeking assistance here. I didn't see anything that would help. This seemed to be the right place to ask vs. burdening Doug with an e-mail. Great resource by the way. The Super Remove Dead Tracks is a real timesaver.

I was incorrect when I said the tags are updated when the track was selected. After careful testing, the tags for non-owners are not refreshed by simply selecting the track or selecting all tracks. They do immediatlely update when the tag in question is clicked OR when selecting GET INFO for the track (updated tags appear in the dialog). I suppose my first efforts must have involved clicking the tag cell while selecting the track so I assumed merely selecting the track would do the trick. It would seem that whatever process checks the tags for currentness isn't initiated without specific action to do so.

Thanks for the reply and I look forward to any guidance you can offer. I am willing to assist with the scripting, just not sure where to start.
 

MikeM

New member
Administrator
Joined
May 7, 2003
Messages
4,655
Points
0
Age
42
Location
ME, USA
I tried my hand at writing something. I don't really want to mess with my tracks, so I haven't tested changing track info with an external editor and seeing if the script works. I did however let it run for a bit on my library and it didn't screw anything up. I have 4408 tracks currently and I only let it run for about 20 seconds. I don't know how long it would take to do the whole library.

Anyway, this should refresh the track info for every track in your library. Hopefully, it works for you and doesn't take forever.

Code:
tell application "iTunes"
	repeat with i from 1 to (count of every track of library playlist 1)
		refresh track i of library playlist 1
	end repeat
end tell
 

MikeM

New member
Administrator
Joined
May 7, 2003
Messages
4,655
Points
0
Age
42
Location
ME, USA
No problem. I'm glad it worked and even more glad it didn't screw anything up considering I couldn't fully test it. ;)
 

bishopdonmiguel

New member
Joined
Jun 21, 2006
Messages
5
Points
0
Would you happen to know how to script the "File/Add To Library" command in iTunes? I'd like to automate the adding new music and updating tags process. I loaded the iTunes Dictionary into Script Editor but I didn't see any command that looked like it would work. Sorry to bug, I'm new to the Mac and Script Editor. Thanks again for your help.
 

MikeM

New member
Administrator
Joined
May 7, 2003
Messages
4,655
Points
0
Age
42
Location
ME, USA
When using the "Add To Library" feature, do you need to select the specific tracks or can you just select a folder with all of the music and iTunes determines which ones are new?

I'm generally just ripping CDs and don't use that feature.
 

bishopdonmiguel

New member
Joined
Jun 21, 2006
Messages
5
Points
0
I just select the folder... and it's the same for all users. In fact, the folder last used is "remembered" by iTunes between sessions so it's fairly easy to run. I'm trying to consolidate the actions into 1 vs. the current 2 (add new tracks then update tags for existng ones). If the script could pass the folder, that would be keen. Is there a source for all the scripting commands?

Thanks again.
 

MikeM

New member
Administrator
Joined
May 7, 2003
Messages
4,655
Points
0
Age
42
Location
ME, USA
I'm sure there are some online resources but I tend to just use the Dictionaries, then Google when I need to figure something out. I don't do a lot of scripting, so I tend to hunt down little bits as I need them.

There should be a way to automate the whole process. I use the application iKey to automate many things. You can assign a series of events to your keyboard, including applescripts.

You could, for instance, use iKey to set the F1 key to do the following: Simulate pressing Cmd+O (to open the Add to Library dialog), simulate pressing Enter (since the correct folder is already selected), and then run the script to update the track info.

I don't know how to the first two steps in Applescript, which is why I recommend iKey. I also don't know if there's an issue with timing. For instance, if there's a good amount of new music, does it take some extended time to add it all to the library? You might confuse any automated system if you start updating track info too early.
 

remp

New member
Joined
Jun 23, 2011
Messages
1
Points
0
I tried my hand at writing something. I don't really want to mess with my tracks, so I haven't tested changing track info with an external editor and seeing if the script works. I did however let it run for a bit on my library and it didn't screw anything up. I have 4408 tracks currently and I only let it run for about 20 seconds. I don't know how long it would take to do the whole library.

Anyway, this should refresh the track info for every track in your library. Hopefully, it works for you and doesn't take forever.

Code:
tell application "iTunes"
	repeat with i from 1 to (count of every track of library playlist 1)
		refresh track i of library playlist 1
	end repeat
end tell
When I run this it goes through track 163 of library playlist 1 - stops, and I get "iTunes got an error: An error type 100 has occurred" Nice grammar apple -lol

Any idea on why not working for me?

Thx in advance
 
Top