Example #1
0
        internal virtual void Reload(Rainmeter.API api, ref double maxValue)
        {
            //@TODO Use this port
            int port = api.ReadInt("Port", 58932);

            string playerTypeString = api.ReadString("PlayerType", "Status");

            try
            {
                playerType = (InfoTypes)Enum.Parse(typeof(InfoTypes), playerTypeString, true);

                if (playerType == InfoTypes.Cover)
                {
                    //Unused @TODO Implement using this. Probably would be cleanest to null all other music info locations during write to disk
                    //defaultCoverLocation = api.ReadPath("DefaultPath", "");
                    string temp = api.ReadPath("CoverPath", null);
                    if (temp.Length > 0)
                    {
                        CoverOutputLocation = temp;
                    }
                    temp = api.ReadPath("DefaultPath", null);
                    if (temp.Length > 0)
                    {
                        CoverDefaultLocation = temp;
                    }
                }
                else if (playerType == InfoTypes.Progress)
                {
                    maxValue = 100;
                }
            }
            catch (Exception e)
            {
                API.Log(API.LogType.Error, "WebNowPlaying.dll - Unknown PlayerType:" + playerTypeString);
                API.Log(API.LogType.Debug, "Error:" + e.ToString());
                playerType = InfoTypes.Status;
            }
        }
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            Name = api.GetMeasureName();
            //API.Log(API.LogType.Notice, "RainGoo.dll : Measure name is  : " + Name);

            googleClientId     = api.ReadString(PARAM_GOOGLE_CLIENT_ID, "");
            googleClientSecret = api.ReadString(PARAM_GOOGLE_CLIENT_SECRET, "");
            googleAppName      = api.ReadString(PARAM_GOOGLE_APP_NAME, "");
            googleUserName     = api.ReadString(PARAM_GOOGLE_USER_NAME, "");



            if (Name == "mGcal")
            {
                Skin = api.GetSkin();

                calUrls.Clear();

                int    i   = 1;
                String tmp = null;

                while (!String.IsNullOrWhiteSpace((tmp = api.ReadString(PARAM_CAL + i, ""))))
                {
                    if (tmp != "#Calendar2#" && tmp != "#Calendar3#")
                    {
                        calUrls.Add(tmp);
                    }
                    i++;
                }

                max          = api.ReadInt(PARAM_MAX, DEFAULT_MAX);
                Limit2Xdays  = api.ReadInt(PARAM_LIMIT2XDAYS, DEFAULT_LIMITXDAYS);
                MIN_INTERVAL = api.ReadInt(PARAM_REFRESH_CAL, 30) * 1000;


                todayDateFormat = api.ReadString(PARAM_TODAY_FORMAT, "HH:mm");
                weekDateFormat  = api.ReadString(PARAM_WEEK_DATE_FORMAT, "ddd");
                dateFormat      = api.ReadString(PARAM_DATE_FORMAT, "ddd dd MMM");



#if DEBUG
                API.Log(API.LogType.Notice, "RainGoo.dll: Calendars : " + calUrls.Count + " - Max results : " + max + " - Limit 2 X days : " + Limit2Xdays);
#endif

                calendarPath = api.ReadPath(PARAM_INC_PATH, "");

                lastUpdate = 0;
                UpdateEvents();
            }
            else
            {
                Skin = api.GetSkin();
                // Generates include files
                maxGmail  = api.ReadInt(PARAM_MAX, DEFAULT_MAX);
                gmailPath = api.ReadPath(PARAM_INC_PATH, "");
#if DEBUG
                API.Log(API.LogType.Notice, "RainGoo.dll: Gmail inc file path :" + gmailPath);
#endif
                lastUpdategmail   = 0;
                MIN_INTERVALGMAIL = api.ReadInt(PARAM_REFRESH_MAIL, 10) * 1000;
                UpdateGmail();
            }
        }
        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);
            }
        }