diff --git a/lib/PiTube/Controller/Nginx.pm b/lib/PiTube/Controller/Nginx.pm
index f2951c5e6e6b4bec613ed3a94a666d68ff5a1954..fdc4562984521062865fd7648757f503aee77e04 100644
--- a/lib/PiTube/Controller/Nginx.pm
+++ b/lib/PiTube/Controller/Nginx.pm
@@ -1,7 +1,7 @@
 package PiTube::Controller::Nginx;
 use Mojo::Base 'Mojolicious::Controller';
 
-use constant HLS => qr/^\/hls\/([a-z0-9\-]+)(_\w+)?(\/\w+)?\.(m3u8|ts)$/i;
+use constant HLS => qr/hls\/([a-z0-9\-]+)(_\w+)?(\/\w+)?\.(m3u8|ts)$/i;
 
 sub callback_rtmp {
     my $c = shift;
@@ -40,10 +40,45 @@ sub callback_rtmp {
     $c->render( status => 204, text => '' );
 }
 
-sub callback_hls {
+sub callback_recorder {
     my $c = shift;
 
-    $c->app->log->debug($c->req->headers->header('X-Original-URI'));
+    my $name = $c->param('name');
+
+    # stream
+    my $stream = $c->schema->resultset('Stream')->find({
+        key => $name,
+    });
+    $c->render( status => 404, text => '' ), return if ! $stream;
+
+    # aktualizace stavu streamu
+    $stream->update({
+        recording     => 'f',
+    });
+
+    my $record = $stream->records(
+        {
+            end  => undef,
+            path => undef,
+        },
+        {
+            order_by => {'-desc' => 'begin'}
+        }
+    )->first;
+
+    if ( $record ) {
+        $record->update({
+            path     => $c->param('path'),
+            recorder => $c->param('recorder'),
+            end      => \'now()',
+        });
+    }
+
+    $c->render( status => 204, text => '' );
+}
+
+sub callback_hls {
+    my $c = shift;
 
     if ($c->req->headers->header('X-Original-URI') =~ HLS ) {
         if ( $c->session->{user}{acl}{ $1 } & 4 ) { #TODO: constant
@@ -56,4 +91,20 @@ sub callback_hls {
 
 }
 
+sub callback_record {
+    my $c = shift;
+
+    $c->app->log->debug($c->req->headers->header('X-Original-URI'));
+
+#    if ($c->req->headers->header('X-Original-URI') =~ HLS ) {
+#        if ( $c->session->{user}{acl}{ $1 } & 4 ) { #TODO: constant
+            $c->render( status => 204, text => '' );
+#            return;
+#        }
+#    }
+
+#    $c->render( status => 403, text => '');
+
+}
+
 1;