4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
< |
#include <menes/standard.hh> |
7 |
> |
#ifndef _DecentralizedMedia_hpp_ |
8 |
> |
#define _DecentralizedMedia_hpp_ |
9 |
|
|
10 |
+ |
#include <menes/platform.hpp> |
11 |
+ |
|
12 |
+ |
#ifdef MENES_PRAGMA_ONCE |
13 |
+ |
#pragma once |
14 |
+ |
#endif |
15 |
+ |
|
16 |
+ |
#include <menes-api/process.hpp> |
17 |
|
#include <menes-waf/server.hpp> |
18 |
|
|
19 |
|
#include "BeepRemote.hpp" |
27 |
|
_H<api::Process> process; |
28 |
|
int Destroy() { return process->Join(); } |
29 |
|
protected: |
30 |
< |
virtual void Process(const net::Http::Request& request, net::Http::Response& response) |
23 |
< |
{ |
24 |
< |
if (request.method_ == "PLAY") |
25 |
< |
api::Cout << "PLAY" << ios::NewLine; |
26 |
< |
else if (request.method_ == "PAUSE") |
27 |
< |
api::Cout << "PAUSE" << ios::NewLine; |
28 |
< |
else |
29 |
< |
waf::Server::Process(request, response); |
30 |
< |
} |
30 |
> |
virtual void Process(const net::Http::Request& request, net::Http::Response& response); |
31 |
|
public: |
32 |
< |
// XXX: "../Web" can be "Web" when we take out the evil juju |
33 |
< |
DecentralizedMedia() : waf::Server("../Web"), process(bmp.IsRunning() ? NULL : new api::Process("/usr/X11R6/bin/beep-media-player")) |
34 |
< |
{ |
35 |
< |
AddPort(6996); |
36 |
< |
} |
37 |
< |
~DecentralizedMedia() |
38 |
< |
{ |
39 |
< |
if (!process.IsEmpty()) |
40 |
< |
{ |
41 |
< |
_H<api::Thread> thread(new api::Thread(etl::BindAll(&DecentralizedMedia::Destroy, this))); |
42 |
< |
|
43 |
< |
bmp.Quit(); |
44 |
< |
|
45 |
< |
thread->Join(); |
46 |
< |
} |
47 |
< |
} |
32 |
> |
DecentralizedMedia(); |
33 |
> |
virtual ~DecentralizedMedia(); |
34 |
|
}; |
35 |
|
|
36 |
< |
int Main(const app::Options& options) |
51 |
< |
{ |
52 |
< |
// XXX: evil juju to make waf::Server behave nicely |
53 |
< |
::chdir("menes"); |
54 |
< |
|
55 |
< |
DecentralizedMedia media; |
56 |
< |
|
57 |
< |
return 0; |
58 |
< |
} |
36 |
> |
#endif//_DecentralizedMedia_hpp_ |