• 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

automator mp3 script

mkrm

Granny Smith
Registriert
01.09.08
Beiträge
12
hi

bin noch neu in der mac welt und kenne mich mit script net aus.

ich bastle schon eine weile mit automator herum und schaffe es einfach nicht.

also. die heruntergeladenen dateien landen ja im ordner -downloads. ich kaufe mir meine mp3s bei beatport.com. eine datei hast dann zb. 1232423_Attention_Whore_Original_Mix.mp3
unter quelle steht jetzt zb. http://download.beatportxxxxxxx usw

ich möchte alle mp3s die in der quelle "beaport" stehen haben oder im kommentar "beatport" verschieben. wie mach stelle ich das an? ich werd wahnsinnig :/
 

hubionmac

Tydemans Early Worcester
Registriert
25.06.04
Beiträge
393
Ein AppleScript, dass so etwas bewerkstelligen könnte, sähe dann so aus...
Dabei wird aber nur der Kommentar berücksichtigt, weil ich mir unter
nix vorstellen konnte ;)
Also einfach die MP3s in iTunes auswählen und dann werden diese, sofern sie von Beatport stammen und sich im Download-Ordner befinden, in den Zielordner bewegt.

Code:
set search_string to ""
set search_string to ""
tell application "iTunes"
    set thefiles to selection of browser window 1 -- das ist die Auswahl in iTunes
    tell application "Finder" to set must_be_source_folder to folder "Downloads" of home -- in dem Verzeichnis müssen sich die Tracks befinden, ansonsten werden sie ignoriert
    set my_destination to choose folder with prompt "Zielort für die ausgewählten Datein (zum verschieben)" --Der Zielordner, in den die Dateien verschoben werden
    display dialog "Suche nach:" default answer "beaport" --der Suchstring
    set search_string to text returned of the result
end tell
if search_string ≠ "" then
    
    repeat with current_file in thefiles -- jetzt wird jede Datei die Ausgewählt ist einzeln bearbeitet
        tell application "iTunes" to set track_path to location of current_file
        tell application "iTunes" to set track_comment to comment of current_file
        tell application "Finder" to set track_name to name of track_path
        tell application "Finder"
            set must_be_source_folder to folder "Downloads" of home
            set h to choose file
            if folder of h is must_be_source_folder then
                set is_in_downloads to true
            else
                set is_in_downloads to false
            end if
        end tell
        if is_in_downloads = true then
            if track_comment contains search_string then
                -- nach der ganzen Vorarbeit wird nun endlich auch was bewegt =)
                move_track(track_name, track_path, my_destination)
            end if
        end if
    end repeat
end if




on move_track(trackname, tracklocation, workingdir)
    tell application "Finder"
        --if another files with same name exists
        set counter to 0
        set no_error to false
        try
            move tracklocation to workingdir as alias
        on error
            repeat until no_error = true
                set counter to counter + 1
                try
                    set name of tracklocation to ("## " & counter & " ##" & trackname) as string
                    move tracklocation to workingdir as alias
                    set no_error to true
                    exit repeat
                on error
                    set no_error to false
                end try
            end repeat
        end try
    end tell
end move_track