예제 #1
0
        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();
        }
예제 #2
0
 void EnsureInstance()
 {
     if (_instance == null)
     {
         _instance = new Config(
             new Configuration()
         );
     }
 }
예제 #3
0
        public Server(IEnumerable<IService> services)
        {
            _config = new Config();

            _uris = _config.Url
                .Split(' ')
                .Select(u => new Uri(u))
                .ToArray();

            _services = services;
        }
예제 #4
0
        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);
            //	}
            //};
        }
예제 #5
0
파일: Mpc.cs 프로젝트: seyyedi/remote-mpc
		public Mpc()
		{
			_config = new Config();
			_http = new HttpClient();
			_http.Timeout = TimeSpan.FromSeconds(2);
		}
예제 #6
0
파일: Omdb.cs 프로젝트: seyyedi/remote-mpc
		public Omdb()
		{
			_config = new Config();
			_http = new HttpClient();
		}
예제 #7
0
 public MediaLibrary()
 {
     _config = new Config();
 }