Use the Translit field from Group.ini, Migrate Banner code to Group class
This commit is contained in:
+100
-24
@@ -33,47 +33,123 @@ Group::~Group() {
|
||||
SONGMAN->GetGroupGroupMap().clear();
|
||||
m_sCredits.clear();
|
||||
}
|
||||
Group::Group(const RString &sPath) {
|
||||
RString sGroupIniPath = sPath + "/Group.ini";
|
||||
|
||||
Group::Group(const RString sDir, const RString &sGroupDirName) {
|
||||
RString sGroupIniPath = sDir + sGroupDirName + "/Group.ini";
|
||||
RString credits = "";
|
||||
RString sDisplayTitle = sGroupDirName;
|
||||
RString SortTitle = sGroupDirName;
|
||||
RString TranslitTitle = "";
|
||||
RString Series = "";
|
||||
RString bannerPath = "";
|
||||
RString authorsNotes = "";
|
||||
float fOffset = 0;
|
||||
|
||||
if (FILEMAN->DoesFileExist(sGroupIniPath)) {
|
||||
IniFile ini;
|
||||
ini.ReadFile(sGroupIniPath);
|
||||
ini.GetValue("Group", "DisplayTitle", m_sDisplayTitle);
|
||||
if (m_sDisplayTitle.empty()) {
|
||||
m_sDisplayTitle = m_sGroupName;
|
||||
ini.ReadFile( sGroupIniPath );
|
||||
ini.GetValue( "Group", "DisplayTitle", sDisplayTitle );
|
||||
if (sDisplayTitle.empty()) {
|
||||
sDisplayTitle = Basename(sGroupDirName);
|
||||
}
|
||||
ini.GetValue("Group", "Banner", m_sBannerPath);
|
||||
ini.GetValue("Group", "SortTitle", m_sSortTitle);
|
||||
if (m_sSortTitle.empty()) {
|
||||
m_sSortTitle = m_sDisplayTitle;
|
||||
ini.GetValue( "Group", "Banner", bannerPath );
|
||||
ini.GetValue( "Group", "SortTitle", SortTitle );
|
||||
if (SortTitle.empty()) {
|
||||
SortTitle = sDisplayTitle;
|
||||
}
|
||||
ini.GetValue("Group", "TranslitTitle", m_sTranslitTitle);
|
||||
if (m_sTranslitTitle.empty()) {
|
||||
m_sTranslitTitle = m_sDisplayTitle;
|
||||
ini.GetValue( "Group", "TranslitTitle", TranslitTitle );
|
||||
if (TranslitTitle.empty()) {
|
||||
TranslitTitle = sDisplayTitle;
|
||||
}
|
||||
ini.GetValue("Group", "Series", m_sSeries);
|
||||
ini.GetValue( "Group", "Series", Series );
|
||||
RString sValue = "";
|
||||
|
||||
ini.GetValue("Group", "SyncOffset", sValue);
|
||||
if (sValue.CompareNoCase("null") == 0) {
|
||||
m_iSyncOffset = 0;
|
||||
fOffset = 0;
|
||||
} else if (sValue.CompareNoCase("itg") == 0) {
|
||||
m_iSyncOffset = 0.009f;
|
||||
fOffset = 0.009f;
|
||||
} else {
|
||||
m_iSyncOffset = StringToFloat(sValue);
|
||||
fOffset = StringToFloat(sValue);
|
||||
}
|
||||
ini.GetValue("Group", "Year", m_iYearReleased);
|
||||
ini.GetValue("Group", "AuthorsNotes", m_sAuthorsNotes);
|
||||
|
||||
std::vector<RString> credits_vector;
|
||||
ini.GetValue("Group", "Credits", credits);
|
||||
split(credits, ";", credits_vector);
|
||||
m_sCredits = credits_vector;
|
||||
m_bHasGroupIni = true;
|
||||
ini.GetValue( "Group", "Credits", credits );
|
||||
ini.GetValue( "Group", "AuthorsNotes", authorsNotes );
|
||||
} else {
|
||||
m_bHasGroupIni = false;
|
||||
}
|
||||
|
||||
// Look for a group banner in this group folder
|
||||
std::vector<RString> arrayGroupBanners;
|
||||
|
||||
// First check if there is a banner provided in group.ini
|
||||
if( bannerPath != "" )
|
||||
{
|
||||
GetDirListing( sDir+sGroupDirName+"/"+bannerPath, arrayGroupBanners );
|
||||
}
|
||||
GetDirListing( sDir+sGroupDirName+"/*.png", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+"/*.jpg", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+"/*.jpeg", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+"/*.gif", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+"/*.bmp", arrayGroupBanners );
|
||||
|
||||
if( !arrayGroupBanners.empty() ) {
|
||||
m_sBannerPath = sDir+sGroupDirName+"/"+arrayGroupBanners[0] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Look for a group banner in the parent folder
|
||||
GetDirListing( sDir+sGroupDirName+".png", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+".jpg", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+".jpeg", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+".gif", arrayGroupBanners );
|
||||
GetDirListing( sDir+sGroupDirName+".bmp", arrayGroupBanners );
|
||||
if( !arrayGroupBanners.empty() )
|
||||
m_sBannerPath = sDir+arrayGroupBanners[0];
|
||||
}
|
||||
|
||||
/* Other group graphics are a bit trickier, and usually don't exist.
|
||||
* A themer has a few options, namely checking the aspect ratio and
|
||||
* operating on it. -aj
|
||||
* TODO: Once the files are implemented in Song, bring the extensions
|
||||
* from there into here. -aj */
|
||||
// Group background
|
||||
|
||||
//vector<RString> arrayGroupBackgrounds;
|
||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.png", arrayGroupBanners );
|
||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpg", arrayGroupBanners );
|
||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.jpeg", arrayGroupBanners );
|
||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.gif", arrayGroupBanners );
|
||||
//GetDirListing( sDir+sGroupDirName+"/*-bg.bmp", arrayGroupBanners );
|
||||
/*
|
||||
RString sBackgroundPath;
|
||||
if( !arrayGroupBackgrounds.empty() )
|
||||
sBackgroundPath = sDir+sGroupDirName+"/"+arrayGroupBackgrounds[0];
|
||||
else
|
||||
{
|
||||
// Look for a group background in the parent folder
|
||||
GetDirListing( sDir+sGroupDirName+"-bg.png", arrayGroupBackgrounds );
|
||||
GetDirListing( sDir+sGroupDirName+"-bg.jpg", arrayGroupBackgrounds );
|
||||
GetDirListing( sDir+sGroupDirName+"-bg.jpeg", arrayGroupBackgrounds );
|
||||
GetDirListing( sDir+sGroupDirName+"-bg.gif", arrayGroupBackgrounds );
|
||||
GetDirListing( sDir+sGroupDirName+"-bg.bmp", arrayGroupBackgrounds );
|
||||
if( !arrayGroupBackgrounds.empty() )
|
||||
sBackgroundPath = sDir+arrayGroupBackgrounds[0];
|
||||
}
|
||||
*/
|
||||
|
||||
m_sDisplayTitle = sDisplayTitle;
|
||||
m_sSortTitle = SortTitle;
|
||||
m_sTranslitTitle = TranslitTitle;
|
||||
m_sSeries = Series;
|
||||
m_sPath = sDir + sGroupDirName;
|
||||
m_sGroupName = sGroupDirName;
|
||||
std::vector<RString> credits_vector;
|
||||
split(credits, ";", credits_vector);
|
||||
m_sCredits = credits_vector;
|
||||
m_sAuthorsNotes = authorsNotes;
|
||||
m_iSyncOffset = fOffset;
|
||||
|
||||
}
|
||||
|
||||
const std::vector<Song *> &Group::GetSongs() const
|
||||
|
||||
Reference in New Issue
Block a user