-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add palworld_player_save_count metric
- Loading branch information
Showing
4 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from glob import glob | ||
import os | ||
|
||
|
||
class SaveCollector: | ||
def __init__(self, save_directory: str): | ||
self.save_directory = save_directory | ||
|
||
def player_save_count(self) -> int: | ||
players_save_path = os.path.join(self.save_directory, "Players") | ||
# Ensure Players directory exists | ||
if not os.path.exists(players_save_path): | ||
raise FileNotFoundError( | ||
f'Player saves directory does not exist in: {self.save_directory}') | ||
player_saves = glob(os.path.join(players_save_path, '*.sav')) | ||
return len(player_saves) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters