Exemple #1
0
        /// <summary>
        /// Do we have all required fields filled
        /// </summary>
        /// <returns></returns>
        private bool AllFilledIn()
        {
            int MaximumShares = 250;

            //Do we have 1 or more music,picture,video shares?
            using (Settings xmlreader = new MPSettings())
            {
                string playlistFolder = xmlreader.GetValueAsString("music", "playlists", "");
                if (playlistFolder == string.Empty)
                {
                    MessageBox.Show("No music playlist folder specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                playlistFolder = xmlreader.GetValueAsString("movies", "playlists", "");
                if (playlistFolder == string.Empty)
                {
                    MessageBox.Show("No video playlist folder specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                bool added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string sharePathData = xmlreader.GetValueAsString("music", sharePath, "");
                    if (!Util.Utils.IsDVD(sharePathData) && sharePathData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No music folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string shareNameData = xmlreader.GetValueAsString("movies", sharePath, "");
                    if (!Util.Utils.IsDVD(shareNameData) && shareNameData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No video folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string shareNameData = xmlreader.GetValueAsString("pictures", sharePath, "");
                    if (!Util.Utils.IsDVD(shareNameData) && shareNameData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No pictures folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }

                bool audioScrobblerOn = xmlreader.GetValueAsBool("plugins", "Audioscrobbler", false);
                if (audioScrobblerOn)
                {
                    // Does Audioscrobbler have a user but no password (due to DB upgrades, restores, etc)
                    string asuser = xmlreader.GetValueAsString("audioscrobbler", "user", "");
                    if (!string.IsNullOrEmpty(asuser))
                    {
                        Music.Database.MusicDatabase mdb = Music.Database.MusicDatabase.Instance;
                        string AsPass = mdb.AddScrobbleUserPassword(Convert.ToString(mdb.AddScrobbleUser(asuser)), "");
                        if (string.IsNullOrEmpty(AsPass))
                        {
                            MessageBox.Show("No password specified for current Audioscrobbler user", "MediaPortal Settings",
                                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                    }
                }

                // Check hostname for tv server if tv or radio is used
                bool tvPluginEnabled    = xmlreader.GetValueAsBool("plugins", "TV", false);
                bool radioPluginEnabled = xmlreader.GetValueAsBool("plugins", "Radio", false);
                if (UseTvServer && (tvPluginEnabled || radioPluginEnabled))
                {
                    string hostName = xmlreader.GetValueAsString("tvservice", "hostname", "");
                    if (string.IsNullOrEmpty(hostName))
                    {
                        // Show message box
                        DialogResult result = MessageBox.Show("There is a problem with the hostname specified in the \"TV/Radio\" section. " +
                                                              "It will not be saved." + Environment.NewLine + Environment.NewLine + "Do you want to review it before exiting?",
                                                              "MediaPortal Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        // If user wants to review hostname select "TV/Radio" section and return false
                        if (result == DialogResult.Yes)
                        {
                            // Loop through the tree to find the "TV/Radio" node and select it
                            foreach (TreeNode parentNode in sectionTree.Nodes)
                            {
                                if (parentNode.Text == "TV/Radio")
                                {
                                    sectionTree.SelectedNode = parentNode;
                                    parentNode.EnsureVisible();
                                    return(false);
                                }
                            }
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Do we have all required fields filled
        /// </summary>
        /// <returns></returns>
        private bool AllFilledIn()
        {
            int MaximumShares = 250;

            //Do we have 1 or more music,picture,video shares?
            using (Settings xmlreader = new MPSettings())
            {
                string playlistFolder = xmlreader.GetValueAsString("music", "playlists", "");
                if (playlistFolder == string.Empty)
                {
                    MessageBox.Show("No music playlist folder specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                playlistFolder = xmlreader.GetValueAsString("movies", "playlists", "");
                if (playlistFolder == string.Empty)
                {
                    MessageBox.Show("No video playlist folder specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                bool added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string sharePathData = xmlreader.GetValueAsString("music", sharePath, "");
                    if (!Util.Utils.IsDVD(sharePathData) && sharePathData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No music folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string shareNameData = xmlreader.GetValueAsString("movies", sharePath, "");
                    if (!Util.Utils.IsDVD(shareNameData) && shareNameData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No video folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                added = false;
                for (int index = 0; index < MaximumShares; index++)
                {
                    string sharePath     = String.Format("sharepath{0}", index);
                    string shareNameData = xmlreader.GetValueAsString("pictures", sharePath, "");
                    if (!Util.Utils.IsDVD(shareNameData) && shareNameData != string.Empty)
                    {
                        added = true;
                        break;
                    }
                }
                if (!added)
                {
                    MessageBox.Show("No pictures folders specified", "MediaPortal Settings", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return(false);
                }
                // is last.fm enabled but audioscrobbler is not?
                bool audioScrobblerOn = xmlreader.GetValueAsBool("plugins", "Audioscrobbler", false);
                bool lastFmOn         = xmlreader.GetValueAsBool("plugins", "Last.fm Radio", false);
                if (lastFmOn && !audioScrobblerOn)
                {
                    MessageBox.Show("Please configure the Audioscrobbler plugin to use Last.fm radio", "MediaPortal Settings",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }

                if (audioScrobblerOn)
                {
                    // Does Audioscrobbler have a user but no password (due to DB upgrades, restores, etc)
                    string asuser = xmlreader.GetValueAsString("audioscrobbler", "user", "");
                    if (!string.IsNullOrEmpty(asuser))
                    {
                        Music.Database.MusicDatabase mdb = Music.Database.MusicDatabase.Instance;
                        string AsPass = mdb.AddScrobbleUserPassword(Convert.ToString(mdb.AddScrobbleUser(asuser)), "");
                        if (string.IsNullOrEmpty(AsPass))
                        {
                            MessageBox.Show("No password specified for current Audioscrobbler user", "MediaPortal Settings",
                                            MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }