jam-cloud/web/app/controllers/api_backing_tracks_controll...

33 lines
976 B
Ruby
Raw Permalink Normal View History

2015-01-16 02:28:34 +00:00
class ApiBackingTracksController < ApiController
# have to be signed in currently to see this screen
before_filter :api_signed_in_user
2015-02-16 04:15:34 +00:00
before_filter :lookup_recorded_backing_track, :only => [ :backing_track_silent ]
2015-01-16 02:28:34 +00:00
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
2015-02-16 04:15:34 +00:00
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)
2015-02-16 04:15:34 +00:00
end
end # class ApiBackingTracksController