private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { m_bAutoShuffle = xmlreader.GetValueAsBool("musicfiles", "autoshuffle", true); } }
private void SetRefreshInterval() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("weather", "refresh", btnRefreshInterval.SelectedItemValue); } }
private void InitTemperatureSelect() { string tempUnit; using (Profile.Settings xmlreader = new Profile.MPSettings()) { tempUnit = xmlreader.GetValueAsString("weather", "temperature", "C"); } ArrayList availableUnits = new ArrayList(); availableUnits.Add("Celsius"); // Celsius availableUnits.Add("Farenheit"); // Farenheit int index = 0; foreach (string au in availableUnits) { btnTemperatureSelect.AddItem(au, index); if (au[0] == tempUnit[0]) { btnTemperatureSelect.SelectedItem = index; } index++; } }
private void SetWindSpeedSelect() { int newWindUnit = 0; if (btnWindSpeedSelect.SelectedItemLabel == GUILocalizeStrings.Get(561)) { newWindUnit = 0; // km/h } else if (btnWindSpeedSelect.SelectedItemLabel == GUILocalizeStrings.Get(562)) { newWindUnit = 1; // mph } else if (btnWindSpeedSelect.SelectedItemLabel == GUILocalizeStrings.Get(564)) { newWindUnit = 2; // m/s } else if (btnWindSpeedSelect.SelectedItemLabel == GUILocalizeStrings.Get(563)) { newWindUnit = 3; // kn } else if (btnWindSpeedSelect.SelectedItemLabel == GUILocalizeStrings.Get(565)) { newWindUnit = 4; // bft } using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("weather", "speed", newWindUnit); } }
private void OnShuffleSlideShows() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("pictures", "autoShuffle", cmShuffleSlideShows.Selected); } }
private void OnLoopSlideShows() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("pictures", "autoRepeat", cmLoopSlideShows.Selected); } }
private void SaveSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { xmlreader.SetValueAsBool("musicfiles", "autoshuffle", m_bAutoShuffle); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("mpsettings", "pin", Util.Utils.EncryptPin(_pin)); } }
private void SavePlayList() { string strNewFileName = playlistPlayer.CurrentPlaylistName; if (VirtualKeyboard.GetKeyboard(ref strNewFileName, GetID)) { string strPath = Path.GetFileNameWithoutExtension(strNewFileName); string strPlayListPath = string.Empty; using (Profile.Settings xmlreader = new Profile.MPSettings()) { strPlayListPath = xmlreader.GetValueAsString("music", "playlists", string.Empty); strPlayListPath = Util.Utils.RemoveTrailingSlash(strPlayListPath); } strPath += ".m3u"; if (strPlayListPath.Length != 0) { strPath = strPlayListPath + @"\" + strPath; } PlayList playlist = new PlayList(); for (int i = 0; i < facadeLayout.Count; ++i) { GUIListItem pItem = facadeLayout[i]; PlayListItem newItem = new PlayListItem(); newItem.FileName = pItem.Path; newItem.Description = pItem.Label; newItem.Duration = (pItem.MusicTag == null) ? pItem.Duration : (pItem.MusicTag as MusicTag).Duration; newItem.Type = PlayListItem.PlayListItemType.Audio; playlist.Add(newItem); } IPlayListIO saver = new PlayListM3uIO(); saver.Save(playlist, strPath); } }
public override bool Init() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _playlistFolder = xmlreader.GetValueAsString("music", "playlists", string.Empty); _savePlaylistOnExit = xmlreader.GetValueAsBool("musicfiles", "savePlaylistOnExit", false); _resumePlaylistOnEnter = xmlreader.GetValueAsBool("musicfiles", "resumePlaylistOnMusicEnter", false); _savePlaylistAsUtf8 = xmlreader.GetValueAsBool("musicfiles", "savePlaylistUTF8", false); playlistPlayer.RepeatPlaylist = xmlreader.GetValueAsBool("musicfiles", "repeat", true); } if (_resumePlaylistOnEnter) { if (_savePlaylistAsUtf8) { _defaultPlaylist = string.Format("{0}.m3u8", Path.GetFileNameWithoutExtension(_defaultPlaylist)); } Log.Info("GUIMusicPlaylist: Loading default playlist {0}", _defaultPlaylist); bw = new BackgroundWorker(); bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = false; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.RunWorkerAsync(); } else { defaultPlaylistLoaded = true; } GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage); GUIWindowManager.OnNewAction += new OnActionHandler(this.OnNewAction); playlistPlayer.PlaylistChanged += playlistPlayer_Changed; return(Load(GUIGraphicsContext.GetThemedSkinFile(@"\myMusicplaylist.xml"))); }
static UNCTools() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { HostDetectMethod = xmlreader.GetValueAsString("general", "HostDetectMethod", "Ping"); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { chkboxFixScrollbar.Checked = xmlreader.GetValueAsBool("home", "scrollfixed", false); chkBoxUseMyPlugins.Checked = xmlreader.GetValueAsBool("home", "usemyplugins", true); chkBoxAnimation.Checked = xmlreader.GetValueAsBool("home", "enableanimation", true); checkBoxShowSeconds.Checked = xmlreader.GetValueAsBool("home", "LongTimeFormat", false); string text = xmlreader.GetValueAsString("home", "dateformat", "<Day> <DD>.<Month>"); cboxFormat.Items.Add(text); if (!text.Equals("<Day> <DD>.<Month>")) { cboxFormat.Items.Add("<Day> <DD>.<Month>"); } if (!text.Equals("<Day> <DD> <Month>")) { cboxFormat.Items.Add("<Day> <DD> <Month>"); } if (!text.Equals("<Day> <Month> <DD>")) { cboxFormat.Items.Add("<Day> <Month> <DD>"); } cboxFormat.Text = text; } }
protected override void LoadSettings() { base.LoadSettings(); using (Profile.Settings xmlreader = new Profile.MPSettings()) { int defaultSort = (int)VideoSort.SortMethod.Name; if ((handler != null) && (handler.View != null) && (handler.View.Filters != null) && (handler.View.Filters.Count > 0)) { FilterDefinition def = (FilterDefinition)handler.View.Filters[0]; defaultSort = (int)GetSortMethod(def.DefaultSort); } currentSortMethod = (VideoSort.SortMethod)xmlreader.GetValueAsInt(SerializeName, "sortmethod", defaultSort); currentSortMethodRoot = (VideoSort.SortMethod)xmlreader.GetValueAsInt(SerializeName, "sortmethodroot", defaultSort); string playListFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); playListFolder += @"\My Playlists"; m_strPlayListPath = xmlreader.GetValueAsString("movies", "playlists", playListFolder); m_strPlayListPath = Util.Utils.RemoveTrailingSlash(m_strPlayListPath); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { // Resume settings _cmTurnoffmonitor.Selected = xmlreader.GetValueAsBool("general", "turnoffmonitor", false); _cmShowlastactivemodule.Selected = xmlreader.GetValueAsBool("general", "showlastactivemodule", false); _cmStopOnAudioRemoval.Selected = xmlreader.GetValueAsBool("general", "stoponaudioremoval", false); _screennumber = xmlreader.GetValueAsInt("screenselector", "screennumber", 0); // Delay startup _iStartUpDelay = xmlreader.GetValueAsInt("general", "delay", 0); string property = _iStartUpDelay + " sec"; GUIPropertyManager.SetProperty("#delayStartup", property); if (_iStartUpDelay == 0) { _cmDelayStartup.IsEnabled = false; _cmDelayResume.IsEnabled = false; } else { _cmDelayStartup.IsEnabled = true; _cmDelayResume.IsEnabled = true; } _cmDelayStartup.Selected = xmlreader.GetValueAsBool("general", "delay startup", false); _cmDelayResume.Selected = xmlreader.GetValueAsBool("general", "delay resume", false); GetScreens(); GUIPropertyManager.SetProperty("#defScreen", _screenCollection[_screennumber].ToString()); } }
public override bool Init() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _playlistFolder = xmlreader.GetValueAsString("music", "playlists", string.Empty); _savePlaylistOnExit = xmlreader.GetValueAsBool("musicfiles", "savePlaylistOnExit", false); _resumePlaylistOnEnter = xmlreader.GetValueAsBool("musicfiles", "resumePlaylistOnMusicEnter", false); playlistPlayer.RepeatPlaylist = xmlreader.GetValueAsBool("musicfiles", "repeat", true); } if (_resumePlaylistOnEnter) { Log.Info("GUIMusicPlaylist: Loading default playlist {0}", _defaultPlaylist); bw = new BackgroundWorker(); bw.WorkerSupportsCancellation = true; bw.WorkerReportsProgress = false; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); bw.RunWorkerAsync(); } else { defaultPlaylistLoaded = true; } GUIWindowManager.Receivers += new SendMessageHandler(this.OnThreadMessage); GUIWindowManager.OnNewAction += new OnActionHandler(this.OnNewAction); playlistPlayer.PlaylistChanged += playlistPlayer_Changed; return Load(GUIGraphicsContext.GetThemedSkinFile(@"\myMusicplaylist.xml")); }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("musicfiles", "extractthumbs", btnExtractthumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "createartistthumbs", btnCreateartistthumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "creategenrethumbs", btnCreategenrethumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "useFolderThumbs", btnUseFolderThumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "useAllImages", btnUseAllImages.Selected); xmlwriter.SetValueAsBool("musicfiles", "createMissingFolderThumbs", btnCreateMissingFolderThumbs.Selected); xmlwriter.SetValueAsBool("musicfiles", "treatFolderAsAlbum", btnTreatFolderAsAlbum.Selected); xmlwriter.SetValueAsBool("musicfiles", "monitorShares", btnMonitorShares.Selected); xmlwriter.SetValueAsBool("musicfiles", "updateSinceLastImport", btnUpdateSinceLastImport.Selected); xmlwriter.SetValueAsBool("musicfiles", "stripartistprefixes", btnStripartistprefixes.Selected); xmlwriter.SetValue("musicfiles", "artistprefixes", _prefixes); xmlwriter.SetValue("musicfiles", "dateadded", _dateAddedSelectedIndex); SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); settingsSharesHelper.ShareListControl = lcFolders.ListItems; settingsSharesHelper.RememberLastFolder = _rememberLastFolder; settingsSharesHelper.AddOpticalDiskDrives = _addOpticalDiskDrives; settingsSharesHelper.SwitchRemovableDrives = _autoSwitchRemovableDrives; settingsSharesHelper.DefaultShare = _defaultShare; settingsSharesHelper.SaveSettings("music"); } }
public static void InitSystemStatus(ref SystemStatus CurrentStatus) { lock (StatusMutex) { using (Profile.Settings settings = new Profile.MPSettings()) { CurrentStatus._AudioIsMixing = settings.GetValueAsBool("audioplayer", "mixing", false); CurrentStatus._AudioUseASIO = settings.GetValueAsBool("audioplayer", "asio", false); bool flag = settings.GetValueAsBool("volume", "digital", true); CurrentStatus._AudioUseMasterVolume = !flag; CurrentStatus._AudioUseWaveVolume = flag; } CurrentStatus.CurrentIconMask = 0L; CurrentStatus.MP_Is_Idle = false; CurrentStatus.SystemVolumeLevel = 0; CurrentStatus.IsMuted = false; CurrentStatus.MediaPlayer_Active = false; CurrentStatus.MediaPlayer_Playing = false; CurrentStatus.MediaPlayer_Paused = false; CurrentStatus.Media_IsRecording = false; CurrentStatus.Media_IsTV = false; CurrentStatus.Media_IsTVRecording = false; CurrentStatus.Media_IsDVD = false; CurrentStatus.Media_IsCD = false; CurrentStatus.Media_IsRadio = false; CurrentStatus.Media_IsVideo = false; CurrentStatus.Media_IsMusic = false; CurrentStatus.Media_IsTimeshifting = false; CurrentStatus.Media_CurrentPosition = 0.0; CurrentStatus.Media_Duration = 0.0; CurrentStatus.Media_Speed = 0; } }
private void OnStartUpDelay() { string seconds = _iStartUpDelay.ToString(CultureInfo.InvariantCulture); GetNumberFromKeyboard(ref seconds); _iStartUpDelay = Convert.ToInt32(seconds); string property = _iStartUpDelay + " " + GUILocalizeStrings.Get(2999); // sec GUIPropertyManager.SetProperty("#delayStartup", property); if (_iStartUpDelay == 0) { _cmDelayStartup.IsEnabled = false; _cmDelayResume.IsEnabled = false; } else { _cmDelayStartup.IsEnabled = true; _cmDelayResume.IsEnabled = true; } using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("general", "delay", _iStartUpDelay); SettingsChanged(true); } }
public static void InitEQ(ref EQControl EQSettings) { EQSettings.UseEqDisplay = false; EQSettings.UseNormalEq = true; EQSettings.UseStereoEq = false; EQSettings.UseVUmeter = false; EQSettings.UseVUmeter2 = false; EQSettings._useVUindicators = false; EQSettings._useEqMode = 0; EQSettings.RestrictEQ = false; EQSettings.SmoothEQ = false; EQSettings.DelayEQ = true; EQSettings.EQTitleDisplay = false; EQSettings._EqDataAvailable = false; EQSettings.EqFftData = new float[0x800]; EQSettings.EqArray = new byte[0x11]; EQSettings.LastEQ = new int[0x11]; EQSettings._EQTitleDisplayTime = 10; EQSettings._EQTitleShowTime = 2; EQSettings._LastEQTitle = 0.0; EQSettings._EQDisplayTitle = false; EQSettings._Max_EQ_FPS = 0; EQSettings._EQ_Framecount = 0; EQSettings._EQ_Restrict_FPS = 10; EQSettings._EqUpdateDelay = 0; EQSettings._DelayEQTime = 0; using (Profile.Settings settings = new Profile.MPSettings()) { EQSettings._AudioIsMixing = settings.GetValueAsBool("audioplayer", "mixing", false); EQSettings._AudioUseASIO = settings.GetValueAsBool("audioplayer", "asio", false); } }
public static bool IsSetupAvailable() { string str = Settings.Instance.Type; if (!File.Exists(Config.GetFile(Config.Dir.Config, "MiniDisplay.xml"))) { return(false); } if (str == null || (str != "DebugForm" && str != "iMONLCDg" && str != "MatrixMX" && str != "MatrixGX" && str != "VLSYS_Mplay")) { return(false); } if (Settings.Instance.DisableGUISetup) { return(false); } bool enabled = false; using (Profile.Settings xmlreader = new Profile.MPSettings()) { enabled = MediaPortal.GUI.Library.PluginManager.IsPluginNameEnabled2("MiniDisplay"); } return(enabled); }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("general", "startfullscreen", _cmStartfullscreen.Selected); xmlwriter.SetValueAsBool("general", "usefullscreensplash", _cmUsefullscreensplash.Selected); xmlwriter.SetValueAsBool("general", "alwaysontop", _cmAlwaysontop.Selected); try { if (_cmAlwaysontop.Selected) // always on top { using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true)) { if (subkey != null) { subkey.SetValue("ForegroundLockTimeout", 0); } } } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) { } // ReSharper restore EmptyGeneralCatchClause xmlwriter.SetValueAsBool("general", "hidetaskbar", _cmHidetaskbar.Selected); xmlwriter.SetValueAsBool("general", "autostart", _cmAutostart.Selected); try { if (_cmAutostart.Selected) // autostart on boot { Log.Debug("AUTOSTART"); string fileName = Config.GetFile(Config.Dir.Base, "MediaPortal.exe"); using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true)) { if (subkey != null) { subkey.SetValue("MediaPortal", fileName); } } } else { using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true)) { if (subkey != null) { subkey.DeleteValue("MediaPortal", false); } } } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) { } // ReSharper restore EmptyGeneralCatchClause xmlwriter.SetValueAsBool("general", "minimizeonstartup", _cmMinimizeonstartup.Selected); xmlwriter.SetValueAsBool("general", "minimizeonexit", _cmMinimizeonexit.Selected); xmlwriter.SetValueAsBool("general", "minimizeonfocusloss", _cmMinimizeonfocusloss.Selected); } }
protected override void OnPageLoad() { base.OnPageLoad(); currentLayout = Layout.Playlist; facadeLayout.CurrentLayout = currentLayout; LoadDirectory(string.Empty); if (g_Player.Playing && playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_VIDEO) { int iSong = playlistPlayer.CurrentSong; if (iSong >= 0 && iSong <= facadeLayout.Count) { GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iSong); } } if (facadeLayout.Count <= 0) { GUIControl.FocusControl(GetID, btnLayouts.GetID); IMDBMovie movie = new IMDBMovie(); movie.SetProperties(false, string.Empty); } using (Profile.Settings settings = new Profile.MPSettings()) { playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("movies", "repeat", true); } if (btnRepeatPlaylist != null) { btnRepeatPlaylist.Selected = playlistPlayer.RepeatPlaylist; } }
private void OnShowScreens() { var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(496); // Options foreach (string screen in _screenCollection) { dlg.Add(screen); } if (_screennumber < _screenCollection.Count) { dlg.SelectedLabel = _screennumber; } // Show dialog menu dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("screenselector", "screennumber", dlg.SelectedLabel); SettingsChanged(true); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("musicmisc", "lookupSimilarTracks", !btnDisableSimilarTrackLookup.Selected); xmlwriter.SetValue("musicmisc", "vumeter", _vuMeter.ToLowerInvariant()); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { m_iSpeedHorizontal = xmlreader.GetValueAsInt("gui", "ScrollSpeedRight", 1); m_iSpeedVertical = xmlreader.GetValueAsInt("gui", "ScrollSpeedDown", 4); } }
private void InitSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _useExif = xmlreader.GetValueAsBool("pictures", "useExif", true); _usePicasa = xmlreader.GetValueAsBool("pictures", "usePicasa", false); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("general", "startfullscreen", _cmStartfullscreen.Selected); xmlwriter.SetValueAsBool("general", "usefullscreensplash", _cmUsefullscreensplash.Selected); xmlwriter.SetValueAsBool("general", "keepstartfullscreen", _cmkeepstartfullscreen.Selected); xmlwriter.SetValueAsBool("general", "alwaysontop", _cmAlwaysontop.Selected); try { if (_cmAlwaysontop.Selected) // always on top { using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true)) { if (subkey != null) subkey.SetValue("ForegroundLockTimeout", 0); } } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) { } // ReSharper restore EmptyGeneralCatchClause xmlwriter.SetValueAsBool("general", "hidetaskbar", _cmHidetaskbar.Selected); xmlwriter.SetValueAsBool("general", "autostart", _cmAutostart.Selected); try { if (_cmAutostart.Selected) // autostart on boot { Log.Debug("AUTOSTART"); string fileName = Config.GetFile(Config.Dir.Base, "MediaPortal.exe"); using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true)) { if (subkey != null) { subkey.SetValue("MediaPortal", fileName); } } } else { using (RegistryKey subkey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true)) { if (subkey != null) { subkey.DeleteValue("MediaPortal", false); } } } } // ReSharper disable EmptyGeneralCatchClause catch (Exception) { } // ReSharper restore EmptyGeneralCatchClause xmlwriter.SetValueAsBool("general", "minimizeonstartup", _cmMinimizeonstartup.Selected); xmlwriter.SetValueAsBool("general", "minimizeonexit", _cmMinimizeonexit.Selected); xmlwriter.SetValueAsBool("general", "minimizeonfocusloss", _cmMinimizeonfocusloss.Selected); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("gui", "ScrollSpeedRight", m_iSpeedHorizontal.ToString()); xmlwriter.SetValue("gui", "ScrollSpeedDown", m_iSpeedVertical.ToString()); xmlwriter.SetValue("screen", "GuiRenderFps", GUIGraphicsContext.MaxFPS); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { btnDisableSimilarTrackLookup.Selected = !xmlreader.GetValueAsBool("musicmisc", "lookupSimilarTracks", true); _vuMeter = xmlreader.GetValueAsString("musicmisc", "vumeter", "none"); _vuMeter = UppercaseFirst(_vuMeter); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { m_iSpeedHorizontal = xmlreader.GetValueAsInt("gui", "ScrollSpeedRight", 1); m_iSpeedVertical = xmlreader.GetValueAsInt("gui", "ScrollSpeedDown", 4); m_iListLoopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 100); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { btnDisableSimilarTrackLookup.Selected = !xmlreader.GetValueAsBool("musicmisc", "lookupSimilarTracks", true); _vuMeter= xmlreader.GetValueAsString("musicmisc", "vumeter", "none"); _vuMeter = UppercaseFirst(_vuMeter); } }
private void LoadSettings() { String firstSite = ""; m_sites.Clear(); using (Profile.Settings xmlreader = new Profile.MPSettings()) { for (int i = 0; i < NUM_STORIES; i++) { string strNameTag = String.Format("siteName{0}", i); string strURLTag = String.Format("siteURL{0}", i); string strEncodingTag = String.Format("siteEncoding{0}", i); string strImageTag = String.Format("siteImage{0}", i); string strDescriptionTag = String.Format("siteDescription{0}", i); string strName = xmlreader.GetValueAsString("rss", strNameTag, ""); string strURL = xmlreader.GetValueAsString("rss", strURLTag, ""); string strEncoding = xmlreader.GetValueAsString("rss", strEncodingTag, "windows-1252"); string strImage = xmlreader.GetValueAsString("rss", strImageTag, ""); string strDescription = xmlreader.GetValueAsString("rss", strDescriptionTag, ""); if (strName.Length > 0 && strURL.Length > 0) { if (strImage.Length == 0) { strImage = DEFAULT_NEWS_ICON; } if (firstSite == "") { m_strSiteName = strName; m_strSiteURL = strURL; m_strSiteIcon = strImage; m_strDescription = String.IsNullOrEmpty(m_strDescription) ? strName : strDescription; m_strSiteEncoding = strEncoding; firstSite = strURL; } Site loc = new Site(); loc.m_Name = strName; loc.m_URL = strURL; loc.m_Image = strImage; loc.m_Description = strDescription; loc.m_Encoding = strEncoding; m_sites.Add(loc); } } // General settings m_iRSSRefresh = xmlreader.GetValueAsInt("rss", "iRefreshTime", 15); m_bRSSAutoRefresh = false; if (xmlreader.GetValueAsInt("rss", "bAutoRefresh", 0) != 0) { m_bRSSAutoRefresh = true; } } }
protected override void SaveSettings() { base.SaveSettings(); using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue(SerializeName, "sortmethod", (int)CurrentSortMethod); xmlwriter.SetValue(SerializeName, "sortmethodroot", (int)currentSortMethodRoot); } }
protected override void OnPageDestroy(int newWindowId) { currentSelectedItem = facadeLayout.SelectedListItemIndex; using (Profile.Settings settings = new Profile.MPSettings()) { settings.SetValueAsBool("movies", "repeat", playlistPlayer.RepeatPlaylist); } base.OnPageDestroy(newWindowId); }
protected virtual void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _fixedScroll = xmlreader.GetValueAsBool("home", "scrollfixed", true); // fix scrollbar in the middle of menu _useMyPlugins = xmlreader.GetValueAsBool("home", "usemyplugins", true); // use previous menu handling _enableAnimation = xmlreader.GetValueAsBool("home", "enableanimation", true); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValue("gui", "ScrollSpeedRight", m_iSpeedHorizontal.ToString()); xmlwriter.SetValue("gui", "ScrollSpeedDown", m_iSpeedVertical.ToString()); xmlwriter.SetValue("screen", "GuiRenderFps", GUIGraphicsContext.MaxFPS); xmlwriter.SetValue("gui", "listLoopDelay", m_iListLoopDelay.ToString()); } }
private void SaveSettings() { using (Profile.Settings xmlWriter = new Profile.MPSettings()) { xmlWriter.SetValueAsBool("home", "scrollfixed", chkboxFixScrollbar.Checked); xmlWriter.SetValueAsBool("home", "usemyplugins", chkBoxUseMyPlugins.Checked); xmlWriter.SetValueAsBool("home", "enableanimation", chkBoxAnimation.Checked); xmlWriter.SetValueAsBool("home", "LongTimeFormat", checkBoxShowSeconds.Checked); xmlWriter.SetValue("home", "dateformat", cboxFormat.Text); } SaveMenuSorting(); }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("musicmisc", "fetchlastfmcovers", !btnFetchlastfmcovers.Selected); xmlwriter.SetValueAsBool("musicmisc", "fetchlastfmtopalbums", !btnFetchlastfmtopalbums.Selected); xmlwriter.SetValueAsBool("musicmisc", "fetchlastfmtracktags", !btnFetchlastfmtracktags.Selected); xmlwriter.SetValueAsBool("musicmisc", "switchArtistOnLastFMSubmit", btnSwitchArtistOnLastFMSubmit.Selected); xmlwriter.SetValue("musicmisc", "vumeter", _vuMeter.ToLowerInvariant()); } }
// Need change for 1.3.0 #region Serialization private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { // Mark Watched btnMarkWatched.Selected = xmlreader.GetValueAsBool("movies", "markwatched", true); btnKeepFoldersTogether.Selected = xmlreader.GetValueAsBool("movies", "keepfolderstogether", false); btnCommercialSkip.Selected = xmlreader.GetValueAsBool("comskip", "automaticskip", false); _watchedPercentage = xmlreader.GetValueAsInt("movies", "playedpercentagewatched", 95); _videoAudioDelay = xmlreader.GetValueAsInt("FFDShow", "audiodelayInterval", 50); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("movies", "markwatched", btnMarkWatched.Selected); xmlwriter.SetValueAsBool("movies", "keepfolderstogether", btnKeepFoldersTogether.Selected); xmlwriter.SetValueAsBool("comskip", "automaticskip", btnCommercialSkip.Selected); xmlwriter.SetValue("movies", "playedpercentagewatched", _watchedPercentage); xmlwriter.SetValue("FFDShow", "audiodelayInterval", _videoAudioDelay); } }
public void LoadSettings(string section) { Clear(); using (Profile.Settings xmlreader = new Profile.MPSettings()) { string strDefault = xmlreader.GetValueAsString(section, "default", string.Empty); for (int i = 0; i < MaximumShares; i++) { string strShareName = String.Format("sharename{0}", i); string strSharePath = String.Format("sharepath{0}", i); string strPincode = String.Format("pincode{0}", i); string shareType = String.Format("sharetype{0}", i); string shareServer = String.Format("shareserver{0}", i); string shareLogin = String.Format("sharelogin{0}", i); string sharePwd = String.Format("sharepassword{0}", i); string sharePort = String.Format("shareport{0}", i); string remoteFolder = String.Format("shareremotepath{0}", i); string shareViewPath = String.Format("shareview{0}", i); Share share = new Share(); share.Name = xmlreader.GetValueAsString(section, strShareName, string.Empty); share.Path = xmlreader.GetValueAsString(section, strSharePath, string.Empty); string pinCode = Utils.DecryptPin(xmlreader.GetValueAsString(section, strPincode, string.Empty)); if (pinCode != string.Empty) share.Pincode = Convert.ToInt32(pinCode); else share.Pincode = -1; share.IsFtpShare = xmlreader.GetValueAsBool(section, shareType, false); share.FtpServer = xmlreader.GetValueAsString(section, shareServer, string.Empty); share.FtpLoginName = xmlreader.GetValueAsString(section, shareLogin, string.Empty); share.FtpPassword = xmlreader.GetValueAsString(section, sharePwd, string.Empty); share.FtpPort = xmlreader.GetValueAsInt(section, sharePort, 21); share.FtpFolder = xmlreader.GetValueAsString(section, remoteFolder, "/"); share.DefaultLayout = (Layout)xmlreader.GetValueAsInt(section, shareViewPath, (int)Layout.List); if (share.Name.Length > 0) { if (strDefault == share.Name) { share.Default = true; if (defaultshare == null) { defaultshare = share; } } Add(share); } else break; } } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _pin = Util.Utils.DecryptPin(xmlreader.GetValueAsString("mpsettings", "pin", string.Empty)); if (_pin != string.Empty) { btnLocked.Selected = true; } } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { checkBoxUseTrayIcon.Checked = xmlreader.GetValueAsBool("audioscrobbler", "showtrayicon", true); checkBoxShowBallonTips.Checked = xmlreader.GetValueAsBool("audioscrobbler", "showballontips", true); checkBoxSubmitToProfile.Checked = xmlreader.GetValueAsBool("audioscrobbler", "submitradiotracks", true); checkBoxDirectSkip.Checked = xmlreader.GetValueAsBool("audioscrobbler", "directskip", false); numericUpDownListEntries.Value = xmlreader.GetValueAsInt("audioscrobbler", "listentrycount", 24); comboBoxStreamPlayerType.SelectedIndex = xmlreader.GetValueAsInt("audioscrobbler", "streamplayertype", 0); checkBoxOneClickMode.Checked = xmlreader.GetValueAsBool("audioscrobbler", "oneclickstart", false); } }
private void SaveSettings() { using (Profile.Settings xmlwriter = new Profile.MPSettings()) { xmlwriter.SetValueAsBool("audioscrobbler", "showtrayicon", checkBoxUseTrayIcon.Checked); xmlwriter.SetValueAsBool("audioscrobbler", "showballontips", checkBoxShowBallonTips.Checked); xmlwriter.SetValueAsBool("audioscrobbler", "submitradiotracks", checkBoxSubmitToProfile.Checked); xmlwriter.SetValueAsBool("audioscrobbler", "directskip", checkBoxDirectSkip.Checked); xmlwriter.SetValue("audioscrobbler", "listentrycount", numericUpDownListEntries.Value); xmlwriter.SetValue("audioscrobbler", "streamplayertype", 0); // comboBoxStreamPlayerType.SelectedIndex); xmlwriter.SetValueAsBool("audioscrobbler", "oneclickstart", checkBoxOneClickMode.Checked); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { // startup settings cmStartfullscreen.Selected = xmlreader.GetValueAsBool("general", "startfullscreen", true); cmUsefullscreensplash.Selected = xmlreader.GetValueAsBool("general", "usefullscreensplash", true); cmAlwaysontop.Selected = xmlreader.GetValueAsBool("general", "alwaysontop", false); cmHidetaskbar.Selected = xmlreader.GetValueAsBool("general", "hidetaskbar", false); cmAutostart.Selected = xmlreader.GetValueAsBool("general", "autostart", false); cmMinimizeonstartup.Selected = xmlreader.GetValueAsBool("general", "minimizeonstartup", false); cmMinimizeonexit.Selected = xmlreader.GetValueAsBool("general", "minimizeonexit", false); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { btnFetchlastfmcovers.Selected = !xmlreader.GetValueAsBool("musicmisc", "fetchlastfmcovers", true); btnFetchlastfmtopalbums.Selected = !xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtopalbums", true); btnFetchlastfmtracktags.Selected = !xmlreader.GetValueAsBool("musicmisc", "fetchlastfmtracktags", true); btnSwitchArtistOnLastFMSubmit.Selected= xmlreader.GetValueAsBool("musicmisc", "switchArtistOnLastFMSubmit", false); _vuMeter= xmlreader.GetValueAsString("musicmisc", "vumeter", "none"); _vuMeter = UppercaseFirst(_vuMeter); } }
public void Load() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { m_bMusic = xmlreader.GetValueAsBool("tetris", "music", true); m_bSound = xmlreader.GetValueAsBool("tetris", "sound", true); m_nHighscore = xmlreader.GetValueAsInt("tetris", "highscore", -1); if (m_nHighscore == -1) { m_nHighscore = xmlreader.GetValueAsInt("tetris", "hiscore", 0); } } }
private void SaveMenuSorting() { using (Profile.Settings xmlWriter = new Profile.MPSettings()) { foreach (TreeNode node in tvMenu.Nodes) { xmlWriter.SetValue("pluginSorting", node.Text, node.Index); if (node.Nodes != null) { foreach (TreeNode subNode in node.Nodes) { xmlWriter.SetValue("pluginSorting", subNode.Text, subNode.Index); } } } } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { m_iSpeed = xmlreader.GetValueAsInt("pictures", "speed", 3); m_iTransistion = xmlreader.GetValueAsInt("pictures", "transition", 20); m_iKenBurnsSpeed = xmlreader.GetValueAsInt("pictures", "kenburnsspeed", 20); m_bKenBurns = xmlreader.GetValueAsBool("pictures", "kenburns", false); m_bRandom = xmlreader.GetValueAsBool("pictures", "random", false); m_bXFade = (!m_bRandom & !m_bKenBurns); cmShuffleSlideShows.Selected = xmlreader.GetValueAsBool("pictures", "autoShuffle", false); cmLoopSlideShows.Selected = xmlreader.GetValueAsBool("pictures", "autoRepeat", false); cmExifSlideShows.Selected = xmlreader.GetValueAsBool("pictures", "useExif", true); cmPicasaSlideShows.Selected = xmlreader.GetValueAsBool("pictures", "usePicasa", false); cmGroupByDaySlideShows.Selected = xmlreader.GetValueAsBool("pictures", "useDayGrouping", false); cmEnablePlaySlideShows.Selected = xmlreader.GetValueAsBool("pictures", "enableVideoPlayback", false); cmPlayInSlideShows.Selected = xmlreader.GetValueAsBool("pictures", "playVideosInSlideshows", false); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { _noLargeThumbnails = xmlreader.GetValueAsBool("thumbnails", "picturenolargethumbondemand", true); lcFolders.Clear(); _scanShare = 0; SettingsSharesHelper settingsSharesHelper = new SettingsSharesHelper(); // Load share settings settingsSharesHelper.LoadSettings("pictures"); foreach (GUIListItem item in settingsSharesHelper.ShareListControl) { string driveLetter = FolderInfo(item).Folder.Substring(0, 3).ToUpperInvariant(); if (driveLetter.StartsWith("\\\\") || Util.Utils.getDriveType(driveLetter) == 3 || Util.Utils.getDriveType(driveLetter) == 4) { item.IsPlayed = false; if (FolderInfo(item).ScanShare) { item.IsPlayed = true; item.Label2 = GUILocalizeStrings.Get(193); // Scan _scanShare++; } item.OnItemSelected += OnItemSelected; item.Label = FolderInfo(item).Folder; item.Path = FolderInfo(item).Folder; lcFolders.Add(item); } } _defaultShare = xmlreader.GetValueAsString("pictures", "default", ""); _rememberLastFolder = xmlreader.GetValueAsBool("pictures", "rememberlastfolder", false); _addOpticalDiskDrives = xmlreader.GetValueAsBool("pictures", "AddOpticalDiskDrives", true); _autoSwitchRemovableDrives = xmlreader.GetValueAsBool("pictures", "SwitchRemovableDrives", true); } }
/// <summary> /// /// </summary> private void Initialize() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { ReceiveEnabled = xmlreader.GetValueAsBool("USBUIRT", "internal", false); TransmitEnabled = xmlreader.GetValueAsBool("USBUIRT", "external", false); Is3Digit = xmlreader.GetValueAsBool("USBUIRT", "is3digit", false); NeedsEnter = xmlreader.GetValueAsBool("USBUIRT", "needsenter", false); RepeatWait = xmlreader.GetValueAsInt("USBUIRT", "repeatwait", 300); RepeatDelay = xmlreader.GetValueAsInt("USBUIRT", "repeatdelay", 30); CommandRepeatCount = xmlreader.GetValueAsInt("USBUIRT", "repeatcount", 2); InterCommandDelay = xmlreader.GetValueAsInt("USBUIRT", "commanddelay", 100); } if (!LoadValues()) { Log.Info("USBUIRT:unable to load values from:{0}", Remotefile); } if (!LoadTunerValues()) { Log.Info("USBUIRT:unable to load tunervalues from:{0}", Tunerfile); } }
private void LoadSettings() { using (Profile.Settings xmlreader = new Profile.MPSettings()) { string VizName = "None"; bool ShowViz = false; VizName = xmlreader.GetValueAsString("musicvisualization", "name", "None"); ShowViz = xmlreader.GetValueAsBool("musicmisc", "showVisInNowPlaying", false); _vuMeter = xmlreader.GetValueAsString("musicmisc", "vumeter", "none"); _lookupSimilarTracks = xmlreader.GetValueAsBool("musicmisc", "lookupSimilarTracks", true); if (ShowViz && VizName != "None") { _showVisualization = true; } else { _showVisualization = false; Log.Debug("GUIMusicPlayingNow: Viz disabled - ShowViz {0}, VizName {1}", Convert.ToString(ShowViz), VizName); } } _usingBassEngine = BassMusicPlayer.IsDefaultMusicPlayer; }
public void ImportNfo(string nfoFile, bool skipExisting, bool refreshdbOnly) { IMDBMovie movie = new IMDBMovie(); bool isMovieFolder = Util.Utils.IsFolderDedicatedMovieFolder(Path.GetFullPath(nfoFile)); bool useInternalNfoScraper = false; using (Profile.Settings xmlreader = new Profile.MPSettings()) { // Use only nfo scrapper useInternalNfoScraper = xmlreader.GetValueAsBool("moviedatabase", "useonlynfoscraper", false); } try { XmlDocument doc = new XmlDocument(); doc.Load(nfoFile); Log.Debug("Importing nfo file:{0}", nfoFile); if (doc.DocumentElement != null) { int id = -1; XmlNodeList movieList = doc.DocumentElement.SelectNodes("/movie"); if (movieList == null) { Log.Debug("Movie tag for nfo file:{0} not exist. Nfo skipped.", nfoFile); return; } foreach (XmlNode nodeMovie in movieList) { string genre = string.Empty; string cast = string.Empty; string path = string.Empty; string nfofileName = string.Empty; #region nodes XmlNode nodeTitle = nodeMovie.SelectSingleNode("title"); XmlNode nodeSortTitle = nodeMovie.SelectSingleNode("sorttitle"); XmlNode nodeRating = nodeMovie.SelectSingleNode("rating"); XmlNode nodeYear = nodeMovie.SelectSingleNode("year"); XmlNode nodeDuration = nodeMovie.SelectSingleNode("runtime"); XmlNode nodePlotShort = nodeMovie.SelectSingleNode("outline"); XmlNode nodePlot = nodeMovie.SelectSingleNode("plot"); XmlNode nodeTagline = nodeMovie.SelectSingleNode("tagline"); XmlNode nodeDirector = nodeMovie.SelectSingleNode("director"); XmlNode nodeDirectorImdb = nodeMovie.SelectSingleNode("directorimdb"); XmlNode nodeImdbNumber = nodeMovie.SelectSingleNode("imdb"); XmlNode nodeIdImdbNumber = nodeMovie.SelectSingleNode("id"); XmlNode nodeMpaa = nodeMovie.SelectSingleNode("mpaa"); XmlNode nodeTop250 = nodeMovie.SelectSingleNode("top250"); XmlNode nodeVotes = nodeMovie.SelectSingleNode("votes"); XmlNode nodeStudio = nodeMovie.SelectSingleNode("studio"); XmlNode nodePlayCount = nodeMovie.SelectSingleNode("playcount"); XmlNode nodeWatched = nodeMovie.SelectSingleNode("watched"); XmlNode nodeFanart = nodeMovie.SelectSingleNode("fanart"); XmlNode nodePoster = nodeMovie.SelectSingleNode("thumb"); XmlNode nodeLanguage = nodeMovie.SelectSingleNode("language"); XmlNode nodeCountry = nodeMovie.SelectSingleNode("country"); XmlNode nodeReview = nodeMovie.SelectSingleNode("review"); XmlNode nodeCredits = nodeMovie.SelectSingleNode("credits"); #endregion #region Moviefiles // Get path from *.nfo file) Util.Utils.Split(nfoFile, out path, out nfofileName); // Movie filename to search from gathered files from nfo path nfofileName = Util.Utils.GetFilename(nfofileName, true); // Get all video files from nfo path ArrayList files = new ArrayList(); GetVideoFiles(path, ref files); bool isDvdBdFolder = false; foreach (String file in files) { //Log.Debug("Import nfo-processing video file:{0} (Total files: {1})", file, files.Count); string logFilename = Path.GetFileName(file); if ((file.ToUpperInvariant().Contains("VIDEO_TS.IFO") || file.ToUpperInvariant().Contains("INDEX.BDMV")) && files.Count == 1) { var pattern = Util.Utils.StackExpression(); int stackSequence = -1; // seq 0 = [x-y], seq 1 = CD1, Part1.... int digit = 0; for (int i = 0; i < pattern.Length; i++) { if (pattern[i].IsMatch(file)) { digit = Convert.ToInt16(pattern[i].Match(file).Groups["digit"].Value); stackSequence = i; break; } } if (digit > 1) { Log.Debug("Import nfo-file: {0} is stack part.", file); string filename; string tmpPath = string.Empty; DatabaseUtility.Split(file, out path, out filename); try { if (stackSequence == 0) { string strReplace = "[" + digit; int stackIndex = path.LastIndexOf(strReplace); tmpPath = path.Remove(stackIndex, 2); tmpPath = tmpPath.Insert(stackIndex, "[1"); } else { int stackIndex = path.LastIndexOf(digit.ToString()); tmpPath = path.Remove(stackIndex, 1); tmpPath = tmpPath.Insert(stackIndex, "1"); } int movieId = VideoDatabase.GetMovieId(tmpPath + filename); int pathId = VideoDatabase.AddPath(path); Log.Debug("Import nfo-Adding file: {0}", logFilename); VideoDatabase.AddFile(movieId, pathId, filename); return; } catch(Exception ex) { Log.Error("Import nfo error-stack check for path {0} Error: {1}", path, ex.Message); return; } } id = VideoDatabase.AddMovie(file, true); movie.ID = id; isDvdBdFolder = true; } else { string tmpFile = string.Empty; string tmpPath = string.Empty; // Read filename Util.Utils.Split(file, out tmpPath, out tmpFile); // Remove extension tmpFile = Util.Utils.GetFilename(tmpFile, true); // Remove stack endings (CD1...) Util.Utils.RemoveStackEndings(ref tmpFile); Util.Utils.RemoveStackEndings(ref nfofileName); // Check and add to vdb and get movieId if (tmpFile.Equals(nfofileName, StringComparison.InvariantCultureIgnoreCase)) { Log.Debug("Import nfo-Adding file: {0}", logFilename); id = VideoDatabase.AddMovie(file, true); movie.ID = id; } else if (isMovieFolder && tmpPath.Length > 0) // Every movie in it's own folder, compare by folder name { try { tmpPath = tmpPath.Substring(tmpPath.LastIndexOf(@"\") + 1).Trim(); if (tmpPath.Equals(nfofileName, StringComparison.InvariantCultureIgnoreCase) || nfofileName.ToLowerInvariant() == "movie") { Log.Debug("Import nfo-Adding file: {0}", logFilename); id = VideoDatabase.AddMovie(file, true); movie.ID = id; } else { Log.Debug("Import nfo-Skipping file:{0}", logFilename); } } catch (Exception ex) { Log.Error("Import nfo-Error comparing path name. File:{0} Err.:{1}", file, ex.Message); } } else { Log.Debug("Import nfo-Skipping file: {0}", logFilename); } } } #endregion #region Check for existing movie or refresh database only GetMovieInfoById(id, ref movie); if (skipExisting && !movie.IsEmpty || refreshdbOnly && movie.IsEmpty || id < 1) { Log.Debug("Import nfo-Skipping import for movieId = {0}).", id); return; } movie = new IMDBMovie(); movie.ID = id; #endregion #region Genre XmlNodeList genres = nodeMovie.SelectNodes("genre"); foreach (XmlNode nodeGenre in genres) { if (nodeGenre.InnerText != null) { if (genre.Length > 0) { genre += " / "; } genre += nodeGenre.InnerText; } } if (string.IsNullOrEmpty(genre)) { genres = nodeMovie.SelectNodes("genres/genre"); foreach (XmlNode nodeGenre in genres) { if (nodeGenre.InnerText != null) { if (genre.Length > 0) { genre += " / "; } genre += nodeGenre.InnerText; } } } movie.Genre = genre; #endregion #region Credits (Writers) // Writers if (nodeCredits != null) { movie.WritingCredits = nodeCredits.InnerText; } #endregion #region DateAdded movie.DateAdded = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); #endregion #region Title // Title if (nodeTitle != null) { movie.Title = nodeTitle.InnerText; } #endregion #region Sort Title // SortTitle if (nodeSortTitle != null) { if (!string.IsNullOrEmpty(nodeTitle.InnerText)) { movie.SortTitle = nodeSortTitle.InnerText; } else { movie.SortTitle = movie.Title; } } #endregion #region Language // Title if (nodeLanguage != null) { movie.Language = nodeLanguage.InnerText; } #endregion #region Country // Title if (nodeCountry != null) { movie.Country = nodeCountry.InnerText; } #endregion #region IMDB number // IMDB number if (nodeImdbNumber != null) { if (CheckMovieImdbId(nodeImdbNumber.InnerText)) { movie.IMDBNumber = nodeImdbNumber.InnerText; } } if (string.IsNullOrEmpty(movie.IMDBNumber) && nodeIdImdbNumber != null) { if (CheckMovieImdbId(nodeIdImdbNumber.InnerText)) { movie.IMDBNumber = nodeIdImdbNumber.InnerText; } } #endregion #region CD/DVD labels // CD label movie.CDLabel = string.Empty; // DVD label movie.DVDLabel = string.Empty; #endregion #region Director // Director string dirImdb = string.Empty; if (nodeDirectorImdb != null) { dirImdb = nodeDirectorImdb.InnerText; if (!CheckActorImdbId(dirImdb)) { dirImdb = string.Empty; } } if (nodeDirector != null) { movie.Director = nodeDirector.InnerText; movie.DirectorID = VideoDatabase.AddActor(dirImdb, movie.Director); } #endregion #region Studio // Studio if (nodeStudio != null) { movie.Studios = nodeStudio.InnerText; } #endregion #region MPAA // MPAA if (nodeMpaa != null) { movie.MPARating = nodeMpaa.InnerText; } else { movie.MPARating = "NR"; } #endregion #region Plot/Short plot // Plot if (nodePlot != null) { movie.Plot = nodePlot.InnerText; } else { movie.Plot = string.Empty; } // Short plot if (nodePlotShort != null) { movie.PlotOutline = nodePlotShort.InnerText; } else { movie.PlotOutline = string.Empty; } #endregion #region Review // Title if (nodeReview != null) { movie.UserReview = nodeReview.InnerText; } #endregion #region Rating (n.n/10) // Rating if (nodeRating != null) { double rating = 0; if (Double.TryParse(nodeRating.InnerText.Replace(".", ","), out rating)) { movie.Rating = (float) rating; if (movie.Rating > 10.0f) { movie.Rating /= 10.0f; } } } #endregion #region Duration // Duration if (nodeDuration != null) { int runtime = 0; if (Int32.TryParse(nodeDuration.InnerText, out runtime)) { movie.RunTime = runtime; } else { string regex = "(?<h>[0-9]*)h.(?<m>[0-9]*)"; MatchCollection mc = Regex.Matches(nodeDuration.InnerText, regex, RegexOptions.Singleline | RegexOptions.IgnoreCase); if (mc.Count > 0) { foreach (Match m in mc) { int hours = 0; Int32.TryParse(m.Groups["h"].Value, out hours); int minutes = 0; Int32.TryParse(m.Groups["m"].Value, out minutes); hours = hours*60; minutes = hours + minutes; movie.RunTime = minutes; } } else { regex = @"\d*\s*min."; if (Regex.Match(nodeDuration.InnerText, regex, RegexOptions.IgnoreCase).Success) { regex = @"\d*"; int minutes = 0; Int32.TryParse(Regex.Match(nodeDuration.InnerText, regex).Value, out minutes); movie.RunTime = minutes; } } } } else { movie.RunTime = 0; } #endregion #region Tagline // Tagline if (nodeTagline != null) { movie.TagLine = nodeTagline.InnerText; } #endregion #region TOP250 // Top250 if (nodeTop250 != null) { int top250 = 0; Int32.TryParse(nodeTop250.InnerText, out top250); movie.Top250 = top250; } else { movie.Top250 = 0; } #endregion #region votes // Votes if (nodeVotes != null) { movie.Votes = nodeVotes.InnerText; } #endregion #region Watched/watched count // Watched int percent = 0; int watchedCount = 0; GetMovieWatchedStatus(movie.ID, out percent, out watchedCount); if (watchedCount < 1) { if (nodeWatched != null) { if (nodeWatched.InnerText.ToLowerInvariant() == "true" || nodeWatched.InnerText == "1") { movie.Watched = 1; VideoDatabase.SetMovieWatchedStatus(movie.ID, true, 100); } else { movie.Watched = 0; VideoDatabase.SetMovieWatchedStatus(movie.ID, false, 0); } } // Watched count if (nodePlayCount != null) { watchedCount = 0; Int32.TryParse(nodePlayCount.InnerText, out watchedCount); SetMovieWatchedCount(movie.ID, watchedCount); if (watchedCount > 0 && movie.Watched == 0) { movie.Watched = 1; VideoDatabase.SetMovieWatchedStatus(movie.ID, true, 100); } else if (watchedCount == 0 && movie.Watched > 0) { SetMovieWatchedCount(movie.ID, 1); } } } else { movie.Watched = 1; } #endregion #region Year // Year if (nodeYear != null) { int year = 0; Int32.TryParse(nodeYear.InnerText, out year); movie.Year = year; } #endregion #region poster // Poster string thumbJpgFile = string.Empty; string thumbTbnFile = string.Empty; string thumbFolderJpgFile = string.Empty; string thumbFolderTbnFile = string.Empty; string titleExt = movie.Title + "{" + id + "}"; string jpgExt = @".jpg"; string tbnExt = @".tbn"; string folderJpg = @"\folder.jpg"; string folderTbn = @"\folder.tbn"; if (isDvdBdFolder) { thumbJpgFile = path + @"\" + Path.GetFileNameWithoutExtension(path) + jpgExt; thumbTbnFile = path + @"\" + Path.GetFileNameWithoutExtension(path) + tbnExt; thumbFolderJpgFile = path + @"\" + folderJpg; thumbFolderTbnFile = path + @"\" + folderTbn; } else { thumbJpgFile = path + @"\" + nfofileName + jpgExt; thumbTbnFile = path + @"\" + nfofileName + tbnExt; if (isMovieFolder) { thumbFolderJpgFile = path + @"\" + folderJpg; thumbFolderTbnFile = path + @"\" + folderTbn; } } if (nodePoster != null) { // Local source cover if (File.Exists(thumbJpgFile)) { CreateCovers(titleExt, thumbJpgFile, movie); } else if (File.Exists(thumbTbnFile)) { CreateCovers(titleExt, thumbTbnFile, movie); } else if (!string.IsNullOrEmpty(thumbFolderJpgFile) && File.Exists(thumbFolderJpgFile)) { CreateCovers(titleExt, thumbFolderJpgFile, movie); } else if (!string.IsNullOrEmpty(thumbFolderTbnFile) && File.Exists(thumbFolderTbnFile)) { CreateCovers(titleExt, thumbFolderTbnFile, movie); } else if (!nodePoster.InnerText.StartsWith("http:") && File.Exists(nodePoster.InnerText)) { CreateCovers(titleExt, nodePoster.InnerText, movie); } else if (!nodePoster.InnerText.StartsWith("http:") && File.Exists(path + @"\" + nodePoster.InnerText)) { CreateCovers(titleExt, path + @"\" + nodePoster.InnerText, movie); } // web source cover else if (nodePoster.InnerText.StartsWith("http:")) { try { string imageUrl = nodePoster.InnerText; if (imageUrl.Length > 0) { string largeCoverArtImage = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt); string coverArtImage = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, titleExt); if (!File.Exists(coverArtImage)) { string imageExtension = Path.GetExtension(imageUrl); if (imageExtension == string.Empty) { imageExtension = jpgExt; } string temporaryFilename = "MPTempImage"; temporaryFilename += imageExtension; temporaryFilename = Path.Combine(Path.GetTempPath(), temporaryFilename); Util.Utils.FileDelete(temporaryFilename); Util.Utils.DownLoadAndOverwriteCachedImage(imageUrl, temporaryFilename); if (File.Exists(temporaryFilename)) { if (Util.Picture.CreateThumbnail(temporaryFilename, largeCoverArtImage, (int)Thumbs.ThumbLargeResolution, (int)Thumbs.ThumbLargeResolution, 0, Thumbs.SpeedThumbsSmall)) { Util.Picture.CreateThumbnail(temporaryFilename, coverArtImage, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0, Thumbs.SpeedThumbsLarge); } } Util.Utils.FileDelete(temporaryFilename); } } } catch (Exception ex) { Log.Error("Import nfo - Poster node: {0}", ex.Message); } movie.ThumbURL = nodePoster.InnerText; } // MP scrapers cover else { if (movie.ThumbURL == string.Empty && !useInternalNfoScraper) { // IMPAwards IMPAwardsSearch impSearch = new IMPAwardsSearch(); impSearch.SearchCovers(movie.Title, movie.IMDBNumber); if ((impSearch.Count > 0) && (impSearch[0] != string.Empty)) { movie.ThumbURL = impSearch[0]; } // If no IMPAwards lets try TMDB TMDBCoverSearch tmdbSearch = new TMDBCoverSearch(); if (impSearch.Count == 0) { tmdbSearch.SearchCovers(movie.Title, movie.IMDBNumber); if ((tmdbSearch.Count > 0) && (tmdbSearch[0] != string.Empty)) { movie.ThumbURL = tmdbSearch[0]; } } // All fail, last try IMDB if (impSearch.Count == 0 && tmdbSearch.Count == 0) { IMDBSearch imdbSearch = new IMDBSearch(); imdbSearch.SearchCovers(movie.IMDBNumber, true); if ((imdbSearch.Count > 0) && (imdbSearch[0] != string.Empty)) { movie.ThumbURL = imdbSearch[0]; } } } string largeCoverArt = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt); string coverArt = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, titleExt); if (movie.ID >= 0) { if (!string.IsNullOrEmpty(movie.ThumbURL)) { Util.Utils.FileDelete(largeCoverArt); Util.Utils.FileDelete(coverArt); } // Save cover thumbs if (!string.IsNullOrEmpty(movie.ThumbURL)) { IMDBFetcher.DownloadCoverArt(Thumbs.MovieTitle, movie.ThumbURL, titleExt); } } } } else // Node thumb not exist { if (File.Exists(thumbJpgFile)) { CreateCovers(titleExt, thumbJpgFile, movie); } else if (File.Exists(thumbTbnFile)) { CreateCovers(titleExt, thumbTbnFile, movie); } else if (!string.IsNullOrEmpty(thumbFolderJpgFile) && File.Exists(thumbFolderJpgFile)) { CreateCovers(titleExt, thumbFolderJpgFile, movie); } else if (!string.IsNullOrEmpty(thumbFolderTbnFile) && File.Exists(thumbFolderTbnFile)) { CreateCovers(titleExt, thumbFolderTbnFile, movie); } else if (movie.ThumbURL == string.Empty && !useInternalNfoScraper) { // IMPAwards IMPAwardsSearch impSearch = new IMPAwardsSearch(); impSearch.SearchCovers(movie.Title, movie.IMDBNumber); if ((impSearch.Count > 0) && (impSearch[0] != string.Empty)) { movie.ThumbURL = impSearch[0]; } // If no IMPAwards lets try TMDB TMDBCoverSearch tmdbSearch = new TMDBCoverSearch(); if (impSearch.Count == 0) { tmdbSearch.SearchCovers(movie.Title, movie.IMDBNumber); if ((tmdbSearch.Count > 0) && (tmdbSearch[0] != string.Empty)) { movie.ThumbURL = tmdbSearch[0]; } } // All fail, last try IMDB if (impSearch.Count == 0 && tmdbSearch.Count == 0) { IMDBSearch imdbSearch = new IMDBSearch(); imdbSearch.SearchCovers(movie.IMDBNumber, true); if ((imdbSearch.Count > 0) && (imdbSearch[0] != string.Empty)) { movie.ThumbURL = imdbSearch[0]; } } string largeCoverArt = Util.Utils.GetLargeCoverArtName(Thumbs.MovieTitle, titleExt); string coverArt = Util.Utils.GetCoverArtName(Thumbs.MovieTitle, titleExt); if (movie.ID >= 0) { if (!string.IsNullOrEmpty(movie.ThumbURL)) { Util.Utils.FileDelete(largeCoverArt); Util.Utils.FileDelete(coverArt); } // Save cover thumbs if (!string.IsNullOrEmpty(movie.ThumbURL)) { IMDBFetcher.DownloadCoverArt(Thumbs.MovieTitle, movie.ThumbURL, titleExt); } } } } #endregion #region Fanart // Fanart XmlNodeList fanartNodeList = nodeMovie.SelectNodes("fanart/thumb"); int faIndex = 0; bool faFound = false; string faFile = string.Empty; FanArt fa = new FanArt(); foreach (XmlNode fanartNode in fanartNodeList) { if (fanartNode != null) { faFile = path + @"\" + fanartNode.InnerText; if (File.Exists(faFile)) { fa.GetLocalFanart(id, "file://" + faFile, faIndex); movie.FanartURL = faFile; faFound = true; } } faIndex ++; if (faIndex == 5) { break; } } if (!faFound) { List<string> localFanart = new List<string>(); faIndex = 0; faFile = path + @"\" + nfofileName + "-fanart.jpg"; localFanart.Add(faFile); faFile = path + @"\" + nfofileName + "-backdrop.jpg"; localFanart.Add(faFile); faFile= path + @"\" + "backdrop.jpg"; localFanart.Add(faFile); faFile = path + @"\" + "fanart.jpg"; localFanart.Add(faFile); foreach (string fanart in localFanart) { if (File.Exists(fanart)) { fa.GetLocalFanart(id, "file://" + fanart, faIndex); movie.FanartURL = fanart; faFound = true; break; } } if (!faFound && !useInternalNfoScraper) { fa.GetTmdbFanartByApi(movie.ID, movie.IMDBNumber, string.Empty, false, 1, string.Empty); } } #endregion #region Cast // Cast parse XmlNodeList actorsList = nodeMovie.SelectNodes("actor"); foreach (XmlNode nodeActor in actorsList) { string name = string.Empty; string role = string.Empty; string actorImdbId = string.Empty; string line = string.Empty; XmlNode nodeActorName = nodeActor.SelectSingleNode("name"); XmlNode nodeActorRole = nodeActor.SelectSingleNode("role"); XmlNode nodeActorImdbId = nodeActor.SelectSingleNode("imdb"); XmlNode nodeActorBirthDate = nodeActor.SelectSingleNode("birthdate"); XmlNode nodeActorBirthPlace = nodeActor.SelectSingleNode("birthplace"); XmlNode nodeActorDeathDate = nodeActor.SelectSingleNode("deathdate"); XmlNode nodeActorDeathPlace = nodeActor.SelectSingleNode("deathplace"); XmlNode nodeActorMiniBio = nodeActor.SelectSingleNode("minibiography"); XmlNode nodeActorBiography= nodeActor.SelectSingleNode("biography"); XmlNode nodeActorThumbnail = nodeActor.SelectSingleNode("thumb"); if (nodeActorName != null && nodeActorName.InnerText != null) { name = nodeActorName.InnerText; } if (nodeActorRole != null && nodeActorRole.InnerText != null) { role = nodeActorRole.InnerText; } if (nodeActorImdbId != null) { if (CheckActorImdbId(nodeActorImdbId.InnerText)) { actorImdbId = nodeActorImdbId.InnerText; } } if (!string.IsNullOrEmpty(name)) { if (!string.IsNullOrEmpty(role)) { line = String.Format("{0} as {1}\n", name, role); } else { line = String.Format("{0}\n", name); } cast += line; int actId = VideoDatabase.AddActor(actorImdbId, name); VideoDatabase.AddActorToMovie(id, actId, role); if (CheckActorImdbId(actorImdbId)) { IMDBActor info = new IMDBActor(); info.IMDBActorID = actorImdbId; if (nodeActorBirthDate != null) { info.DateOfBirth = nodeActorBirthDate.InnerText; } if (nodeActorBirthPlace != null) { info.PlaceOfBirth = nodeActorBirthPlace.InnerText; } if (nodeActorDeathDate != null) { info.DateOfDeath = nodeActorDeathDate.InnerText; } if (nodeActorDeathPlace != null) { info.PlaceOfDeath = nodeActorDeathPlace.InnerText; } if (nodeActorMiniBio != null) { info.MiniBiography = nodeActorMiniBio.InnerText; } if (nodeActorBiography != null) { info.Biography = nodeActorBiography.InnerText; } if (info.DateOfBirth != string.Empty || info.PlaceOfBirth != string.Empty|| info.DateOfDeath != string.Empty || info.PlaceOfBirth != string.Empty || info.MiniBiography != string.Empty || info.Biography != string.Empty) { SetActorInfo(actId, info); } } } } // Cast movie.Cast = cast; #endregion #region UserGroups XmlNodeList userGroups = nodeMovie.SelectNodes("set"); foreach (XmlNode nodeUserGroup in userGroups) { string strUserGroup = string.Empty; if (nodeUserGroup != null && nodeUserGroup.InnerText != null) { strUserGroup = nodeUserGroup.InnerText; if (!string.IsNullOrEmpty(strUserGroup)) { int iUserGroup = AddUserGroup(strUserGroup); AddUserGroupToMovie(movie.ID, iUserGroup); } } } #endregion VideoDatabase.SetMovieInfoById(id, ref movie, true); } } } catch (Exception ex) { Log.Error("videodatabase exception error importing nfo file {0}:{1} ", nfoFile, ex.Message); } }