Skip to content

Commit

Permalink
General work
Browse files Browse the repository at this point in the history
modified:   Gemfile.lock
	-- updated capistrano

deleted:    app/assets/javascripts/angular/controllers/annotate.js
	-- uneeded

modified:   app/assets/stylesheets/application.css.scss
	-- fixed missing bottstrap directory css

modified:   app/assets/javascripts/angular/controllers/listen.js
modified:   app/assets/templates/listen.html
	-- added support for the audio element having multiple audio sources

modified:   app/controllers/media_controller.rb
	-- prepended "."'s to the avaailable formats strings in order to be consistent with the default formats

modified:   lib/RestFailureApp.rb
	-- Fixed bad JSON output - handcrafted string had single quotes in it
  • Loading branch information
atruskie committed Jan 10, 2013
1 parent f524e6d commit 2a2317d
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
Empty file.
13 changes: 9 additions & 4 deletions app/assets/javascripts/angular/controllers/annotation_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
/**
* The listen controller. Show a spectrogram, listen to audio, annotate the spectrogram.
* @param $scope
* @param $routeParams
* @param $element
* @param $attrs
* @param $transclude
* @constructor
*/
function AnnotationViewerCtrl($scope, $element, $attrs, $transclude) {
Expand All @@ -23,12 +25,15 @@ function AnnotationViewerCtrl($scope, $element, $attrs, $transclude) {
// TODO: these are stubs and will need to be refactored

// constants go here
var me = $scope;

return {
pixelsToSeconds: function pixelsToSeconds(value) {
return value * 10;
pixelsToSeconds: function pixelsToSeconds(pixels) {
var seconds = pixels * pixelsPerSecond;
return seconds;
},
pixelsToHertz: function pixelsToHertz(value) {
pixelsToHertz: function pixelsToHertz(pixels) {
var hertz = hetz * pixelsPerHertz;
return value * 10;
},
secondsToPixels: function secondsToPixels(value) {
Expand Down
11 changes: 9 additions & 2 deletions app/assets/javascripts/angular/controllers/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ function ListenCtrl($scope, $resource, $routeParams, Media, AudioEvent, Tag) {

var formatPaths = function () {
if ($scope.model.media && $scope.model.media.hasOwnProperty('recordingId')) {
$scope.model.media.imageUrl = $scope.model.media.spectrogramBaseUrl.format($scope.model.media) + "?" + $scope.authTokenQuery();
$scope.model.media.audioUrl = $scope.model.media.audioBaseUrl.format($scope.model.media) + "?" + $scope.authTokenQuery();
var authToken = $scope.authTokenQuery();
$scope.model.media.imageUrl = $scope.model.media.spectrogramBaseUrl.format($scope.model.media) + "?" + authToken;

$scope.model.media.audioUrls = [];
angular.forEach($scope.model.media.options.audioFormats, function (value, key){
$scope.model.media.audioFormat = value;
this.push($scope.model.media.audioBaseUrl.format($scope.model.media) + "?" + authToken);
},$scope.model.media.audioUrls);

}
};
$scope.$on('event:auth-loginRequired', formatPaths);
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*= require_tree ../../../vendor/assets/javascripts/.
*= require_tree ../images/.
* require_tree .
* require_tree bootstrap
* depend_on "_base"
*/

Expand Down
6 changes: 3 additions & 3 deletions app/assets/templates/listen.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h3>Spectrogram</h3>

<h3>Audio Controls</h3>
<audio id="main-player" controls>
<source ng-src="{{media.audioUrl}}" src="">
<source ng-repeat="url in model.media.audioUrls" ng-src="{{url}}" src="">
Your browser does not support the audio element.
</audio>
<div id="listenEditContainer">
Expand All @@ -31,10 +31,10 @@ <h3>
<label>
<span>Tags</span>
<input type="hidden" ng-multiple="true" tags multiple ui-select2="{allowClear:true, tags:tags }"
ng-model="selectedEvent.audioEventTags">
ng-model="selectedEvent.audioEventTags" />
<!--<option ng-repeat="t in tags" value="{{t.id}}">{{t.text}} <span> &lt;!&ndash; ng-show={{t.type_of_tag}}&ndash;&gt;,-->
<!--{{t.typeOfTag}} &lt;!&ndash; &ndash;&gt;</span></option>-->
</input>

</label>
<label>
<span>Duration (seconds)</span></label>
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/media_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def item
:options => {
:colors => Spectrogram.colour_options,
:window_size => Spectrogram.window_options,
:audio_formats => audio_media_types.collect { |mt| mt.symbol },
:image_formats => image_media_types.collect { |mt| mt.symbol },
:audio_formats => audio_media_types.collect { |mt| '.' + mt.symbol.to_s}.uniq,
:image_formats => image_media_types.collect { |mt| '.' + mt.symbol.to_s},
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/RestFailureApp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def respond
def json_failure
self.status = 401
self.content_type = 'application/json'
self.response_body = "{'error' : 'authentication error'}"
self.response_body = '{"error" : "authentication error"}'
end
end

0 comments on commit 2a2317d

Please sign in to comment.