Rename the previously changed subsonic controller, service and related tests.
In order to better follow the google naming convention. See https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub
This commit is contained in:
parent
f57b969e55
commit
a2747a633d
7 changed files with 67 additions and 81 deletions
|
@ -32,6 +32,8 @@
|
||||||
<script src="bower_components/jplayer/jquery.jplayer/jquery.jplayer.js" type="text/javascript"></script>
|
<script src="bower_components/jplayer/jquery.jplayer/jquery.jplayer.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/notify.js/notify.js" type="text/javascript"></script>
|
<script src="bower_components/notify.js/notify.js" type="text/javascript"></script>
|
||||||
<script src="js/app.js" type="text/javascript"></script>
|
<script src="js/app.js" type="text/javascript"></script>
|
||||||
|
<script src="js/services/globals-service.js" type="text/javascript"></script>
|
||||||
|
<script src="js/services/model-service.js" type="text/javascript"></script>
|
||||||
<script src="js/service.js" type="text/javascript"></script>
|
<script src="js/service.js" type="text/javascript"></script>
|
||||||
<script src="js/utils.js" type="text/javascript"></script>
|
<script src="js/utils.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/main.js" type="text/javascript"></script>
|
<script src="js/controllers/main.js" type="text/javascript"></script>
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
JamStash.controller('SubsonicCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var Jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
Jamstash.controller('SubsonicCtrl',
|
||||||
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications) {
|
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications) {
|
||||||
'use strict';
|
|
||||||
|
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.itemType = 'ss';
|
$scope.itemType = 'ss';
|
|
@ -1,81 +1,4 @@
|
||||||
JamStash.service('model', function () {
|
JamStash.service('notifications', function ($rootScope, globals) {
|
||||||
// Figure out how to move this, circular dependency with utils
|
|
||||||
secondsToTime = function (secs) {
|
|
||||||
// secs = 4729
|
|
||||||
var times = new Array(3600, 60, 1);
|
|
||||||
var time = '';
|
|
||||||
var tmp;
|
|
||||||
for (var i = 0; i < times.length; i++) {
|
|
||||||
tmp = Math.floor(secs / times[i]);
|
|
||||||
// 0: 4729/3600 = 1
|
|
||||||
// 1: 1129/60 = 18
|
|
||||||
// 2: 49/1 = 49
|
|
||||||
if (tmp < 1) {
|
|
||||||
tmp = '00';
|
|
||||||
}
|
|
||||||
else if (tmp < 10) {
|
|
||||||
tmp = '0' + tmp;
|
|
||||||
}
|
|
||||||
if (i === 0 && tmp == '00') {
|
|
||||||
} else {
|
|
||||||
time += tmp;
|
|
||||||
if (i < 2) {
|
|
||||||
time += ':';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
secs = secs % times[i];
|
|
||||||
}
|
|
||||||
return time;
|
|
||||||
};
|
|
||||||
this.Index = function (name, artist) {
|
|
||||||
this.name = name;
|
|
||||||
this.artist = artist;
|
|
||||||
};
|
|
||||||
this.Artist = function (id, name) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
};
|
|
||||||
this.Album = function (id, parentid, name, artist, artistId, coverartthumb, coverartfull, date, starred, description, url, type) {
|
|
||||||
this.id = id;
|
|
||||||
this.parentid = parentid;
|
|
||||||
this.name = name;
|
|
||||||
this.artist = artist;
|
|
||||||
this.artistId = artistId;
|
|
||||||
this.coverartthumb = coverartthumb;
|
|
||||||
this.coverartfull = coverartfull;
|
|
||||||
this.date = date;
|
|
||||||
this.starred = starred;
|
|
||||||
this.description = description;
|
|
||||||
this.url = url;
|
|
||||||
this.type = type;
|
|
||||||
};
|
|
||||||
this.Song = function (id, parentid, track, name, artist, artistId, album, albumId, coverartthumb, coverartfull, duration, rating, starred, suffix, specs, url, position, description) {
|
|
||||||
this.id = id;
|
|
||||||
this.parentid = parentid;
|
|
||||||
this.track = track;
|
|
||||||
this.name = name;
|
|
||||||
this.artist = artist;
|
|
||||||
this.artistId = artistId;
|
|
||||||
this.album = album;
|
|
||||||
this.albumId = albumId;
|
|
||||||
this.coverartthumb = coverartthumb;
|
|
||||||
this.coverartfull = coverartfull;
|
|
||||||
this.duration = duration;
|
|
||||||
this.time = duration === '' ? '00:00' : secondsToTime(duration);
|
|
||||||
this.rating = rating;
|
|
||||||
this.starred = starred;
|
|
||||||
this.suffix = suffix;
|
|
||||||
this.specs = specs;
|
|
||||||
this.url = url;
|
|
||||||
this.position = position;
|
|
||||||
this.selected = false;
|
|
||||||
this.playing = false;
|
|
||||||
this.description = description;
|
|
||||||
this.displayName = this.name + " - " + this.album + " - " + this.artist;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
JamStash.service('notifications', function ($rootScope, globals) {
|
|
||||||
var msgIndex = 1;
|
var msgIndex = 1;
|
||||||
this.updateMessage = function (msg, autohide) {
|
this.updateMessage = function (msg, autohide) {
|
||||||
if (msg != '') {
|
if (msg != '') {
|
||||||
|
|
52
js/services/model-service.js
Normal file
52
js/services/model-service.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.service('model', function (utils) {
|
||||||
|
this.Index = function (name, artist) {
|
||||||
|
this.name = name;
|
||||||
|
this.artist = artist;
|
||||||
|
};
|
||||||
|
this.Artist = function (id, name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
};
|
||||||
|
this.Album = function (id, parentid, name, artist, artistId, coverartthumb, coverartfull, date, starred, description, url, type) {
|
||||||
|
this.id = id;
|
||||||
|
this.parentid = parentid;
|
||||||
|
this.name = name;
|
||||||
|
this.artist = artist;
|
||||||
|
this.artistId = artistId;
|
||||||
|
this.coverartthumb = coverartthumb;
|
||||||
|
this.coverartfull = coverartfull;
|
||||||
|
this.date = date;
|
||||||
|
this.starred = starred;
|
||||||
|
this.description = description;
|
||||||
|
this.url = url;
|
||||||
|
this.type = type;
|
||||||
|
};
|
||||||
|
this.Song = function (id, parentid, track, name, artist, artistId, album, albumId, coverartthumb, coverartfull, duration, rating, starred, suffix, specs, url, position, description) {
|
||||||
|
this.id = id;
|
||||||
|
this.parentid = parentid;
|
||||||
|
this.track = track;
|
||||||
|
this.name = name;
|
||||||
|
this.artist = artist;
|
||||||
|
this.artistId = artistId;
|
||||||
|
this.album = album;
|
||||||
|
this.albumId = albumId;
|
||||||
|
this.coverartthumb = coverartthumb;
|
||||||
|
this.coverartfull = coverartfull;
|
||||||
|
this.duration = duration;
|
||||||
|
this.time = duration === '' ? '00:00' : utils.secondsToTime(duration);
|
||||||
|
this.rating = rating;
|
||||||
|
this.starred = starred;
|
||||||
|
this.suffix = suffix;
|
||||||
|
this.specs = specs;
|
||||||
|
this.url = url;
|
||||||
|
this.position = position;
|
||||||
|
this.selected = false;
|
||||||
|
this.playing = false;
|
||||||
|
this.description = description;
|
||||||
|
this.displayName = this.name + " - " + this.album + " - " + this.artist;
|
||||||
|
};
|
||||||
|
});
|
|
@ -1,9 +1,15 @@
|
||||||
describe("subsonicService", function() {
|
describe("subsonicService", function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
/*
|
||||||
|
var Subsonic;
|
||||||
beforeEach(module('JamStash'));
|
beforeEach(module('JamStash'));
|
||||||
|
beforeEach(inject(function (subsonic) {
|
||||||
|
Subsonic = subsonic;
|
||||||
|
}));
|
||||||
|
|
||||||
it("should exist", inject(function(subsonic) {
|
it("should exist", inject(function(subsonic) {
|
||||||
expect(subsonic).toBeDefined();
|
expect(subsonic).toBeDefined();
|
||||||
}));
|
}));
|
||||||
|
*/
|
||||||
|
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue