test
This commit is contained in:
@@ -494,7 +494,7 @@
|
||||
"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": {
|
||||
"name": "mixdrop",
|
||||
@@ -595,7 +595,7 @@
|
||||
"(simfileshare\\.net/download/[0-9]+/)"
|
||||
],
|
||||
"regexp": "(simfileshare\\.net/download/[0-9]+/)",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"streamtape": {
|
||||
"name": "streamtape",
|
||||
|
||||
@@ -5,7 +5,7 @@ import sys
|
||||
import json
|
||||
import socket
|
||||
import re
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from pathlib import Path
|
||||
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()
|
||||
query = "SELECT timestamp, level, module, message FROM logs WHERE module = 'mpv'"
|
||||
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:
|
||||
query += " AND LOWER(message) LIKE ?"
|
||||
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()
|
||||
conn.close()
|
||||
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:
|
||||
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:
|
||||
for timestamp, level, _module, message in mpv_logs:
|
||||
ts = str(timestamp or "").strip()
|
||||
@@ -2305,7 +2310,7 @@ CMDLET = Cmdlet(
|
||||
CmdletArg(
|
||||
name="log",
|
||||
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(
|
||||
name="borderless",
|
||||
|
||||
@@ -1593,6 +1593,9 @@ def main() -> int:
|
||||
ps1_text = r"""Param([Parameter(ValueFromRemainingArguments=$true)] $args)
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.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
|
||||
if (Test-Path (Join-Path $repo ".git")) {
|
||||
@@ -1608,7 +1611,17 @@ if (Test-Path (Join-Path $repo ".git")) {
|
||||
if (-not $skip) {
|
||||
Write-Host "Checking for updates..." -ForegroundColor Gray
|
||||
$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
|
||||
Write-Host "Medeia-Macina has been updated. Please restart the application to apply changes." -ForegroundColor Cyan
|
||||
exit 0
|
||||
@@ -1619,8 +1632,6 @@ if (Test-Path (Join-Path $repo ".git")) {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
$venv = Join-Path $repo '.venv'
|
||||
$py = Join-Path $venv 'Scripts\python.exe'
|
||||
if (Test-Path $py) {
|
||||
& $py -m scripts.cli_entry @args; exit $LASTEXITCODE
|
||||
}
|
||||
@@ -1665,6 +1676,10 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
|
||||
"@echo off\n"
|
||||
"setlocal enabledelayedexpansion\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"
|
||||
":: Automatically check for updates if this is a git repository\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"
|
||||
" echo Checking for updates...\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"
|
||||
" echo Medeia-Macina has been updated. Please restart the application to apply changes.\n"
|
||||
" exit /b 0\n"
|
||||
@@ -1690,9 +1713,6 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
|
||||
" )\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"
|
||||
" \"!PY!\" \"!ENTRY!\" %*\n"
|
||||
" exit /b !ERRORLEVEL!\n"
|
||||
@@ -1869,7 +1889,21 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
|
||||
' if [ "$AUTO_UPDATE" = "true" ]; then\n'
|
||||
' echo "Checking for updates..."\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'
|
||||
' 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'
|
||||
' echo "Medeia-Macina has been updated. Please restart the application to apply changes."\n'
|
||||
' exit 0\n'
|
||||
|
||||
Reference in New Issue
Block a user