public override bool UpdateDynamicNode(DBNode <DBMovieInfo> node) { if (node.BasicFilteringField == DBField.GetFieldByDBName(typeof(DBMovieInfo), "year")) { UpdateYear(node); TranslateName(node); return(true); } if (node.BasicFilteringField == DBField.GetFieldByDBName(typeof(DBMovieInfo), "date_added")) { UpdateDateAdded(node); TranslateName(node); return(true); } if (node.BasicFilteringField == DBField.GetFieldByDBName(typeof(DBMovieInfo), "actors")) { UpdateActors(node); TranslateName(node); return(true); } // for all other dynamic nodes, use generic processing but use a translated name node.UpdateDynamicNodeGeneric(); TranslateName(node); return(true); }
private string dbNameParser(Match match) { // try to grab the field object string fieldName = match.Value.Substring(1, match.Length - 2); DBField field = DBField.GetFieldByDBName(typeof(DBMovieInfo), fieldName); // if no dice, the user probably entered an invalid string. if (field == null && match.Value != "%filename") { logger.Error("Error parsing \"" + match.Value + "\" from local_backdrop_pattern advanced setting. Not a database field name."); return(match.Value); } return((field.GetValue(movie) ?? string.Empty).ToString()); }
public static void VerifyFilterMenu() { DBMenu <DBTrackInfo> menu = mvCentralCore.Settings.FilterMenu; if (menu.RootNodes.Count == 0) { int position = 1; DBNode <DBTrackInfo> unwatchedNode = new DBNode <DBTrackInfo>(); unwatchedNode.Name = "${UnwatchedmvCentral}"; unwatchedNode.DynamicNode = false; unwatchedNode.Filter = new DBFilter <DBTrackInfo>(); DBCriteria <DBTrackInfo> criteria = new DBCriteria <DBTrackInfo>(); criteria.Field = DBField.GetFieldByDBName(typeof(DBUserMusicVideoSettings), "watched"); criteria.Relation = DBRelation.GetRelation(typeof(DBTrackInfo), typeof(DBUserMusicVideoSettings), ""); criteria.Operator = DBCriteria <DBTrackInfo> .OperatorEnum.EQUAL; criteria.Value = "0"; unwatchedNode.Filter.Criteria.Add(criteria); unwatchedNode.SortPosition = position++; unwatchedNode.DBManager = mvCentralCore.DatabaseManager; menu.RootNodes.Add(unwatchedNode); DBNode <DBTrackInfo> genreNode = new DBNode <DBTrackInfo>(); genreNode.DynamicNode = true; genreNode.BasicFilteringField = DBField.GetFieldByDBName(typeof(DBTrackInfo), "genres"); genreNode.Name = "${Genre}"; genreNode.DBManager = mvCentralCore.DatabaseManager; genreNode.SortPosition = position++; menu.RootNodes.Add(genreNode); DBNode <DBTrackInfo> dateNode = new DBNode <DBTrackInfo>(); dateNode.DynamicNode = true; dateNode.BasicFilteringField = DBField.GetFieldByDBName(typeof(DBTrackInfo), "date_added"); dateNode.Name = "${DateAdded}"; dateNode.DBManager = mvCentralCore.DatabaseManager; dateNode.SortPosition = position++; menu.RootNodes.Add(dateNode); menu.Commit(); } foreach (DBNode <DBTrackInfo> currNode in menu.RootNodes) { currNode.UpdateDynamicNode(); currNode.Commit(); } }
/// <summary> /// Initialized the searcher with database information and the field names to search. /// </summary> public AbstractSearcher(DatabaseManager db, string[] fieldNames) { List <DBField> fields = new List <DBField>(); foreach (string currName in fieldNames) { DBField currField = DBField.GetFieldByDBName(typeof(T), currName); if (currField == null) { throw new SearchException(SearchException.ErrorTypeEnum.INVALID_FIELDS); } fields.Add(currField); } init(db, fields); }
protected void FieldChanged(string fieldName) { if (RetrievalInProcess) { return; } DBField field = DBField.GetField(GetType(), fieldName); if (field == null) { field = DBField.GetFieldByDBName(GetType(), fieldName); } if (field != null) { changedFields.Add(field); } }
/// <summary> /// Get Track field /// </summary> /// <param name="match"></param> /// <returns></returns> private string dbTrackNameParser(Match match) { // try to grab the field object string fieldName = match.Value.Substring(1, match.Length - 2); //Bit of a bodge here to support %title%,really need to handle this differnetly if (fieldName.ToLower() == "title") { return(Path.GetFileNameWithoutExtension(mvTrackObject.LocalMedia[0].TrimmedFullPath)); } // match the DB Field DBField field = DBField.GetFieldByDBName(typeof(DBTrackInfo), fieldName); // if no dice, the user probably entered an invalid string. if (field == null && match.Value != "%filename") { logger.Error("Error parsing \"" + match.Value + "\" from local_art_pattern advanced setting. Not a database field name."); return(match.Value); } return(field.GetValue(mvTrackObject).ToString()); }
public static void VerifyCategoryMenu() { DBMenu <DBTrackInfo> menu = mvCentralCore.Settings.CategoriesMenu; if (menu.RootNodes.Count == 0) { int position = 1; DBNode <DBTrackInfo> allNode = new DBNode <DBTrackInfo>(); allNode.Name = "${AllmvCentral}"; allNode.DynamicNode = false; allNode.Filter = new DBFilter <DBTrackInfo>(); allNode.SortPosition = position++; allNode.DBManager = mvCentralCore.DatabaseManager; menu.RootNodes.Add(allNode); DBNode <DBTrackInfo> unwatchedNode = new DBNode <DBTrackInfo>(); unwatchedNode.Name = "${UnwatchedMusicVideo}"; unwatchedNode.DynamicNode = false; unwatchedNode.Filter = new DBFilter <DBTrackInfo>(); DBCriteria <DBTrackInfo> criteria = new DBCriteria <DBTrackInfo>(); criteria.Field = DBField.GetFieldByDBName(typeof(DBUserMusicVideoSettings), "watched"); criteria.Relation = DBRelation.GetRelation(typeof(DBTrackInfo), typeof(DBUserMusicVideoSettings), ""); criteria.Operator = DBCriteria <DBTrackInfo> .OperatorEnum.EQUAL; criteria.Value = "0"; unwatchedNode.Filter.Criteria.Add(criteria); unwatchedNode.SortPosition = position++; unwatchedNode.DBManager = mvCentralCore.DatabaseManager; menu.RootNodes.Add(unwatchedNode); DBNode <DBTrackInfo> recentNode = new DBNode <DBTrackInfo>(); recentNode.Name = "${RecentlyAddedmvCentral}"; recentNode.DynamicNode = false; recentNode.Filter = new DBFilter <DBTrackInfo>(); recentNode.SortPosition = position++; recentNode.DBManager = mvCentralCore.DatabaseManager; DBCriteria <DBTrackInfo> recentCriteria = new DBCriteria <DBTrackInfo>(); recentCriteria.Field = DBField.GetFieldByDBName(typeof(DBTrackInfo), "date_added"); recentCriteria.Operator = DBCriteria <DBTrackInfo> .OperatorEnum.GREATER_THAN; recentCriteria.Value = "-30d"; recentNode.Filter.Criteria.Add(recentCriteria); DBMusicVideoNodeSettings additionalSettings = new DBMusicVideoNodeSettings(); additionalSettings.UseDefaultSorting = false; // additionalSettings.SortField = SortingFields.DateAdded; // additionalSettings.SortDirection = SortingDirections.Descending; recentNode.AdditionalSettings = additionalSettings; menu.RootNodes.Add(recentNode); DBNode <DBTrackInfo> genreNode = new DBNode <DBTrackInfo>(); genreNode.DynamicNode = true; genreNode.BasicFilteringField = DBField.GetFieldByDBName(typeof(DBTrackInfo), "genres"); genreNode.Name = "${Genres}"; genreNode.SortPosition = position++; genreNode.DBManager = mvCentralCore.DatabaseManager; menu.RootNodes.Add(genreNode); menu.Commit(); } foreach (DBNode <DBTrackInfo> currNode in menu.RootNodes) { currNode.UpdateDynamicNode(); currNode.Commit(); } }