• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Viele hassen ihn, manche schwören auf ihn, wir aber möchten unbedingt sehen, welche Bilder Ihr vor Eurem geistigen Auge bzw. vor der Linse Eures iPhone oder iPad sehen könnt, wenn Ihr dieses Wort hört oder lest. Macht mit und beteiligt Euch an unserem Frühjahrsputz ---> Klick

Playlist - Dateien verschieben / kopieren

Skeeve

Pomme d'or
Registriert
26.10.05
Beiträge
3.120
Vielleicht ist dies noch besser?

Es erstellt im Zielverzeichnis eine M3U Datei. Ob das sinnvoll ist, weiß ich noch nicht, das wird sich dann noch zeigen.

Code:
on run
	tell application "iTunes"
		try
			set curPL to (current playlist)
		on error
			display alert "Keine aktuelle Playlist gefunden." message "Bitte mindestens einmal ein Stück aus der gewünschten Playlist starten." as informational
			return
		end try
		set nme to name of curPL
		set trcks to {}
		repeat with tr in tracks of curPL
			copy quoted form of POSIX path of (location of tr as alias) to the end of trcks
		end repeat
	end tell
	set trgt to choose file name with prompt "Wohin soll die Playlist kopiert werden?" default name nme default location (path to desktop folder)
	set m3u to display dialog "Eine M3U Datei erstellen?)" buttons {"Abbruch", "Nein", "Ja"} default button "Ja" cancel button "Abbruch"
	set oastid to AppleScript's text item delimiters
	set AppleScript's text item delimiters to " "
	set cutoff to ((do shell script "perl -e " & (quoted form of "
		use strict;
		use warnings;
		use File::Basename;
		my ($plname, @files)= @ARGV;
		mkdir $plname,0777;
		my $compare= dirname $files[0];
		my $cutoff= length $compare;
		foreach (@files) {
			my $dir= $compare ^ dirname $_;
			$dir=~ /^(\\x00+)/;
			$cutoff= length $1 if $cutoff > length $1;
		}
		my $commonpth= dirname(substr($compare,0,$cutoff).'X');
		$commonpth=~ s#([^/])$#$1/#;
		$cutoff= length $commonpth;
		foreach (@files) {
			$_= substr($_, $cutoff);
		}
		$plname=~ s/'/'\\''/g;
		chdir $commonpth or die qq($!\\n);
		open my $in, qq/| tar cBpT - | (cd '$plname' ; tar xBpf -)/;
		print $in join(qq(\\n), @files),qq(\\n);
		close $in;
		print $cutoff;
		") & " " & (quoted form of POSIX path of trgt) & " " & (trcks as text)) as number) + 1
	
	if (the button returned of m3u) is not "Ja" then return
	
	set m3u_file to (open for access file ((trgt as string) & ":" & nme & ".m3u") with write permission)
	--try
	write "#EXTM3U" to m3u_file
	write return to m3u_file
	tell application "iTunes"
		repeat with tr in tracks of curPL
			tell tr to set extinfo to "#EXTINF:" & (((duration + 0.5) as integer) as text) & "," & (artist as text) & " - " & (album as text) & " - " & (name as text) & return & (text cutoff thru -1 of (POSIX path of (location as alias))) & return
			tell me to write extinfo to m3u_file
		end repeat
	end tell
	--end try
	close access m3u_file
	
end run
 

Anhänge

  • Copy Playlist M3U.zip
    22,5 KB · Aufrufe: 88