steam-client 2.0.1.dev0__tar.gz → 2.1.0.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {steam-client-2.0.1.dev0/steam_client.egg-info → steam-client-2.1.0.dev0}/PKG-INFO +1 -1
  2. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/pyproject.toml +2 -2
  3. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/app.py +3 -2
  4. steam-client-2.1.0.dev0/steam_client/commands.py +69 -0
  5. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/game.py +16 -0
  6. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/steam.py +3 -2
  7. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0/steam_client.egg-info}/PKG-INFO +1 -1
  8. steam-client-2.0.1.dev0/steam_client/commands.py +0 -52
  9. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/LICENSE +0 -0
  10. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/setup.cfg +0 -0
  11. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/setup.py +0 -0
  12. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/__init__.py +0 -0
  13. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/library.py +0 -0
  14. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/library_directory.py +0 -0
  15. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/login_users.py +0 -0
  16. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/py.typed +0 -0
  17. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/shortcut.py +0 -0
  18. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/utils.py +0 -0
  19. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client/web_api.py +0 -0
  20. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client.egg-info/SOURCES.txt +0 -0
  21. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client.egg-info/dependency_links.txt +0 -0
  22. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client.egg-info/requires.txt +0 -0
  23. {steam-client-2.0.1.dev0 → steam-client-2.1.0.dev0}/steam_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: steam-client
3
- Version: 2.0.1.dev0
3
+ Version: 2.1.0.dev0
4
4
  Summary: Steam client library for Python
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -6,7 +6,7 @@ name = "steam-client"
6
6
  authors = [
7
7
  {name = "William McAllister", email = "dev.garulf@gmail.com"}
8
8
  ]
9
- version = '2.0.1-dev.0'
9
+ version = "2.1.0-dev.0"
10
10
  description = "Steam client library for Python"
11
11
  readme = "README.md"
12
12
  requires-python = ">=3.8"
@@ -31,7 +31,7 @@ packages = ["steam_client"]
31
31
  "steam_client" = ["py.typed"]
32
32
 
33
33
  [tool.bumpversion]
34
- current_version = "2.0.0-dev.0"
34
+ current_version = "2.0.1-dev.0"
35
35
  parse = """(?x)
36
36
  (?P<major>[0-9]+)
37
37
  \\.(?P<minor>[0-9]+)
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  from typing import TYPE_CHECKING
5
5
 
6
6
 
7
- from .commands import run_game_id
7
+ from .commands import Commands
8
8
 
9
9
  if TYPE_CHECKING:
10
10
  from .steam import Steam
@@ -15,6 +15,7 @@ class App(ABC):
15
15
 
16
16
  def __init__(self, steam: Steam):
17
17
  self._steam = steam
18
+ self._commands = Commands()
18
19
 
19
20
  @property
20
21
  @abstractmethod
@@ -51,4 +52,4 @@ class App(ABC):
51
52
 
52
53
  def run(self):
53
54
  """Launches app with the specified app ID in the Steam client."""
54
- self._steam.command(run_game_id(self.appid))
55
+ self._commands.run_game_id(self.appid)
@@ -0,0 +1,69 @@
1
+ from typing import List
2
+ import webbrowser
3
+ from enum import StrEnum
4
+
5
+ SCHEME = 'steam'
6
+
7
+ class SteamWindows(StrEnum):
8
+ """Enumeration of Steam client windows."""
9
+ MAIN = 'main'
10
+ GAMES = 'games'
11
+ GAMES_DETAILS = 'games/details'
12
+ GAMES_GRID = 'games/grid'
13
+ GAMES_LIST = 'games/list'
14
+ FRIENDS = 'friends'
15
+ CHAT = 'chat'
16
+ BIGPICTURE = 'bigpicture'
17
+ NEWS = 'news'
18
+ SETTINGS = 'settings'
19
+ TOOLS = 'tools'
20
+ CONSOLE = 'console'
21
+
22
+ class Command():
23
+
24
+ def __init__(self, scheme: str):
25
+ self._scheme = scheme
26
+
27
+ def _create_uri(self, path: List[str], endpoint: str) -> str:
28
+ return f'{self._scheme}://{"/".join(path)}/{endpoint}'
29
+
30
+ def __call__(self, path: List[str], endpoint: str) -> None:
31
+ """Executes the command with the specified endpoint."""
32
+ webbrowser.open(self._create_uri(path, endpoint))
33
+
34
+
35
+ class Commands:
36
+ """A collection of commands for the Steam client."""
37
+
38
+ def __init__(self):
39
+ self._command = Command(SCHEME)
40
+
41
+ def run_game_id(self, app_id: str) -> str:
42
+ """Launches game with the specified ID in the Steam client."""
43
+ self._command(['rungameid'], app_id)
44
+
45
+ def store(self, app_id: str) -> str:
46
+ """Opens the game's store page in the Steam client."""
47
+ self._command(['store'], app_id)
48
+
49
+ def install(self, app_id: str) -> str:
50
+ """Opens the game's install prompt in the Steam client."""
51
+ self._command(['install'], app_id)
52
+
53
+ def uninstall(self, app_id: str) -> str:
54
+ """Opens the game's uninstall prompt in the Steam client."""
55
+ self._command(['uninstall'], app_id)
56
+
57
+ def update_news(self, app_id: str) -> str:
58
+ """Opens the game's update news in the Steam client."""
59
+ self._command(['updatenews'], app_id)
60
+
61
+ def open(self, window: SteamWindows) -> str:
62
+ """Opens the specified window in the Steam client."""
63
+ self._command(['open'], window)
64
+
65
+ def open_url(self, url: str) -> str:
66
+ """Opens the specified URL in the Steam client."""
67
+ self._command(['openurl'], url)
68
+
69
+
@@ -13,6 +13,14 @@ from .app import App
13
13
 
14
14
  UNKNOWN_GAME_NAME = 'UNKNOWN'
15
15
 
16
+ ASSETS = [
17
+ "header.jpg",
18
+ "library_600x900.jpg",
19
+ "library_hero.jpg",
20
+ "library_hero_blur.jpg",
21
+ "logo.png"
22
+ ]
23
+
16
24
 
17
25
  class SteamGame(App):
18
26
  """Represents a Steam game."""
@@ -25,9 +33,17 @@ class SteamGame(App):
25
33
  def __repr__(self) -> str:
26
34
  return f'Game(steam={self._steam.__repr__()}, library_path={self.library_path.__repr__()}, appid={self.appid.__repr__()})'
27
35
 
36
+ @property
37
+ def asset_dir(self) -> Path:
38
+ """Returns the path to the game's asset directory."""
39
+ return Path(self._steam.library_cache).joinpath(self.appid)
40
+
28
41
  @property
29
42
  def icon(self) -> Path:
30
43
  """Returns the path to the icon image."""
44
+ for asset in self.asset_dir.iterdir():
45
+ if asset.name not in ASSETS:
46
+ return asset
31
47
  return Path(self._steam.library_cache).joinpath(f'{self.appid}_icon.jpg')
32
48
 
33
49
  @property
@@ -4,13 +4,14 @@ import webbrowser
4
4
  from .library import Library
5
5
  from .login_users import LoginUsers
6
6
 
7
- DEFAULT_WIN_STEAM_PATH = r"c:\Program Files (x86)\Steam"
7
+ WIN_STEAM_PATH = r"c:\Program Files (x86)\Steam"
8
+ LINUX_STEAM_PATH = "~/.local/share/steam"
8
9
 
9
10
 
10
11
  class Steam:
11
12
  """Represents the Steam client."""
12
13
 
13
- def __init__(self, base_path: str = DEFAULT_WIN_STEAM_PATH):
14
+ def __init__(self, base_path: str = WIN_STEAM_PATH):
14
15
  self.base_path: str = base_path
15
16
 
16
17
  def __repr__(self) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: steam-client
3
- Version: 2.0.1.dev0
3
+ Version: 2.1.0.dev0
4
4
  Summary: Steam client library for Python
5
5
  Author-email: William McAllister <dev.garulf@gmail.com>
6
6
  License: MIT
@@ -1,52 +0,0 @@
1
- from typing import Literal
2
-
3
-
4
- SteamWindow = Literal[
5
- 'main',
6
- 'games',
7
- 'games/details',
8
- 'games/grid',
9
- 'games/list',
10
- 'friends',
11
- 'chat',
12
- 'bigpicture',
13
- 'news',
14
- 'settings',
15
- 'tools',
16
- 'console'
17
- ]
18
-
19
-
20
- def run_game_id(app_id: str) -> str:
21
- """Launches game with the specified ID in the Steam client."""
22
- return f'steam://rungameid/{app_id}'
23
-
24
-
25
- def store(app_id: str) -> str:
26
- """Opens the game's store page in the Steam client."""
27
- return f'steam://store/{app_id}'
28
-
29
-
30
- def install(app_id: str) -> str:
31
- """Opens the game's install prompt in the Steam client."""
32
- return 'steam://install/{app_id}'
33
-
34
-
35
- def uninstall(app_id: str) -> str:
36
- """Opens the game's uninstall prompt in the Steam client."""
37
- return f'steam://uninstall/{app_id}'
38
-
39
-
40
- def update_news(app_id: str) -> str:
41
- """Opens the game's update news in the Steam client."""
42
- return f'steam://updatenews/{app_id}'
43
-
44
-
45
- def open(window: SteamWindow) -> str:
46
- """Opens the specified window in the Steam client."""
47
- return f'steam://open/{window}'
48
-
49
-
50
- def open_url(url: str) -> str:
51
- """Opens the specified URL in the Steam client."""
52
- return f'steam://openurl/{url}'