iTunes Listen auf Synology NAS

biddescheen

Registriert
Thread Starter
Dabei seit
11.11.2014
Beiträge
2
Reaktionspunkte
0
Hallo alle zusammen. Ich bin neu in diesem Forum und grüße erstmal alle hier im Forum.

Natürlich habe ich auch eine Frage mitgebracht.

Hier erstmal einige Angaben zur Hardware.

- I Mac mit Windows und Mac OSX 250GB HDD per Wlan im Netz
- NAS Synology DS412play 2-Bay 4TB per Lan an der Speedport
- Timecapsul per Lan an der Speedport
- WLAN 2,4 Ghz (5Ghz wegen Drucker nicht möglich)
- Bang und Olulfsen BeoPlay A8 per Wlan im Netz

- gewünschte Hardware für die Zukunft: Mini I Pad

Jetzt zur Frage:

Der Bekannte von mir hatte auf seinem alten XP PC seine ganze Musik -80GB- (50% davon über I Tunes gekauft, Rest eigene CD's importiert) und wollte über auf dem NAS seine Musik sichern aber auch abrufen können.

Also habe ich die Mediathek auf das NAS geschoben. Die Library mit I Tunes verknüpft. Netzlaufwerk unter Windows auf dem I Mac beim starten verbunden. Beo Play mit I Mac (bzw. I Tunes unter Windows) verbunden.

Was funktioniert bis jetzt?

1. I Tunes erkennt die Mediathek auf dem NAS
2. Beoplay verbindet sich perfekt mit I Tunes auf I Mac (Nachteil: wenn Beoplay aktiviert wird, ist die Musik am I Mac aus und der bekannte will Beoplay im Wohnzimmer laufen lassen, sein I Mac steht im Büro wo auch die Musik hören will)

Was funktioniert nicht?

1. Beoplay läßt sich ansteuern durch: I Pad (Mini), I Pod, I Phone
2. I Pad, I Pod, I Phone hat eine andere Software als I Tunes (I Tunes kann sich mit NAS verbinden - I Pad, I Pod, I Phone nicht)
3. Was verbinde ich mit Beoplay um die Mediathek auf dem NAS abzuspielen?
4. Wie kann man die erstellten Musiklisten in I Tunes (I Mac) auf Beoplay erkennen?
5. Der Bekannte möchte nicht dauernd ins Büro laufen um Musik auf Beoplay zu starten im Wohnzimmer.

Ich hoffe es nicht zu undeutlich ausgedrückt zu haben.

Freue mich auf tolle Denkanstöße. Vielleicht Cloud????

Herzliche Grüße euer Tom
 
Also....
Ich habe gerade mal ganz naiv BeoPlay A8 ergooglet.

Du hast die Musik auf dem NAS am laufen?
Du hast auf der Snology den Medien-Server laufen?

Zu deinen Fragen (was nicht funktioniert):
zu 2. Für die iOS Geräte benutze die AUDIO-Station APP von Synology. Damit kannst du auf die Musik auf dem NAS zugreifen und auf dem Gerät wiedergeben (siehe auf 3.b)
zu 3. a. Der BeoPlay unterstützt DLNA <- Verbinde dich mit dem Boplay via DLNA um die Musik vom NAS abzuspielen.
ODER b. Der Boeplay unterstützt Airplay <- Du kannst in der Audio Station App festlegen, dass die Musik auf einem Airplay Device (also in deinem Fall der Beoplay) ausgegeben wird. Das NAS streamt dann direkt auf das Teil. Dein iPhone etc. dient in diesem Fall als Fernbedienung.
4. Was du machen musst ist die Wiedergabe listen die du in iTunes erstellst auf das NAS kopieren, so dass die Audiostation bzw. der Medienserver die Listen auch kennt.
Diese werden dann auch beim Zugriff über DLNA oder per Audiostation App angezeigt.

Ich habe für diese Zwecke ein Apple Script gebaut, was du ggf nur leicht anpassen musst, damit deine Pfade korrekt sind:
Code:
-- Adapted from Bery Rinaldo's "Export Playlist to M3U" script. The original copyright-- information for this script is as follows:


-- Export Playlist to M3U
--
-- This AppleScript is used to output the current iTunes playlist into an M3U format file suitable for use with the AudioTron.


-- Copyright (C) 2002 Bery Rinaldo 
--
-- This program is free software; you can redistribute it and/or modify it under the terms
-- of the GNU General Public License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version. 
--
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
-- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details. 
--
-- You should have received a copy of the GNU General Public License along with this program; if not, 
-- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 


-- Script written by Bery Rinaldo beryrinaldo@mac.com on 18-March-2002
-- Script modified by Jan Philipp Köhler in October 2014
--




property |linefeed| : ASCII character 10


try
	with timeout of 1800 seconds
		
		tell application "iTunes"
			set playlist_names to name of user playlists
			--			set the playlist_text to "#CURTRACK 0" & |linefeed|
			set the playlist_text to "#EXTM3U" & |linefeed|
			set the playlist_name to item 1 of (choose from list playlist_names)
			--			set the export_folder to POSIX path of (choose folder)
			set the export_folder to "/Volumes/music/playlists/"
			set the target_file to export_folder & "temp.m3u" as Unicode text
			--			tell application "System Events" to set fileExists to exists disk item (my POSIX file target_file as string)
			--			if the result then
			--				display dialog "There is already a file named " & playlist_name & ".m3u. Do you want to replace the file?" buttons {"Cancel", "Proceed"}					cancel button 1 with icon caution
			--			end if
			tell playlist playlist_name
				set the track_count to the count of tracks
			end tell
			repeat with z from 1 to the track_count
				tell track z of playlist playlist_name
					copy {location} to {loc}
				end tell
				set name_z to name of (track z of playlist playlist_name)
				set time_z to duration of (track z of playlist playlist_name)
				set time_z to round (time_z) rounding down
				set the posixloc to POSIX path of loc as text
				set new_posixloc to my replace_chars(posixloc, "/Volumes/music", "..")
				set encoded_posixloc to my encode_text(new_posixloc, true, false)
				set the playlist_text to the playlist_text & "#EXTURL:file://" & encoded_posixloc & |linefeed|
				set the playlist_text to the playlist_text & "#EXTINF:" & time_z & "," & name_z & |linefeed|
				set the playlist_text to the playlist_text & new_posixloc & |linefeed|
			end repeat
		end tell
		
		set this_result to my write_to_file(playlist_text, POSIX file target_file)
		if this_result is not true then
			error this_result -- There was a problem writing the playlist file.
		end if
		
		-- Do real UTF-8 Conversion:
		do shell script "iconv -f UTF8-MAC -t UTF8 \"" & target_file & "\" > \"" & export_folder & playlist_name & ".m3u\""
		do shell script "rm \"" & target_file & "\""
		
	end timeout
on error error_message number error_number
	tell application "iTunes"
		if the error_number is not -128 then
			beep
			display dialog error_message buttons {"Cancel"} default button 1
		end if
	end tell
end try

on write_to_file(this_data, target_file)
	try
		set the target_file to the target_file as Unicode text
		set the open_target_file to open for access file target_file with write permission
		set eof open_target_file to 0
		--set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
		--write BOM_UTF8 to open_target_file
		write this_data to the open_target_file as «class utf8»
		close access the open_target_file
		return true
	on error error_message
		try
			close access file target_file
		end try
		return error_message
	end try
end write_to_file

on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars

-- this sub-routine is used to encode text
on encode_text(this_text, encode_URL_A, encode_URL_B)
	set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
	set the URL_A_chars to "$+!'?;&@=#%><{}[]\"~`^\\|*"
	set the URL_B_chars to ".-_:/()"
	set the acceptable_characters to the standard_characters
	if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
	if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
	set the encoded_text to ""
	repeat with this_char in this_text
		if this_char is in the acceptable_characters then
			set the encoded_text to (the encoded_text & this_char)
		else
			set the encoded_text to (the encoded_text & encode_char(this_char)) as string
		end if
	end repeat
	return the encoded_text
end encode_text

on encode_char(this_char)
	set the ASCII_num to (the ASCII number this_char)
	set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
	set x to item ((ASCII_num div 16) + 1) of the hex_list
	set y to item ((ASCII_num mod 16) + 1) of the hex_list
	return ("%" & x & y) as string
end encode_char




try
	set fileobj to open for access filepath with write permission
	set eof of fileobj to 0
	set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
	write BOM_UTF8 to fileobj
	write filecont to fileobj as «class utf8»
	close access fileobj
on error errmsg
	try
		close access fileobj
	end try
end try
 
Hallo PK2061,
vielen Dank für deine Hilfe. Hab die Lösung mal überflogen und ein paar Fragen stellen sich da noch. Aber ich schaffe das definitiv nicht vor dem WE das zu probieren oder dem ganzen auf den Grund zu gehen. Mache ich aber kommende Woche. Hört sich auf jeden Fall nach der Lösung an. I Phone als Fernbedienung fürs Beoplay. So ist der Plan. Hoffe nur ich muss auf dem NAS nicht mit der ganzen Mediathek umziehen. Weil dabei sind schon mal alle Listen in I Tunes verschwunden gewesen. Also vorher sichern und dann mit "ich glaube" Shift Taste I Tunes starten und Verzeichnis auf NAS aufrufen und dort Library starten. Wie dem auch sei....herzlichen Dank für die prompte Hilfe. Klasse von Dir. Gruß Tom
 
Ich habe das mit iTunes auf dem NAS so gelöst:
Die iTunes Library (bzw. die Library Datei) liegt auf meinem Haupt-Mac.
Die Musik selbst liegt auf dem Nas unter dem Share Music, welches automatisch beim Start per Script gemounted wird.

Um die Musik vom lokalen Mac auf das NAS umzuziehen reicht es also in den iTunes Einstellungen den Speicherort der Musiklibrary zu wechseln.
Die Files werden dann von iTunes an den neuen Ort verschoben.
- Natürlich muss die automatische Ordnerverwaltung durch iTunes eingeschaltet sein.
(Ohne Garantie - Backup vorher kann nicht schaden! ;))

