// Loops through all mvCentral in the system to verify them public static void VerifyMusicVideoInformation() { logger.Info("Updating MusicVideo Information..."); float count = 0; List<DBTrackInfo> mvs = DBTrackInfo.GetAll(); List<DBUser> users = DBUser.GetAll(); float total = mvs.Count; int removed = 0; int settings = 0; foreach (DBTrackInfo mv in mvs) { if (MaintenanceProgress != null) MaintenanceProgress("", (int)(count * 100 / total)); count++; // Skip uncommited files if (mv.ID == null) continue; #region Remove MusicVideo without attached local media // Remove mvCentral with no files if (mv.LocalMedia.Count == 0) { logger.Info("'{0}' was removed from the system because it had no local media.", mv.Track); mv.Delete(); removed++; continue; } #endregion #region Add missing user settings if (mv.UserSettings.Count == 0) { logger.Info("'{0}' was missing UserMovingSettings, adding now.", mv.Track); foreach (DBUser currUser in users) { DBUserMusicVideoSettings userSettings = new DBUserMusicVideoSettings(); userSettings.User = currUser; userSettings.Commit(); mv.UserSettings.Add(userSettings); userSettings.CommitNeeded = false; } // lock (mv) { mv.Commit(); } settings++; } #endregion } logger.Info("Removed {0} MusicVideo entries.", removed.ToString()); logger.Info("Updated {0} MusicVideo entries with default user setting.", settings.ToString()); if (MaintenanceProgress != null) MaintenanceProgress("", 100); }
// Loops through all mvCentral in the system to verify them public static void VerifyMusicVideoInformation() { logger.Info("Updating MusicVideo Information..."); float count = 0; List <DBTrackInfo> mvs = DBTrackInfo.GetAll(); List <DBUser> users = DBUser.GetAll(); float total = mvs.Count; int removed = 0; int settings = 0; foreach (DBTrackInfo mv in mvs) { if (MaintenanceProgress != null) { MaintenanceProgress("", (int)(count * 100 / total)); } count++; // Skip uncommited files if (mv.ID == null) { continue; } #region Remove MusicVideo without attached local media // Remove mvCentral with no files if (mv.LocalMedia.Count == 0) { logger.Info("'{0}' was removed from the system because it had no local media.", mv.Track); mv.Delete(); removed++; continue; } #endregion #region Add missing user settings if (mv.UserSettings.Count == 0) { logger.Info("'{0}' was missing UserMovingSettings, adding now.", mv.Track); foreach (DBUser currUser in users) { DBUserMusicVideoSettings userSettings = new DBUserMusicVideoSettings(); userSettings.User = currUser; userSettings.Commit(); mv.UserSettings.Add(userSettings); userSettings.CommitNeeded = false; } // lock (mv) { mv.Commit(); } settings++; } #endregion } logger.Info("Removed {0} MusicVideo entries.", removed.ToString()); logger.Info("Updated {0} MusicVideo entries with default user setting.", settings.ToString()); if (MaintenanceProgress != null) { MaintenanceProgress("", 100); } }