Skip to content

Commit

Permalink
Merge pull request #536 from rfcx/feature/CS-494-spectrogram-from-api
Browse files Browse the repository at this point in the history
CS-494 Request non-legacy spectrogram tiles from Media API
  • Loading branch information
rassokhina-e authored Feb 17, 2021
2 parents 8120799 + 3529447 commit 9d89b6a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## v3.0.10 - Feb XX, 2021

New features:
- CS-494 Request spectrogram tiles from Media API for audios from RFCx streams

Resolved issues:
- PI-545 Improve the quality of the spectrogram image
- PI-504 Can not filter more than one tag
Expand Down
1 change: 1 addition & 0 deletions app/model/recordings.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ var Recordings = {
projection = "R.recording_id AS id, \n"+
"SUBSTRING_INDEX(R.uri,'/',-1) as file, \n"+
"S.name as site, \n"+
"S.legacy as legacy, \n"+
"R.uri, \n"+
"R.datetime, \n"+
"R.mic, \n"+
Expand Down
13 changes: 10 additions & 3 deletions assets/app/app/visualizer/visobjects/recording.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ angular.module('a2.visobjects.recording', [
})
.service('VisualizerObjectRecordingTypeLoader', function ($q, Project) {
var khz_format = function(v){return (v/1000) | 0; };

var recording = function(data, extra){
for(var i in data){ this[i] = data[i]; }
this.sampling_rate = this.sample_rate;
Expand All @@ -38,11 +38,18 @@ angular.module('a2.visobjects.recording', [
};
// set it to the scope
this.tiles.set.forEach((function(tile){
tile.src="/api/project/"+Project.getUrl()+"/recordings/tiles/"+this.id+"/"+tile.i+"/"+tile.j;
if (!!data.legacy) {
tile.src="/api/project/"+Project.getUrl()+"/recordings/tiles/"+this.id+"/"+tile.i+"/"+tile.j;
} else {
var streamId = data.uri.split('/')[3]
var start = new Date(new Date(data.datetime).valueOf() + Math.round(tile.s * 1000)).toISOString()
var end = new Date(new Date(data.datetime).valueOf() + Math.round((tile.s + tile.ds) * 1000)).toISOString()
tile.src = '/api/ingest/recordings/' + streamId + '_t' + start.replace(/-|:|\./g, '') + '.' + end.replace(/-|:|\./g, '') + '_z95_wdolph_g1_fspec_mtrue_d1023.255.png'
}
}).bind(this));
};
recording.layers=[

];
recording.fetch = function(visobject){
var d = $q.defer();
Expand Down
2 changes: 1 addition & 1 deletion config/rfcx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coreAPIEnabled": false,
"apiBaseUrl": "https://api.rfcx.org",
"mediaBaseUrl": "https://media.rfcx.org"
"mediaBaseUrl": "https://media-api.rfcx.org"
}

0 comments on commit 9d89b6a

Please sign in to comment.