chore(deps):drop plyer as a dependency and switch to platformdirs

This commit is contained in:
Benex254
2024-08-05 09:47:00 +03:00
parent d2a328c2c8
commit 536e175a3a
4 changed files with 13 additions and 54 deletions

View File

@@ -1,15 +0,0 @@
[DEFAULT]
server =
continue_from_history = False
quality = 0
auto_next = True
sort_by = search match
downloads_dir = /home/benxl-85/Videos/FastAnime
translation_type = sub
[stream]
[general]
[anilist]

View File

@@ -3,7 +3,7 @@ import os
import sys
from platform import platform
import plyer
from platformdirs import PlatformDirs
from rich.traceback import install
install(show_locals=True)
@@ -15,6 +15,12 @@ __version__ = "0.3.0"
PLATFORM = platform()
APP_NAME = "FastAnime"
AUTHOR = "Benex254"
GIT_REPO = "github.com"
REPO = f"{GIT_REPO}/{AUTHOR}/{APP_NAME}"
dirs = PlatformDirs(appname=APP_NAME, appauthor=AUTHOR, ensure_exists=True)
# ---- app deps ----
APP_DIR = os.path.abspath(os.path.dirname(__file__))
@@ -22,31 +28,16 @@ CONFIGS_DIR = os.path.join(APP_DIR, "configs")
ASSETS_DIR = os.path.join(APP_DIR, "assets")
# ----- user configs and data -----
if PLATFORM == "windows":
APP_DATA_DIR_ = os.environ.get("LOCALAPPDATA", APP_DIR)
else:
APP_DATA_DIR_ = os.environ.get("XDG_DATA_HOME", APP_DIR)
if not APP_DATA_DIR_:
APP_DATA_DIR = os.path.join(APP_DIR, "data")
else:
APP_DATA_DIR = os.path.join(APP_DATA_DIR_, APP_NAME)
if not os.path.exists(APP_DATA_DIR):
os.mkdir(APP_DATA_DIR)
APP_DATA_DIR = dirs.user_config_dir
if not APP_DATA_DIR:
APP_DATA_DIR = dirs.user_data_dir
USER_DATA_PATH = os.path.join(APP_DATA_DIR, "user_data.json")
USER_CONFIG_PATH = os.path.join(APP_DATA_DIR, "config.ini")
# video dir
if vid_path := plyer.storagepath.get_videos_dir(): # type: ignore
USER_DOWNLOADS_DIR = os.path.join(vid_path, "FastAnime")
else:
USER_DOWNLOADS_DIR = os.path.join(APP_DIR, "videos")
if not os.path.exists(USER_DOWNLOADS_DIR):
os.mkdir(USER_DOWNLOADS_DIR)
USER_DOWNLOADS_DIR = dirs.user_downloads_dir
def FastAnime(gui=False):

19
poetry.lock generated
View File

@@ -1144,23 +1144,6 @@ files = [
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "plyer"
version = "2.1.0"
description = "Platform-independent wrapper for platform-dependent APIs"
optional = false
python-versions = "*"
files = [
{file = "plyer-2.1.0-py2.py3-none-any.whl", hash = "sha256:1b1772060df8b3045ed4f08231690ec8f7de30f5a004aa1724665a9074eed113"},
{file = "plyer-2.1.0.tar.gz", hash = "sha256:65b7dfb7e11e07af37a8487eb2aa69524276ef70dad500b07228ce64736baa61"},
]
[package.extras]
android = ["pyjnius"]
dev = ["flake8", "mock"]
ios = ["pyobjus"]
macosx = ["pyobjus"]
[[package]]
name = "pre-commit"
version = "3.7.1"
@@ -1786,4 +1769,4 @@ test = ["pytest (>=8.1,<9.0)"]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "51811bf7a41344b911fbf883ede9fab2b0a93dc68c59ad90d2aab5ccd0339a51"
content-hash = "2ea2a2ce566efdc50ed0d3cc5e37f746e9a49d32af2bc82a94161ced3c5cb8f6"

View File

@@ -11,7 +11,6 @@ python = "^3.10"
kivy = "^2.3.0"
yt-dlp = "^2024.5.27"
ffpyplayer = "^4.5.1"
plyer = "^2.1.0"
fuzzywuzzy = "^0.18.0"
rich = "^13.7.1"
click = "^8.1.7"
@@ -20,6 +19,7 @@ kivymd = [{url = "https://github.com/kivymd/KivyMD/archive/master.zip"}]
pyshortcuts = "^1.9.0"
inquirerpy = "^0.3.4"
platformdirs = "^4.2.2"
[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
isort = "^5.13.2"