Skip to content

Commit

Permalink
Added '+' add functionality to browse tracks/albums/artists
Browse files Browse the repository at this point in the history
added stage 1 playlist functionality
  • Loading branch information
David Norman committed Nov 8, 2015
1 parent 43cf5c2 commit 587a42f
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 13 deletions.
4 changes: 4 additions & 0 deletions web/src/css/piradio.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
span.bigicon {
padding: 2px;
font-size: 4em;
}
8 changes: 6 additions & 2 deletions web/src/html/browse_album.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<div ng-init="init()" />

<p>Album: {{album_info.album}}</p>
<p>
Album: {{album_info.album}}
<a href="javascript:;" ng-click="add_album(album_info.id)"><span class="glyphicon glyphicon-plus-sign" /></a>
</p>

<p>Artist: <a href="#/local/artist/{{album_info.artist_id}}">{{album_info.artist}}</a></p>

<table class="table table-striped">
Expand All @@ -14,7 +18,7 @@
</thead>
<tbody>
<tr ng-repeat="t in tracks">
<th><span class="glyphicon glyphicon-plus-sign" /></th>
<th><a href="javascript:;" ng-click="add_track(t.id)"><span class="glyphicon glyphicon-plus-sign" /></a></th>
<td>{{t.tracknum}}</td>
<td><a href="#/local/track/{{t.id}}">{{t.title}}</a></td>
<td><a href="#/local/artist/{{t.artist_id}}">{{t.artist}}</a></td>
Expand Down
7 changes: 5 additions & 2 deletions web/src/html/browse_artist.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div ng-init="init()" />

<p>Artist: {{artist_info.artist}}</p>
<p>
Artist: {{artist_info.artist}}
<a href="javascript:;" ng-click="add_artist(artist_info.id)"><span class="glyphicon glyphicon-plus-sign" /></a>
</p>

<table class="table table-striped">
<thead>
Expand All @@ -11,7 +14,7 @@
</thead>
<tbody>
<tr ng-repeat="r in albums">
<th><span class="glyphicon glyphicon-plus-sign" /></th>
<th><a href="javascript:;" ng-click="add_album(r.id)"><span class="glyphicon glyphicon-plus-sign" /></a></th>
<td><a href="#/local/album/{{r.id}}">{{r.album}}</a></td>
</tr>
</tbody>
Expand Down
1 change: 1 addition & 0 deletions web/src/html/browse_track.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div ng-init="init()" />

<h2>Title: {{track.title}}</h2>
<a href="javascript:;" ng-click="add_track(track.id)"><span class="glyphicon glyphicon-plus-sign" /></a>
<ul>
<li>Artist: <a href="#/local/artist/{{track.artist_id}}">{{track.artist}}</a></li>
<li>Album: <a href="#/local/album/{{track.album_id}}">{{track.album}}</a></li>
Expand Down
27 changes: 26 additions & 1 deletion web/src/html/playlist.html
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
<p>playlist page</p>
<div ng-init="init()">

<p>Player: {{data.player_name}} @ {{data.player_ip}}

<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-1"></th>
<th class="col-xs-1">Number</th>
<th class="col-xs-5">Track</th>
<th class="col-xs-4">Album</th>
<th class="col-xs-2">Artist</th>
</tr>
</thead>
<tbody>
<tr ng-class="($index==data.playlist_cur_index)?'success':''" ng-repeat="r in data.playlist_loop">
<td></td>
<td>{{r.tracknum}}</td>
<td><a href="#/local/track/{{r.id}}">{{r.title}}</a></td>
<td><a href="#/local/album/{{r.album_id}}">{{r.album}}</a></td>
<td><a href="#/local/artist/{{r.artist_id}}">{{r.artist}}</a></td>
</tr>
</tbody>
</table>

</div>
12 changes: 6 additions & 6 deletions web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
<body role="document">

