aMSN Forums
May 23, 2013, 04:36:54 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Music plugin for Herrie  (Read 2954 times)
peeaivo
Newbie

Offline Offline

Posts: 10


View Profile
« on: May 29, 2009, 04:10:35 pm »

Herrie is a command line music player.
It needs Herrie SVN and this patch

infoherrie
Code:

#!/bin/bash
HERRIE=`ps -e | grep [h]errie`
if [ "$HERRIE" ]
then
        status=1
        info=`qdbus info.herrie.Herrie /info/herrie/Herrie info.herrie.Herrie.getSong`

        echo $status
        echo -e ${info/" - "/\\n}
else
        echo 0
fi

exit 0


music.tcl
Code:

...
"Herrie" [list GetSongHerrie TreatSongHerrie FillFrameLess] \
...
        ###########################################################
        # ::music::TreatSongHerrie                                #
        # ------------------------------------------------------- #
        # Gets the current playing song in Herrie                 #
        ###########################################################
        proc TreatSongHerrie {} {                                  
                #Grab the information asynchronously : thanks to Tjikkun
                after 0 {::music::exec_async [list "sh" [file join $::music::musicpluginpath "infoherrie"]] }
        }                                                                                                    

        ###########################################################
        # ::music::GetSongHerrie                                  #
        # ------------------------------------------------------- #
        # Gets the current playing song in Herrie                 #
        ###########################################################
        proc GetSongHerrie {} {                                    
                #Split the lines into a list and set the variables as appropriate
                if { [catch {split $::music::actualsong "\n"} tmplst] } {        
                        #actualsong isn't yet defined by asynchronous exec      
                        return 0                                                
                }                                                                

                #Get the information
                set status [lindex $tmplst 0]
                set artist [lindex $tmplst 1]
                set song [lindex $tmplst 2]  

                if { $status == "0" } {
                        return 0      
                }                      

                return [list $song $artist "" "" ""]
        }
...
Logged

Google knows.
billiob
Administrator
Super Power User
*****
Offline Offline

Posts: 1352


View Profile
« Reply #1 on: May 30, 2009, 02:25:14 pm »

what happens if you don't have qdbus?
Logged
peeaivo
Newbie

Offline Offline

Posts: 10


View Profile
« Reply #2 on: June 02, 2009, 11:41:28 pm »

Then you use dbus-send. I wrote that script fast so I forgot it :p
Logged

Google knows.
peeaivo
Newbie

Offline Offline

Posts: 10


View Profile
« Reply #3 on: June 07, 2009, 05:10:50 pm »

Fix:
infoherrie
Code:

#!/bin/bash
HERRIE=`ps -e | grep [h]errie`
if [ "$HERRIE" ]
then
        status=1
        info=`dbus-send --dest=info.herrie.Herrie --print-reply /info/herrie/Herrie info.herrie.Herrie.getSong | grep string | sed -e 's/   string "//;s/"$//'`

        echo $status
        echo -e ${info/" - "/\\n}
else
        echo 0
fi

exit 0
Logged

Google knows.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!