How to check when MPD changes track?

I want to log every time when MPD changes song, but I can't find out how. Anyone got any ideas?

koper wrote:
here is the code in C that prints out name of the song when mpd changes it.
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <libmpd.h>
#include <debug_printf.h>
#define RED "\x1b[31;01m"
#define DARKRED "\x1b[31;06m"
#define RESET "\x1b[0m"
#define GREEN "\x1b[32;06m"
#define YELLOW "\x1b[33;06m"
void status_changed(MpdObj *mi, ChangedStatusType what)
if(what&MPD_CST_SONGID)
mpd_Song *song = mpd_playlist_get_current_song(mi);
if(song)
printf(GREEN"Song:"RESET" %s - %s\n", song->artist, song->title);
int main()
int run = 1, iport = 6600;
char *hostname = getenv("MPD_HOST");
char *port = getenv("MPD_PORT");
char *password = getenv("MPD_PASSWORD");
MpdObj *obj = NULL;
if(!hostname) {
hostname = "localhost";
if(port){
iport = atoi(port);
obj = mpd_new(hostname, iport,password);
mpd_signal_connect_status_changed(obj,(StatusChangedCallback)status_changed, NULL);
mpd_set_connection_timeout(obj, 10);
if(!mpd_connect(obj))
mpd_send_password(obj);
do{
mpd_status_update(obj);
}while(!usleep(100000) && run);
return 1;
to compile it:
gcc source_code -o output_file -lmpd -I/usr/include/libmpd-1.0/libmpd/
the code it's actually a modified example from libmpd site:
https://svn.musicpd.org/MOVED/libmpd/tr … testcase.c
So this wakes up every 0.1 seconds....?  there goes your battery life...

Similar Messages

  • How to Check when the user is connected to different desktop.

    How to Check when the user is connected to different desktop.Sometimes the user maynot see the theme in the personalize theme list. In that case the person must be using different kind of desktop.How to check, I need a path.And how to apply the theme to that user?
    Thanks,
    Paturi

    Hi,
    you can create the new portal desktop from
    System Administration => Portal display => Desktop and Display Themes
    Select your folder from Portal Content and from its context create new Desktop.
    Add The Framework page and the theme to this desktop page.
    Go to your folder from Portal Content and from the context of the framework page select add framework page to portal desktop.
    Adding Theme to desktop
    From Portal content select Theme folder and select the theme right click it and select Add theme to Portal Desktop.
    Create rule for the Desktop.
    Navigate to System Administration => Portal Display => Desktop and Display Themes Portal Content => Portal Administrators => Super Administrators =>main_rules.
    Click Add IF Expression.
    create the expression if user = xyz then click on apply
    Select the then clause of the if and navigate to your folder where Desktop is created ,Add it and Click Apply.
    Save the Changes to the rule.
    Hope it helps you.
    (reward points if its helpful)
    Thanks,
    Gunjan

  • How to check, when the Maintenance Order was deleted

    Hello Experts,
                          Can you please tell me of how to check for the maintenance order that when it was deleted and who has deleted that.
    If any T-Code is there or at the Table level also to check the requirement.
    Regards,
    Yawar Khan

    If you want to track when you have put deletion flag, you can track it using above mentioned techniques.
    If you archived (deleted) permanently, then using archival history only, you can check I guess.
    Check these links. While deleting maintenance order, we can hisorical order with same number. Using that creation date, you can track.
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/3e6552462a11d189000000e8323d3a/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/8d/3e4d2f462a11d189000000e8323d3a/frameset.htm

  • How to check when and who uses my account?

    I need to check if someone used my account in some particular days and hours. is it possible and how. thank you

    Nikoline wrote:
    How to see when and who made changes in some table?
    Some makes me problems and I want to see who are the usernames.
    ThanksEither you need to implement Oracle Audit, or use Logminer Utility to read archived redo log files

  • How to realize WHEN-RADIO-CHANGED- Trigger in ADF

    Hy@ all,
    I try to redevelop the Summit Forms Demo in ADF.
    One of the existing modules is called "ORDER" and contains, among other things, radio buttons based on a database column(VARCHAR2) named PAYMENT_TYPE which contains the values CASH and CREDIT.
    Based on this Item a WHEN-RADIO-CHANGED- Trigger is called which shows an alert and reset the changes to a default value when the payment type is changed but the credit rating(database column from another table) is not equal to an according value.
    The code of the trigger is the following one:
    DECLARE
         n NUMBER;
         v_credit S_CUSTOMER.CREDIT_RATING%TYPE;
    BEGIN
         IF :S_ORD.payment_type = 'CREDIT' THEN
              SELECT credit_rating
              INTO v_credit
              FROM S_CUSTOMER
              WHERE :S_ORD.CUSTOMER_ID = ID;
         IF v_credit NOT IN ('GOOD', 'EXCELLENT') THEN
              :S_ORD.payment_type := 'CASH';
              n := SHOW_ALERT('PAYMENT_TYPE_ALERT');
         END IF;
         END IF;
    END;
    Now my questions are where to place the equivalent code(EO, VO, etc.?) and how to realize this.
    Further, is it possible to roll out the trigger code to the database and then call this stored unit from "the right place"?
    I´m using JDeveloper v10.1.3.1.0 and I´m pleased about any reply or solution.
    Best regards
    Chris

    The answer will depend on how you are storing the parameter in your ADF application and when do you actually need it to be set and based on what.
    This can be for example a property of a managed bean in your JSF application and you can initialize it either in the bean itself or in the faces-config.xml file as a managed property.
    http://www.oracle.com/technology/tech/java/newsletter/articles/jsf_pojo/index.html

  • URGENT- how to check when application was unistalled

    How do you check WHEN an application was unistalled?
    this is very urgent
    Thank you

    Hi and Welcome to the Community!
    Refer:
    KB29215 How to view event logs on a BlackBerry smartphone
    I'm not at all sure if those logs show what you need, or if it would have required that more verbose logging be enabled prior to the app removal. But, you can look to see.
    If the device is on BES, then it's possible that the BES Admin can dig deeper...but you'd need to ask them about that.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to check when admin or some other account has been logging in to the server

    Hi
    How can I check when admin or some other particular account has logged in to the server? So that I can check login times for users.

    Hi,
    You can try to edit the XML file to filter events by logon types.
    In addition, explicit credentials mean that we input our user name and password in front of a computer through keyboard (or other more advanced means). After that, Windows system will pack our credentials as tickets for further
    purposes like access network resources, tickets are implicit credentials.
    More information for you:
    Advanced XML filtering in the Windows Event Viewer
    http://blogs.technet.com/b/askds/archive/2011/09/26/advanced-xml-filtering-in-the-windows-event-viewer.aspx
    Best Regards,
    Amy

  • How to multiplex the block change tracking file?

    Hi,
    I have a question to change block tracking feture.
    The normal way to enable block change tracking would be:
    ALTER DATABASE ENABLE BLOCK CHANGE TRACKING
    USING FILE 'mydir/change_track.f'
    REUSE;
    What if my harddrive is gone?
    Is there anyway to define more than one destinitaion like for archive log files?

    The difference is... archive log files can contain irreplaceable data.
    With Block Change Tracking the data is not irreplaceable , just run full RMAN backup and then regen the file. <- IMHO

  • How to verify when i change mode in form of standard?

    To All
             I want to know that how to coding if I change mode on screen Incoming Payment from "Add" mode to "OK" mode. I develop it using vb.net to catch event. This post I want to insert button into standard screen by in first time I created button but I disable it but I click "Last Data Record" in menu bar system will change to "OK" immediately. I want to know coding catch changing mode. example code as below

    Try
                If pVal.FormType = 170 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD And pVal.Before_Action = False Then
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pVal.Before_Action = False Then
                     Then
                        oForm = SBO_Application.Forms.Item(FormUID)
                        oItem = oForm.Items.Add("btnPrint", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
                        'Set Size and Location
                        oItem.Top = 432
                        oItem.Left = 160
                        oItem.Width = 60
                        oItem.Height = 22
                        oButton = oItem.Specific
                        oButton.Caption = "Print"
                        SBO_Application.MessageBox("Button was added")
                    End If
                End If
            Catch ex As Exception
                MsgBox(Err.Description)
            End Try

  • How to check on or change night-time update setting?

    I find the various updates to be unhandy during the day and would like them to take care of themselves at night. Might they leave me a note in the morning if they have run into difficulty and need my help? How can I make the change?

    1)  How Time Machine Works its Magic
    2)  Time Machine vs. Clones and Archives
    3)  How do I view or restore selected items?
    4)  How do I use the (not so intuitive) Time Machine display?
    From Here  >  http://pondini.org/OSX/Home.html

  • How to check when system started? Need ASAP!!

    HI,
    Guys is there a way that I can tell that when the system started and stopped at certain time? If there is, how can i check?
    Please let me know ASAP.
    Thanks,
    I will post points for sure!!

    Afi,
    Check dev_disp.old in work directory .. Towards the end you can something like  change server state from ACTIVE to SHUTDOWN .. You will get some idea from that.  Check dev_disp to see when the server is started
    Thanks
    Prince Jose

  • How to check  last mint change in sap system

    hi all,
    last night someone delete some packages of abapdev from DEV system, how can i insure that who has done that ?
    plz guide
    Regards
    Khan

    St03n --> left side pane select as Expert Mode --> Select the date --> click on the users and statistics --> user profile
    you can c who are all users have logged in for that day. Select a user and double click and then you can get what are all the transactions he has ran on that particular day.
    I hope this helps you.
    Mahesh

  • How to check when DB is Restarted

    Hi all,
    I have a small problem. I am doing database transactions using a class which will run continuously in the background of my main application(From which I am calling the functions of former class and do DB operations). In the data base class constructor itself I am forming Connection to the database and using the same connection to do all db operations. In this synario, I have an issue. That is if after creating the connection, the database crashes and immediately resumes to normal state., my DB class has no way to know this and after this, if any DB operation is occured. I can't use the same connection object(It is throwing Disconnect exception). Can anybody suggest me a way so that I can know when the DB is restarted or is there any other possible means to avoid this problem. Please help me .

    Hi ,
    Thanks for your sugession. I have another doubt .If I am using Connection pooling (using commons Dbcp)and the data base is restarted, can I use the connections from the same pool(Or will it throw the exception). In such case am I need to recreate the pool?. I am new to JDBC and hence I don't have much idea abt connection pooling.
    Note: I am not using any web server in my application. mine is a stand alone application.
    Thanks and Regards,
    vignesh

  • How to check the PR release Strategy change date?

    hi,
    how to check when the PR Release Strategy chagned by someone ...?
    Regs,
    S J Solanki

    Hi
    You can directly go into the Purcahse order & check for the Heder changes which will give the Changed Date
    If you need to use two table to find out the date when the Strategy was changed.
    Use Table CDHDR & CDPOS. Object key is the POurcahse order number
    Thanks & regards
    Kishore

  • Change Tracking Option in Console

    I have enabled change tracking option in console at Table and field level for add/modify/delete.
    Please let me know where I can see the logs for the changes accomplished.

    Hi Sudha,
    See as per your console settings, everything happened at Database Level table A2i_CM_History so its up to you how do you want to see these record changes either through some Portal application for end user or at database level or through some other UI.
    [How to Configure SAP MDM Change Tracker for Any Repository to bring this changes on Webdynpro Application for end user|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/807861ac-f941-2c10-8f8d-c57f9d421b99?quicklink=index&overridelayout=true]
    Please refer this blog if you want to see these changes at the database level just for complete understanding.
    /people/balas.gorla/blog/2006/09/08/change-tracking-in-mdm
    See figure 5 of this blog before data changes in Data Manager and the same data record in figure 9 of database.
    Now when he make changes to record in figure 10 Data manager the same gets reflected into Database figure 11.
    In fig 11 , please carefully see all the columns NewValue, OldValue, EventTime, FieldName, UserName etc.
    Hope you got now clear idea about change tracking in MDM
    Regards,
    Mandeep Saini

Maybe you are looking for

  • Connect to weblogic using C++

    Dear experts, How do i connect my c++ apps to the weblogic and what version do i use? The version that support JMS C API is 9.0 so isit I need to install WL v9.0 and above? THank you. :)

  • How can I inform which program to use to open a Docx when it doesn't show in my dropdown list in attachments?

    When I attempt to open a Docx type file Thunderbird is attempting to open the document with an old version of Office (2003). I have upgraded to (2013). I have followed the suggestions of going to Tools, Options and Attachments to assign which program

  • Need help making pace invaders in java

    So here is my code: import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.*; import javax.swing.JFrame; import java.awt.*; import javax.swing.JPanel; import java.awt.Canvas; import java.awt.Color; import java.awt.

  • Flex 2.5.33 not installing properly?

    Hi all ~ I was recently trying to install Wine on my Mac running 10.4.11, and it told me that my flex version was too old and it needed to be updated, so I downloaded the source files and followed the install instructions. Flex seemed to compile and

  • Blank screens in published movie

    In a project I thought I had just about finished, it turnsout that after Publishing, about 3 to 5 percent of the slides are BLANK. Haven't figured out any pattern as to which ones get blanked. The slides are definitely present in the Captivate storyb