1. Diese Seite verwendet Cookies. Wenn du dich weiterhin auf dieser Seite aufhältst, akzeptierst du unseren Einsatz von Cookies. Weitere Informationen
  2. Unsere jährliche Weihnachts-Banner-Aktion hat begonnen! Wir freuen uns auf viele, viele kreative Vorschläge.
    Mehr dazu könnt Ihr hier nachlesen: Weihnachtsbanner 2016

    Information ausblenden

Applescript Songs in einer Playlist

Dieses Thema im Forum "AppleScript" wurde erstellt von Serpens, 18.01.07.

  1. Serpens

    Serpens Gast

    Hallo, weiß jemand wie ich überprüfen kann ob ein lied in einer playlist drinne ist, ich versuch das jetzt schon seit tagen mit allen möglciehn kombinationen aber nix klappt, hab das gefühl ich spiele lotto [​IMG]

    Code:
                  on input(dir, defPL) 
       tell application "Finder" 
          set dirName to name of dir 
          set array to every item of dir 
       end tell 
       repeat with cItem in array 
          try 
             set cName to name of cItem 
             if kind of cItem is "Ordner" then 
                if dirName is "Library" then 
                   tell application "iTunes" to if not (exists playlist cName) then make new playlist with properties {name:cName} 
                   input(cItem, cName) 
                else 
                   input(cItem, defPL) 
                end if 
             else 
                --tell application "iTunes" to tell playlist defPL to if not (exists track cName) then  
                tell application "iTunes" 
                   set tList to every track of playlist defPL 
                   if cName is in tList then say "Hi" 
                   --if not (exists track cName) then 
                   --   add (cItem as alias) to playlist defPL 
                   --say "hi" 
                   --end if 
                end tell 
             end if 
          end try 
       end repeat 
    end input
    
    hier mal n bissl code
    schonmal thx
     
  2. Dante101

    Dante101 Ralls Genet

    Dabei seit:
    11.10.05
    Beiträge:
    5.052
    Wie wärs mit der Suchfunktion von iTunes rechts oben?
     
  3. Serpens

    Serpens Gast

    stimmt, daran habe ich garnich gedacht :), ich werde es mal ausprobieren thx
     
  4. hubionmac

    hubionmac Rheinischer Krummstiel

    Dabei seit:
    25.06.04
    Beiträge:
    379
    Code:
    (* Not In Any Playlist  v1.0
    
    written by Doug Adams
    
    Get more free AppleScripts for iTunes and
    help writing your own:
    http://www.malcolmadams.com/itunes/
    *)
    global newContents
    
    tell application "iTunes"
        set opt1 to "Yes, Consider"
        set opt2 to "No, Ignore"
        set options1 to button returned of (display dialog "Not In Any Playlist" & return & return & ¬
            "Creates a text file that will list the library tracks which are not assigned to any iTunes playlists." & return & return & ¬
            "                          " & " Consider Smart Playlists also?" buttons {"Cancel", opt1, opt2} default button 3 giving up after 300)
        
        
        
        display dialog "Gathering information..." buttons {""} giving up after 2
        
        set lib to a reference to library playlist 1
        set c to count of every track of lib
        set everyP to (get a reference to every user playlist)
        set allIDs to {}
        
        
        tell source 1
            set playlistname to ("•Not in any playlist: " & (current date)) as text
            set theplaylist to make new playlist with properties {name:playlistname}
        end tell
        
        
        with timeout of 300000 seconds
            repeat with thisP in everyP
                if (class of thisP) is user playlist then
                    if options1 is opt2 and smart of thisP is true then
                        -- fugedabowdit
                    else
                        repeat with tt from 1 to (count of every track of thisP)
                            copy (get database ID of track tt of thisP) to anid
                            if anid is not in allIDs then copy anid to end of allIDs
                        end repeat
                    end if
                end if
            end repeat
        end timeout
        
        display dialog "Checking tracks..." buttons {""} giving up after 2
        set newContents to {}
        repeat with tt from 1 to count of every track of lib
            with timeout of 300000 seconds
                set aTr to (a reference to track tt of lib)
                set theID to database ID of aTr
                
                if allIDs does not contain theID then
                    set this_track to (every track of library playlist 1 whose database ID is theID)
                    try
                        copy item 1 of this_track to playlist playlistname of source 1
                    end try
                end if
                
            end timeout
        end repeat
    end tell
    
    
     

Diese Seite empfehlen