Skip to content

Commit

Permalink
oh my fod this is so much better
Browse files Browse the repository at this point in the history
  • Loading branch information
RayDeeUx committed Sep 28, 2024
1 parent a709451 commit 8d78e9e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/MenuLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,12 @@ class $modify(MenuLayerMLHook, MenuLayer) {
std::string songArtist = Utils::getSongArtist();
int songID = Utils::getSongID();
std::string customSong = Utils::currentCustomSong();
if (!std::filesystem::exists(m_fields->blacklistFile)) return log::info("error finding blacklist file!");
if (!useCustomSongs) toWriteToFile = toWriteToFile.append(fmt::format(" # Song: {} by {}", songName, songArtist));
auto test = utils::file::readString(m_fields->blacklistFile);
if (test.isErr()) return log::info("error reading blacklist file!");
auto newLine = geode::utils::file::writeString(m_fields->blacklistFile, test.unwrap().append("\n"));
if (newLine.isErr()) return log::info("error writing blacklist file!");
auto readAfterNewLine = geode::utils::file::readString(m_fields->blacklistFile);
if (readAfterNewLine.isErr()) return log::info("error reading blacklist file!");
auto result = geode::utils::file::writeString(m_fields->blacklistFile, readAfterNewLine.unwrap().append(toWriteToFile));
if (result.isErr()) return log::info("error blacklisting song {}", currentSong);
std::ofstream blacklistFileOutput;
blacklistFileOutput.open(m_fields->blacklistFile, std::ios_base::app);
blacklistFileOutput << std::endl << toWriteToFile;
blacklistFileOutput.close();
m_fields->songManager.addToBlacklist();
m_fields->songManager.clearSongs();
Utils::populateVector(useCustomSongs);
Expand Down

0 comments on commit 8d78e9e

Please sign in to comment.