public override DBValue this[String fieldName] { get { switch (fieldName) { // if the user choose a different language for the import, we don't have this as the prettyname case DBOnlineSeries.cOriginalName: string origLanguage = "en"; // English (original) DBValue currentTitle = base[DBOnlineSeries.cPrettyName]; if (DBOption.GetOptions(DBOption.cOnlineLanguage) == origLanguage) return base[DBOnlineSeries.cPrettyName]; else { if (base[DBOnlineSeries.cOriginalName].ToString().Length > 0) return base[DBOnlineSeries.cOriginalName]; else { // we need to get it MPTVSeriesLog.Write("Retrieving Original Series Name for '{0}'", currentTitle); UpdateSeries origParser = new UpdateSeries(base[DBOnlineSeries.cID], origLanguage); if (origParser != null && origParser.Results.Count == 1) { DBValue origTitle = origParser.Results[0][DBOnlineSeries.cPrettyName]; // there may not be an english title, so localized title is the original name origTitle = string.IsNullOrEmpty(origTitle) ? base[DBOnlineSeries.cPrettyName] : origTitle; // save for next time base[DBOnlineSeries.cOriginalName] = origTitle; Commit(); MPTVSeriesLog.Write("Original Series Name retrieved: '{0}'", origTitle); return origTitle; } else { // something wrong MPTVSeriesLog.Write("Original Series Name could not be retrieved"); return base[DBOnlineSeries.cPrettyName]; } } } case cSummary: DBValue summary = base[cSummary]; if (string.IsNullOrEmpty(summary)) summary = Translation.SummaryNotAvailable; return summary; default: return base[fieldName]; } } set { base[fieldName] = value; } }
public override DBValue this[String fieldName] { get { switch (fieldName) { // if the user chooses a different language for the import, we don't have this as the prettyname case DBOnlineSeries.cOriginalName: string origLanguage = "en"; // English (original) DBValue currentTitle = base[DBOnlineSeries.cPrettyName]; if (DBOption.GetOptions(DBOption.cOnlineLanguage) == "en" && !DBOption.GetOptions(DBOption.cOverrideLanguage)) { return(base[DBOnlineSeries.cPrettyName]); } else { if (base[DBOnlineSeries.cOriginalName].ToString().Length > 0) { return(base[DBOnlineSeries.cOriginalName]); } else { // we need to get it MPTVSeriesLog.Write("Retrieving Original Series Name for '{0}'", currentTitle); UpdateSeries origParser = new UpdateSeries(base[DBOnlineSeries.cID], origLanguage, true); if (origParser != null && origParser.Results.Count == 1) { DBValue origTitle = origParser.Results[0][DBOnlineSeries.cPrettyName]; // there may not be an english title, so localized title is the original name origTitle = string.IsNullOrEmpty(origTitle) ? base[DBOnlineSeries.cPrettyName] : origTitle; // save for next time base[DBOnlineSeries.cOriginalName] = origTitle; Commit(); MPTVSeriesLog.Write("Original Series Name retrieved: '{0}'", origTitle); return(origTitle); } else { // something wrong MPTVSeriesLog.Write("Original Series Name could not be retrieved"); return(base[DBOnlineSeries.cPrettyName]); } } } case cSummary: DBValue summary = base[cSummary]; if (string.IsNullOrEmpty(summary)) { summary = Translation.SummaryNotAvailable; } return(summary); default: return(base[fieldName]); } } set { base[fieldName] = value; } }