Skip to content

Commit

Permalink
Changes to audio modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cofiem committed Oct 30, 2012
2 parents 21eb6a0 + 3d3cb4b commit 1412bc5
Show file tree
Hide file tree
Showing 19 changed files with 601 additions and 1,418 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ doc/
/.project

# rubymine stuff
.idea/workspace.xml
/.idea/workspace.xml
817 changes: 0 additions & 817 deletions .idea/workspace.xml

This file was deleted.

44 changes: 22 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
language: ruby
bundler_args: --without development
rvm:
- 1.9.3
# - 1.9.2
# - 1.8.7
# - jruby-18mode # JRuby in 1.8 mode
# - jruby-19mode # JRuby in 1.9 mode
# - rbx-18mode
# - rbx-19mode
branches:
only:
- 'master'
gemfile:
- Gemfile
before_script:
- sh vendor/bin/install_console_audio_tools.sh
script:
- ls -la
- RAILS_ENV=test bundle exec rake --trace db:migrate
- RAILS_ENV=test bundle exec rake --trace
notifications:
language: ruby
bundler_args: --without development
rvm:
- 1.9.3
# - 1.9.2
# - 1.8.7
# - jruby-18mode # JRuby in 1.8 mode
# - jruby-19mode # JRuby in 1.9 mode
# - rbx-18mode
# - rbx-19mode
branches:
only:
- 'master'
gemfile:
- Gemfile
before_script:
- sh vendor/bin/install_console_audio_tools.sh
script:
- ls -la
- RAILS_ENV=test bundle exec rake --trace db:migrate
- RAILS_ENV=test bundle exec rake --trace
notifications:
webhooks: http://build.ecosounds.org/build
24 changes: 12 additions & 12 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Copyright 2012 QUT Bioacoustics Research Group
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
Copyright 2012 QUT Bioacoustics Research Group

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
134 changes: 67 additions & 67 deletions app/controllers/media_controller.rb
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
class MediaController < ApplicationController
include Cache, Spectrogram, Audio

def index
# index page for media files
@testing = QubarSite::Application.config.media_file_config
end

def item
# page for an individual media file
# use params to get query string or parsed route parameters

# get the path for the file matching the request
file_name = Cache::cached_spectrogram_file(params)
#file_name = Cache::cached_audio_file(params)
#file_name = Cache::original_audio_file({ :id => '21EC2020-3AEA-1069-A2DD-08002B30309D', :date => '20121026', :time => '132600', :format => 'wav'})

#@file_path = Cache::possible_paths(file_name)
#@file_path = Cache::existing_paths(Cache::cached_spectrogram_storage_paths,file_name)
#@file_path = QubarSite::Application.config.media_file_config.cached_spectrogram_paths
@file_path = Cache::possible_paths(Cache::cached_spectrogram_storage_paths,file_name)

# see if the requested file exists

@avail_params = params

end

def info
@input_path = './test/fixtures/'
# not-an-audio-file.wav
# TorresianCrow.wav
# TestAudio1.wv
# sites.yml
# this file does not exist.nope
@audio = 'TestAudio1.wv'
@input_audio = @input_path + @audio
@result = Audio::info(@input_audio)
end
def audio
print params

@input_path = './test/fixtures/'
@output_path = './public/tests/'

@audio = 'TestAudio1.wv'
@modified_audio = 'TestAudio1.wav'

@input_audio = @input_path + @audio
@output_audio = @output_path + @modified_audio


#@result = Audio::modify(@input_audio, @output_audio, [])
end
def spectrogram
print params
@input_path = './test/fixtures/'
@output_path = './public/tests/'

@audio = 'TorresianCrow.wav'
@image = 'TorresianCrow.png'

@input_audio = @input_path + @audio
@output_image = @output_path + @image

#@result = Spectrogram::generate(@input_audio, @output_image)
end
class MediaController < ApplicationController
include Cache, Spectrogram, Audio

def index
# index page for media files
@testing = QubarSite::Application.config.media_file_config
end

def item
# page for an individual media file
# use params to get query string or parsed route parameters

# get the path for the file matching the request
file_name = Cache::cached_spectrogram_file(params)
#file_name = Cache::cached_audio_file(params)
#file_name = Cache::original_audio_file({ :id => '21EC2020-3AEA-1069-A2DD-08002B30309D', :date => '20121026', :time => '132600', :format => 'wav'})