Viel Erfolg dann beim Testen!
 
Zwar schon älter der Thread, aber ich nutze auch DLNA mit MinimServer. Die Playlisten exportiere ich über iTunes als m3u8 und im TextEdit ersetze ich nur 'Volumes' gegen 'media' und alles funktioniert reibungslos. Die A8 meines Dads hat nur AirPlay und das zickt ziemlich oft.
 
Also....
Ich habe gerade mal ganz naiv BeoPlay A8 ergooglet.

Du hast die Musik auf dem NAS am laufen?
Du hast auf der Snology den Medien-Server laufen?

Zu deinen Fragen (was nicht funktioniert):
zu 2. Für die iOS Geräte benutze die AUDIO-Station APP von Synology. Damit kannst du auf die Musik auf dem NAS zugreifen und auf dem Gerät wiedergeben (siehe auf 3.b)
zu 3. a. Der BeoPlay unterstützt DLNA <- Verbinde dich mit dem Boplay via DLNA um die Musik vom NAS abzuspielen.
ODER b. Der Boeplay unterstützt Airplay <- Du kannst in der Audio Station App festlegen, dass die Musik auf einem Airplay Device (also in deinem Fall der Beoplay) ausgegeben wird. Das NAS streamt dann direkt auf das Teil. Dein iPhone etc. dient in diesem Fall als Fernbedienung.
4. Was du machen musst ist die Wiedergabe listen die du in iTunes erstellst auf das NAS kopieren, so dass die Audiostation bzw. der Medienserver die Listen auch kennt.
Diese werden dann auch beim Zugriff über DLNA oder per Audiostation App angezeigt.

