33 lines
976 B
Ruby
33 lines
976 B
Ruby
class ApiBackingTracksController < ApiController
|
|
|
|
# have to be signed in currently to see this screen
|
|
before_filter :api_signed_in_user
|
|
|
|
before_filter :lookup_recorded_backing_track, :only => [ :backing_track_silent ]
|
|
|
|
respond_to :json
|
|
|
|
def index
|
|
tracks = [
|
|
{:name=>'foo',:path=>"foobar.mp3", :length=>4283},
|
|
{:name=>'bar',:path=>"foo.mp3",:length=>3257}
|
|
]
|
|
@backing_tracks, @next = tracks, nil
|
|
render "api_backing_tracks/index", :layout => nil
|
|
end
|
|
|
|
def backing_track_silent
|
|
@recorded_backing_track.mark_silent
|
|
|
|
render :json => {}, :status => 200
|
|
end
|
|
|
|
private
|
|
|
|
def lookup_recorded_backing_track
|
|
@recorded_backing_track = RecordedBackingTrack.find_by_recording_id_and_client_track_id!(params[:id], params[:track_id])
|
|
raise JamPermissionError, ValidationMessages::PERMISSION_VALIDATION_ERROR unless @recorded_backing_track.recording.has_access?(current_user)
|
|
end
|
|
|
|
end # class ApiBackingTracksController
|