Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

FIX: Allow both prepend and append in advancedsettings "tvshowmatching" #1673

Merged
merged 1 commit into from

2 participants

@koying
Collaborator

Not sure whether this actually is a fix, change or feature.

It always seemed logical to me to be able to do both appends and prepends in lists of regexps in advancedsettings, and the wiki is not clear regarding this.

Nowadays, the additional lists are silently dropped.

[EDIT] Definitely a fix, as only "tvshowmatching" has this issue.

@jmarshallnz jmarshallnz merged commit bc32001 into xbmc:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 45 additions and 39 deletions.
  1. +45 −39 xbmc/settings/AdvancedSettings.cpp
View
84 xbmc/settings/AdvancedSettings.cpp
@@ -1066,52 +1066,58 @@ void CAdvancedSettings::Clear()
void CAdvancedSettings::GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings)
{
- int iAction = 0; // overwrite
- // for backward compatibility
- const char* szAppend = pRootElement->Attribute("append");
- if ((szAppend && stricmp(szAppend, "yes") == 0))
- iAction = 1;
- // action takes precedence if both attributes exist
- const char* szAction = pRootElement->Attribute("action");
- if (szAction)
- {
- iAction = 0; // overwrite
- if (stricmp(szAction, "append") == 0)
- iAction = 1; // append
- else if (stricmp(szAction, "prepend") == 0)
- iAction = 2; // prepend
- }
- if (iAction == 0)
- settings.clear();
- TiXmlNode* pRegExp = pRootElement->FirstChild("regexp");
- int i = 0;
- while (pRegExp)
+ TiXmlElement *pElement = pRootElement;
+ while (pElement)
{
- if (pRegExp->FirstChild())
+ int iAction = 0; // overwrite
+ // for backward compatibility
+ const char* szAppend = pElement->Attribute("append");
+ if ((szAppend && stricmp(szAppend, "yes") == 0))
+ iAction = 1;
+ // action takes precedence if both attributes exist
+ const char* szAction = pElement->Attribute("action");
+ if (szAction)
+ {
+ iAction = 0; // overwrite
+ if (stricmp(szAction, "append") == 0)
+ iAction = 1; // append
+ else if (stricmp(szAction, "prepend") == 0)
+ iAction = 2; // prepend
+ }
+ if (iAction == 0)
+ settings.clear();
+ TiXmlNode* pRegExp = pElement->FirstChild("regexp");
+ int i = 0;
+ while (pRegExp)
{
- bool bByDate = false;
- int iDefaultSeason = 1;
- if (pRegExp->ToElement())
+ if (pRegExp->FirstChild())
{
- CStdString byDate = pRegExp->ToElement()->Attribute("bydate");
- if(byDate && stricmp(byDate, "true") == 0)
+ bool bByDate = false;
+ int iDefaultSeason = 1;
+ if (pRegExp->ToElement())
{
- bByDate = true;
- }
- CStdString defaultSeason = pRegExp->ToElement()->Attribute("defaultseason");
- if(!defaultSeason.empty())
- {
- iDefaultSeason = atoi(defaultSeason.c_str());
+ CStdString byDate = pRegExp->ToElement()->Attribute("bydate");
+ if(byDate && stricmp(byDate, "true") == 0)
+ {
+ bByDate = true;
+ }
+ CStdString defaultSeason = pRegExp->ToElement()->Attribute("defaultseason");
+ if(!defaultSeason.empty())
+ {
+ iDefaultSeason = atoi(defaultSeason.c_str());
+ }
}
+ CStdString regExp = pRegExp->FirstChild()->Value();
+ regExp.MakeLower();
+ if (iAction == 2)
+ settings.insert(settings.begin() + i++, 1, TVShowRegexp(bByDate,regExp,iDefaultSeason));
+ else
+ settings.push_back(TVShowRegexp(bByDate,regExp,iDefaultSeason));
}
- CStdString regExp = pRegExp->FirstChild()->Value();
- regExp.MakeLower();
- if (iAction == 2)
- settings.insert(settings.begin() + i++, 1, TVShowRegexp(bByDate,regExp,iDefaultSeason));
- else
- settings.push_back(TVShowRegexp(bByDate,regExp,iDefaultSeason));
+ pRegExp = pRegExp->NextSibling("regexp");
}
- pRegExp = pRegExp->NextSibling("regexp");
+
+ pElement = pElement->NextSiblingElement(pRootElement->Value());
}
}
Something went wrong with that request. Please try again.