Ich habe für diese Zwecke ein Apple Script gebaut, was du ggf nur leicht anpassen musst, damit deine Pfade korrekt sind:
Code:
-- Adapted from Bery Rinaldo's "Export Playlist to M3U" script. The original copyright-- information for this script is as follows:


-- Export Playlist to M3U
--
-- This AppleScript is used to output the current iTunes playlist into an M3U format file suitable for use with the AudioTron.


-- Copyright (C) 2002 Bery Rinaldo
--
-- This program is free software; you can redistribute it and/or modify it under the terms
-- of the GNU General Public License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along with this program; if not,
-- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


-- Script written by Bery Rinaldo beryrinaldo@mac.com on 18-March-2002
-- Script modified by Jan Philipp Köhler in October 2014
--




property |linefeed| : ASCII character 10


try
    with timeout of 1800 seconds
       
        tell application "iTunes"
            set playlist_names to name of user playlists
            --            set the playlist_text to "#CURTRACK 0" & |linefeed|
            set the playlist_text to "#EXTM3U" & |linefeed|
            set the playlist_name to item 1 of (choose from list playlist_names)
            --            set the export_folder to POSIX path of (choose folder)
            set the export_folder to "/Volumes/music/playlists/"
            set the target_file to export_folder & "temp.m3u" as Unicode text
            --            tell application "System Events" to set fileExists to exists disk item (my POSIX file target_file as string)
            --            if the result then
            --                display dialog "There is already a file named " & playlist_name & ".m3u. Do you want to replace the file?" buttons {"Cancel", "Proceed"}                    cancel button 1 with icon caution
            --            end if
            tell playlist playlist_name
                set the track_count to the count of tracks
            end tell
            repeat with z from 1 to the track_count
                tell track z of playlist playlist_name
                    copy {location} to {loc}
                end tell
                set name_z to name of (track z of playlist playlist_name)
                set time_z to duration of (track z of playlist playlist_name)
                set time_z to round (time_z) rounding down
                set the posixloc to POSIX path of loc as text
                set new_posixloc to my replace_chars(posixloc, "/Volumes/music", "..")
                set encoded_posixloc to my encode_text(new_posixloc, true, false)
                set the playlist_text to the playlist_text & "#EXTURL:file://" & encoded_posixloc & |linefeed|
                set the playlist_text to the playlist_text & "#EXTINF:" & time_z & "," & name_z & |linefeed|
                set the playlist_text to the playlist_text & new_posixloc & |linefeed|
            end repeat
        end tell
       
        set this_result to my write_to_file(playlist_text, POSIX file target_file)
        if this_result is not true then
            error this_result -- There was a problem writing the playlist file.
        end if
       
        -- Do real UTF-8 Conversion:
        do shell script "iconv -f UTF8-MAC -t UTF8 \"" & target_file & "\" > \"" & export_folder & playlist_name & ".m3u\""
        do shell script "rm \"" & target_file & "\""
       
    end timeout
