Skip to content

Commit 58384d4

Browse files
committed
bugfix pt2
1 parent d48fe81 commit 58384d4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/SongControl.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ namespace SongControl {
8989
if (songManager.isOriginalMenuLoop()) return SongControl::woahThereBuddy("There's nothing to blacklist! Open Menu Loop Randomizer's config directory and edit its <cj>blacklist.txt</c> file to bring back some songs.");
9090
if (songManager.isOverride()) return SongControl::woahThereBuddy("You're trying to blacklist your own <cy>override</c>. Double-check your settings again.");
9191

92-
const std::string& currentSong = songManager.getCurrentSong();
92+
const std::string& songBeingBlacklisted = songManager.getCurrentSong();
9393

94-
if (const auto songManagerBlacklist = songManager.getBlacklist(); std::ranges::find(songManagerBlacklist, currentSong) != songManagerBlacklist.end()) return SongControl::woahThereBuddy("You've already blacklisted this song. Double-check your <cl>blacklist.txt</c> again.");
95-
if (const auto songManagerFavorites = songManager.getFavorites(); std::ranges::find(songManagerFavorites, currentSong) != songManagerFavorites.end()) return SongControl::woahThereBuddy("You've already favorited this song! Double-check your <cl>favorites.txt</c> again.");
94+
if (const auto songManagerBlacklist = songManager.getBlacklist(); std::ranges::find(songManagerBlacklist, songBeingBlacklisted) != songManagerBlacklist.end()) return SongControl::woahThereBuddy("You've already blacklisted this song. Double-check your <cl>blacklist.txt</c> again.");
95+
if (const auto songManagerFavorites = songManager.getFavorites(); std::ranges::find(songManagerFavorites, songBeingBlacklisted) != songManagerFavorites.end()) return SongControl::woahThereBuddy("You've already favorited this song! Double-check your <cl>favorites.txt</c> again.");
9696

97-
geode::log::info("blacklisting: {}", currentSong);
97+
geode::log::info("blacklisting: {}", songBeingBlacklisted);
9898

9999
const bool useCustomSongs = Utils::getBool("useCustomSongs");
100100
const std::string& songName = Utils::getSongName();
101101
const std::string& songArtist = Utils::getSongArtist();
102102
const std::string& customSong = Utils::currentCustomSong();
103103
const int songID = Utils::getSongID();
104-
const std::string& toWriteToFile = useCustomSongs ? currentSong : fmt::format("{} # [MLR] Song: {} by {} [MLR] #", currentSong, songName, songArtist);
104+
const std::string& toWriteToFile = useCustomSongs ? songBeingBlacklisted : fmt::format("{} # [MLR] Song: {} by {} [MLR] #", songBeingBlacklisted, songName, songArtist);
105105

106106
Utils::writeToFile(toWriteToFile, BLACKLIST_FILE);
107107

@@ -111,9 +111,9 @@ namespace SongControl {
111111
geode::log::info("repopulating vector from blacklisting current song");
112112
Utils::refreshTheVector();
113113
} else {
114-
geode::log::info("dangerousBlacklisting is active. added {} to blacklist, removing it from current queue", currentSong);
114+
geode::log::info("dangerousBlacklisting is active. added {} to blacklist, removing it from current queue", songBeingBlacklisted);
115115
geode::log::info("original size: {}", songManager.getSongsSize());
116-
songManager.removeSong(currentSong);
116+
songManager.removeSong(songBeingBlacklisted);
117117
geode::log::info("updated size: {}", songManager.getSongsSize());
118118
}
119119

@@ -128,7 +128,10 @@ namespace SongControl {
128128
if (!useCustomSongs && !songName.empty()) return Utils::newNotification(fmt::format("Blacklisted {}. Have fun with the original menu loop. :)", songName));
129129
}
130130

131-
if (!useCustomSongs) return Utils::newNotification(fmt::format("Blacklisted {} by {} ({}), now playing {}.", songName, songArtist, songID, Utils::getSongName()));
131+
if (!useCustomSongs) {
132+
if (songID != -1) return Utils::newNotification(fmt::format("Blacklisted {} by {} ({}), now playing {}.", songName, songArtist, songID, Utils::getSongName()));
133+
return Utils::newNotification(fmt::format("Blacklisted {}, now playing {}.", Utils::toNormalizedString(std::filesystem::path(songBeingBlacklisted).filename()), Utils::getSongName()));
134+
}
132135
if (!customSong.empty()) return Utils::newNotification(fmt::format("Blacklisted {}, now playing {}.", customSong, Utils::currentCustomSong()));
133136
}
134137
void copySong() {

0 commit comments

Comments
 (0)