internal Measure(Rainmeter.API api) { ++measureCount; try { if (rainmeterFileSettingsLocation != api.GetSettingsFile()) { rainmeterFileSettingsLocation = api.GetSettingsFile(); } if (wssv == null) { //@TODO Declare on reload so that custom ports can be allowed? wssv = new WebSocketServer(8974); } if (wssv.IsListening == false) { wssv.AddWebSocketService <WebNowPlaying>("/"); wssv.Start(); } } catch (Exception e) { API.Log(API.LogType.Error, "WebNowPlaying.dll - Error starting WebNowPlaying plugin"); API.Log(API.LogType.Debug, "Error:" + e.ToString()); } }
internal virtual void Reload(Rainmeter.API api, ref double maxValue) { string infoType = api.ReadString("PlayerInfo", ""); switch (infoType.ToLowerInvariant()) { case "artist": InfoType = MeasureInfoType.Artist; break; case "album": InfoType = MeasureInfoType.Album; break; case "title": InfoType = MeasureInfoType.Title; break; case "number": InfoType = MeasureInfoType.Number; break; case "year": InfoType = MeasureInfoType.Year; break; case "genre": InfoType = MeasureInfoType.Genre; break; case "cover": InfoType = MeasureInfoType.Cover; defaultCoverLocation = api.ReadPath("DefaultPath", ""); coverOutputLocation = api.ReadPath("CoverPath", ""); break; case "coverwebaddress": InfoType = MeasureInfoType.CoverWebAddress; break; case "duration": InfoType = MeasureInfoType.Duration; break; case "position": InfoType = MeasureInfoType.Position; break; case "progress": InfoType = MeasureInfoType.Progress; break; case "rating": InfoType = MeasureInfoType.Rating; break; case "repeat": InfoType = MeasureInfoType.Repeat; break; case "shuffle": InfoType = MeasureInfoType.Shuffle; break; case "state": InfoType = MeasureInfoType.State; break; case "status": InfoType = MeasureInfoType.Status; break; case "connectionstatus": InfoType = MeasureInfoType.ConnectionStatus; break; case "volume": InfoType = MeasureInfoType.Volume; break; default: API.Log(API.LogType.Error, "BetterMusicPlugin.dll: InfoType=" + infoType + " not valid, assuming title"); InfoType = MeasureInfoType.Title; break; } string playerType = api.ReadString("PlayerType", ""); switch (playerType.ToLowerInvariant()) { case "dynamic": PlayerType = MeasurePlayerType.Dynamic; break; case "gpmdp": PlayerType = MeasurePlayerType.GPMDP; break; case "soundnode": PlayerType = MeasurePlayerType.Soundnode; break; case "ChromeMusicInfo": PlayerType = MeasurePlayerType.ChromeMusicInfo; break; default: API.Log(API.LogType.Error, "BetterMusicPlugin.dll: PlayerType=" + playerType + " not valid, assuming dynamic"); PlayerType = MeasurePlayerType.Dynamic; break; } //If not setup get the rainmeter settings file location and load the authcode if (rainmeterFileSettingsLocation.Length == 0) { rainmeterFileSettingsLocation = api.GetSettingsFile(); char[] authchar = new char[36]; GetPrivateProfileString("BetterMusic", "AuthCode", "", authchar, 37, rainmeterFileSettingsLocation); authcode = new String(authchar); } }