on error error_message number error_number
    tell application "iTunes"
        if the error_number is not -128 then
            beep
            display dialog error_message buttons {"Cancel"} default button 1
        end if
    end tell
end try

on write_to_file(this_data, target_file)
    try
        set the target_file to the target_file as Unicode text
        set the open_target_file to open for access file target_file with write permission
        set eof open_target_file to 0
        --set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
        --write BOM_UTF8 to open_target_file
        write this_data to the open_target_file as «class utf8»
        close access the open_target_file
        return true
    on error error_message
        try
            close access file target_file
        end try
        return error_message
    end try
end write_to_file

on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
end replace_chars

-- this sub-routine is used to encode text
on encode_text(this_text, encode_URL_A, encode_URL_B)
    set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
    set the URL_A_chars to "$+!'?;&@=#%><{}[]\"~`^\\|*"
    set the URL_B_chars to ".-_:/()"
    set the acceptable_characters to the standard_characters
    if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
    if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
    set the encoded_text to ""
    repeat with this_char in this_text
        if this_char is in the acceptable_characters then
            set the encoded_text to (the encoded_text & this_char)
        else
            set the encoded_text to (the encoded_text & encode_char(this_char)) as string
        end if
    end repeat
    return the encoded_text
end encode_text

on encode_char(this_char)
    set the ASCII_num to (the ASCII number this_char)
    set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
    set x to item ((ASCII_num div 16) + 1) of the hex_list
    set y to item ((ASCII_num mod 16) + 1) of the hex_list
    return ("%" & x & y) as string
end encode_char




try
    set fileobj to open for access filepath with write permission
    set eof of fileobj to 0
    set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
    write BOM_UTF8 to fileobj
    write filecont to fileobj as «class utf8»
    close access fileobj
