Converted to python flask #1
@ -10,7 +10,7 @@ from datetime import timedelta
|
||||
|
||||
|
||||
# Configs
|
||||
APP_NAME = 'WebFM'
|
||||
APP_NAME = 'WebFM'
|
||||
ROOT_FILE_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ class Config(object):
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
THREADED = True
|
||||
SECRET_KEY = secrets.token_hex(32)
|
||||
SECRET_KEY = "2A#GQafbREoblgMSQYomZSxbaPE6dt#"
|
||||
# SECRET_KEY = secrets.token_hex(32)
|
||||
|
||||
PERMANENT_SESSION_LIFETIME = timedelta(days = 7).total_seconds()
|
||||
SQLALCHEMY_DATABASE_URI = "sqlite:///static/db/webfm.db"
|
||||
@ -38,12 +39,14 @@ class Config(object):
|
||||
]
|
||||
|
||||
STATIC_FPTH = ROOT_FILE_PTH + "/static"
|
||||
REMUX_FOLDER = STATIC_FPTH + "/remuxs" # Remuxed files folder
|
||||
FFMPG_THUMBNLR = STATIC_FPTH + "/ffmpegthumbnailer" # Thumbnail generator binary
|
||||
|
||||
ABS_THUMBS_PTH = STATIC_FPTH + "/imgs/thumbnails" # Used for thumbnail generation
|
||||
REL_THUMBS_PTH = "static/imgs/thumbnails" # Used for flask thumbnail return
|
||||
|
||||
# We are overiding some of the the shellmen view settings with these to make it all work with flask.
|
||||
# These are passed along to the shellmen view from the Routes file upon the window controller creation.
|
||||
ABS_THUMBS_PTH = STATIC_FPTH + "/imgs/thumbnails" # Used for thumbnail generation
|
||||
REMUX_FOLDER = STATIC_FPTH + "/remuxs" # Remuxed files folder
|
||||
FFMPG_THUMBNLR = STATIC_FPTH + "/ffmpegthumbnailer" # Thumbnail generator binary
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@ from ... import app, oidc
|
||||
@app.route('/oidc-login', methods=['GET', 'POST'])
|
||||
@oidc.require_login
|
||||
def oidc_login():
|
||||
print(request)
|
||||
return redirect("/")
|
||||
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
# System import
|
||||
from os import path
|
||||
|
||||
|
||||
# Lib imports
|
||||
|
||||
|
||||
# Apoplication imports
|
||||
|
||||
|
||||
|
||||
class Settings:
|
||||
logger = None
|
||||
ABS_THUMBS_PTH = None # Used for thumbnail generation and is set by passing in
|
||||
REMUX_FOLDER = None # Used for Remuxed files and is set by passing in
|
||||
FFMPG_THUMBNLR = None # Used for thumbnail generator binary and is set by passing in
|
||||
HIDE_HIDDEN_FILES = True
|
||||
lock_folder = True
|
||||
go_past_home = False
|
||||
|
||||
subpath = "/LazyShare" # modify 'home' folder path
|
||||
locked_folders = "Synced Backup::::venv::::flasks".split("::::")
|
||||
mplayer_options = "-quiet -really-quiet -xy 1600 -geometry 50%:50%".split()
|
||||
music_app = "/opt/deadbeef/bin/deadbeef"
|
||||
media_app = "mpv"
|
||||
image_app = "mirage"
|
||||
office_app = "libreoffice"
|
||||
pdf_app = "evince"
|
||||
text_app = "leafpad"
|
||||
file_manager_app = "spacefm"
|
||||
remux_folder_max_disk_usage = "8589934592"
|
||||
|
||||
|
||||
fvideos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
|
||||
foffice = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf')
|
||||
fimages = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga')
|
||||
ftext = ('.txt', '.text', '.sh', '.cfg', '.conf')
|
||||
fmusic = ('.psf', '.mp3', '.ogg', '.flac', '.m4a')
|
||||
fpdf = ('.pdf')
|
@ -1,4 +1,4 @@
|
||||
from .import View
|
||||
from .view import View
|
||||
|
||||
|
||||
class Window:
|
||||
|
@ -1,6 +1,2 @@
|
||||
from .Settings import Settings
|
||||
from .Launcher import Launcher
|
||||
from .Path import Path
|
||||
from .View import View
|
||||
from .Window import Window
|
||||
from .WindowController import WindowController
|
||||
|
@ -9,8 +9,8 @@ from os.path import isdir, isfile, join
|
||||
|
||||
|
||||
# Application imports
|
||||
from . import Path, Settings, Launcher
|
||||
|
||||
from .utils import Settings, Launcher
|
||||
from . import Path
|
||||
|
||||
class View(Settings, Launcher, Path):
|
||||
def __init__(self):
|
4
src/core/utils/shellfm/windows/view/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
from .utils import *
|
||||
|
||||
from .Path import Path
|
||||
from .View import View
|
93
src/core/utils/shellfm/windows/view/utils/Settings.py
Normal file
@ -0,0 +1,93 @@
|
||||
# System import
|
||||
import json
|
||||
import os
|
||||
from os import path
|
||||
|
||||
# Lib imports
|
||||
|
||||
|
||||
# Apoplication imports
|
||||
|
||||
|
||||
|
||||
class Settings:
|
||||
logger = None
|
||||
|
||||
USER_HOME = path.expanduser('~')
|
||||
CONFIG_PATH = USER_HOME + "/.config/webfm"
|
||||
CONFIG_FILE = CONFIG_PATH + "/settings.json"
|
||||
HIDE_HIDDEN_FILES = True
|
||||
|
||||
GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
|
||||
DEFAULT_ICONS = CONFIG_PATH + "/icons"
|
||||
DEFAULT_ICON = DEFAULT_ICONS + "/text.png"
|
||||
FFMPG_THUMBNLR = CONFIG_PATH + "/ffmpegthumbnailer" # Thumbnail generator binary
|
||||
REMUX_FOLDER = USER_HOME + "/.remuxs" # Remuxed files folder
|
||||
|
||||
STEAM_BASE_URL = "https://steamcdn-a.akamaihd.net/steam/apps/"
|
||||
ICON_DIRS = ["/usr/share/pixmaps", "/usr/share/icons", USER_HOME + "/.icons" ,]
|
||||
BASE_THUMBS_PTH = USER_HOME + "/.thumbnails" # Used for thumbnail generation
|
||||
ABS_THUMBS_PTH = BASE_THUMBS_PTH + "/normal" # Used for thumbnail generation
|
||||
STEAM_ICONS_PTH = BASE_THUMBS_PTH + "/steam_icons"
|
||||
CONTAINER_ICON_WH = [128, 128]
|
||||
VIDEO_ICON_WH = [128, 64]
|
||||
SYS_ICON_WH = [56, 56]
|
||||
|
||||
# CONTAINER_ICON_WH = [128, 128]
|
||||
# VIDEO_ICON_WH = [96, 48]
|
||||
# SYS_ICON_WH = [96, 96]
|
||||
|
||||
subpath = ""
|
||||
go_past_home = None
|
||||
lock_folder = None
|
||||
locked_folders = None
|
||||
mplayer_options = None
|
||||
music_app = None
|
||||
media_app = None
|
||||
image_app = None
|
||||
office_app = None
|
||||
pdf_app = None
|
||||
text_app = None
|
||||
file_manager_app = None
|
||||
remux_folder_max_disk_usage = None
|
||||
|
||||
if path.isfile(CONFIG_FILE):
|
||||
with open(CONFIG_FILE) as infile:
|
||||
settings = json.load(infile)["settings"]
|
||||
|
||||
subpath = settings["base_of_home"]
|
||||
HIDE_HIDDEN_FILES = True if settings["hide_hidden_files"] == "true" else False
|
||||
go_past_home = True if settings["go_past_home"] == "true" else False
|
||||
lock_folder = True if settings["lock_folder"] == "true" else False
|
||||
locked_folders = settings["locked_folders"].split("::::")
|
||||
mplayer_options = settings["mplayer_options"].split()
|
||||
music_app = settings["music_app"]
|
||||
media_app = settings["media_app"]
|
||||
image_app = settings["image_app"]
|
||||
office_app = settings["office_app"]
|
||||
pdf_app = settings["pdf_app"]
|
||||
text_app = settings["text_app"]
|
||||
file_manager_app = settings["file_manager_app"]
|
||||
remux_folder_max_disk_usage = settings["remux_folder_max_disk_usage"]
|
||||
|
||||
# Filters
|
||||
fvideos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
|
||||
foffice = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf')
|
||||
fimages = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga')
|
||||
ftext = ('.txt', '.text', '.sh', '.cfg', '.conf')
|
||||
fmusic = ('.psf', '.mp3', '.ogg', '.flac', '.m4a')
|
||||
fpdf = ('.pdf')
|
||||
|
||||
|
||||
# Dire structure check
|
||||
if path.isdir(REMUX_FOLDER) == False:
|
||||
os.mkdir(REMUX_FOLDER)
|
||||
|
||||
if path.isdir(BASE_THUMBS_PTH) == False:
|
||||
os.mkdir(BASE_THUMBS_PTH)
|
||||
|
||||
if path.isdir(ABS_THUMBS_PTH) == False:
|
||||
os.mkdir(ABS_THUMBS_PTH)
|
||||
|
||||
if path.isdir(STEAM_ICONS_PTH) == False:
|
||||
os.mkdir(STEAM_ICONS_PTH)
|
2
src/core/utils/shellfm/windows/view/utils/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .Settings import Settings
|
||||
from .Launcher import Launcher
|
BIN
src/user_config/webfm/ffmpegthumbnailer
Executable file
BIN
src/user_config/webfm/icons/archive.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
src/user_config/webfm/icons/audio.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
src/user_config/webfm/icons/bin.png
Normal file
After Width: | Height: | Size: 858 B |
BIN
src/user_config/webfm/icons/dir.png
Normal file
After Width: | Height: | Size: 850 B |
BIN
src/user_config/webfm/icons/doc.png
Normal file
After Width: | Height: | Size: 702 B |
BIN
src/user_config/webfm/icons/pdf.png
Normal file
After Width: | Height: | Size: 925 B |
BIN
src/user_config/webfm/icons/presentation.png
Normal file
After Width: | Height: | Size: 882 B |
BIN
src/user_config/webfm/icons/spreadsheet.png
Normal file
After Width: | Height: | Size: 707 B |
BIN
src/user_config/webfm/icons/text.png
Normal file
After Width: | Height: | Size: 798 B |
BIN
src/user_config/webfm/icons/trash.png
Normal file
After Width: | Height: | Size: 989 B |
BIN
src/user_config/webfm/icons/video.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/user_config/webfm/icons/web.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
18
src/user_config/webfm/settings.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"settings": {
|
||||
"base_of_home": "/LazyShare",
|
||||
"hide_hidden_files": "true",
|
||||
"go_past_home": "true",
|
||||
"lock_folder": "true",
|
||||
"locked_folders": "Synced Backup::::venv::::flasks::::Cryptomator",
|
||||
"mplayer_options": "-quiet -really-quiet -xy 1600 -geometry 50%:50%",
|
||||
"music_app": "/opt/deadbeef/bin/deadbeef",
|
||||
"media_app": "mpv",
|
||||
"image_app": "mirage",
|
||||
"office_app": "libreoffice",
|
||||
"pdf_app": "evince",
|
||||
"text_app": "leafpad",
|
||||
"file_manager_app": "spacefm",
|
||||
"remux_folder_max_disk_usage": "8589934592"
|
||||
}
|
||||
}
|