Skip to content

Commit fc5b071

Browse files
committed
chore: apply upstream commit adjustments for URL extraction; add regression test script
1 parent 34cb7f4 commit fc5b071

3 files changed

Lines changed: 263 additions & 77 deletions

File tree

scripts/regression_test.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Regression test: compare tv_downloader_fixed and tv_downloader_enhanced outputs for a URL
2+
# Usage: . .venv\Scripts\Activate.ps1; ./scripts/regression_test.ps1 -Url "https://www.tradingview.com/scripts/luxalgo/"
3+
param(
4+
[string]$Url = "https://www.tradingview.com/scripts/luxalgo/",
5+
[int]$MaxPages = 3
6+
)
7+
8+
$env:PINE_OUTPUT_DIR = ""
9+
$base = Get-Location
10+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "test_fixed" | Out-Null
11+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "test_enhanced" | Out-Null
12+
13+
Write-Host "Running fixed downloader..." -ForegroundColor Cyan
14+
python tv_downloader_fixed.py --url $Url --output ./test_fixed --max-pages $MaxPages --visible:$false
15+
16+
Write-Host "Running enhanced downloader..." -ForegroundColor Cyan
17+
python tv_downloader_enhanced.py --url $Url --output ./test_enhanced --no-resume --delay 1.5 --visible:$false
18+
19+
function Count-PineFiles($dir) {
20+
if (!(Test-Path $dir)) { return 0 }
21+
return (Get-ChildItem -Recurse -Include *.pine -Path $dir -ErrorAction SilentlyContinue | Measure-Object).Count
22+
}
23+
24+
$fixedCount = Count-PineFiles "$base\test_fixed"
25+
$enhancedCount = Count-PineFiles "$base\test_enhanced"
26+
27+
Write-Host "\nResults:" -ForegroundColor Green
28+
Write-Host " Fixed downloader: $fixedCount .pine files" -ForegroundColor Yellow
29+
Write-Host " Enhanced downloader: $enhancedCount .pine files" -ForegroundColor Yellow
30+
31+
if ($fixedCount -ne $enhancedCount) {
32+
Write-Host "Counts differ. Inspect ./test_fixed and ./test_enhanced for details." -ForegroundColor Red
33+
} else {
34+
Write-Host "Counts match." -ForegroundColor Green
35+
}

systemd/tv-downloader.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Wants=network-online.target
77
Type=oneshot
88
WorkingDirectory=/home/serveradmin/Tradingview-Pine-Script-Downloader
99
Environment=PINE_OUTPUT_DIR=/mnt/pinescripts
10-
Environment=DOWNLOAD_URL="https://www.tradingview.com/scripts/luxalgo/"
10+
Environment=DOWNLOAD_URL="https://www.tradingview.com/scripts/?script_type=libraries"
1111
ExecStart=/home/serveradmin/Tradingview-Pine-Script-Downloader/scripts/run_download.sh --url ${DOWNLOAD_URL}
1212
User=serveradmin
1313
Nice=10

0 commit comments

Comments
 (0)