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()); }
/// <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()); }