public ApiModule(Mpc mpc, MediaLibrary mediaLibrary, Omdb omdb) : base("/api") { _config = new Config(); _mpc = mpc; _mediaLibrary = mediaLibrary; _omdb = omdb; Play(); //RegisterApiMpc("play", 887); RegisterApiMpc("pause", 888); RegisterApiMpc("volume-up", 907); RegisterApiMpc("volume-down", 908); NextFile(); RegisterApiMpc("fullscreen", 830); RegisterApiMpc("back", 901); RegisterApiMpc("forward", 902); GetLibrary(); GetExtendedItem(); PlayFile(); UpdateLibrary(); ScanItem(); }
void EnsureInstance() { if (_instance == null) { _instance = new Config( new Configuration() ); } }
public Server(IEnumerable<IService> services) { _config = new Config(); _uris = _config.Url .Split(' ') .Select(u => new Uri(u)) .ToArray(); _services = services; }
public StaticModule() { var config = new Config(); ScanFiles(config.Html5, string.Empty); Get["/"] = p => StaticResponse( Path.Combine(config.Html5, "index.html") ); Get["/media"] = p => StaticResponse( Path.Combine(config.Html5, "index.html") ); Get["/js/all.js"] = p => { return Response.AsText( string.Join("\n\n", Directory .GetFiles(Path.Combine(config.Html5, "js"), "*.js") .Select(f => File.ReadAllText(f)) ), "application/x-javascript" ); }; //Get["/media/{hash}/{ext}/{session}"] = p => //{ // //var request = this.Bind<MediaRequest>(); // var session = this.GetSession((string)p.session); // if (session == null) // { // return Response.Error("no session"); // } // else // { // var path = config[session.Account].GetHashPath((string)p.hash); // return StaticResponse(path, path + (string)p.ext); // } //}; }
public Mpc() { _config = new Config(); _http = new HttpClient(); _http.Timeout = TimeSpan.FromSeconds(2); }
public Omdb() { _config = new Config(); _http = new HttpClient(); }
public MediaLibrary() { _config = new Config(); }