-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeriesToolkit.ps1
More file actions
68 lines (62 loc) · 2.55 KB
/
Copy pathSeriesToolkit.ps1
File metadata and controls
68 lines (62 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#requires -Version 5.1
<#
.NOTES
Движок: исправление подвыражений $(if ...) в строках с оператором -f (PS 5.1).
Папки эпизодов King of the Hill / Царь горы: префикс 3 или 4 цифры + пробел в имени каталога.
Родительский Fetch-VideoMetadata.ps1: fuzzy-поиск эпизода TMDB по названию (Find-TmdbTvEpisodeByTitleFuzzy) для связки с MediaInboxToolkit.
#>
[CmdletBinding()]
param(
[ValidateSet('Batch', 'Manual')]
[string]$Mode = 'Batch',
[string]$RootPath = '\\MEDIA-SERVER\Video\Cartoons',
[string]$SeriesPath = '',
[string]$ReferenceRootPath = '\\MEDIA-SERVER\Video\Series',
[string]$HtmlPath = '',
[string]$LogDirectory = '',
[switch]$Apply,
[switch]$DryRun,
[switch]$VerifyOnly,
[switch]$UseTmdb,
[string]$TmdbApiKey = '',
[ValidateSet('Fast', 'Balanced', 'Full')]
[string]$ExecutionProfile = 'Balanced',
[switch]$SkipAutoVersion,
[switch]$SkipAutoSync,
[switch]$SkipAutoBuildExe
)
try {
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force -ErrorAction SilentlyContinue
} catch { }
try {
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)
[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false)
} catch { }
$legacyScript = Join-Path $PSScriptRoot 'SeriesToolkit.Engine.ps1'
if ($null -eq $legacyScript -or -not (Test-Path -LiteralPath $legacyScript)) {
throw "Engine script not found next to launcher."
}
if ([string]::IsNullOrWhiteSpace($LogDirectory)) {
$LogDirectory = Join-Path $PSScriptRoot 'LOGS'
}
if (-not $SkipAutoVersion) {
$bump = Join-Path $PSScriptRoot 'Bump-Version.ps1'
if (Test-Path -LiteralPath $bump) {
try {
$bumpArgs = @{ ProjectRoot = $PSScriptRoot; ChangeNote = "Автоинкремент версии при изменении SeriesToolkit.ps1 ($Mode)." }
if ($SkipAutoBuildExe) { $bumpArgs['SkipAutoBuildExe'] = $true }
& $bump @bumpArgs
} catch { }
}
}
$runArgs = @{}
foreach ($k in $PSBoundParameters.Keys) { $runArgs[$k] = $PSBoundParameters[$k] }
$runArgs['LogDirectory'] = $LogDirectory
$null = $runArgs.Remove('SkipAutoVersion')
$null = $runArgs.Remove('SkipAutoSync')
$null = $runArgs.Remove('SkipAutoBuildExe')
& $legacyScript @runArgs
$syncScript = Join-Path $PSScriptRoot 'Sync-GitHub.ps1'
if ((-not $SkipAutoSync) -and (Test-Path -LiteralPath $syncScript)) {
try { & $syncScript -ProjectRoot $PSScriptRoot } catch { }
}