Anyone have a script that does the following:
You have predefine smart lists in itunes.
The script gets the last played date of the files in that smart list.
If the last played date exceeds a month, week or days (or specified).
The script moves that file to the trash from the library.
thanks in advance.
itunes has a global setting but not very helpful in this case.
Hmm doesn’t seem to be functioning… for some reason.
No files are moved to trash that meet criteria.
Strangest thing it’s working now… Thanks again…
Revisiting this. It’s been working for the longest time but now I get the following error:
“Can’t get location of {file track id 7583 of library playlist id 4934 of source id 39 of application “iTunes”}. ”
Anyone have some insight to fixing this?
ahem “Jacques ”
The error message says: Can’t get location of the list file track .
For some reason I don’t know iTunes returns a list even you filter first track of
this should fix it, make sure that the parentheses are exactly at these places
.
set this_track to item 1 of (first track of library playlist 1 whose database ID is This_id)
.
Thanks… that fixed the issue.
PS: I recommend to consider both the list and the flat track result
.
set this_track to (first track of library playlist 1 whose database ID is This_id)
if class of this_track is list then set this_track to item 1 of this_track
.
Stefank,
I’m assuming that this is better because it’s processing an list rather than individual elements?
thanks
my surprise was, that iTunes returns a list at all using this filter construction.
In all other cases I know, the syntax
1st element of whatever whose name is something
results the element, not a list containing the element.
If Apple will conform this behavior in the future, your script will work anyway
thanks again appreciate the reply…
Hello all,
Looks like the above script is broken in itunes 8 :
error:
iTunes got an error: can’t get item 1 of track 1 of library playlist 1 whose database ID = item 1 of {9244, 9238, 9240, 9242}
Any help would be greatly appreciated.
Apparently the fix was to revert back to the original script.
StefanK
September 11, 2008, 5:09pm
#14
For what purpose do you need the database IDs?
no particular need actually. It’s just how the script ran. Haven’t had an opportunity to look thoroughly through the code.
StefanK
September 11, 2008, 7:23pm
#16
although this is not documented in the dictionary
library playlist 1 of application "iTunes"
refers to the main music library