From a2e0d2cd8a3a4a1543da4c502e58556a737a44ad Mon Sep 17 00:00:00 2001 From: limil Date: Sun, 3 Nov 2024 11:45:20 +0800 Subject: [PATCH] =?UTF-8?q?ls=E5=88=97=E5=87=BA=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PikPakFileSystem.py | 7 +++++++ main.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/PikPakFileSystem.py b/PikPakFileSystem.py index cb9035b..792ce55 100644 --- a/PikPakFileSystem.py +++ b/PikPakFileSystem.py @@ -269,6 +269,13 @@ class PikPakFileSystem: father, son_name = await self._path_to_father_node_and_son_name(path) return await self._node_to_path(father), son_name + async def GetFileUrl(self, path : str) -> str: + node = await self._path_to_node(path) + if not isinstance(node, FileNode): + return None + await self._refresh(node) + return node.url + async def GetChildrenNames(self, path : str, ignore_files : bool) -> list[str]: node = await self._path_to_node(path) if not isinstance(node, DirNode): diff --git a/main.py b/main.py index f2ba45e..68e61b0 100644 --- a/main.py +++ b/main.py @@ -199,6 +199,8 @@ class App(cmd2.Cmd): if await Client.IsDir(args.path): for child_name in await Client.GetChildrenNames(args.path, False): await self.print(child_name) + else: + await self.print(await Client.GetFileUrl(args.path)) @RunSync async def complete_cd(self, text, line, begidx, endidx):