#@file_path = Cache::possible_paths(file_name)
#@file_path = Cache::existing_paths(Cache::cached_spectrogram_storage_paths,file_name)
#@file_path = QubarSite::Application.config.media_file_config.cached_spectrogram_paths
@file_path = Cache::possible_paths(Cache::cached_spectrogram_storage_paths,file_name)

# see if the requested file exists

@avail_params = params

end

def info
@input_path = './test/fixtures/'
# not-an-audio-file.wav
# TorresianCrow.wav
# TestAudio1.wv
# sites.yml
# this file does not exist.nope
@audio = 'TestAudio1.wv'
@input_audio = @input_path + @audio
@result = Audio::info(@input_audio)
end
def audio
print params

@input_path = './test/fixtures/'
@output_path = './public/tests/'

@audio = 'TestAudio1.wv'
@modified_audio = 'TestAudio1.wav'

@input_audio = @input_path + @audio
@output_audio = @output_path + @modified_audio


#@result = Audio::modify(@input_audio, @output_audio, [])
end
def spectrogram
print params
@input_path = './test/fixtures/'
@output_path = './public/tests/'

@audio = 'TorresianCrow.wav'
@image = 'TorresianCrow.png'

@input_audio = @input_path + @audio
@output_image = @output_path + @image

#@result = Spectrogram::generate(@input_audio, @output_image)
end
end
178 changes: 89 additions & 89 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
class PhotosController < ApplicationController
# GET /photos
# GET /photos.json
def index
@photos = Photo.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @photos }
end
end

# GET /photos/1
# GET /photos/1.json
def show
@photo = Photo.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @photo }
end
end

# GET /photos/new
# GET /photos/new.json
def new
@photo = Photo.new

@all_sites = Site.all
@all_projects = Project.all

respond_to do |format|
format.html # new.html.erb
format.json { render json: @photo }
end
end

# GET /photos/1/edit
def edit
@photo = Photo.find(params[:id])

@all_sites = Site.all
@all_projects = Project.all
end

# POST /photos
# POST /photos.json
def create
@photo = Photo.new(params[:photo])

respond_to do |format|
if @photo.save
format.html { redirect_to @photo, notice: 'Photo was successfully created.' }
format.json { render json: @photo, status: :created, location: @photo }
else
format.html { render action: "new" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# PUT /photos/1
# PUT /photos/1.json
def update
@photo = Photo.find(params[:id])

respond_to do |format|
if @photo.update_attributes(params[:photo])
format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# DELETE /photos/1
# DELETE /photos/1.json
def destroy
@photo = Photo.find(params[:id])
@photo.destroy

respond_to do |format|
format.html { redirect_to photos_url }
format.json { head :no_content }
end
end
end
class PhotosController < ApplicationController
# GET /photos
# GET /photos.json
def index
@photos = Photo.all

respond_to do |format|
format.html # index.html.erb
format.json { render json: @photos }
end
end

# GET /photos/1
# GET /photos/1.json
def show
@photo = Photo.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.json { render json: @photo }
end
end

# GET /photos/new
# GET /photos/new.json
def new
@photo = Photo.new

@all_sites = Site.all
@all_projects = Project.all

respond_to do |format|
format.html # new.html.erb
format.json { render json: @photo }
end
end

# GET /photos/1/edit
def edit
@photo = Photo.find(params[:id])

@all_sites = Site.all
@all_projects = Project.all
end

# POST /photos
# POST /photos.json
def create
@photo = Photo.new(params[:photo])

respond_to do |format|
if @photo.save
format.html { redirect_to @photo, notice: 'Photo was successfully created.' }
format.json { render json: @photo, status: :created, location: @photo }
else
format.html { render action: "new" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# PUT /photos/1
# PUT /photos/1.json
def update
@photo = Photo.find(params[:id])

respond_to do |format|
if @photo.update_attributes(params[:photo])
format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @photo.errors, status: :unprocessable_entity }
end
end
end

# DELETE /photos/1
# DELETE /photos/1.json
def destroy
@photo = Photo.find(params[:id])
@photo.destroy

respond_to do |format|
format.html { redirect_to photos_url }
format.json { head :no_content }
end
end
end
Loading

0 comments on commit 1412bc5

Please sign in to comment.