OhioJoe

mm-music-ip.js

Jun 14th, 2017
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php $command="/sbin/ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'";
  2. $localIP = exec ($command);
  3. ?>
  4.  
  5. function updateTitle(data){
  6.               $('.music').updateWithText( 'Track: ' + data.title);
  7.         }
  8.        
  9.         // We set that when the event:trackPlaybackStarted is fired, updateText() will be executed
  10.     var mopidy = new Mopidy({webSocketUrl: "ws://<?php echo $localIP; ?>:6680/mopidy/ws/"});   
  11. //  var mopidy = new Mopidy({webSocketUrl: "ws://localhost:6680/mopidy/ws/"});
  12. //  var mopidy = new Mopidy();
  13.     mopidy.on("event:trackPlaybackStarted", updateText);
  14.     mopidy.on("event:streamTitleChanged", updateTitle);
Advertisement
Add Comment
Please, Sign In to add comment