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):