AudioScrobbler / last.fm support

Viewing 4 posts - 51 through 54 (of 54 total)
  • Author
    Posts
  • #5264
    Anonymous
    Inactive

    Hi,

    I’ve just released the version 0.7b of FireflyClient which includes a last.fm scrobbling support :
    https://sourceforge.net/project/showfiles.php?group_id=212642

    More information available on a thread on this forum about firefly client : http://forums.fireflymediaserver.org/viewtopic.php?t=7198&start=90

    I know this is a client-side only solution (compared to a firefly media server plugin) but it may do the trick !

    — caribou

    #5265
    pcace
    Participant

    Hey,

    i just tried to install lastfm support in my mt-daapd server. BUT i get a strange error: i changed the path names according to my needs but it simply dont works. what i get is:

    [: 33: -rw-r--r-- 1 mt-daapd nogroup 19552256 2010-04-14 14:48 /var/cache/mt-daapd/songs3.db: unexpected operator

    I tried the script from here: http://www.themaelstrom.co.uk/node/10
    I run ubuntu 9.04 Server (mt-daapd version svn-1696, sqlite3 version 3.6.16)

    Hopefully someone can help me!

    Thanks!

    Thats the complete output:

    user@mashine:~/scripts$ cat lastfmsubmit.sh
    #!/bin/bash

    # fetch newly played songs from fireflydb and write
    # into lastfmsubmitd readable format

    # config
    SQLITE=/usr/bin/sqlite3
    DATABASE=/var/cache/mt-daapd/songs3.db
    LASTFILE=./lastfmsubmit.date
    DBLSFILE=./lastfmsubmit.ls

    # get last run time
    if [ -e $LASTFILE ]
    then
    . $LASTFILE
    else
    LASTRUN=0
    fi

    # get last database file date
    if [ -e $DBLSFILE ]
    then
    . $DBLSFILE
    else
    DBLSRUN=
    fi

    # exit when database file unchanged
    DBLSNOW=`ls -l $DATABASE`
    if [ “$DBLSRUN” == “$DBLSNOW” ]
    then
    exit
    fi

    # log file date
    echo “DBLSRUN=”$DBLSNOW”” > $DBLSFILE

    # query database
    OUTFILE=$(mktemp /tmp/mt-daapd-XXXXXXXX)
    $SQLITE $DATABASE ‘SELECT artist,album,title,track,song_length,time_played FROM songs where time_played > ‘$LASTRUN’ ORDER BY time_played ASC;’ | gawk -F ‘|’ ‘{ printf “—nartist: “%s”nalbum: “%s”ntitle: “%s”ntrack: %snlength: %dntime: !timestamp %sn”,$1,$2,$3,$4,$5/1000,strftime(“%Y-%m-%d %T”,$6) }’ > $OUTFILE

    # Move the file to the daemon spool directory if it is not empty
    if [ -s $OUTFILE ]
    then
    mv $OUTFILE /var/spool/lastfm
    fi

    # log query date
    echo “LASTRUN=”`date +%s` > $LASTFILE

    # make lastfmsubmitd files readable
    chmod 664 /var/spool/lastfm/*

    user@mashine:~/scripts$ sudo sh lastfmsubmit.sh
    [: 33: -rw-r–r– 1 mt-daapd nogroup 19552256 2010-04-14 14:52 /var/cache/mt-daapd/songs3.db: unexpected operator
    user@mashine:~/scripts$

    #5266
    pcace
    Participant

    Hey,

    i just tried to install lastfm support in my mt-daapd server. BUT i get a strange error: i changed the path names according to my needs but it simply dont works. what i get is:

    [: 33: -rw-r--r-- 1 mt-daapd nogroup 19552256 2010-04-14 14:48 /var/cache/mt-daapd/songs3.db: unexpected operator

    I tried the script from here: http://www.themaelstrom.co.uk/node/10
    I run ubuntu 9.04 Server (mt-daapd version svn-1696, sqlite3 version 3.6.16)

    Hopefully someone can help me!

    Thanks!

    Thats the complete output:

    user@mashine:~/scripts$ cat lastfmsubmit.sh
    #!/bin/bash

    # fetch newly played songs from fireflydb and write
    # into lastfmsubmitd readable format

    # config
    SQLITE=/usr/bin/sqlite3
    DATABASE=/var/cache/mt-daapd/songs3.db
    LASTFILE=./lastfmsubmit.date
    DBLSFILE=./lastfmsubmit.ls

    # get last run time
    if [ -e $LASTFILE ]
    then
    . $LASTFILE
    else
    LASTRUN=0
    fi

    # get last database file date
    if [ -e $DBLSFILE ]
    then
    . $DBLSFILE
    else
    DBLSRUN=
    fi

    # exit when database file unchanged
    DBLSNOW=`ls -l $DATABASE`
    if [ “$DBLSRUN” == “$DBLSNOW” ]
    then
    exit
    fi

    # log file date
    echo “DBLSRUN=”$DBLSNOW”” > $DBLSFILE

    # query database
    OUTFILE=$(mktemp /tmp/mt-daapd-XXXXXXXX)
    $SQLITE $DATABASE ‘SELECT artist,album,title,track,song_length,time_played FROM songs where time_played > ‘$LASTRUN’ ORDER BY time_played ASC;’ | gawk -F ‘|’ ‘{ printf “—nartist: “%s”nalbum: “%s”ntitle: “%s”ntrack: %snlength: %dntime: !timestamp %sn”,$1,$2,$3,$4,$5/1000,strftime(“%Y-%m-%d %T”,$6) }’ > $OUTFILE

    # Move the file to the daemon spool directory if it is not empty
    if [ -s $OUTFILE ]
    then
    mv $OUTFILE /var/spool/lastfm
    fi

    # log query date
    echo “LASTRUN=”`date +%s` > $LASTFILE

    # make lastfmsubmitd files readable
    chmod 664 /var/spool/lastfm/*

    user@mashine:~/scripts$ sudo sh lastfmsubmit.sh
    [: 33: -rw-r–r– 1 mt-daapd nogroup 19552256 2010-04-14 14:52 /var/cache/mt-daapd/songs3.db: unexpected operator
    user@mashine:~/scripts$

    #5267
    pcace
    Participant

    @FrankZabbath wrote:

    So here’s my currently running script:


    #!/bin/bash

    # fetch newly played songs from fireflydb and write
    # into lastfmsubmitd readable format

    # config
    SQLITE=sqlite
    DATABASE=/opt/var/mt-daapd/songs.db
    LASTFILE=/opt/var/mt-daapd/lastfmsubmit.date
    DBLSFILE=/opt/var/mt-daapd/lastfmsubmit.ls

    # get last run time
    if [ -e $LASTFILE ]
    then
    . $LASTFILE
    else
    LASTRUN=0
    fi

    # get last database file date
    if [ -e $DBLSFILE ]
    then
    . $DBLSFILE
    else
    DBLSRUN=
    fi

    # exit when database file unchanged
    DBLSNOW=`ls -l $DATABASE`
    if [ "$DBLSRUN" == "$DBLSNOW" ]
    then
    exit
    fi

    # log file date
    echo "DBLSRUN="$DBLSNOW"" > $DBLSFILE

    # query database
    OUTFILE=$(mktemp /tmp/mt-daapd-XXXXXXXX)
    $SQLITE $DATABASE 'SELECT artist,album,title,track,song_length,time_played FROM songs where time_played > '$LASTRUN' ORDER BY time_played ASC;' | gawk -F '|' '{ printf "---nartist: "%s"nalbum: "%s"ntitle: "%s"ntrack: %snlength: %dntime: !timestamp %sn",$1,$2,$3,$4,$5/1000,strftime("%Y-%m-%d %T",$6-3600) }' > $OUTFILE
    mv $OUTFILE /var/spool/lastfm

    # log query date
    echo "LASTRUN="`date +%s` > $LASTFILE

    # make lastfmsubmitd files readable
    chmod 664 /var/spool/lastfm/*

    Be sure to set the paths, the sqlite executable and time offset to your needs. This script needs bash and gawk available via ipkg.
    I haven’t tried yet to change the shebang line from bash to sh. Might be better to do so.

    Hey Thank you a lot! it Works good!
    What do i have to do to change the “time played” in last fm? Every Song is shown as played 2 hours later than it originaly is!

    Any idea what i can do there?

    Thanks!

    Pcace

Viewing 4 posts - 51 through 54 (of 54 total)
  • The forum ‘Feature Requests’ is closed to new topics and replies.