2021-03-18 05:29:58 +00:00
|
|
|
# System import
|
2021-09-04 03:57:00 +00:00
|
|
|
import json
|
2021-04-24 21:43:45 +00:00
|
|
|
import os
|
2021-03-18 05:29:58 +00:00
|
|
|
from os import path
|
|
|
|
|
|
|
|
# Lib imports
|
|
|
|
|
|
|
|
|
|
|
|
# Apoplication imports
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings:
|
|
|
|
logger = None
|
|
|
|
|
2022-06-14 23:20:38 +00:00
|
|
|
USR_SHELLFM = "/usr/share/shellfm"
|
2021-04-24 21:43:45 +00:00
|
|
|
USER_HOME = path.expanduser('~')
|
2022-06-14 23:20:38 +00:00
|
|
|
CONFIG_PATH = f"{USER_HOME}/.config/shellfm"
|
2022-02-11 06:29:50 +00:00
|
|
|
CONFIG_FILE = f"{CONFIG_PATH}/settings.json"
|
2021-09-04 04:00:33 +00:00
|
|
|
HIDE_HIDDEN_FILES = True
|
2021-09-04 03:57:00 +00:00
|
|
|
|
2022-06-14 23:20:38 +00:00
|
|
|
GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
|
2022-02-11 06:29:50 +00:00
|
|
|
DEFAULT_ICONS = f"{CONFIG_PATH}/icons"
|
|
|
|
DEFAULT_ICON = f"{DEFAULT_ICONS}/text.png"
|
|
|
|
FFMPG_THUMBNLR = f"{CONFIG_PATH}/ffmpegthumbnailer" # Thumbnail generator binary
|
|
|
|
REMUX_FOLDER = f"{USER_HOME}/.remuxs" # Remuxed files folder
|
2021-04-24 21:43:45 +00:00
|
|
|
|
2022-10-28 01:41:27 +00:00
|
|
|
ICON_DIRS = ["/usr/share/icons", f"{USER_HOME}/.icons" "/usr/share/pixmaps"]
|
2022-02-11 06:29:50 +00:00
|
|
|
BASE_THUMBS_PTH = f"{USER_HOME}/.thumbnails" # Used for thumbnail generation
|
|
|
|
ABS_THUMBS_PTH = f"{BASE_THUMBS_PTH}/normal" # Used for thumbnail generation
|
|
|
|
STEAM_ICONS_PTH = f"{BASE_THUMBS_PTH}/steam_icons"
|
2021-04-24 21:43:45 +00:00
|
|
|
|
2021-11-27 07:54:08 +00:00
|
|
|
# Dir structure check
|
2022-02-11 06:29:50 +00:00
|
|
|
if not path.isdir(REMUX_FOLDER):
|
2021-04-24 21:43:45 +00:00
|
|
|
os.mkdir(REMUX_FOLDER)
|
|
|
|
|
2022-02-11 06:29:50 +00:00
|
|
|
if not path.isdir(BASE_THUMBS_PTH):
|
2021-04-24 21:43:45 +00:00
|
|
|
os.mkdir(BASE_THUMBS_PTH)
|
|
|
|
|
2022-02-11 06:29:50 +00:00
|
|
|
if not path.isdir(ABS_THUMBS_PTH):
|
2021-04-24 21:43:45 +00:00
|
|
|
os.mkdir(ABS_THUMBS_PTH)
|
|
|
|
|
2022-02-11 06:29:50 +00:00
|
|
|
if not path.isdir(STEAM_ICONS_PTH):
|
2021-04-24 21:43:45 +00:00
|
|
|
os.mkdir(STEAM_ICONS_PTH)
|
2022-02-11 06:29:50 +00:00
|
|
|
|
|
|
|
if not os.path.exists(DEFAULT_ICONS):
|
2022-06-14 23:20:38 +00:00
|
|
|
DEFAULT_ICONS = f"{USR_SHELLFM}/icons"
|
2022-02-11 06:29:50 +00:00
|
|
|
DEFAULT_ICON = f"{DEFAULT_ICONS}/text.png"
|
2022-06-14 23:20:38 +00:00
|
|
|
|
|
|
|
with open(CONFIG_FILE) as f:
|
|
|
|
settings = json.load(f)
|
|
|
|
config = settings["config"]
|
|
|
|
|
|
|
|
subpath = config["base_of_home"]
|
|
|
|
STEAM_CDN_URL = config["steam_cdn_url"]
|
|
|
|
FFMPG_THUMBNLR = FFMPG_THUMBNLR if config["thumbnailer_path"] == "" else config["thumbnailer_path"]
|
|
|
|
HIDE_HIDDEN_FILES = True if config["hide_hidden_files"] == "true" else False
|
|
|
|
go_past_home = True if config["go_past_home"] == "" else config["go_past_home"]
|
|
|
|
lock_folder = True if config["lock_folder"] == "true" else False
|
|
|
|
locked_folders = config["locked_folders"].split("::::")
|
|
|
|
mplayer_options = config["mplayer_options"].split()
|
|
|
|
music_app = config["music_app"]
|
|
|
|
media_app = config["media_app"]
|
|
|
|
image_app = config["image_app"]
|
|
|
|
office_app = config["office_app"]
|
|
|
|
pdf_app = config["pdf_app"]
|
|
|
|
code_app = config["code_app"]
|
|
|
|
text_app = config["text_app"]
|
|
|
|
terminal_app = config["terminal_app"]
|
|
|
|
container_icon_wh = config["container_icon_wh"]
|
|
|
|
video_icon_wh = config["video_icon_wh"]
|
|
|
|
sys_icon_wh = config["sys_icon_wh"]
|
|
|
|
file_manager_app = config["file_manager_app"]
|
|
|
|
remux_folder_max_disk_usage = config["remux_folder_max_disk_usage"]
|
|
|
|
|
|
|
|
# Filters
|
|
|
|
filters = settings["filters"]
|
|
|
|
fcode = tuple(filters["code"])
|
|
|
|
fvideos = tuple(filters["videos"])
|
|
|
|
foffice = tuple(filters["office"])
|
|
|
|
fimages = tuple(filters["images"])
|
|
|
|
ftext = tuple(filters["text"])
|
|
|
|
fmusic = tuple(filters["music"])
|
|
|
|
fpdf = tuple(filters["pdf"])
|