Close

Risultati da 1 a 7 di 7

Discussione: Itunes + Lyrics script

  1. #1
    Mac Peer Aficionado L'avatar di navarf
    Data Registrazione
    Sep 2005
    Località
    Como
    Messaggi
    500

    Itunes + Lyrics script

     

    Sono appena entrato nel tunnel degli script per Itunes

    NE ho trovato uno per ottenere i testi delle canzoni qui

    Get Lyrics v2.1

    Penso siano free (altrimenti bacchettatemi) questo è lo script
    global foundcount
    try
    set foundcount to 0
    tell application "iTunes"
    set diag to button returned of (display dialog "What do you want to get lyrics for?" buttons {"Cancel", "Current", "Selection"} default button 3)
    end tell
    if diag is "Current" then
    tell application "iTunes"
    if player state is not stopped then
    set trackers to {1}
    set sel to current track --as list
    --return sel
    my liracl(sel, true)
    else
    display dialog "No tracks playing..." buttons {"OK"} default button 1 with icon 2 giving up after 15
    error

    end if
    end tell

    else if diag is "Selection" then
    tell application "iTunes" to set trackers to (get selection)
    if trackers is not {} then
    repeat with i from 1 to number of items in trackers
    set theTrack to item i of trackers
    my liracl(theTrack, true)
    end repeat
    else
    tell application "iTunes" to display dialog "No tracks selected..." buttons {"OK"} default button 1 with icon 2 giving up after 15
    error
    end if

    else
    error
    end if

    tell application "iTunes" to display dialog "Done finding lyrics!" & return & foundcount & " of " & (number of items in trackers) buttons {"OK"} default button 1 --giving up after 15

    on error
    --
    end try

    --Subroutines--

    on liracl(theTrack, overwrite)
    --display dialog 1
    try
    tell application "iTunes"

    tell theTrack
    set origlyr to lyrics
    if (origlyr is not "") and (overwrite is false) then error
    set nom to my justletters(my smallCaps(name))
    set art to my justletters(my smallCaps(artist))
    --display dialog nom giving up after 1
    end tell
    end tell
    set lyrsearchlink to "http://search.lyrics.astraweb.com/?word=" & art & "+" & nom
    set thelyrsearch to do shell script "curl -A\"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-GB; rv — 1.7.10) Gecko/20050717 Firefox/1.0.6\" \"" & lyrsearchlink & "\""
    set aa to item 1 of my textToList(item 2 of (my textToList(thelyrsearch, "1. [b]")
    set ab to "http://lyrics.astraweb.com/displayp.cgi?f=" & item 2 of my textToList(aa, "/")

    set thelyr to do shell script "curl -A\"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-GB; rv — 1.7.10) Gecko/20050717 Firefox/1.0.6\" \"" & ab & "\""
    set ba to item 1 of my textToList(item 2 of my textToList(thelyr, "
    "), "
    ")
    set bb to switchText(ba, "
    ", return)

    set clearedhtml to my clearHTML(bb)

    set LyricalF to my rmfb(bb) & return & return & "[ Find/add/request lyrics at lyrics.astraweb.com ]"

    --display dialog 1 default answer LyricalF

    tell application "iTunes"
    tell theTrack
    set lyrics to LyricalF
    end tell
    end tell

    set foundcount to foundcount + 1
    on error
    --error
    end try
    end liracl

    on rmfb(t)
    set p1 to paragraphs of t

    repeat with i from 1 to number of items in p1
    set ti to item i of p1
    set sh to do shell script "echo '" & ti & "' | sed 's/^[ \\t]*//;s/[ \\t]*$//'"
    if sh is not "" then
    set p2 to items i thru -1 of p1
    exit repeat
    end if
    end repeat

    set p2 to reverse of p2

    repeat with i from 1 to number of items in p2
    set ti to item i of p2
    set sh to do shell script "echo '" & ti & "' | sed 's/^[ \\t]*//;s/[ \\t]*$//'"
    if sh is not "" then
    set p3 to items i thru -1 of p2
    exit repeat
    end if
    end repeat

    set p3 to reverse of p3

    set the item_count to the number of items in p3
    repeat with i from 1 to the item_count
    set ti to item i of p3
    if i is 1 then
    set ret to ti
    else
    set ret to ret & return & ti
    end if
    end repeat

    return ret as text
    end rmfb

    on switchText(tex, remove, neww)
    set d to text item delimiters
    set text item delimiters to remove
    set tex to tex's text items
    set text item delimiters to neww
    tell tex to set tex to beginning & ({""} & rest)
    set text item delimiters to d
    return tex
    end switchText

    on textToList(theText, theSep)
    set soFar to {}
    set textSoFar to theText
    repeat until theSep is not in textSoFar
    set thePos to the offset of theSep in textSoFar
    set thenewPos to thePos
    if thenewPos is 1 then set thenewPos to 2
    set nextBit to text 1 through (thenewPos - 1) of textSoFar
    if textSoFar is not theSep then
    set textSoFar to text (thePos + (count of text items in theSep)) through -1 of textSoFar
    copy nextBit to the end of soFar
    else
    set textSoFar to ""
    end if
    end repeat
    copy textSoFar to the end of soFar
    return soFar
    end textToList

    on clearHTML(theText)
    set Lthetext to text items of theText
    set tl to {}
    set kill to false
    repeat with i from 1 to number of items in Lthetext
    set this_item to item i of Lthetext
    if this_item is "<" then set kill to true
    if kill is false then set end of tl to this_item
    if this_item is ">" then set kill to false
    end repeat
    return tl as text
    end clearHTML

    on justletters(teststring)
    if word 1 of teststring is "the" then set teststring to text 5 thru -1 of teststring
    set the testlist to the text items of the teststring
    set ns to {}
    repeat with letter in testlist
    set asc to the ASCII number of the letter
    if (asc is greater than 96) and (asc is less than 123) then
    set end of ns to ASCII character asc
    else if asc is 32 then
    set end of ns to ASCII character 43
    end if
    end repeat
    set the teststring to the ns as text
    return the teststring
    end justletters

    on smallCaps(teststring)
    set the testlist to the text items of the teststring
    repeat with letter in testlist
    set asc to the ASCII number of the letter
    if (asc is greater than 64) and (asc is less than 91) then
    set the contents of the letter to ASCII character (asc + 32)
    end if
    end repeat
    set the teststring to the testlist as text
    return the teststring
    end smallCaps
    Vorrei sapere come fare a cambiare il sito dove prende i testi per esempio invece che astraweb ecc.. vada su getlyrics.com o magari un altro più fornito

    Qualcuno ha idea?...magari non è complicato (spero) ealtri utenti possono essere interessati


    Grazie
    And all the corny tricks you tried
    Will not forestall the rising tide of hungry freaks daddy!

  2. #2
    sarebbe bello...
    allora proviamoci!!!

    io mi appoggio sempre ad "angolotesti" fin'ora non c'è stata una sola canzone per la quale non ho trovato i testi... fenomenali...

    dallo script ho notato che in una riga hai :
    Find/add/request lyrics at lyrics.astraweb.com
    prova a cambiare "lyrics.astraweb.com" con "angolotesti.leonardo.it"

    stessa cosa per gli altri 2 riferimenti poche righe più sopra...


    non sono sicuro che funzioni, ma magari ci va bene al primo colpo!!
    ora sono in ufficio e non ho il mac con me... fammi sapere come va!!!

    ciao

  3. #3
    Mac Peer Aficionado L'avatar di navarf
    Data Registrazione
    Sep 2005
    Località
    Como
    Messaggi
    500
    Tu dici di sostituire solo lyrics.astraweb.com ma a volte è seguito da un /

    Ex.

    "http://search.lyrics.astraweb.com/?word="

    "http://lyrics.astraweb.com/displayp.cgi?f="

    li metto come

    "http://angolotesti.leonardo.it/?word="

    "http://angolotesti.leonardo.it/displayp.cgi?f="
    And all the corny tricks you tried
    Will not forestall the rising tide of hungry freaks daddy!

  4. #4
    Quintessenza di Mac Peer L'avatar di TheCube
    Data Registrazione
    Jan 2005
    Località
    Milano
    Messaggi
    11,944
    Citazione Originariamente Scritto da navarf
    Tu dici di sostituire solo lyrics.astraweb.com ma a volte è seguito da un /

    Ex.

    "http://search.lyrics.astraweb.com/?word="

    "http://lyrics.astraweb.com/displayp.cgi?f="

    li metto come

    "http://angolotesti.leonardo.it/?word="

    "http://angolotesti.leonardo.it/displayp.cgi?f="
    Non funzionerà mai, a meno che "angolotesti" non sia fatto esattamente come astraweb, sia a livello di codice (displayp.cgi scommetto che non esiste su angolotesti), sia a livello di layout...
    [B][FONT=Comic Sans MS][SIZE=4][COLOR=#0000ff]
    [/COLOR][/SIZE][/FONT][/B]

  5. #5
    Mac Peer Aficionado L'avatar di navarf
    Data Registrazione
    Sep 2005
    Località
    Como
    Messaggi
    500
    Quindi secondo te non è così semplice ?
    accidenti
    And all the corny tricks you tried
    Will not forestall the rising tide of hungry freaks daddy!

  6. #6
    Quintessenza di Mac Peer L'avatar di TheCube
    Data Registrazione
    Jan 2005
    Località
    Milano
    Messaggi
    11,944
    Citazione Originariamente Scritto da navarf
    Quindi secondo te non è così semplice ?
    accidenti
    No, non lo è...
    [B][FONT=Comic Sans MS][SIZE=4][COLOR=#0000ff]
    [/COLOR][/SIZE][/FONT][/B]

  7. #7
    infatti ho scritto "non sono sicuro che funzioni"...

    ho solo pensato di fare un tentativo, per vedere se ci andava bene...

    bisognerebbe capire com'è strutturato il sito di angolotesti (ribadisco, a mio avviso il migliore in assoluto)

    ciao

Discussioni Simili

  1. lyrics su iTunes?
    Di nondormomai nel forum Elaborazione digitale su Mac
    Risposte: 26
    Ultimo Messaggio: 02-02-09, 20:49
  2. msn e script ???
    Di raffolator nel forum Mac Help
    Risposte: 1
    Ultimo Messaggio: 02-01-07, 13:46
  3. Safari Script
    Di avrobay nel forum Mac Help
    Risposte: 0
    Ultimo Messaggio: 15-10-06, 10:41
  4. widget freeware per lyrics compatile con iTunes
    Di kingofgames nel forum I migliori freeware per il Mac
    Risposte: 14
    Ultimo Messaggio: 19-05-06, 01:36
  5. apple script
    Di kphigo nel forum Mac Basic
    Risposte: 1
    Ultimo Messaggio: 15-04-06, 10:35

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •