This commit is contained in:
2026-02-27 22:14:14 -08:00
parent cf1e081ea7
commit 6e26242ef0
3 changed files with 52 additions and 13 deletions

View File

@@ -494,7 +494,7 @@
"mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})" "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})"
], ],
"regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})", "regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})",
"status": false "status": true
}, },
"mixdrop": { "mixdrop": {
"name": "mixdrop", "name": "mixdrop",
@@ -595,7 +595,7 @@
"(simfileshare\\.net/download/[0-9]+/)" "(simfileshare\\.net/download/[0-9]+/)"
], ],
"regexp": "(simfileshare\\.net/download/[0-9]+/)", "regexp": "(simfileshare\\.net/download/[0-9]+/)",
"status": true "status": false
}, },
"streamtape": { "streamtape": {
"name": "streamtape", "name": "streamtape",

View File

@@ -5,7 +5,7 @@ import sys
import json import json
import socket import socket
import re import re
from datetime import datetime from datetime import datetime, timedelta
from urllib.parse import urlparse, parse_qs from urllib.parse import urlparse, parse_qs
from pathlib import Path from pathlib import Path
from SYS.cmdlet_spec import Cmdlet, CmdletArg, parse_cmdlet_args from SYS.cmdlet_spec import Cmdlet, CmdletArg, parse_cmdlet_args
@@ -2086,6 +2086,9 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
cur = conn.cursor() cur = conn.cursor()
query = "SELECT timestamp, level, module, message FROM logs WHERE module = 'mpv'" query = "SELECT timestamp, level, module, message FROM logs WHERE module = 'mpv'"
params: List[str] = [] params: List[str] = []
cutoff_24h = (datetime.utcnow() - timedelta(hours=24)).strftime("%Y-%m-%d %H:%M:%S")
query += " AND timestamp >= ?"
params.append(cutoff_24h)
if log_filter_text: if log_filter_text:
query += " AND LOWER(message) LIKE ?" query += " AND LOWER(message) LIKE ?"
params.append(f"%{log_filter_text.lower()}%") params.append(f"%{log_filter_text.lower()}%")
@@ -2095,9 +2098,11 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
cur.close() cur.close()
conn.close() conn.close()
if log_filter_text: if log_filter_text:
print(f"MPV logs from database (mpv module, filtered by '{log_filter_text}', most recent first):") print(
f"MPV logs from database (mpv module, last 24h, filtered by '{log_filter_text}', most recent first):"
)
else: else:
print("MPV logs from database (mpv module, most recent first):") print("MPV logs from database (mpv module, last 24h, most recent first):")
if mpv_logs: if mpv_logs:
for timestamp, level, _module, message in mpv_logs: for timestamp, level, _module, message in mpv_logs:
ts = str(timestamp or "").strip() ts = str(timestamp or "").strip()
@@ -2305,7 +2310,7 @@ CMDLET = Cmdlet(
CmdletArg( CmdletArg(
name="log", name="log",
type="flag", type="flag",
description="Enable pipeable debug output, write an mpv log file, and optionally specify a filter string right after -log to search the stored logs", description="Enable pipeable debug output, write an mpv log file, and optionally specify a filter string right after -log to search stored mpv logs from the last 24 hours",
), ),
CmdletArg( CmdletArg(
name="borderless", name="borderless",

View File

@@ -1593,6 +1593,9 @@ def main() -> int:
ps1_text = r"""Param([Parameter(ValueFromRemainingArguments=$true)] $args) ps1_text = r"""Param([Parameter(ValueFromRemainingArguments=$true)] $args)
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$repo = (Resolve-Path (Join-Path $scriptDir "..")).Path $repo = (Resolve-Path (Join-Path $scriptDir "..")).Path
$venv = Join-Path $repo '.venv'
$py = Join-Path $venv 'Scripts\python.exe'
$requirements = Join-Path $repo 'scripts\requirements.txt'
# Automatically check for updates if this is a git repository # Automatically check for updates if this is a git repository
if (Test-Path (Join-Path $repo ".git")) { if (Test-Path (Join-Path $repo ".git")) {
@@ -1608,7 +1611,17 @@ if (Test-Path (Join-Path $repo ".git")) {
if (-not $skip) { if (-not $skip) {
Write-Host "Checking for updates..." -ForegroundColor Gray Write-Host "Checking for updates..." -ForegroundColor Gray
$update = git -C "$repo" pull --ff-only 2>&1 $update = git -C "$repo" pull --ff-only 2>&1
if ($update -like "*Updating*" -or $update -like "*Fast-forward*") { $repoUpdated = ($update -like "*Updating*" -or $update -like "*Fast-forward*")
if (-not $env:MM_NO_DEP_UPDATE -and (Test-Path $py) -and (Test-Path $requirements)) {
Write-Host "Checking Python module updates..." -ForegroundColor Gray
& $py -m pip install --disable-pip-version-check --upgrade -r $requirements *> $null
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: dependency update failed; continuing startup." -ForegroundColor Yellow
}
}
if ($repoUpdated) {
Clear-Host Clear-Host
Write-Host "Medeia-Macina has been updated. Please restart the application to apply changes." -ForegroundColor Cyan Write-Host "Medeia-Macina has been updated. Please restart the application to apply changes." -ForegroundColor Cyan
exit 0 exit 0
@@ -1619,8 +1632,6 @@ if (Test-Path (Join-Path $repo ".git")) {
} catch {} } catch {}
} }
$venv = Join-Path $repo '.venv'
$py = Join-Path $venv 'Scripts\python.exe'
if (Test-Path $py) { if (Test-Path $py) {
& $py -m scripts.cli_entry @args; exit $LASTEXITCODE & $py -m scripts.cli_entry @args; exit $LASTEXITCODE
} }
@@ -1665,6 +1676,10 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
"@echo off\n" "@echo off\n"
"setlocal enabledelayedexpansion\n" "setlocal enabledelayedexpansion\n"
f'set "REPO={repo_bat_str}"\n' f'set "REPO={repo_bat_str}"\n'
"set \"VENV=!REPO!\\.venv\"\n"
"set \"PY=!VENV!\\Scripts\\python.exe\"\n"
"set \"ENTRY=!REPO!\\scripts\\cli_entry.py\"\n"
"set \"REQ=!REPO!\\scripts\\requirements.txt\"\n"
"\n" "\n"
":: Automatically check for updates if this is a git repository\n" ":: Automatically check for updates if this is a git repository\n"
"if not defined MM_NO_UPDATE (\n" "if not defined MM_NO_UPDATE (\n"
@@ -1680,7 +1695,15 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
" if \"!AUTO_UPDATE!\" == \"true\" (\n" " if \"!AUTO_UPDATE!\" == \"true\" (\n"
" echo Checking for updates...\n" " echo Checking for updates...\n"
" git -C \"!REPO!\" pull --ff-only | findstr /i /c:\"Updating\" /c:\"Fast-forward\" >nul 2>&1\n" " git -C \"!REPO!\" pull --ff-only | findstr /i /c:\"Updating\" /c:\"Fast-forward\" >nul 2>&1\n"
" if !errorlevel! == 0 (\n" " set \"REPO_UPDATED=false\"\n"
" if !errorlevel! == 0 set \"REPO_UPDATED=true\"\n"
" if not defined MM_NO_DEP_UPDATE (\n"
" if exist \"!PY!\" if exist \"!REQ!\" (\n"
" echo Checking Python module updates...\n"
" \"!PY!\" -m pip install --disable-pip-version-check --upgrade -r \"!REQ!\" >nul 2>&1\n"
" )\n"
" )\n"
" if \"!REPO_UPDATED!\" == \"true\" (\n"
" cls\n" " cls\n"
" echo Medeia-Macina has been updated. Please restart the application to apply changes.\n" " echo Medeia-Macina has been updated. Please restart the application to apply changes.\n"
" exit /b 0\n" " exit /b 0\n"
@@ -1690,9 +1713,6 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
" )\n" " )\n"
")\n" ")\n"
"\n" "\n"
"set \"VENV=!REPO!\\.venv\"\n"
"set \"PY=!VENV!\\Scripts\\python.exe\"\n"
"set \"ENTRY=!REPO!\\scripts\\cli_entry.py\"\n"
"if exist \"!PY!\" (\n" "if exist \"!PY!\" (\n"
" \"!PY!\" \"!ENTRY!\" %*\n" " \"!PY!\" \"!ENTRY!\" %*\n"
" exit /b !ERRORLEVEL!\n" " exit /b !ERRORLEVEL!\n"
@@ -1869,7 +1889,21 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
' if [ "$AUTO_UPDATE" = "true" ]; then\n' ' if [ "$AUTO_UPDATE" = "true" ]; then\n'
' echo "Checking for updates..."\n' ' echo "Checking for updates..."\n'
' UPDATE_OUT=$(git -C "$REPO" pull --ff-only 2>&1)\n' ' UPDATE_OUT=$(git -C "$REPO" pull --ff-only 2>&1)\n'
' REPO_UPDATED="false"\n'
' if echo "$UPDATE_OUT" | grep -qiE \'Updating|Fast-forward\'; then\n' ' if echo "$UPDATE_OUT" | grep -qiE \'Updating|Fast-forward\'; then\n'
' REPO_UPDATED="true"\n'
' fi\n'
' MM_PY=""\n'
' if [ -x "$VENV/bin/python3" ]; then\n'
' MM_PY="$VENV/bin/python3"\n'
' elif [ -x "$VENV/bin/python" ]; then\n'
' MM_PY="$VENV/bin/python"\n'
' fi\n'
' if [ -z "${MM_NO_DEP_UPDATE:-}" ] && [ -n "$MM_PY" ] && [ -f "$REPO/scripts/requirements.txt" ]; then\n'
' echo "Checking Python module updates..."\n'
' "$MM_PY" -m pip install --disable-pip-version-check --upgrade -r "$REPO/scripts/requirements.txt" >/dev/null 2>&1 || true\n'
' fi\n'
' if [ "$REPO_UPDATED" = "true" ]; then\n'
' clear\n' ' clear\n'
' echo "Medeia-Macina has been updated. Please restart the application to apply changes."\n' ' echo "Medeia-Macina has been updated. Please restart the application to apply changes."\n'
' exit 0\n' ' exit 0\n'