on error errmsg
    try
        close access fileobj
    end try
end try

@pk2061 Dein Script funktioniert bei mir nach einer kleinen Modifikation super. Da ich von Skripten null Ahnung habe... Leider sortiert das Script alphabetisch die Playlisten durch, was müsste ich denn ändern, dass die Playlist so geschrieben wird, wie in iTunes angelegt? Wäre dankbar für jeden Tipp!
 
Mmm ich habe in letzter Zeit wenig mit dem Thema beschäftigt, aus dem Kopf aber folgendes:
Ich meine es hat auch viel damit zu tun wie die Playliste in iTunes sortiert ist, wenn du die Playlist exportierst.
Wenn die Lieder der Playlist in iTunes zum Zeitpunkt des Exports alphabetisch sortiert sind, sind sie auf der exportierten Playliste auch in der selben Reihenfolge.
(Wie gesagt kann sich auch anders verhalten, ich müßte mich erst mal wieder mit dem Thema beschäftigen...) :D
 
Mmm ich habe in letzter Zeit wenig mit dem Thema beschäftigt, aus dem Kopf aber folgendes:
Ich meine es hat auch viel damit zu tun wie die Playliste in iTunes sortiert ist, wenn du die Playlist exportierst.
Wenn die Lieder der Playlist in iTunes zum Zeitpunkt des Exports alphabetisch sortiert sind, sind sie auf der exportierten Playliste auch in der selben Reihenfolge.
(Wie gesagt kann sich auch anders verhalten, ich müßte mich erst mal wieder mit dem Thema beschäftigen...) :D

Die Tracks sind anders sortiert, aber dann google ich mal und bei Erfolg poste ich es hier, aber danke ;)
 
Der Thread ist zwar wirklich schon in die Jahre gekommen aber weiterhin eine gute Lösung für Nas-User, um Playlisten zu exportieren und importieren ohne großes Tamtam.

Vielleicht könnt ihr mir weiterhelfen...
Das Script funktioniert super aber ich würde gerne, dass es alle Playlisten hintereinander exportiert und importiert ohne vorherige Eingabe zu machen.
Ich hoffe sehr, dass mir hierzu einer weiterhelfen kann :)

Vielen Dank und beste Grüße
 
Willst du auf einen Rutsch alle Playlisten aufeinmal exportieren?

Dann das Script so modifizieren:
Schleife über alle Playlist Names und damit dann die eigentliche Exportroutine aufrufen.

Ich müsste mich erstmal wieder einlesen wie das funktioniert.
Ggf. poste ich später nochwas, wenn mir was einfällt.
 
So...
Mal eben was dahingerotzt:
Code:
-- Adapted from Bery Rinaldo's "Export Playlist to M3U" script. The original copyright-- information for this script is as follows:


-- Export Playlist to M3U
--
-- This AppleScript is used to output the current iTunes playlist into an M3U format file suitable for use with the AudioTron.


-- Copyright (C) 2002 Bery Rinaldo 
--
-- This program is free software; you can redistribute it and/or modify it under the terms
-- of the GNU General Public License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version. 
--
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
-- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details. 
--
-- You should have received a copy of the GNU General Public License along with this program; if not, 
-- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 


-- Script written by Bery Rinaldo beryrinaldo@mac.com on 18-March-2002
-- Script modified by Jan Philipp Köhler in October 2014 - Modified for NAS Support
-- Script modified by Jan Philipp Köhler in December 2016 - Modified to export all Playlists at once
--

property |linefeed| : ASCII character 10


try
	with timeout of 1800 seconds
		
		tell application "iTunes"
			
			-- Itunes playlist names:
			set playlist_names to name of user playlists
			
			-- Export path & tempfiles
			set the export_folder to "/Volumes/music/playlists/"
			set the target_file to export_folder & "temp.m3u" as Unicode text
			
			repeat name in playlist_names times
				-- Export single playlist:
				export_playlist(playlist_name)
			end repeat
		end tell
		
	end timeout
	
on error error_message number error_number
	tell application "iTunes"
		if the error_number is not -128 then
			beep
			display dialog error_message buttons {"Cancel"} default button 1
		end if
	end tell
	
