ajax.php
changeset 18 69af47034212
parent 10 d3059e20b0fa
child 21 74edc873234f
equal deleted inserted replaced
17:66c3eb4cdc4c 18:69af47034212
    74       }
    74       }
    75       $tid = intval($tid);
    75       $tid = intval($tid);
    76       dcop_action('playlist', "playByIndex $tid");
    76       dcop_action('playlist', "playByIndex $tid");
    77       $return = array(
    77       $return = array(
    78         'current_track_length' => $playlist[$tid]['length_int'],
    78         'current_track_length' => $playlist[$tid]['length_int'],
    79         'current_track_pos' => 0
    79         'current_track_pos' => 0,
       
    80         'current_track_title' => $playlist[$tid]['title'],
       
    81         'current_track_album' => $playlist[$tid]['album'],
       
    82         'current_track_artist' => $playlist[$tid]['artist']
    80       );
    83       );
    81       echo $json->encode($return);
    84       echo $json->encode($return);
    82       break;
    85       break;
    83     case 'volume':
    86     case 'volume':
    84       if ( !$allowcontrol )
    87       if ( !$allowcontrol )
   118           'is_playing' => dcop_action('player', 'isPlaying'),
   121           'is_playing' => dcop_action('player', 'isPlaying'),
   119           'current_track' => $current_track,
   122           'current_track' => $current_track,
   120           'volume' => dcop_action('player', 'getVolume'),
   123           'volume' => dcop_action('player', 'getVolume'),
   121           // include the MD5 of the playlist so that if it changes, the
   124           // include the MD5 of the playlist so that if it changes, the
   122           // client can refresh (otherwise things get madly corrupted)
   125           // client can refresh (otherwise things get madly corrupted)
   123           'playlist_hash' => $playlist_last_md5
   126           'playlist_hash' => $playlist_last_md5,
       
   127           'current_track_title' => false,
       
   128           'current_track_album' => false,
       
   129           'current_track_artist' => false
   124         );
   130         );
   125       if ( isset($playlist[$current_track]) )
   131       if ( isset($playlist[$current_track]) )
   126       {
   132       {
   127         $return['current_track_length'] = $playlist[$current_track]['length_int'];
   133         $return['current_track_length'] = $playlist[$current_track]['length_int'];
   128         $return['current_track_pos'] = dcop_action('player', 'trackCurrentTime');
   134         $return['current_track_pos'] = dcop_action('player', 'trackCurrentTime');
       
   135         $return['current_track_title'] = $playlist[$current_track]['title'];
       
   136         $return['current_track_artist'] = $playlist[$current_track]['artist'];
       
   137         $return['current_track_album'] = $playlist[$current_track]['album'];
   129       }
   138       }
   130       echo $json->encode($return);
   139       echo $json->encode($return);
   131       break;
   140       break;
   132     default:
   141     default:
   133       return json_die("Undefined action: $action");
   142       return json_die("Undefined action: $action");