Suchen in iTunes

S

snehls

Mitglied
Thread Starter
Dabei seit
31.08.2004
Beiträge
36
Reaktionspunkte
0
Hi,

ich bastel gerade ein Skript das alle iTunes Titel die in dem Stil
Peter feat. Paul - Song
in
Peter - Song (feat. Paul)
umwandelt.

Statt dem feat wird allerdings manchmal auch ein & benutzt. Ich will im ertsen Schritt alle relevanten Titeln raussuchen.

Code:
set fsongs to every track of playlist "Bibliothek" whose artist contains "feat." or "&"

Leider funktioniert das so mit dem "or" nicht, wie schaff ichs, dass ich zwei Suchwörter angeben kann?

mfg
snehls
 
snehls schrieb:
Leider funktioniert das so mit dem "or" nicht, wie schaff ichs, dass ich zwei Suchwörter angeben kann?

Sicher so:
Code:
set fsongs to every track of playlist "Bibliothek" whose (artist contains "feat.") or (whose artist contains "&")

Eventuell auch so (waere eleganter, weiss aber nicht ob's klappt):
Code:
set fsongs to every track of playlist "Bibliothek" whose artist contains set fsongs to every track of playlist "Bibliothek" whose artist contains {"feat.", "&"}

Good scripting
Farid
 
danke so ....
Code:
set fsongs to every track of playlist "Bibliothek" whose (artist contains "feat.") or (artist contains "&")
gings
 
das ist eine sehr tolle idee für ein script. habe mir teilweise die mühe gemacht das ganze per hand zu ändern. würdest du das script zu verfügung stellen, wenn's funktioniert? wäre sehr nett. ich selbst habe leider keinerlei ahnung von apple script.

gruß
f.
 
Ja werd ich machen, mit dem "&" gibts allerdings das Problem, dass man beispielsweise "Simon & Garfunkel" nicht trennen will ..... aber wenns erstmal nur mit dem feat geht is ja auch nett ......
 
OK es ist erstmal fertig. Funktioniert aber nur um die "feat."'s weg zu kriegen, fürs "&" hab ich noch keine Lösung.

Ein Problem gibts noch mit Sonderzeichen, die werden im Titel und Artist einfach verschluckt.(Also "Santana Feat. The Project G & B" - "Maria Maria" wird zu "Santana" - "Maria Maria (Feat The Project G B)") Liegt daran, dass ich mit nem wordArray arbeite, mich störts nicht.

Ach ja ... das Skript löscht die Playlist "featSongs" am Ende nicht, so kann man sich anschauen was wie geändert wurde und hat das auf einen Blick.

Code:
set AppleScript's text item delimiters to {" "}

--does the string converting work
on convertTitle(title, artist)
	set featPos to 0
	set wordArray to words of artist
	repeat with i from 1 to length of wordArray
		if item i of wordArray is "Feat" then
			set featPos to i
		end if
	end repeat
	set newArtist to items 1 thru (featPos - 1) of wordArray as string
	set newTitel to title & " (" & (items featPos thru (length of wordArray) of wordArray as string) & ")"
	return {newArtist, newTitel}
end convertTitle


--create playlist containing tracks you want to change
set fsongs to {}
tell application "iTunes"
	set fsongs to every track of playlist "Bibliothek" whose artist contains "feat."
	set mylist to make user playlist with properties {name:"featSongs"}
	repeat with song in fsongs
		duplicate song to user playlist "featSongs"
	end repeat
end tell

--change track names
tell application "iTunes"
	set myPlaylist to playlist "featSongs"
	set trackCount to (count of tracks of myPlaylist)
end tell
repeat with j from 1 to trackCount
	tell application "iTunes"
		set myTrack to track j of myPlaylist
		set myArtist to artist of myTrack
		set myTitle to name of myTrack
	end tell
	set resultArray to convertTitle(myTitle, myArtist)
	tell application "iTunes"
		set artist of myTrack to (first item of resultArray)
		set name of myTrack to (2nd item of resultArray)
	end tell
end repeat
 
Zurück
Oben Unten