Skip to content

Commit

Permalink
v1.4.12.44 beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdelsol committed Mar 26, 2024
1 parent 174194e commit 776820e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 49 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ You'll find them in the app folder[^3]:
[^3]:The app is installed by default in `%LocalAppData%\Programs\Sfvip All x64`, `%LocalAppData%\Programs\Sfvip All x86` or the installation directory you've specified during the installation.

# Build
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.43-informational?logo=github)](/build_config.py#L27)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc%208.5k-informational?logo=file-code)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.44-informational?logo=github)](/build_config.py#L27)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc%208.4k-informational?logo=file-code)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![Ruff](https://custom-icon-badges.demolab.com/badge/Ruff-informational?logo=ruff-color)](https://docs.astral.sh/ruff/)
[![Python](https://custom-icon-badges.demolab.com/badge/Python%203.11.8-linen?logo=python-color)](https://www.python.org/downloads/release/python-3118/)
[![mitmproxy](https://custom-icon-badges.demolab.com/badge/Mitmproxy%2010.2.4-linen?logo=mitmproxy-black)](https://mitmproxy.org/)
Expand Down
3 changes: 3 additions & 0 deletions build/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.4.12.44
* Fix minor bugs.

## 1.4.12.43
* Option to modify _Sfvip All_ install directory.
* When updating the Install directory won't be asked again
Expand Down
2 changes: 1 addition & 1 deletion build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Build:
main: ClassVar = "sfvip_all.py"
company: ClassVar = "sebdelsol"
name: ClassVar = "Sfvip All"
version: ClassVar = "1.4.12.43"
version: ClassVar = "1.4.12.44"
dir: ClassVar = "build"
enable_console: ClassVar = False
logs_dir: ClassVar = "../logs"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# packages to run the app for both environments
mitmproxy>=10.1.6
msgspec>=0.18.6
psutil>=5.9.8
tkinter-tooltip>=2.2.0
watchdog>=3.0.0
# for downloading the player and libmpv
Expand Down
10 changes: 7 additions & 3 deletions src/mitm/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
ValidMediaTypes = Literal["vod", "series"]


def _in_beetween(value: float, min_value: float, max_value: float) -> float:
return max(min_value, min(value, max_value))


class MacQuery(NamedTuple):
server: str
type: ValidMediaTypes
Expand Down Expand Up @@ -129,7 +133,7 @@ def valid(self) -> bool:

@property
def missing_percent(self) -> float:
return ((self.total - self.actual) / self.total) if self.total else 1
return _in_beetween((self.total - self.actual) / self.total, 0, 100) if self.total else 1


class MacCacheSave(MACCacheFile):
Expand Down Expand Up @@ -219,7 +223,7 @@ class AllCached(NamedTuple):

def title(self, loaded: MacCacheLoad) -> str:
if missing_percent := loaded.missing_percent:
percent = max(1, min(round(missing_percent * 100), 99))
percent = _in_beetween(round(missing_percent * 100), 1, 99)
missing_str = f"⚠️ {self.missing.format(percent=percent)}"
else:
missing_str = f"✔ {self.complete}"
Expand All @@ -244,7 +248,7 @@ class MACCache(CacheCleaner):
cached_all_category = "cached_all_category"
cached_header = "ListCached"
cached_header_bytes = cached_header.encode()
clean_after_days = 15
clean_after_days = 30
suffixes = MediaTypes
all_category = "*"

Expand Down
6 changes: 4 additions & 2 deletions src/sfvip/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from pathlib import Path
from typing import Optional

from ..winapi import mutex, pids
import psutil

from ..winapi import mutex
from .utils.retry import RetryIfException

logger = logging.getLogger(__name__)
Expand All @@ -30,7 +32,7 @@ def _save(self) -> None:
json.dump(self, f, indent=2)

def _clean_pids(self, pid_to_remove: Optional[str]) -> None:
clean_pids = [pid for pid in self if not pids.exists(int(pid)) or pid == pid_to_remove]
clean_pids = [pid for pid in self if not psutil.pid_exists(int(pid)) or pid == pid_to_remove]
for pid in clean_pids:
del self[pid]

Expand Down
41 changes: 0 additions & 41 deletions src/winapi/pids.py

This file was deleted.

0 comments on commit 776820e

Please sign in to comment.