Skip to content

Commit

Permalink
Fix more missing song assets expected to be autolocated
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Mar 7, 2019
1 parent 9bf1f46 commit 677a439
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
vector<RString> ends_with(1, " bn");
m_bHasBanner = FindFirstFilenameContaining(
image_list, m_sBannerFile, empty_list, contains, ends_with);
if (m_bHasBanner && !HasBanner())
m_sBannerPath = GetSongAssetPath(m_sBannerPath, m_sSongDir);
}

if (!m_bHasBackground) {
Expand All @@ -831,6 +833,9 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
vector<RString> ends_with(1, "bg");
m_bHasBackground = FindFirstFilenameContaining(
image_list, m_sBackgroundFile, empty_list, contains, ends_with);
if (m_bHasBackground && !HasBackground())
m_sBackgroundPath =
GetSongAssetPath(m_sBackgroundFile, m_sSongDir);
}

if (!has_jacket) {
Expand All @@ -842,6 +847,8 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
contains.push_back("albumart");
has_jacket = FindFirstFilenameContaining(
image_list, m_sJacketFile, starts_with, contains, empty_list);
if (has_jacket && !HasJacket())
m_sJacketPath = GetSongAssetPath(m_sJacketFile, m_sSongDir);
}

if (!has_cdimage) {
Expand All @@ -850,6 +857,8 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
vector<RString> ends_with(1, "-cd");
has_cdimage = FindFirstFilenameContaining(
image_list, m_sCDFile, empty_list, empty_list, ends_with);
if (has_cdimage && !HasCDImage())
m_sCDPath = GetSongAssetPath(m_sCDFile, m_sSongDir);
}

if (!has_disc) {
Expand All @@ -860,20 +869,26 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
ends_with.push_back(" title");
has_disc = FindFirstFilenameContaining(
image_list, m_sDiscFile, empty_list, empty_list, ends_with);
if (has_disc && !HasDisc())
m_sDiscPath = GetSongAssetPath(m_sDiscPath, m_sSongDir);
}

if (!has_cdtitle) {
// find an image with "cdtitle" in the file name
vector<RString> contains(1, "cdtitle");
has_cdtitle = FindFirstFilenameContaining(
image_list, m_sCDTitleFile, empty_list, contains, empty_list);
if (has_cdtitle && !HasCDTitle())
m_sCDTitlePath = GetSongAssetPath(m_sCDTitleFile, m_sSongDir);
}

if (!HasLyrics()) {
// Check if there is a lyric file in here
if (!lyric_list.empty()) {
m_sLyricsFile = lyric_list[0];
}
if (!m_sLyricsFile.empty())
m_sLyricsPath = GetSongAssetPath(m_sLyricsFile, m_sSongDir);
}

/* Now, For the images we still haven't found,
Expand Down Expand Up @@ -939,7 +954,8 @@ Song::TidyUpData(bool from_cache, bool /* duringCache */)
height <= 240) {
m_sBannerFile = image_list[i];
m_bHasBanner = true;
m_sBannerPath = GetSongAssetPath(m_sBannerFile, m_sSongDir).c_str();
m_sBannerPath =
GetSongAssetPath(m_sBannerFile, m_sSongDir).c_str();
continue;
}

Expand Down

0 comments on commit 677a439

Please sign in to comment.