Lyrics with Amarok - Suse

This is a discussion on Lyrics with Amarok - Suse ; Imagine you are listening happily to your music and while writing a text, you urgently need to enter the text of the song into the email (or Usenet posting) for some reason. Haven't you ever had that need? Neither did ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Lyrics with Amarok

  1. Lyrics with Amarok

    Imagine you are listening happily to your music and while writing a
    text, you urgently need to enter the text of the song into the email (or
    Usenet posting) for some reason.

    Haven't you ever had that need? Neither did I untill I made the
    following script. So in other words, this is utterly and completely
    useless. That never stopped me before, so here is what I did.

    #!/bin/bash
    # set -x
    AMA="dcop amarok player"
    TITLE () {
    echo "| Artist : `$AMA artist`
    | Song : `$AMA title`
    | Album : `$AMA album`
    __________________________________________________ _____________________
    "
    }
    LYRICS () {
    $AMA lyrics|\
    sed "s/'/'/g" | \
    sed "s/&#8217/'/g" | \
    sed "s/"/\"/g" | \
    sed "s/<\/lyrics>//g"|\
    sed "s/.*title='/== /g"|\
    sed "s/' page_url.*/ ==\n/g"
    }
    HELP () {
    echo "Usage : -t to add the title"
    exit 1
    }
    while getopts "th" OPTION
    do
    case ${OPTION} in
    t) TITLE ;;
    [?]) HELP ;;
    esac
    done
    LYRICS

    I save it as lyrics and when I type in vi `[ESC]:r! lyrics` it adds the
    following (depending on the song you are playing)

    == No one to depend on ==

    Ain't got nobody that I can depend on
    Ain't got nobody that I can depend on

    Ain't got nobody that I can depend on

    Ain't got no one tengo a nadie
    That I know of no tengo a nadie
    That I can depend on no tengo a nadie
    Ain't got no one

    Got nobody
    That I can depend on no tengo a nadie
    Ain't got nobody that I can depend on
    No tengo a nadie.

    When I use `lyrics -t` it adds the thing that is in my sig as well.

    Now I not any have wasted my time, but yours as well if you read untill
    here. :-D

    So another useless bit of information. Try this:
    dcop amarok player setVolume `perl -e 'print int(rand() * 100)'`

    It will reset the volume from anywhere from 0% to 100%. This because the
    perl command within the backticks makes a random number.
    So if that random number is 34, then it actualy does
    dcop amarok player setVolume 34

    Yep, pretty useless, unless you can put it in crontab of a user and run
    it every 5 minutes or so. Why? Because, that's why!

    houghi
    --
    This was written under the influence of the following:
    | Artist : Santana
    | Song : No One To Depend On
    | Album : Sacred fire, live in South America

  2. Re: Lyrics with Amarok

    On Sun, 05 Oct 2008 12:34:01 +0200, houghi wrote:

    > Imagine you are listening happily to your music and while writing a
    > text, you urgently need to enter the text of the song into the email (or
    > Usenet posting) for some reason.
    >
    > Haven't you ever had that need? Neither did I untill I made the
    > following script. So in other words, this is utterly and completely
    > useless. That never stopped me before, so here is what I did.
    >
    > #!/bin/bash
    > # set -x
    > AMA="dcop amarok player"
    > TITLE () {
    > echo "| Artist : `$AMA artist`
    > | Song : `$AMA title`
    > | Album : `$AMA album`
    > __________________________________________________ _____________________
    > "
    > }
    > LYRICS () {
    > $AMA lyrics|\
    > sed "s/'/'/g" | \
    > sed "s/&#8217/'/g" | \
    > sed "s/"/\"/g" | \
    > sed "s/<\/lyrics>//g"|\
    > sed "s/.*title='/== /g"|\
    > sed "s/' page_url.*/ ==\n/g"
    > }
    > HELP () {
    > echo "Usage : -t to add the title"
    > exit 1
    > }
    > while getopts "th" OPTION
    > do
    > case ${OPTION} in
    > t) TITLE ;;
    > [?]) HELP ;;
    > esac
    > done
    > LYRICS
    >
    > I save it as lyrics and when I type in vi `[ESC]:r! lyrics` it adds the
    > following (depending on the song you are playing)
    >
    > == No one to depend on ==
    >
    > Ain't got nobody that I can depend on Ain't got nobody that I can depend
    > on
    >
    > Ain't got nobody that I can depend on
    >
    > Ain't got no one tengo a nadie
    > That I know of no tengo a nadie
    > That I can depend on no tengo a nadie Ain't got no one
    >
    > Got nobody
    > That I can depend on no tengo a nadie Ain't got nobody that I can depend
    > on No tengo a nadie.
    >
    > When I use `lyrics -t` it adds the thing that is in my sig as well.
    >
    > Now I not any have wasted my time, but yours as well if you read untill
    > here. :-D
    >
    > So another useless bit of information. Try this: dcop amarok player
    > setVolume `perl -e 'print int(rand() * 100)'`
    >
    > It will reset the volume from anywhere from 0% to 100%. This because the
    > perl command within the backticks makes a random number. So if that
    > random number is 34, then it actualy does dcop amarok player setVolume
    > 34
    >
    > Yep, pretty useless, unless you can put it in crontab of a user and run
    > it every 5 minutes or so. Why? Because, that's why!
    >
    > houghi


    Uh, Houghi, will you be adding this to Amarok's downloadable scripts?

    --
    Elvish

  3. Re: Lyrics with Amarok

    On Sun, 05 Oct 2008 12:34:01 +0200, houghi wrote:

    > Imagine you are listening happily to your music and while writing a
    > text, you urgently need to enter the text of the song into the email (or
    > Usenet posting) for some reason.
    >
    > Haven't you ever had that need? Neither did I untill I made the
    > following script. So in other words, this is utterly and completely
    > useless. That never stopped me before, so here is what I did.


    I knew I got on usenet this morning for something. This is awesome.

    As for the random volume setting - this will be a perfect addition for my
    script that runs at random times during the day blasting random speed
    metal songs in my wife's office.

  4. Re: Lyrics with Amarok

    Elvish wrote:
    > Uh, Houghi, will you be adding this to Amarok's downloadable scripts?


    Nah. It is seriously a bad script at this moment.

    Instead of using my previously filled MySQL database, I started all
    over.

    First I de-installed Amarok. Then I re-installed the Packman version
    that has MySQL enabled. I also installed the Wiki-Lyrics with the script
    manager. I then configured it according to
    http://amarok.kde.org/wiki/MySQL_HowTo

    I then looked if it indeed accepted lyrics in the database and it did,
    so all is well.

    I then wrote a scriot that at a maximum of 60 seconds tries to look up
    the lyrics. The fastest is 3 seconds.

    The 60 seconds I measured by looking how long it took if it could not
    find anything and then I added something.
    The 3 seconds (1+2) I got from trying it out. Both might depend on your
    connection.

    The 2400 I got from the number of songs. To run it, just launch Amarok.
    I shuffeld the playlist as well, so that I do not hear the same music
    all the time. Once the music is playing, lauch the script in a terminal.

    #!/bin/bash
    #set -x
    for I in `seq 2400`
    do
    I=0
    echo " `dcop amarok player title`"
    while [ "$I" -lt "60" ]
    do
    LYRICS=`dcop amarok player lyrics`
    sleep 1
    let "I = $I + 1"
    if [ "$LYRICS" != "" ]
    then
    I=61
    fi
    printf "$I\r"
    done
    dcop amarok player next
    sleep 2
    done

    So it takes between 2 and 40 hours for the playlist that would otherwise
    play 8 days,

    houghi
    --
    This was written under the influence of the following:
    | Artist : Emerson, Lake and Palmer
    | Song : Toccata
    | Album : Welcome back my friends ...

  5. Re: Lyrics with Amarok

    On Mon, 06 Oct 2008 23:53:26 +0200, houghi wrote:

    > Elvish wrote:
    >> Uh, Houghi, will you be adding this to Amarok's downloadable scripts?

    >
    > Nah. It is seriously a bad script at this moment.
    >
    > Instead of using my previously filled MySQL database, I started all
    > over.
    >
    > First I de-installed Amarok. Then I re-installed the Packman version
    > that has MySQL enabled. I also installed the Wiki-Lyrics with the script
    > manager. I then configured it according to
    > http://amarok.kde.org/wiki/MySQL_HowTo
    >
    > I then looked if it indeed accepted lyrics in the database and it did,
    > so all is well.
    >
    > I then wrote a scriot that at a maximum of 60 seconds tries to look up
    > the lyrics. The fastest is 3 seconds.
    >
    > The 60 seconds I measured by looking how long it took if it could not
    > find anything and then I added something. The 3 seconds (1+2) I got from
    > trying it out. Both might depend on your connection.
    >
    > The 2400 I got from the number of songs. To run it, just launch Amarok.
    > I shuffeld the playlist as well, so that I do not hear the same music
    > all the time. Once the music is playing, lauch the script in a terminal.
    >
    > #!/bin/bash
    > #set -x
    > for I in `seq 2400`
    > do
    > I=0
    > echo " `dcop amarok player title`"
    > while [ "$I" -lt "60" ]
    > do
    > LYRICS=`dcop amarok player lyrics`
    > sleep 1
    > let "I = $I + 1"
    > if [ "$LYRICS" != "" ]
    > then
    > I=61
    > fi
    > printf "$I\r"
    > done
    > dcop amarok player next
    > sleep 2
    > done
    >
    > So it takes between 2 and 40 hours for the playlist that would otherwise
    > play 8 days,
    >
    > houghi


    Good show! Always learning something from you, pal.

    --
    Elvish

+ Reply to Thread