Skip to content

Commit

Permalink
initial android support
Browse files Browse the repository at this point in the history
credit will be added later
  • Loading branch information
FlafyDev committed May 30, 2024
1 parent baea0aa commit cf93a37
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ jobs:
fail-fast: false
matrix:
config:
- name: Windows
os: windows-latest
# - name: Windows
# os: windows-latest

# - name: macOS
# os: macos-latest

# - name: Android32
# os: ubuntu-latest
# target: Android32
#
# - name: Android64
# os: ubuntu-latest
# target: Android64
- name: Android32
os: ubuntu-latest
target: Android32

- name: Android64
os: ubuntu-latest
target: Android64

name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
Expand Down
5 changes: 4 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"geode": "2.0.0-beta.27",
"gd": "2.204",
"gd": {
"win": "2.204",
"android": "2.205"
},
"version": "v0.0.3",
"id": "flafy.autonong",
"name": "Auto Nong",
Expand Down
18 changes: 13 additions & 5 deletions src/ui/an_song_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,29 @@ void ANSongCell::setSong() {
}

fs::path ANSongCell::getFileDownloadPath(bool create) {
#ifdef GEODE_IS_ANDROID
std::string baseDir = "/storage/emulated/0/nongs";
if (!fs::exists(baseDir)) {
fs::create_directories(baseDir);
}
#else
std::string baseDir = Mod::get()->getSaveDir().string();
#endif

if (typeid(*m_anSong) == typeid(ANYTSong)) {
const ANYTSong *ytSong = static_cast<ANYTSong *>(m_anSong);
const std::string videoId = ytSong->m_ytId;
if (create) {
fs::create_directory(fmt::format("{}\\youtube", Mod::get()->getSaveDir().string()));
fs::create_directories(fmt::format("{}/youtube", baseDir));
}
return fmt::format("{}\\youtube\\{}.mp3", Mod::get()->getSaveDir().string(), videoId);
return fmt::format("{}/youtube/{}.mp3", baseDir, videoId);
}
if (typeid(*m_anSong) == typeid(ANHostSong)) {
const ANHostSong *hostSong = static_cast<ANHostSong *>(m_anSong);
if (create) {
fs::create_directory(fmt::format("{}\\host", Mod::get()->getSaveDir().string()));
fs::create_directories(fmt::format("{}/host", baseDir));
}
return fmt::format("{}\\host\\{}.mp3", Mod::get()->getSaveDir().string(),
urlToFilename(hostSong->m_url));
return fmt::format("{}/host/{}.mp3", baseDir, urlToFilename(hostSong->m_url));
}
return "";
}
Expand Down

0 comments on commit cf93a37

Please sign in to comment.