]> cgit.babelmonkeys.de Git - mpdbot.git/blobdiff - src/PEPThread.m
Fetch track information using comand lists
[mpdbot.git] / src / PEPThread.m
index 80577e100fc73e19977a51b39b8e8f842f318f36..4daaefc3636f2d86ba94fab416b1a55bba12e08d 100644 (file)
                        tune = [OFXMLElement elementWithName: @"tune"
                                                   namespace: NS_TUNE];
                        [item addChild: tune];
+
+                       [conn send: @"command_list_begin"];
                        [conn send: @"status"];
+                       [conn send: @"currentsong"];
+                       [conn send: @"command_list_end"];
                        response = [conn response];
+
                        if ([[response objectForKey: @"state"]
                            isEqual: @"play"]) {
-                               [conn send: @"currentsong"];
-                               response = [conn response];
                                if ((answer =
                                    [response objectForKey: @"Artist"]))
                                        [tune addChild: [OFXMLElement
                                            elementWithName: @"title"
                                                  namespace: NS_TUNE
                                                stringValue: answer]];
+                               else if ((answer =
+                                   [response objectForKey: @"file"]))
+                                       [tune addChild: [OFXMLElement
+                                           elementWithName: @"title"
+                                                 namespace: NS_TUNE
+                                               stringValue: answer]];
                                if ((answer =
                                    [response objectForKey: @"Track"]))
                                        [tune addChild: [OFXMLElement