end try


-- this sup does the export work
on export_playlist(playlist_name)
	tell application "iTunes"
		
		tell playlist playlist_name
			set the track_count to the count of tracks
		end tell
		
		repeat with z from 1 to the track_count
			tell track z of playlist playlist_name
				copy {location} to {loc}
			end tell
			set name_z to name of (track z of playlist playlist_name)
			set time_z to duration of (track z of playlist playlist_name)
			set time_z to round (time_z) rounding down
			set the posixloc to POSIX path of loc as text
			set new_posixloc to my replace_chars(posixloc, "/Volumes/music", "..")
			set encoded_posixloc to my encode_text(new_posixloc, true, false)
			set the playlist_text to the playlist_text & "#EXTURL:file://" & encoded_posixloc & |linefeed|
			set the playlist_text to the playlist_text & "#EXTINF:" & time_z & "," & name_z & |linefeed|
			set the playlist_text to the playlist_text & new_posixloc & |linefeed|
		end repeat
	end tell
	
	set this_result to my write_to_file(playlist_text, POSIX file target_file)
	
	if this_result is not true then
		error this_result -- There was a problem writing the playlist file.
	end if
	
	-- Do real UTF-8 Conversion:
	do shell script "iconv -f UTF8-MAC -t UTF8 \"" & target_file & "\" > \"" & export_folder & playlist_name & ".m3u\""
	do shell script "rm \"" & target_file & "\""
	
end export_playlist


on write_to_file(this_data, target_file)
	try
		set the target_file to the target_file as Unicode text
		set the open_target_file to open for access file target_file with write permission
		set eof open_target_file to 0
		--set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
		--write BOM_UTF8 to open_target_file
		write this_data to the open_target_file as «class utf8»
		close access the open_target_file
		return true
	on error error_message
		try
			close access file target_file
		end try
		return error_message
	end try
end write_to_file


on replace_chars(this_text, search_string, replacement_string)
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to ""
	return this_text
end replace_chars


-- this sub-routine is used to encode text
on encode_text(this_text, encode_URL_A, encode_URL_B)
	set the standard_characters to "abcdefghijklmnopqrstuvwxyz0123456789"
	set the URL_A_chars to "$+!'?;&@=#%><{}[]\"~`^\\|*"
	set the URL_B_chars to ".-_:/()"
	set the acceptable_characters to the standard_characters
	if encode_URL_A is false then set the acceptable_characters to the acceptable_characters & the URL_A_chars
	if encode_URL_B is false then set the acceptable_characters to the acceptable_characters & the URL_B_chars
	set the encoded_text to ""
	repeat with this_char in this_text
		if this_char is in the acceptable_characters then
			set the encoded_text to (the encoded_text & this_char)
		else
			set the encoded_text to (the encoded_text & encode_char(this_char)) as string
		end if
	end repeat
	return the encoded_text
end encode_text


on encode_char(this_char)
	set the ASCII_num to (the ASCII number this_char)
	set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"}
	set x to item ((ASCII_num div 16) + 1) of the hex_list
	set y to item ((ASCII_num mod 16) + 1) of the hex_list
	return ("%" & x & y) as string
end encode_char


try
	set fileobj to open for access filepath with write permission
	set eof of fileobj to 0
	set BOM_UTF8 to ((ASCII character 239) & (ASCII character 187) & (ASCII character 191))
	write BOM_UTF8 to fileobj
	write filecont to fileobj as «class utf8»
	close access fileobj
on error errmsg
	try
		close access fileobj
	end try
end try

Nicht getestet aber vielleicht ne gute Grundlage... :D
 
Nicht schlecht :D
ich habe es versucht das Script zu verstehen. :rolleyes:
Im Moment habe ich nur deine Scriptmodifikation eingefügt. Er zeigt mir die Playlisten in iTunes an, ähnlich wie beim vorherigen Script aber bleibt dann stehen. Ich kann nur mit Cancel abbrechen. Aktuell sind es ca. 120 Playlisten.

Danke für deine Hilfe.
 
Zurück
Oben Unten