Skip to content

Commit

Permalink
fix: android build
Browse files Browse the repository at this point in the history
  • Loading branch information
FlafyDev committed Apr 4, 2024
1 parent 1da61c7 commit 84118cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/hooks/custom_song_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
#include "../managers/auto_nong_manager.hpp"
#include "../types/serializable_vector.hpp"
#include "../ui/an_dropdown_layer.hpp"
#include <ranges>

struct ANCustomSongWidget : geode::Modify<ANCustomSongWidget, CustomSongWidget> {
bool m_showNong;
CCMenu *m_nongMenu;

std::set<int> getSongIds() {
auto kv = std::views::keys(m_songs);
std::set<int> songIds{kv.begin(), kv.end()};
std::set<int> songIds;
for (const auto& pair : m_songs) {
songIds.insert(pair.first);
}
songIds.insert(m_songInfoObject->m_songID);
return songIds;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/an_dropdown_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ bool ANDropdownLayer::setup(int songId, std::vector<std::shared_ptr<ANSong>> son
auto contentSize = m_mainLayer->getContentSize();

auto manifestLabel = CCLabelBMFont::create(
std::format("{} / {}", popupNumber, totalPopups).c_str(), "chatFont.fnt");
fmt::format("{} / {}", popupNumber, totalPopups).c_str(), "chatFont.fnt");
manifestLabel->setPosition(contentSize.width / 2, 13.f);
manifestLabel->limitLabelWidth(140.f, 0.6f, 0.1f);
manifestLabel->setColor(cc3x(0xc2c2c2));
manifestLabel->setID("manifest-label");
m_mainLayer->addChild(manifestLabel);

auto titleLabel =
CCLabelBMFont::create(std::format("Replace song for {}", songId).c_str(), "goldFont.fnt");
CCLabelBMFont::create(fmt::format("Replace song for {}", songId).c_str(), "goldFont.fnt");
titleLabel->setPosition(contentSize.width / 2, contentSize.height - 22.f);
titleLabel->limitLabelWidth(contentSize.width - 40.f, 1.5f, 0.1f);
titleLabel->setID("title-label");
Expand Down
14 changes: 7 additions & 7 deletions src/ui/an_song_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool ANSongCell::init(int songId, ANSong *song, ANDropdownLayer *parentPopup, CC
m_artistNameLabel->setID("artist-name");

m_sourceLabel = CCLabelBMFont::create(
std::format("{} : {}", getSubstringAfterSlash(m_anSong->m_index), m_anSong->getSource())
fmt::format("{} : {}", getSubstringAfterSlash(m_anSong->m_index), m_anSong->getSource())
.c_str(),
"goldFont.fnt");
m_sourceLabel->limitLabelWidth(120.f, 0.7f, 0.1f);
Expand Down Expand Up @@ -135,16 +135,16 @@ fs::path ANSongCell::getFileDownloadPath(bool create) {
const ANYTSong *ytSong = static_cast<ANYTSong *>(m_anSong);
const std::string videoId = ytSong->m_ytId;
if (create) {
fs::create_directory(std::format("{}\\youtube", Mod::get()->getSaveDir().string()));
fs::create_directory(fmt::format("{}\\youtube", Mod::get()->getSaveDir().string()));
}
return std::format("{}\\youtube\\{}.mp3", Mod::get()->getSaveDir().string(), videoId);
return fmt::format("{}\\youtube\\{}.mp3", Mod::get()->getSaveDir().string(), videoId);
}
if (typeid(*m_anSong) == typeid(ANHostSong)) {
const ANHostSong *hostSong = static_cast<ANHostSong *>(m_anSong);
if (create) {
fs::create_directory(std::format("{}\\host", Mod::get()->getSaveDir().string()));
fs::create_directory(fmt::format("{}\\host", Mod::get()->getSaveDir().string()));
}
return std::format("{}\\host\\{}.mp3", Mod::get()->getSaveDir().string(),
return fmt::format("{}\\host\\{}.mp3", Mod::get()->getSaveDir().string(),
urlToFilename(hostSong->m_url));
}
return "";
Expand Down Expand Up @@ -173,7 +173,7 @@ void ANSongCell::downloadFromYtDlp() {
std::thread commandThread([this, ytSong, ytDlpCommand]() {
std::string command = ytDlpCommand;

int result = std::system(std::format("\"{}\"", command).c_str());
int result = std::system(fmt::format("\"{}\"", command).c_str());

log::info("command({}): {}", result, command);

Expand Down Expand Up @@ -205,7 +205,7 @@ void ANSongCell::downloadFromCobalt() {
const std::string videoId = ytSong->m_ytId;

std::unordered_map<std::string, std::string> parameters = {
{"url", std::format("https://www.youtube.com/watch?v={}", videoId)},
{"url", fmt::format("https://www.youtube.com/watch?v={}", videoId)},
{"aFormat", "mp3"},
{"isAudioOnly", "true"}};

Expand Down

0 comments on commit 84118cb

Please sign in to comment.