Compare commits

..

No commits in common. "27c637c0091cd6db249c8e58c0e21e751ab0c488" and "de76c6541ecfce299763549880d7afe41f3eb100" have entirely different histories.

6 changed files with 12 additions and 36 deletions

View File

@ -5,7 +5,6 @@ bandit>=1.7.0
codespell>=2.2.0
coverage>=7.4.0
howlongtobeatpy>=1.0
mcp>=1.9
mypy>=1.8.0
pre-commit>=3.6.0
pylint>=3.0.0

View File

@ -15,10 +15,8 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_DIR
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
readonly REPO_DIR
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
readonly VENV_DIR="${HOME}/.venvs/steam-backlog-mcp"
main() {

View File

@ -35,11 +35,7 @@ from steam_backlog_enforcer.protondb import (
ProtonDBRating,
fetch_protondb_ratings,
)
from steam_backlog_enforcer.steam_api import (
GameInfo,
SteamAPIClient,
SteamAPIError,
)
from steam_backlog_enforcer.steam_api import GameInfo, SteamAPIClient
if TYPE_CHECKING:
from steam_backlog_enforcer.config import Config, State
@ -280,8 +276,7 @@ def _print_pace_scenario(state: State, remaining: int, games_done: int) -> None:
rate = games_done / days_elapsed
_echo(f" Started: {started.strftime('%Y-%m-%d')}")
_echo(
f" Finished: {games_done} games in {days_elapsed} days "
"(since enforcement start)"
f" Finished: {games_done} games in {days_elapsed} days (since enforcement start)"
)
_echo(
f" Pace: {rate:.4f} games/day (1 game every {1 / rate:.1f} days)"
@ -362,6 +357,8 @@ def _refresh_recently_played_completions(
except OSError:
return games
from steam_backlog_enforcer.steam_api import SteamAPIError
try:
client = SteamAPIClient(config.steam_api_key, config.steam_id)
owned_raw = client.get_owned_games()

View File

@ -246,7 +246,7 @@ def count_complete_since_start(games: list[GameInfo], started_at: str) -> int:
Games with no achievement timestamp data are excluded — their completion
date is unknown, and they were most likely finished before Steam began
recording unlock timestamps (i.e. before the enforcement period).
Returns 0 when started_at is empty or unparsable.
Returns 0 when started_at is empty or unparseable.
"""
if not started_at:
return 0

View File

@ -3,11 +3,11 @@ Picking a game should work like this:
1. user invokes script with specific flag for picking a game manually
2. user provides game steam id (in testing use 489830)
3. Script shows what game it believes this id means (in this case it should show The Elder Scrolls V: Skyrim Special Edition)
4. user confirms that this is the game they want to pick and confirm that they will not be able to use the script for up to 2 weeks or until the game is completed (100% achievements)
4. user confirms that this is the game they want to pick and confirm that they will not be able to use the script for up to 2 weeks or until the game is completed (100% achievments)
When user picks a game manually this should override the current pick if it exists
After picking manually backlog enforcer should make a note of that and very aggressively disallow user to do anything else
for a period of 2 weeks or until user completes a given game
After picking manually backlog enforcer should make a note of that and very aggresively disallow user to do anything else
for a period of 2 weeks or untill user completes a given game
Logic should be as follows:
1. backlog checks if a user picked game manually
a. if not -> continue as before
@ -16,4 +16,4 @@ Logic should be as follows:
3. if NOT show info that user picked a specific game manually and they have to finish it before using ANY OTHER functionality of backlog enforcer
test the functionality with 489830 (The Elder Scrolls V: Skyrim Special Edition)
as always first write full functionality confirm that it works alone and with the user and only AFTER that write tests and coverage and fix issues
as always first write full functionality confirm that it works alone and with the user and only AFTER that write tests and coverage and fix issues

View File

@ -21,7 +21,7 @@ from steam_backlog_enforcer._stats import (
from steam_backlog_enforcer._web_dataset import PaceVsHLTB
from steam_backlog_enforcer.config import Config, State
from steam_backlog_enforcer.protondb import ProtonDBRating
from steam_backlog_enforcer.steam_api import GameInfo, SteamAPIError
from steam_backlog_enforcer.steam_api import GameInfo
_PKG = "steam_backlog_enforcer._stats"
@ -990,24 +990,6 @@ class TestRefreshRecentlyPlayedCompletions:
result = _refresh_recently_played_completions(games, Config())
assert result == games
def test_steam_api_error_returns_games_unchanged(self) -> None:
"""A SteamAPIError while fetching owned games is swallowed."""
games = [GameInfo(1, "G", 10, 0, 60)]
with (
patch(f"{_PKG}.SNAPSHOT_FILE") as mock_sf,
patch(f"{_PKG}.SteamAPIClient") as mock_cls,
):
mock_sf.stat.return_value.st_mtime = 1_000_000.0
mock_cls.return_value.get_owned_games.side_effect = SteamAPIError(
"api down"
)
from steam_backlog_enforcer._stats import (
_refresh_recently_played_completions,
)
result = _refresh_recently_played_completions(games, Config())
assert result == games
def test_no_recently_played_returns_games_unchanged(self) -> None:
games = [GameInfo(1, "G", 10, 0, 60)]
with (