]> git.tdb.fi Git - xinema.git/blobdiff - source/client.cpp
Fix a command processing error
[xinema.git] / source / client.cpp
index f116892a06b1073401a5c1683007935f29b9bd97..1f2164876024adc75fe4f440aa6f7938ca944dd8 100644 (file)
@@ -17,6 +17,9 @@ Client::Client(Xinema &x, Net::StreamSocket *s):
        socket->signal_end_of_file.connect(sigc::mem_fun(this, &Client::end_of_stream));
 
        xinema.signal_stream_created.connect(sigc::mem_fun(this, &Client::stream_created));
+       XineStream *stream = xinema.get_stream();
+       if(stream)
+               stream_created(*stream);
 }
 
 void Client::data_available()
@@ -39,7 +42,6 @@ void Client::data_available()
                catch(const exception &e)
                {
                        send_reply(string("error ")+e.what());
-                       return;
                }
 
                start = newline+1;
@@ -90,11 +92,19 @@ void Client::list_directory(const FS::Path &dn)
 
 void Client::stream_created(XineStream &stream)
 {
+       stream.signal_title_changed.connect(sigc::mem_fun(this, &Client::stream_title_changed));
        stream.signal_duration_changed.connect(sigc::mem_fun(this, &Client::stream_duration_changed));
        stream.signal_position_changed.connect(sigc::mem_fun(this, &Client::stream_position_changed));
        string title = stream.get_title();
        if(!title.empty())
                send_reply("title "+title);
+       if(const Time::TimeDelta &dur = stream.get_duration())
+               stream_duration_changed(dur);
+}
+
+void Client::stream_title_changed(const string &title)
+{
+       send_reply("title "+title);
 }
 
 void Client::stream_duration_changed(const Time::TimeDelta &dur)