<div ng-controller="TransportController">
<a href="#/search"><span class="glyphicon glyphicon-search"></span></a>
<a href="#/playlist"><span class="glyphicon glyphicon-list"></span></a>
<a href="javascript:;" ng-click="ctrl_fb()"><span class="glyphicon glyphicon-fast-backward"></span></a>
<a href="javascript:;" ng-click="ctrl_play()"><span class="glyphicon glyphicon-play"></span></a>
<a href="javascript:;" ng-click="ctrl_pause()"><span class="glyphicon glyphicon-pause"></span></a>
<a href="javascript:;" ng-click="ctrl_ff()"><span class="glyphicon glyphicon-fast-forward"></span></a>
<a href="#/search"><span class="glyphicon bigicon glyphicon-search"></span></a>
<a href="#/playlist"><span class="glyphicon bigicon glyphicon-list"></span></a>
<a href="javascript:;" ng-click="ctrl_fb()"><span class="glyphicon bigicon glyphicon-fast-backward"></span></a>
<a href="javascript:;" ng-click="ctrl_play()"><span class="glyphicon bigicon glyphicon-play"></span></a>
<a href="javascript:;" ng-click="ctrl_pause()"><span class="glyphicon bigicon glyphicon-pause"></span></a>
<a href="javascript:;" ng-click="ctrl_ff()"><span class="glyphicon bigicon glyphicon-fast-forward"></span></a>
</div>

<div class="container main-body" role="main">
Expand Down
2 changes: 2 additions & 0 deletions web/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ var app = angular.module('piradio', ['ngRoute', 'ui.bootstrap'])
$scope.serverStatus = serverStatus;
})
.controller('TransportController', function($scope, slimClient) {
$scope.ctrl_fb = slimClient.ctrl_fb;
$scope.ctrl_play = slimClient.ctrl_play;
$scope.ctrl_pause = slimClient.ctrl_pause;
$scope.ctrl_ff = slimClient.ctrl_ff;
});

4 changes: 4 additions & 0 deletions web/src/js/browse_album.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function AlbumController($scope, $routeParams, slimClient) {

$scope.client = slimClient;

$scope.add_track = slimClient.add_track;
$scope.add_album = slimClient.add_album;
$scope.add_artist = slimClient.add_artist;

$scope.init = function() {
var album = $routeParams.album;
if (album != "") {
Expand Down
4 changes: 4 additions & 0 deletions web/src/js/browse_artist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function ArtistController($scope, $routeParams, slimClient) {

$scope.client = slimClient;

$scope.add_track = slimClient.add_track;
$scope.add_album = slimClient.add_album;
$scope.add_artist = slimClient.add_artist;

$scope.init = function() {
var artist = $routeParams.artist;
if (artist != "") {
Expand Down
4 changes: 4 additions & 0 deletions web/src/js/browse_track.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ function TrackController($scope, $routeParams, slimClient) {

$scope.client = slimClient;

$scope.add_track = slimClient.add_track;
$scope.add_album = slimClient.add_album;
$scope.add_artist = slimClient.add_artist;

$scope.init = function() {
var track = $routeParams.track;
if (track != "") {
Expand Down
9 changes: 8 additions & 1 deletion web/src/js/playlist.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
function PlaylistController($scope) {
function PlaylistController($scope, slimClient) {

$scope.init = function() {
slimClient.player_status().
success(function(result) {
$scope.data = result;
});
};
}

9 changes: 8 additions & 1 deletion web/src/js/slim-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function SlimClient($http, $location, serverStatus) {
};

this.ctrl_fb = function() {
data = ["playlist", "index", "-1"];
return slimRequest(data);
};

this.ctrl_play = function() {
Expand All @@ -65,8 +67,13 @@ function SlimClient($http, $location, serverStatus) {
};

this.ctrl_ff = function() {
data = ["playlist", "index", "+1"];
return slimRequest(data);
};


this.player_status = function() {
data = ["status", 0, 100, "tags:adelsty"];
return slimRequest(data);
}
};

0 comments on commit 587a42f

Please sign in to comment.