diff --git a/main.py b/main.py index f60b020..bb5d292 100644 --- a/main.py +++ b/main.py @@ -159,7 +159,8 @@ async def delete_pack(self, name: str) -> Result: self.soundPacks.remove(pack) return Result(True).to_dict() - async def parse_packs(self, packsDir : str): + async def parse_packs(self): + packsDir = get_pack_path() self.soundPacks = [] possiblePacks = [str(p) for p in os.listdir(packsDir)] @@ -211,7 +212,7 @@ async def _load(self): if (not os.path.exists(configPath)): await create_config(configPath) - await self.parse_packs(self, packsPath) + await self.parse_packs(self) await self.get_config(self) diff --git a/src/pack-manager/PackBrowserPage.tsx b/src/pack-manager/PackBrowserPage.tsx index 0276ba7..173963c 100644 --- a/src/pack-manager/PackBrowserPage.tsx +++ b/src/pack-manager/PackBrowserPage.tsx @@ -7,11 +7,7 @@ import { isEqual } from "lodash"; // Interfaces for the JSON objects the lists work with import { useGlobalState } from "../state"; -import { - BrowserSearchFields, - LoadMoreButton, - PackDisplayCard, -} from "../components"; +import { BrowserSearchFields, LoadMoreButton, PackDisplayCard } from "../components"; export const PackBrowserPage: FC = () => { const { @@ -23,13 +19,14 @@ export const PackBrowserPage: FC = () => { prevSearchOpts, } = useGlobalState(); - const [backendVersion, setBackendVer] = useState(2); - function reloadBackendVer() { - python.resolve(python.getBackendVersion(), setBackendVer); - } + // Doesn't currently filter rn + // const [backendVersion, setBackendVer] = useState(2); + // function reloadBackendVer() { + // python.resolve(python.getBackendVersion(), setBackendVer); + // } function reloadThemes() { - reloadBackendVer(); + // reloadBackendVer(); getThemes(searchOpts, "/themes", "browseThemeList", setSnapIndex); python.reloadBackend(); } @@ -42,7 +39,7 @@ export const PackBrowserPage: FC = () => { // Runs upon opening the page every time useLayoutEffect(() => { - reloadBackendVer(); + // reloadBackendVer(); if (apiShortToken && !apiFullToken) { logInWithShortToken(); } diff --git a/src/python.ts b/src/python.ts index be61693..4ca8de3 100644 --- a/src/python.ts +++ b/src/python.ts @@ -53,24 +53,18 @@ export function execute(promise: Promise) { export function getAndSetSoundPacks(): Promise { const setGlobalState = globalState!.setGlobalState.bind(globalState); - return server! - .callPluginMethod<{}, Pack[]>("get_sound_packs", {}) - .then((data) => { - if (data.success) { - setGlobalState("soundPacks", data.result); - } - }); + return server!.callPluginMethod<{}, Pack[]>("get_sound_packs", {}).then((data) => { + if (data.success) { + setGlobalState("soundPacks", data.result); + } + }); } // getSoundPacks just fetches the packs already stored in python memory, you need to call this reload function to re-fetch the folder list export function reloadBackend(): Promise { - return server! - .callPluginMethod("parse_packs", { - packsDir: "/home/deck/homebrew/sounds", - }) - .then(() => { - getAndSetSoundPacks(); - }); + return server!.callPluginMethod("parse_packs", {}).then(() => { + getAndSetSoundPacks(); + }); } export function dummyFuncTest(): void {