Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Entwickler>itunes skript hilfe gesucht

itunes skript hilfe gesucht

omek30.09.0617:14
hallo ich habe ein itunes artwork skript so verändert das es bei discogs nach artist und album sucht.ich möchte aber das es nach artist und track sucht.kann mir jemand helfen, welche parameter ich verändern muss? hier das skript



property limit_to_size : true --if set to true, will only serch for images described in image_size
property image_size : "large" --can be 'icon' 'small' 'medium' 'large'
property limit_to_domain : false --if set to true, will search only in the domain described in search_domain
property search_domain : "amazon.com" --search for images only in a certian domain/website, such as 'amazon.com' or 'artistdirect.com'

-- you probably don't want to change anything below here
property required_version : "4.0"
property search_URL : "http://www.discogs.com/search?type=all&q="

tell application "iTunes"
activate
try
set this_version to the version as string
if this_version is not greater than or equal to the required_version then
beep
display dialog "This script requires iTunes version: " & required_version & ¬
return & return & ¬
"Current version of iTunes: " & this_version buttons {"Update", "Cancel"} default button 2 with icon 2
if the button returned of the result is "Update" then
my access_website("http://www.apple.com/itunes/download/")
return "incorrect version"
end if
end if
set these_tracks to the selection of browser window 1
if these_tracks is {} then error "No tracks are selected in the front window."
-- they can select multiple tracks, but only the first will be looked up
set this_track to item 1 of these_tracks
set the_album to (the album of this_track) as string
set the_artist to (the artist of this_track) as string
-- search for artist if no album name
if the_album is "" then
set this_searchstring to the_artist as string
else if the_artist is "" then
set this_searchstring to the_album as string
else
set this_searchstring to (the_artist & " " & the_album)
end if
on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Cancel"} default button 1
else
error number -128
end if
end try
end tell

set the encoded_string to my encode_text(this_searchstring, true, true)
if limit_to_size is true and limit_to_domain is true then
set the final_url to (search_URL & encoded_string & "&as_sitesearch=" & search_domain & "&imgsz=" & image_size)
else if limit_to_size is true and limit_to_domain is false then
set the final_url to (search_URL & encoded_string & "&imgsz=" & image_size)
else if limit_to_size is false and limit_to_domain is true then
set the final_url to (search_URL & encoded_string & "&as_sitesearch=" & search_domain)
else
set the final_url to (search_URL & encoded_string)
end if
access_website(final_url)

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

on access_website(this_URL)
ignoring application responses
tell application "Finder"
open location this_URL
end tell
end ignoring
end access_website
0

Kommentare

_mäuschen
_mäuschen30.09.0618:42

auf die Schnelle in etwa so...;-)
0
omek30.09.0619:33
hab ich doch noch selber geschafft siehe meinen anderen posting
0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.