123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <?php
- /*
- Template Name: Music
- */
- get_header(); ?>
- <div class="container">
- <article id="content" class="single" role="main">
- <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <div id="music" class="entry-content">
- <div class="row">
- <div class="col-sm-12">
- <div class="row">
- <div class="col-sm-8 col-sm-offset-2">
- <div class="panel panel-default">
- <div class="panel-body">
- <div id="player">
- <div id="song-information">
- <div class="row">
- <div class="col-xs-8">
- <img id="radio" src="" title="radio" width="25px" style="float:left;margin-right:15px;">
- <span id="amplitude-now-playing-listeners">Listeners: <span id="listeners">00</span> - Peak: <span id="peak-listeners">00</span></span><br>
- <span id="amplitude-now-playing-bitrate">Bitrate: <span id="bitrate">00</span> Kbps 44.100 Khz</span>
- </div>
- <div class="col-xs-4">
-
- </div>
- </div>
- </div>
- <input class="bar" type="range" id="amplitude-volume-slider" value="90"/>
- <div id="controls">
- <div id="amplitude-play-pause" class="amplitude-paused"></div><br>
- <span id="amplitude-current-time">0:00</span>
- </div>
-
- </div>
- </div>
- <div class="panel-footer">
- <h6 style="margin:0;"><img id="eq" src="" title="eq" style="float:left;margin:3px 10px 0 7px;"> <span id="amplitude-now-playing-name">Current track: <span id="track">* Off Air *</span></span></h6>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="divider"></div>
- <?php the_content(); ?>
- <div class="row">
- <div class="col-sm-12">
- <p> </p>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- <h5 class="cm-type"><em></em></h5>
- <div class="timeline">
- <canvas id="timechart" width="900" height="400"></canvas>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-2">
- <h5 class="cm-type"><em></em></h5>
- </div>
- <div class="col-sm-2">
- <h5 class="cm-type"><em></em></h5>
- </div>
- <div class="col-sm-4">
- </div>
- <div class="col-sm-4">
- </div>
- </div>
- <div class="row">
- <div class="col-md-4">
- <div class="row">
- <div class="col-sm-6">
- <ul class="list-group">
- <li class="list-group-item active">Tracks</li>
- <li class='list-group-item'>Year<span class='badge'>7151</span></li>
- <li class='list-group-item'>Month<span class='badge'>687</span></li>
- <li class='list-group-item'>Day<span class='badge'>37</span></li>
- </li>
- </ul>
- <ul class="list-group">
- <li class="list-group-item active">Albums</li>
- <li class='list-group-item'>Year<span class='badge'>160</span></li>
- <li class='list-group-item'>Month<span class='badge'>11</span></li>
- </li>
- </ul>
- </div>
- <div class="col-sm-6">
- <div id="key">
- </div>
- </div>
- </div>
- </div>
- <div class="col-md-8">
- <div class="row">
- <div class="col-sm-6">
- <div class="music-types">
- <canvas id="typechart" width="300" height="300"></canvas>
- </div>
- </div>
- <div class="col-sm-6">
- <div class="music-typed">
- <canvas id="artchart" width="300" height="300"></canvas>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- <div id="music-notes">
- <p> </p>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- <div id="music-notes">
- <p> </p>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- <div id="linechart"></div>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-12">
- </div>
- </div>
- <?php class NowPlaying{
- private $url;
- private $noTrackPlayingMessage;
- function __construct($user, $api_key){
- $this->url = 'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&limit=1';
- $this->url .= '&user=' . $user . '&api_key=' . $api_key;
- $this->noTrackPlayingMessage = 'All Quiet - Silence is Golden';
- }
- public function getNowPlaying(){
- $xml = simplexml_load_file($this->url);
- $track = $xml->recenttracks->track;
- $nowplaying = $track->attributes()->nowplaying;
- if($nowplaying){
- $artist = $track->artist;
- $songname = $track->name;
- $albumname = $track->album;
- $albumart = $track->album->image[2];
- return '<img src="../../wp-content/themes/dw/img/eq.gif"> ' . ' ' . $artist . ' - ' . $songname;
- }
- else{
- return $this->noTrackPlayingMessage;
- }
- }
- public function setNoTrackPlayingMessage($messageIn){
- $this->noTrackPlayingMessage = $messageIn;
- }
- }
- $nowPlaying = new NowPlaying('windhamdavid', 'e12ea1d0253898ee9a93edfe42ffdeab');
- ?>
- <div class="row">
- <div class="col-sm-12">
- <h5 class="cm-type"><em>Currently Playing</em></h5>
- <ul class="list-group">
- <li class="list-group-item"><h5 style="margin:0;"><?php echo $nowPlaying->getNowPlaying(); ?></h5></li>
- </ul>
- <h5 class="cm-type"><em>Recently Played</em></h5>
- <ul class="list-group">
- <div class="recent"></div>
- </ul>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <h5 class="cm-type"><em>Artists: 7 Days</em></h5>
- <ul class="list-group">
- <div class="wartists"></div>
- </ul>
- </div>
- <div class="col-sm-8">
- <h5 class="cm-type"><em>Tracks: 7 Days</em></h5>
- <ul class="list-group">
- <div class="wtracks"></div>
- </ul>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <h5 class="cm-type"><em>Artists: 1 Month</em></h5>
- <ul class="list-group">
- <div class="martists"></div>
- </ul>
- </div>
- <div class="col-sm-8">
- <h5 class="cm-type"><em>Tracks: 1 Month</em></h5>
- <ul class="list-group">
- <div class="mtracks"></div>
- </ul>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <h5 class="cm-type"><em>Artists: 6 Months</em></h5>
- <ul class="list-group">
- <div class="artists"></div>
- </ul>
- </div>
- <div class="col-sm-8">
- <h5 class="cm-type"><em>Tracks: 6 Months</em></h5>
- <ul class="list-group">
- <div class="tracks"></div>
- </ul>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-4">
- <h5 class="cm-type"><em>Artists: 1 Year</em></h5>
- <ul class="list-group">
- <div class="artists"></div>
- </ul>
- </div>
- <div class="col-sm-8">
- <h5 class="cm-type"><em>Tracks: 1 Year</em></h5>
- <ul class="list-group">
- <div class="tracks"></div>
- </ul>
- </div>
- </div>
-
- <h5 class="cm-type"><em>Top 200 Albums From the Last Year</em></h5>
- <div class="albums"></div>
- </div>
- </div>
- <?php endwhile; ?>
- </article>
- </div>
- <?php get_footer(); ?>
|