diff --git a/download.py b/download.py index 2d053b546716d5b0f6f76da5bf5ed88729e202c5..debf0ed7824aac9cbd0735370bbc7649885b1825 100644 --- a/download.py +++ b/download.py @@ -31,11 +31,18 @@ download_lock = _thread.allocate_lock() def download_thread(self): download_lock.acquire(1) + if st3m.utils.sd_card_plugged(): + rootpath = "/sd/PetalHero" + else: + rootpath = f"{self.app.path}/songs" + if not os.path.exists(rootpath): + os.mkdir(rootpath) + while self.file_list and not self.cancel: self.current_song = self.file_list.pop(0) self.file_no += 1 self.file_progress = 0 - dirname = f"/sd/PetalHero/{self.current_song[2]} - {self.current_song[3]}" + dirname = f"{rootpath}/{self.current_song[2]} - {self.current_song[3]}" try: l = os.listdir(dirname) diff --git a/select.py b/select.py index bbc1c8995ff2aa8a86a8ffaabb3b1683e765743f..a9b576cbde2e9c076d17482738c16fe87ef7b374 100644 --- a/select.py +++ b/select.py @@ -3,6 +3,7 @@ from st3m.input import InputState from st3m.ui.interactions import ScrollController from st3m.goose import Optional from ctx import Context +import st3m.utils import math import os, stat import time @@ -195,7 +196,7 @@ class SelectView(BaseView): ctx.font_size = 24 ctx.text("No songs found!") - if self.sd_card_present: + if self.sd_card_present or st3m.utils.is_simulator(): ctx.gray(0.8) ctx.move_to(0, 32) ctx.font_size = 17 @@ -330,7 +331,7 @@ class SelectView(BaseView): utils.play_go(self.app) if self.songs: self.vm.push(difficulty.DifficultyView(self.app, self.songs[pos]), ViewTransitionSwipeLeft()) - elif self.sd_card_present: + elif self.sd_card_present or st3m.utils.is_simulator(): self.vm.replace(connecting.ConnectingView(self.app), ViewTransitionBlend()) if self.first_scroll_think: