diff --git a/src/Javinizer/Private/Convert-HTMLCharacter.ps1 b/src/Javinizer/Private/Convert-HTMLCharacter.ps1
index 293c098b..5c4070b5 100644
--- a/src/Javinizer/Private/Convert-HTMLCharacter.ps1
+++ b/src/Javinizer/Private/Convert-HTMLCharacter.ps1
@@ -19,7 +19,6 @@ function Convert-HTMLCharacter {
-replace ''', ''
$newString = $String.Trim()
- # Write-JVLog -Level Debug -Message "Begin String: [$String]; End string: [$newString]"
Write-Output $newString
}
}
diff --git a/src/Javinizer/Private/Convert-JVTitle.ps1 b/src/Javinizer/Private/Convert-JVTitle.ps1
index 295515d3..718a2bdc 100644
--- a/src/Javinizer/Private/Convert-JVTitle.ps1
+++ b/src/Javinizer/Private/Convert-JVTitle.ps1
@@ -86,7 +86,7 @@ function Convert-JVTitle {
$id = ($file | Select-String $RegexString).Matches.Groups[$RegexIdMatch].Value
$partNum = ($file | Select-String $RegexString).Matches.Groups[$RegexPtMatch].Value
} catch {
- Write-JVLog -Level Debug -Message "File [$file] not matched by regex"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "File [$file] not matched by regex"
break
}
if ($fileBaseNameUpper -eq 1) {
@@ -198,7 +198,7 @@ function Convert-JVTitle {
<#
#Match ID-###-A, ID-###-B, etc.
elseif ($fileBaseNameUpper[$x] -match "[-][0-9]{1,6}[-][a-iA-I]$") {
- Write-JVLog -Level Debug -Message "Match 3"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Match 3"
$fileP1, $fileP2, $fileP3, $fileP4 = $fileBaseNameUpper[$x] -split "([-][0-9]{1,6})[-]([a-zA-Z])"
$fileBaseNameUpperCleaned += $fileP1 + $fileP2 + $fileP3
}
diff --git a/src/Javinizer/Private/Get-JVUrlLocation.ps1 b/src/Javinizer/Private/Get-JVUrlLocation.ps1
index c3d2bc00..2f00b7a2 100644
--- a/src/Javinizer/Private/Get-JVUrlLocation.ps1
+++ b/src/Javinizer/Private/Get-JVUrlLocation.ps1
@@ -70,7 +70,7 @@ function Get-JVUrlLocation {
Source = 'jav321'
}
} else {
- Write-JVLog -Level Warning -Message "[$($MyInvocation.MyCommand.Name)] [Url - $Url] not matched"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$($MyInvocation.MyCommand.Name)] [Url - $Url] not matched"
}
}
Write-Output $testUrlObject
diff --git a/src/Javinizer/Private/Scraper.R18.ps1 b/src/Javinizer/Private/Scraper.R18.ps1
index 0011029a..ec1ecf90 100644
--- a/src/Javinizer/Private/Scraper.R18.ps1
+++ b/src/Javinizer/Private/Scraper.R18.ps1
@@ -223,10 +223,10 @@ function Get-R18Series {
if ($series -like '*...') {
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$seriesUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$seriesUrl]"
$seriesSearch = Invoke-WebRequest -Uri $seriesUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level ERROR -Message "Error [GET] on URL [$seriesUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level ERROR -Message "Error [GET] on URL [$seriesUrl]: $PSItem"
}
$series = (Convert-HtmlCharacter -String ((((($seriesSearch.Content -split '
')[1]) -split '<\/span>')[0]) -split '')[1]) -replace "`t", ''
}
diff --git a/src/Javinizer/Private/Set-JavlibraryOwned.ps1 b/src/Javinizer/Private/Set-JavlibraryOwned.ps1
index 027fe431..6860d409 100644
--- a/src/Javinizer/Private/Set-JavlibraryOwned.ps1
+++ b/src/Javinizer/Private/Set-JavlibraryOwned.ps1
@@ -1,54 +1,48 @@
function Set-JavlibraryOwned {
+ [CmdletBinding()]
param (
[object]$AjaxId,
[object]$JavlibraryUrl,
[object]$Settings
)
- Write-Debug "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] Function started"
- Write-Debug "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] AjaxId: $AjaxId"
- Write-Debug "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] Url: $JavlibraryUrl"
-
- try {
- $timeout = New-TimeSpan -Seconds $Settings.JavLibrary.'request-timeout-sec'
- $stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
- while ($check.content -notmatch '"ERROR":1' -and $stopwatch.elapsed -lt $timeout) {
- if ($check.Content -match '"ERROR":-3') {
- Start-Sleep -Seconds 3
+ process {
+ try {
+ $timeout = New-TimeSpan -Seconds $Settings.JavLibrary.'request-timeout-sec'
+ $stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
+ while ($check.content -notmatch '"ERROR":1' -and $stopwatch.elapsed -lt $timeout) {
+ if ($check.Content -match '"ERROR":-3') {
+ Start-Sleep -Seconds 3
+ }
+ $check = Invoke-WebRequest -Uri "https://www.javlibrary.com/ajax/ajax_cv_favoriteadd.php" `
+ -Method "POST" `
+ -Headers @{
+ "method" = "POST"
+ "authority" = "www.javlibrary.com"
+ "scheme" = "https"
+ "path" = "/ajax/ajax_cv_favoriteadd.php"
+ "accept" = "application/json, text/javascript, */*; q=0.01"
+ "x-requested-with" = "XMLHttpRequest"
+ "user-agent" = $session.UserAgent
+ "origin" = "https://www.javlibrary.com"
+ "sec-fetch-site" = "same-origin"
+ "sec-fetch-mode" = "cors"
+ "sec-fetch-dest" = "empty"
+ "referer" = $JavlibraryUrl
+ "accept-encoding" = "gzip, deflate, br"
+ "accept-language" = "en-US,en;q=0.9"
+ "cookie" = "timezone=420; over18=18; __cfduid=$SessionCFDUID; userid=$($Settings.JavLibrary.username); session=$($Settings.JavLibrary.'session-cookie')"
+ } `
+ -ContentType "application/x-www-form-urlencoded; charset=UTF-8" `
+ -Body "type=2&targetid=$AjaxId" `
+ -Verbose:$false
}
- $check = Invoke-WebRequest -Uri "https://www.javlibrary.com/ajax/ajax_cv_favoriteadd.php" `
- -Method "POST" `
- -Headers @{
- "method" = "POST"
- "authority" = "www.javlibrary.com"
- "scheme" = "https"
- "path" = "/ajax/ajax_cv_favoriteadd.php"
- "accept" = "application/json, text/javascript, */*; q=0.01"
- "x-requested-with" = "XMLHttpRequest"
- "user-agent" = $session.UserAgent
- "origin" = "https://www.javlibrary.com"
- "sec-fetch-site" = "same-origin"
- "sec-fetch-mode" = "cors"
- "sec-fetch-dest" = "empty"
- "referer" = $JavlibraryUrl
- "accept-encoding" = "gzip, deflate, br"
- "accept-language" = "en-US,en;q=0.9"
- "cookie" = "timezone=420; over18=18; __cfduid=$SessionCFDUID; userid=$($Settings.JavLibrary.username); session=$($Settings.JavLibrary.'session-cookie')"
- } `
- -ContentType "application/x-www-form-urlencoded; charset=UTF-8" `
- -Body "type=2&targetid=$AjaxId" `
- -Verbose:$false
- }
- if ($stopwatch.elapsed -gt $timeout) {
- Write-Error "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] Movie [$JavlibraryUrl] timed out while setting owned status"
- Write-Log -Log $javinizerLogPath -Level ERROR -Text "Movie [$JavlibraryUrl] timed out while setting owned status"
+ if ($stopwatch.elapsed -gt $timeout) {
+ Write-JVLog -Level Warning -Message "Failed setting owned on JAVLibrary [$JavlibraryUrl]: Timed out"
+ }
+ } catch {
+ Write-JVLog -Level Error -Message "Failed setting owned on JAVLibrary [$JavlibraryUrl]: $PSItem"
}
- } catch {
- Write-Error "[$(Get-TimeStamp)][$($MyInvocation.MyCommand.Name)] Error setting owned status for [$JavlibraryUrl]: $PSItem"
- Write-Log -Log $javinizerLogPath -Level ERROR -Text "Error setting owned status for [$JavlibraryUrl]: $PSItem"
}
}
-
-
-
diff --git a/src/Javinizer/Private/Test-JVSettings.ps1 b/src/Javinizer/Private/Test-JVSettings.ps1
index 9f17dc87..7b5430fb 100644
--- a/src/Javinizer/Private/Test-JVSettings.ps1
+++ b/src/Javinizer/Private/Test-JVSettings.ps1
@@ -20,41 +20,39 @@ function Test-JVSettings {
[String]$Type
)
- process {
- foreach ($setting in $SettingsGroup) {
- $settingValue = $Settings.($setting)
-
- if ($Type -eq 'Path') {
- if ($settingValue -ne '') {
- if (!(Test-Path -Path $settingValue -IsValid)) {
- Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a Path"
- }
- }
- }
+ foreach ($setting in $SettingsGroup) {
+ $settingValue = $Settings.($setting)
- if ($Type -eq 'Boolean') {
- if ($settingValue -ne 0 -and $settingValue -ne 1 -and $settingValue.GetType() -ne 'System.ValueType') {
- Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a Boolean"
+ if ($Type -eq 'Path') {
+ if ($settingValue -ne '') {
+ if (!(Test-Path -Path $settingValue)) {
+ Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a path"
}
}
+ }
- if ($Type -eq 'Integer') {
- if ($settingValue.GetType().BaseType -ne 'System.ValueType' -and $settingValue.GetType().Name -notlike 'int*') {
- Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a Integer"
- }
+ if ($Type -eq 'Boolean') {
+ if ($settingValue -ne 0 -and $settingValue -ne 1) {
+ Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a boolean"
+ }
+ }
+ if ($Type -eq 'Integer') {
+ if ($settingValue.GetType().BaseType -ne 'System.ValueType' -and $settingValue.GetType().Name -notlike 'int*') {
+ Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as an integer"
}
- if ($Type -eq 'String') {
- if ($settingValue.GetType().BaseType -ne 'System.Object' -and $settingValue.GetType().Name -ne 'String') {
- Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a String"
- }
+ }
+
+ if ($Type -eq 'String') {
+ if ($settingValue.GetType().BaseType -ne 'System.Object' -and $settingValue.GetType().Name -ne 'String') {
+ Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a string"
}
+ }
- if ($Type -eq 'Array') {
- if ($settingValue.GetType().Name -notlike '*Object*') {
- Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as a Array"
- }
+ if ($Type -eq 'Array') {
+ if ($settingValue.GetType().BaseType -notlike '*array*' -and $settingValue.GetType().BaseType -notlike '*object*') {
+ Write-JVLog -Level Error -Message "Error occurred when validating setting [$setting] with value [$settingValue] as an array"
}
}
}
@@ -70,6 +68,8 @@ function Test-JVSettings {
$booleanSettings = @(
'admin.log',
+ 'javlibrary.request.interval',
+ 'javlibrary.request.timeout',
'match.regex',
'scraper.movie.dmm',
'scraper.movie.jav321',
@@ -100,8 +100,6 @@ function Test-JVSettings {
) | Test-JVSettingsGroup -Settings $Settings -Type Boolean
$integerSettings = @(
- 'javlibrary.request.interval',
- 'javlibrary.request.timeout',
'match.minimumfilesize',
'match.regex.idmatch',
'match.regex.ptmatch',
@@ -147,7 +145,7 @@ function Test-JVSettings {
'sort.metadata.priority.screenshoturl',
'sort.metadata.priority.series',
'sort.metadata.priority.title',
- 'sort.metadata.priority.trailerurl'
+ 'sort.metadata.priority.trailerurl',
'sort.metadata.requiredfield'
) | Test-JVSettingsGroup -Settings $Settings -Type Array
diff --git a/src/Javinizer/Private/Write-JVLog.ps1 b/src/Javinizer/Private/Write-JVLog.ps1
index 7cd1cf92..aeb0b089 100644
--- a/src/Javinizer/Private/Write-JVLog.ps1
+++ b/src/Javinizer/Private/Write-JVLog.ps1
@@ -1,35 +1,68 @@
function Write-JVLog {
[CmdletBinding()]
param (
- [Parameter(Mandatory = $true)]
- [string]$Message,
+ [Parameter(Mandatory = $true, Position = 0)]
+ [String]$Message,
- [Parameter(Mandatory = $true)]
+ [Parameter(Mandatory = $true, Position = 1)]
[ValidateSet('Debug', 'Info', 'Warning', 'Error')]
- [string]$Level,
+ [String]$Level,
+
+ [Parameter()]
+ [AllowEmptyString()]
+ [String]$Write,
+
+ [Parameter()]
+ [AllowEmptyString()]
+ [String]$WriteLevel,
+
+ [Parameter()]
+ [AllowEmptyString()]
+ [String]$LogPath,
[Parameter()]
[ValidateSet('Break', 'Continue', 'Ignore', 'Inquire', 'SilentlyContinue', 'Stop', 'Suspend')]
- [string]$Action = 'Stop'
+ [String]$Action = 'Stop'
)
+ $timeStamp = Get-Date -Format s
+
if ($Level -eq 'Debug') {
- Write-Debug -Message $Message
- Write-Log -Level $Level -Message $Message | Wait-Logging
+ if ($WriteLevel -eq 'Debug') {
+ $formattedMessage = "[$timeStamp][DEBUG] $Message"
+ }
+ Write-Debug -Message "$Message"
}
if ($Level -eq 'Info') {
+ if ($WriteLevel -eq 'Debug' -or $WriteLevel -eq 'Info') {
+ $formattedMessage = "[$timeStamp][INFO ] $Message"
+ }
Write-Verbose -Message $Message
- Write-Log -Level $Level -Message $Message | Wait-Logging
}
if ($Level -eq 'Warning') {
+ if ($WriteLevel -eq 'Debug' -or $WriteLevel -eq 'Info' -or $WriteLevel -eq 'Warning') {
+ $formattedMessage = "[$timeStamp][WARN ] $Message"
+ }
Write-Warning -Message $Message
- Write-Log -Level $Level -Message $Message | Wait-Logging
}
if ($Level -eq 'Error') {
- Write-Log -Level $Level -Message $Message | Wait-Logging
+ if ($writeLevel -eq 'Debug' -or $WriteLevel -eq 'Info' -or $WriteLevel -eq 'Warning' -or $WriteLevel -eq 'Error') {
+ $formattedMessage = "[$timeStamp][ERROR] $Message"
+ }
Write-Error -Message $Message -ErrorAction $Action
}
+
+ if ($LogPath -ne '' -and $null -ne $LogPath) {
+ if ($formattedMessage -ne '' -and $null -ne $formattedMessage) {
+ if ($Write -eq 1) {
+ $LogMutex = New-Object System.Threading.Mutex($false, "LogMutex")
+ $LogMutex.WaitOne() | Out-Null
+ $formattedMessage | Out-File -FilePath $LogPath -Append
+ $LogMutex.ReleaseMutex() | Out-Null
+ }
+ }
+ }
}
diff --git a/src/Javinizer/Public/Get-DmmData.ps1 b/src/Javinizer/Public/Get-DmmData.ps1
index 9f2dc6d1..a0b5dae6 100644
--- a/src/Javinizer/Public/Get-DmmData.ps1
+++ b/src/Javinizer/Public/Get-DmmData.ps1
@@ -13,10 +13,10 @@ function Get-DmmData {
$dmmUrl = $Url
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$dmmUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$dmmUrl]"
$webRequest = Invoke-WebRequest -Uri $dmmUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "Error [GET] on URL [$dmmUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "Error [GET] on URL [$dmmUrl]: $PSItem"
}
$movieDataObject = [PSCustomObject]@{
@@ -41,7 +41,7 @@ function Get-DmmData {
#TrailerUrl = Get-DmmTrailerUrl -WebRequest $webRequest
}
- Write-JVLog -Level Debug -Message "DMM data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "DMM data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
Write-Output $movieDataObject
}
}
diff --git a/src/Javinizer/Public/Get-DmmUrl.ps1 b/src/Javinizer/Public/Get-DmmUrl.ps1
index 6548933a..6cee39a5 100644
--- a/src/Javinizer/Public/Get-DmmUrl.ps1
+++ b/src/Javinizer/Public/Get-DmmUrl.ps1
@@ -15,7 +15,7 @@ function Get-DmmUrl {
if ($r18Url) {
$r18Id = (($r18Url -split 'id=')[1] -split '\/')[0]
$directUrl = "https://www.dmm.co.jp/digital/videoa/-/detail/=/cid=$r18Id"
- Write-JVLog -Level Debug -Message "Converting R18 Id to Dmm: [$r18Id] -> [$directUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Converting R18 Id to Dmm: [$r18Id] -> [$directUrl]"
} else {
# Convert the movie Id (ID-###) to content Id (ID00###) to match dmm naming standards
if ($Id -match '([a-zA-Z|tT28|rR18]+-\d+z{0,1}Z{0,1}e{0,1}E{0,1})') {
@@ -26,10 +26,10 @@ function Get-DmmUrl {
$searchUrl = "https://www.dmm.co.jp/search/?redirect=1&enc=UTF-8&category=&searchstr=$Id"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$searchUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$searchUrl]: $PSItem"
}
$retryCount = 3
@@ -41,19 +41,19 @@ function Get-DmmUrl {
}
if ($numResults -ge 1) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$retryCount] of [$numResults] results for [$Id]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$retryCount] of [$numResults] results for [$Id]"
$count = 1
foreach ($result in $searchResults) {
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
$webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem"
}
$resultId = Get-DmmContentId -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
if ($resultId -match $Id) {
$directUrl = $result
break
@@ -69,7 +69,7 @@ function Get-DmmUrl {
}
if ($null -eq $directUrl) {
- Write-JVLog -Level Warning -Message "[$Id] not matched on DMM"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] not matched on DMM"
return
} else {
$urlObject = [PSCustomObject]@{
diff --git a/src/Javinizer/Public/Get-JVAggregatedData.ps1 b/src/Javinizer/Public/Get-JVAggregatedData.ps1
index a2bd2d48..73d24fc0 100644
--- a/src/Javinizer/Public/Get-JVAggregatedData.ps1
+++ b/src/Javinizer/Public/Get-JVAggregatedData.ps1
@@ -195,7 +195,7 @@ function Get-JVAggregatedData {
} else {
$aggregatedDataObject.$field = $sourceData.$field
}
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [$field - $priority] Set to [$($sourceData.$field | ConvertTo-Json -Compress)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [$field - $priority] Set to [$($sourceData.$field | ConvertTo-Json -Compress)]"
}
}
}
@@ -208,7 +208,7 @@ function Get-JVAggregatedData {
try {
$actressCsv = Import-Csv -LiteralPath $thumbCsvPath
} catch {
- Write-JVLog -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when importing thumbnail csv [$genreCsvPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when importing thumbnail csv [$genreCsvPath]: $PSItem"
}
for ($x = 0; $x -lt $aggregatedDataObject.Actress.Count; $x++) {
@@ -241,7 +241,7 @@ function Get-JVAggregatedData {
$aggregatedDataObject.Actress[$x].LastName = $actressCsv[$matched[0].Index].LastName
}
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Alias - $aliasString] replaced by [$actressString]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Alias - $aliasString] replaced by [$actressString]"
}
}
@@ -258,7 +258,7 @@ function Get-JVAggregatedData {
$aggregatedDataObject.Actress[$x].ThumbUrl = $matchedActress.ThumbUrl
$aggregatedDataObject.Actress[$x].JapaneseName = $matchedActress.JapaneseName
$actressString = "$($aggregatedDataObject.Actress[$x].LastName) $($aggregatedDataObject.Actress[$x].FirstName)".Trim()
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
}
# Check if JapaneseName matches the thumb csv
} elseif ($matched = Compare-Object -ReferenceObject $actressCsv -DifferenceObject $aggregatedDataObject.Actress[$x] -IncludeEqual -ExcludeDifferent -PassThru -Property @('JapaneseName')) {
@@ -274,7 +274,7 @@ function Get-JVAggregatedData {
$aggregatedDataObject.Actress[$x].LastName = $matchedActress.LastName
$aggregatedDataObject.Actress[$x].ThumbUrl = $matchedActress.ThumbUrl
$actressString = "$($aggregatedDataObject.Actress[$x].JapaneseName)".Trim()
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
}
# Check if FirstName matches the thumb csv for single-word names
} elseif ($null -eq $aggregatedDataObject.Actress[$x].LastName -and $null -ne $aggregatedDataObject.Actress[$x].FirstName) {
@@ -291,12 +291,12 @@ function Get-JVAggregatedData {
$aggregatedDataObject.Actress[$x].ThumbUrl = $matchedActress.ThumbUrl
$aggregatedDataObject.Actress[$x].JapaneseName = $matchedActress.JapaneseName
$actressString = "$($aggregatedDataObject.Actress[$x].FirstName)".Trim()
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [ThumbUrl - $($matchedActress.ThumbUrl)] added to actress [$actressString]"
}
}
}
} else {
- Write-JVLog -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Thumbnail csv file is missing or cannot be found at path [$thumbCsvPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Thumbnail csv file is missing or cannot be found at path [$thumbCsvPath]"
}
}
@@ -305,20 +305,20 @@ function Get-JVAggregatedData {
try {
$replaceGenres = Import-Csv -LiteralPath $GenreCsvPath
} catch {
- Write-JVLog -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when importing genre csv [$GenreCsvPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when importing genre csv [$GenreCsvPath]: $PSItem"
}
$newGenres = $aggregatedDataObject.Genre
foreach ($genrePair in $replaceGenres) {
if ($($genrePair.Original -in $newGenres)) {
$newGenres = $newGenres -replace "$($genrePair.Original)", "$($genrePair.Replacement)"
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Genre - $($genrePair.Original)] replaced as [$($genrePair.Replacement)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Genre - $($genrePair.Original)] replaced as [$($genrePair.Replacement)]"
}
}
$aggregatedDataObject.Genre = $newGenres
} else {
- Write-JVLog -Level Error "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Genre csv file is missing or cannot be found at path [$grenreCsvPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] Genre csv file is missing or cannot be found at path [$grenreCsvPath]"
}
}
@@ -328,7 +328,7 @@ function Get-JVAggregatedData {
foreach ($genre in $IgnoreGenre) {
if ($genre -in $newGenres) {
$newGenres = $newGenres -replace "$genre", $null
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Genre - $genre] ignored"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Genre - $genre] ignored"
}
}
$aggregatedDataObject.Genre = $newGenres | Where-Object { $_ -ne '' }
@@ -341,10 +341,10 @@ function Get-JVAggregatedData {
if ($null -ne $translatedDescription -or $translatedDescription -ne '') {
$aggregatedDataObject.Description = $translatedDescription
- Write-JVLog -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Description - $descriptionTemp] translated to [$($aggregatedDataObject.Description)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data[0].Id)] [$($MyInvocation.MyCommand.Name)] [Description - $descriptionTemp] translated to [$($aggregatedDataObject.Description)]"
}
} else {
- Write-JVLog -Level Warning -Message "[$($Data[0].Id)] Translation language is missing"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$($Data[0].Id)] Translation language is missing"
}
}
diff --git a/src/Javinizer/Public/Get-JVData.ps1 b/src/Javinizer/Public/Get-JVData.ps1
index 93341262..033b63f5 100644
--- a/src/Javinizer/Public/Get-JVData.ps1
+++ b/src/Javinizer/Public/Get-JVData.ps1
@@ -97,7 +97,7 @@ function Get-JVData {
}
if ($R18) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - R18] [Url - $R18Url]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - R18] [Url - $R18Url]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-R18" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:R18Url) {
@@ -109,7 +109,7 @@ function Get-JVData {
}
if ($R18Zh) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - R18Zh] [Url - $R18ZhUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - R18Zh] [Url - $R18ZhUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-R18Zh" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:R18ZhUrl) {
@@ -121,7 +121,7 @@ function Get-JVData {
}
if ($Javlibrary) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Javlibrary] [Url - $JavlibraryUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Javlibrary] [Url - $JavlibraryUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-Javlibrary" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavlibraryUrl) {
@@ -133,7 +133,7 @@ function Get-JVData {
}
if ($JavlibraryJa) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavlibraryJa] [Url - $JavlibraryJaUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavlibraryJa] [Url - $JavlibraryJaUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-JavlibraryJa" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavlibraryJaUrl) {
@@ -145,7 +145,7 @@ function Get-JVData {
}
if ($JavlibraryZh) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavlibraryZh] [Url - $JavlibraryZhUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavlibraryZh] [Url - $JavlibraryZhUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-JavlibraryZh" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavlibraryZhUrl) {
@@ -157,7 +157,7 @@ function Get-JVData {
}
if ($Dmm) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Dmm] [Url - $DmmUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Dmm] [Url - $DmmUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-Dmm" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:DmmUrl) {
@@ -169,7 +169,7 @@ function Get-JVData {
}
if ($Javbus) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Javbus] [Url - $JavbusUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Javbus] [Url - $JavbusUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-Javbus" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavbusUrl) {
@@ -181,7 +181,7 @@ function Get-JVData {
}
if ($JavbusJa) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavbusJa] [Url - $JavbusJaUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavbusJa] [Url - $JavbusJaUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-JavbusJa" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavbusJaUrl) {
@@ -193,7 +193,7 @@ function Get-JVData {
}
if ($JavbusZh) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavbusZh] [Url - $JavbusZhUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - JavbusZh] [Url - $JavbusZhUrl]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-JavbusZh" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:JavbusZhUrl) {
@@ -205,7 +205,7 @@ function Get-JVData {
}
if ($Jav321) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Jav321] [$Url - $Jav321Url]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Search - Jav321] [$Url - $Jav321Url]"
Start-ThreadJob -ThrottleLimit 150 -Name "jvdata-Jav321" -ScriptBlock {
Import-Module $using:jvModulePath
if ($using:Jav321Url) {
@@ -221,18 +221,18 @@ function Get-JVData {
$jobName = @((Get-Job | Where-Object { $_.Name -like "jvdata-*" } | Select-Object Name).Name)
if ($jobCount -eq 0) {
- Write-JVLog -Level Warning -Message "[$Id] No scrapers were run"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] No scrapers were run"
return
} else {
Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] [Waiting - Scraper jobs] [$jobName]"
# Wait-Job is used separately rather than in a pipeline due to the PowerShell.Exit job that is being created during the first-run of this function
- Wait-Job -Id $jobId
+ Wait-Job -Id $jobId | Out-Null
Write-Debug "[$Id] [$($MyInvocation.MyCommand.Name)] [Completed - Scraper jobs] [$jobName]"
$javinizerDataObject = Get-Job -Id $jobId | Receive-Job
$hasData = ($javinizerDataObject | Select-Object Source).Source
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Success - Scraper jobs] [$hasData]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Success - Scraper jobs] [$hasData]"
$dataObject = [PSCustomObject]@{
Data = $javinizerDataObject
@@ -243,11 +243,11 @@ function Get-JVData {
}
}
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured during scraper jobs: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured during scraper jobs: $PSItem"
} finally {
# Remove all completed or running jobs before exiting this script
# If jobs remain after closure, it may cause issues in concurrent runs
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Removed - Scraper jobs]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] [Removed - Scraper jobs]"
Get-Job | Remove-Job -Force
}
}
diff --git a/src/Javinizer/Public/Get-Jav321Data.ps1 b/src/Javinizer/Public/Get-Jav321Data.ps1
index 9b34b61a..a7393bdb 100644
--- a/src/Javinizer/Public/Get-Jav321Data.ps1
+++ b/src/Javinizer/Public/Get-Jav321Data.ps1
@@ -12,10 +12,10 @@ function Get-Jav321Data {
$movieDataObject = @()
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$Url]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$Url]"
$webRequest = Invoke-RestMethod -Uri $Url -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
}
$movieDataObject = [PSCustomObject]@{
@@ -34,7 +34,7 @@ function Get-Jav321Data {
ScreenshotUrl = Get-Jav321ScreenshotUrl -WebRequest $webRequest
}
- Write-JVLog -Level Debug -Message "Jav321 data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Jav321 data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
Write-Output $movieDataObject
}
}
diff --git a/src/Javinizer/Public/Get-Jav321Url.ps1 b/src/Javinizer/Public/Get-Jav321Url.ps1
index 9bf906db..378e3ed2 100644
--- a/src/Javinizer/Public/Get-Jav321Url.ps1
+++ b/src/Javinizer/Public/Get-Jav321Url.ps1
@@ -12,10 +12,10 @@ function Get-Jav321Url {
$searchUrl = "https://jp.jav321.com/search"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-WebRequest -Uri $searchUrl -Method Post -Body "sn=$Id" -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
}
@@ -33,16 +33,16 @@ function Get-Jav321Url {
}
if ($numResults -ge 1) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]"
$count = 1
foreach ($result in $searchResults) {
$result = "https://jp.jav321.com/video/$result"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
$webRequest = Invoke-RestMethod -Uri $result -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
}
$resultId = Get-Jav321Id -WebRequest $webRequest
@@ -51,7 +51,7 @@ function Get-Jav321Url {
break
}
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
if ($count -eq $Tries) {
break
}
@@ -60,7 +60,7 @@ function Get-Jav321Url {
}
if ($null -eq $directUrl) {
- Write-JVLog -Level Warning -Message "[$Id] Search [$Id] not matched on Jav321"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] Search [$Id] not matched on Jav321"
return
} else {
$urlObject = [PSCustomObject]@{
@@ -70,7 +70,7 @@ function Get-Jav321Url {
Write-Output $urlObject
}
} else {
- Write-JVLog -Level Warning -Message "[$Id] Search [$Id] not matched on Jav321"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] Search [$Id] not matched on Jav321"
return
}
}
diff --git a/src/Javinizer/Public/Get-JavbusData.ps1 b/src/Javinizer/Public/Get-JavbusData.ps1
index 53c728ef..ce61c121 100644
--- a/src/Javinizer/Public/Get-JavbusData.ps1
+++ b/src/Javinizer/Public/Get-JavbusData.ps1
@@ -12,10 +12,10 @@ function Get-JavbusData {
$movieDataObject = @()
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$Url]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$Url]"
$webRequest = Invoke-RestMethod -Uri $Url -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
}
$movieDataObject = [PSCustomObject]@{
@@ -37,7 +37,7 @@ function Get-JavbusData {
ScreenshotUrl = Get-JavbusScreenshotUrl -WebRequest $webRequest
}
- Write-JVLog -Level Debug -Message "JavBus data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "JavBus data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
Write-Output $movieDataObject
}
}
diff --git a/src/Javinizer/Public/Get-JavbusUrl.ps1 b/src/Javinizer/Public/Get-JavbusUrl.ps1
index 86269ccc..fcb1e30b 100644
--- a/src/Javinizer/Public/Get-JavbusUrl.ps1
+++ b/src/Javinizer/Public/Get-JavbusUrl.ps1
@@ -16,20 +16,20 @@ function Get-JavbusUrl {
$searchUrl = "https://www.javbus.com/search/$Id&type=0&parent=uc"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false
} catch {
try {
$searchUrl = "https://www.javbus.com/uncensored/search/$Id&type=0&parent=uc"
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false
} catch {
try {
$searchUrl = "https://www.javbus.org/search/$Id&type=0&parent=uc"
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-RestMethod -Uri $searchUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Warning -Message "[$Id] not matched on JavBus"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] not matched on JavBus"
return
}
}
@@ -49,15 +49,15 @@ function Get-JavbusUrl {
}
if ($numResults -ge 1) {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Searching [$Tries] of [$numResults] results for [$Id]"
$count = 1
foreach ($result in $searchResults) {
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
$webRequest = Invoke-RestMethod -Uri $result -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occurred on [GET] on URL [$result]: $PSItem"
}
$resultId = Get-JavbusId -WebRequest $webRequest
if ($resultId -eq $Id) {
@@ -69,7 +69,7 @@ function Get-JavbusUrl {
break
}
- Write-JVLog -Level Debug -Message "Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Result [$count] is [$resultId]"
if ($count -eq $Tries) {
break
@@ -79,7 +79,7 @@ function Get-JavbusUrl {
}
if ($null -eq $directUrl) {
- Write-JVLog -Level Warning -Message "[$Id] not matched on JavBus"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] not matched on JavBus"
return
} else {
$urlObject = [PSCustomObject]@{
diff --git a/src/Javinizer/Public/Get-JavlibraryData.ps1 b/src/Javinizer/Public/Get-JavlibraryData.ps1
index cceef35e..41cdf990 100644
--- a/src/Javinizer/Public/Get-JavlibraryData.ps1
+++ b/src/Javinizer/Public/Get-JavlibraryData.ps1
@@ -12,10 +12,10 @@ function Get-JavlibraryData {
$movieDataObject = @()
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$Url] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$Url] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
$webRequest = Invoke-WebRequest -Uri $Url -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
}
$movieDataObject = [PSCustomObject]@{
@@ -37,7 +37,7 @@ function Get-JavlibraryData {
ScreenshotUrl = Get-JavlibraryScreenshotUrl -WebRequest $webRequest
}
- Write-JVLog -Level Debug -Message "JAVLibrary data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "JAVLibrary data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
Write-Output $movieDataObject
}
}
diff --git a/src/Javinizer/Public/Get-JavlibraryUrl.ps1 b/src/Javinizer/Public/Get-JavlibraryUrl.ps1
index 2b1d5f26..9bc06e09 100644
--- a/src/Javinizer/Public/Get-JavlibraryUrl.ps1
+++ b/src/Javinizer/Public/Get-JavlibraryUrl.ps1
@@ -24,10 +24,10 @@ function Get-JavlibraryUrl {
$searchUrl = "$BaseUrl/en/vl_searchbyid.php?keyword=$Id"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
$webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
}
# Check if the search uniquely matched a video page
@@ -35,14 +35,14 @@ function Get-JavlibraryUrl {
$searchResultUrl = $webRequest.BaseResponse.RequestMessage.RequestUri.AbsoluteUri
if ($searchResultUrl -match "$BaseUrl?v=") {
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
$webRequest = Invoke-WebRequest -Uri $searchResultUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchResultUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
}
$resultId = Get-JavlibraryId -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]"
if ($resultId -eq $Id) {
$javlibraryUrl = $searchResultUrl
}
@@ -64,14 +64,14 @@ function Get-JavlibraryUrl {
$directUrl = "$BaseUrl/en/?v=$videoId"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]"
$webRequest = Invoke-WebRequest -Uri $directUrl -Method Get -WebSession $Session -UserAgent $Session.UserAgent -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$directUrl] with Session: [$Session] and UserAgent: [$($Session.UserAgent)]: $PSItem"
}
$resultId = Get-JavlibraryId -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result [$count] is [$resultId]"
if ($resultId -eq $Id) {
$javlibraryUrl = (Get-JVUrlLocation -Url $webRequest.BaseResponse.RequestMessage.RequestUri.AbsoluteUri).Url
@@ -88,7 +88,7 @@ function Get-JavlibraryUrl {
}
if ($null -eq $javlibraryUrl) {
- Write-JVLog -Level Warning -Message "[$Id] not matched on JavLibrary"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] not matched on JavLibrary"
return
} else {
if ($Language -eq 'ja') {
diff --git a/src/Javinizer/Public/Get-R18Data.ps1 b/src/Javinizer/Public/Get-R18Data.ps1
index 5405f9f0..86b308fb 100644
--- a/src/Javinizer/Public/Get-R18Data.ps1
+++ b/src/Javinizer/Public/Get-R18Data.ps1
@@ -60,10 +60,10 @@ function Get-R18Data {
}
try {
- Write-JVLog -Level Debug -Message "Performing [GET] on URL [$Url]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [GET] on URL [$Url]"
$webRequest = Invoke-WebRequest -Uri $Url -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "Error [GET] on URL [$Url]: $PSItem"
}
$movieDataObject = [PSCustomObject]@{
@@ -88,7 +88,7 @@ function Get-R18Data {
TrailerUrl = Get-R18TrailerUrl -WebRequest $webRequest
}
- Write-JVLog -Level Debug -Message "R18 data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "R18 data object: $($movieDataObject | ConvertTo-Json -Depth 32 -Compress)"
Write-Output $movieDataObject
}
}
diff --git a/src/Javinizer/Public/Get-R18Url.ps1 b/src/Javinizer/Public/Get-R18Url.ps1
index fd5e9c4d..c1e45cbe 100644
--- a/src/Javinizer/Public/Get-R18Url.ps1
+++ b/src/Javinizer/Public/Get-R18Url.ps1
@@ -19,7 +19,7 @@ function Get-R18Url {
# If contentId is given, convert it back to standard movie ID to validate
if ($Id -match '(?:\d{1,5})?([a-zA-Z]{2,10}|[tT]28|[rR]18)(\d{1,5})') {
- Write-JVLog -Level Debug -Message "Content ID [$Id] detected"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Content ID [$Id] detected"
$splitId = $Id | Select-String -Pattern '([a-zA-Z|tT28|rR18]{1,10})(\d{1,5})'
$studioName = $splitId.Matches.Groups[1].Value
$rawStudioId = $splitId.Matches.Groups[2].Value
@@ -37,10 +37,10 @@ function Get-R18Url {
# Try matching the video with Video ID
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
}
$retryCount = 3
@@ -52,19 +52,19 @@ function Get-R18Url {
}
if ($numResults -ge 1) {
- Write-JVLog -Level Debug -Message "Searching [$retryCount] of [$numResults] results for [$Id]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Searching [$retryCount] of [$numResults] results for [$Id]"
$count = 1
foreach ($result in $searchResults) {
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
$webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
}
$resultId = Get-R18Id -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Result [$count] is [$resultId]"
if ($resultId -eq $Id) {
$directUrl = $result
break
@@ -83,10 +83,10 @@ function Get-R18Url {
$searchUrl = "https://www.r18.com/common/search/searchword=$contentId/"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$searchUrl]"
$webRequest = Invoke-WebRequest -Uri $searchUrl -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$searchUrl]: $PSItem"
}
$retryCount = 5
@@ -100,14 +100,14 @@ function Get-R18Url {
$count = 1
foreach ($result in $altSearchResults) {
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$result]"
$webRequest = Invoke-WebRequest -Uri $result -Method Get -Verbose:$false
} catch {
- Write-JVLog -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Error occured on [GET] on URL [$result]: $PSItem"
}
$resultId = Get-R18Id -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "Result [$count] is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Result [$count] is [$resultId]"
if ($resultId -eq $Id) {
$directUrl = $result
break
@@ -126,7 +126,7 @@ function Get-R18Url {
$testUrl = "https://www.r18.com/videos/vod/movies/detail/-/id=$contentId/"
try {
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on Uri [$testUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Performing [GET] on Uri [$testUrl]"
$webRequest = Invoke-WebRequest -Uri $testUrl -Method Get -Verbose:$false
} catch {
$webRequest = $null
@@ -134,7 +134,7 @@ function Get-R18Url {
if ($null -ne $webRequest) {
$resultId = Get-R18Id -WebRequest $webRequest
- Write-JVLog -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$Id] [$($MyInvocation.MyCommand.Name)] Result is [$resultId]"
if ($resultId -eq $Id) {
$directUrl = $testUrl
}
@@ -142,7 +142,7 @@ function Get-R18Url {
}
if ($null -eq $directUrl) {
- Write-JVLog -Level Warning -Message "[$Id] not matched on R18"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Warning -Message "[$Id] not matched on R18"
return
} else {
if ($Language -eq 'zh') {
diff --git a/src/Javinizer/Public/Javinizer.ps1 b/src/Javinizer/Public/Javinizer.ps1
index 465a16f6..4dea2513 100644
--- a/src/Javinizer/Public/Javinizer.ps1
+++ b/src/Javinizer/Public/Javinizer.ps1
@@ -151,20 +151,18 @@ function Javinizer {
if ($Settings.'admin.log' -eq '1') {
if ($Settings.'location.log' -eq '') {
- $logPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvLog.log'
+ $script:JVLogPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvLog.log'
} else {
if (!(Test-Path -LiteralPath $Settings.'location.log' -PathType Leaf)) {
New-Item -Path $Settings.'location.log' | Out-Null
}
- $logPath = $Settings.'location.log'
- }
- Add-LoggingTarget -Name File -Configuration @{
- Path = $logPath
- Append = $true
- Encoding = 'utf8'
- Level = $Settings.'admin.log.level'
- Format = '[%{timestamp}] [%{level:-7}] %{message}'
+ $script:JVLogPath = $Settings.'location.log'
}
+
+ $script:JVLogWrite = '1'
+ $script:JVLogWriteLevel = $Settings.'admin.log.level'
+ } else {
+ $script:JVLogWrite = 0
}
if ($Settings.'location.thumbcsv' -eq '') {
@@ -188,20 +186,20 @@ function Javinizer {
if ($PSBoundParameters.ContainsKey('MoveToFolder')) {
if ($MoveToFolder -eq $true) {
$Settings.'sort.movetofolder' = 1
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.movetofolder] replaced as [1]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.movetofolder] replaced as [1]"
} elseif ($MoveToFolder -eq $false) {
$Settings.'sort.movetofolder' = 0
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.movetofolder] replaced as [1]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.movetofolder] replaced as [1]"
}
}
if ($PSBoundParameters.ContainsKey('RenameFile')) {
if ($RenameFile -eq $true) {
$Settings.'sort.renamefile' = 1
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.renamefile] replaced as [1]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.renamefile] replaced as [1]"
} elseif ($RenameFile -eq $false) {
$Settings.'sort.renamefile' = 0
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.renamefile] replaced as [0]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - sort.renamefile] replaced as [0]"
}
}
@@ -210,10 +208,12 @@ function Javinizer {
$settingName = $item.Key
$settingValue = $item.Value
$Settings."$($item.Key)" = $item.Value
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - $($item.Key)] replaced as [$($item.Value)]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [Setting - $($item.Key)] replaced as [$($item.Value)]"
}
}
+
+
# Validate the values in the settings file following all command-line transformations
$Settings = $Settings | Test-JVSettings
@@ -269,16 +269,16 @@ function Javinizer {
Write-Host "[$($MyInvocation.MyCommand.Name)] [SettingsPath - $SettingsPath]"
Invoke-Item -LiteralPath $SettingsPath
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening settings file [$SettingsPath]: $PSItem"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening settings file [$SettingsPath]: $PSItem"
}
}
if ($OpenLog) {
try {
- Write-Host "[$($MyInvocation.MyCommand.Name)] [LogPath - $logPath]"
- Invoke-Item -LiteralPath $logPath
+ Write-Host "[$($MyInvocation.MyCommand.Name)] [LogPath - $JVLogPath]"
+ Invoke-Item -LiteralPath $JVLogPath
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening log file [$logPath]: $PSItem"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening log file [$JVLogPath]: $PSItem"
}
}
@@ -287,7 +287,7 @@ function Javinizer {
Write-Host "[$($MyInvocation.MyCommand.Name)] [ThumbCsvPath - $thumbCsvPath]"
Invoke-Item -LiteralPath $thumbCsvPath
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
}
}
@@ -296,7 +296,7 @@ function Javinizer {
Write-Host "[$($MyInvocation.MyCommand.Name)] [GenreCsvPath - $genreCsvPath]"
Invoke-Item -LiteralPath $genreCsvPath
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when opening thumbcsv file [$]: $PSItem"
}
}
}
@@ -336,7 +336,7 @@ function Javinizer {
# This will check that the Path is valid
if (!(Test-Path -LiteralPath $Path)) {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Path [$Path] is not a valid path"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Path [$Path] is not a valid path"
}
# Default destination path to location.output in settings if not specified
@@ -346,26 +346,26 @@ function Javinizer {
# This will check that the DestinationPath is a valid directory
if (Test-Path -LiteralPath $DestinationPath -PathType Leaf) {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] DestinationPath [$DestinationPath] is not a valid directory path"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] DestinationPath [$DestinationPath] is not a valid directory path"
}
try {
$javMovies = $Settings | Get-JVItem -Path $Path -Recurse:$Recurse -Strict:$Strict
# Write-Host "[$($MyInvocation.MyCommand.Name)] [Path - $Path] [DestinationPath - $DestinationPath] [Files - $($javMovies.Count)]"
} catch {
- Write-JVLog -Level Warning -Message "Exiting -- no valid movies detected in [$Path]"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Warning -Message "Exiting -- no valid movies detected in [$Path]"
return
}
if ($Url) {
if (!(Test-Path -LiteralPath $Path -PathType Leaf)) {
- Write-JVLog -Level Warning -Message "Exiting -- [$Path] is not a valid single file path"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Warning -Message "Exiting -- [$Path] is not a valid single file path"
return
}
$javData = Get-JVData -Url $Url -Settings $Settings
if ($null -ne $javData) {
- $javAggregatedData = $javData | Get-JVAggregatedData -Settings $Settings | test-JVData -RequiredFields $Settings.'sort.metadata.requiredfield'
+ $javAggregatedData = $javData | Get-JVAggregatedData -Settings $Settings | Test-JVData -RequiredFields $Settings.'sort.metadata.requiredfield'
if ($null -ne $javAggregatedData) {
$javAggregatedData | Set-JVMovie -Path $javMovies.FullName -DestinationPath $DestinationPath -Settings $Settings -PartNumber $JavMovies.PartNumber -Force:$Force
}
@@ -418,17 +418,17 @@ function Javinizer {
foreach ($movie in $javMovies) {
# Write-Host "Sorting [$($movie.FileName)] as [$($movie.Id)]"
$index++
- $javData = Get-JVData -Id $movie.Id -Settings $Settings
+ $javData = Get-JVData -Id $movie.Id -Settings $Settings
if ($null -ne $javData) {
$javAggregatedData = $javData | Get-JVAggregatedData -Settings $Settings | Test-JVData -RequiredFields $Settings.'sort.metadata.requiredfield'
if ($null -ne $javAggregatedData) {
$javAggregatedData | Set-JVMovie -Path $movie.FullName -DestinationPath $DestinationPath -Settings $Settings -PartNumber $movie.Partnumber -Force:$Force
} else {
- Write-JVLog -Level Warning -Message "[$($movie.FileName)] Skipped -- missing required metadata fields"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Warning -Message "[$($movie.FileName)] Skipped -- missing required metadata fields"
return
}
} else {
- Write-JVLog -Level Warning -Message "[$($movie.FileName)] Skipped -- not matched"
+ Write-JVLog -Write:$JVLogWrite -LogPath $JVLogPath -WriteLevel $JVLogWriteLevel -Level Warning -Message "[$($movie.FileName)] Skipped -- not matched"
}
}
}
diff --git a/src/Javinizer/Public/Set-JVEmbyThumbs.ps1 b/src/Javinizer/Public/Set-JVEmbyThumbs.ps1
index dd6e3a8c..f4153cea 100644
--- a/src/Javinizer/Public/Set-JVEmbyThumbs.ps1
+++ b/src/Javinizer/Public/Set-JVEmbyThumbs.ps1
@@ -40,17 +40,17 @@ function Set-JVEmbyThumbs {
try {
$actressUrl = "$Url/emby/Persons/?api_key=$ApiKey"
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$actressUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] Performing [GET] on URL [$actressUrl]"
$embyActress = (Invoke-RestMethod -Method Get -Uri $actressUrl -ErrorAction Stop -Verbose:$false).Items | Select-Object Name, Id, ImageTags
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when getting actresses from Emby: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when getting actresses from Emby: $PSItem"
}
try {
- Write-JVLog -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [ActressCsv - $ThumbCsvPath] imported"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($MyInvocation.MyCommand.Name)] [ActressCsv - $ThumbCsvPath] imported"
$actressCsv = Import-Csv -LiteralPath $ThumbCsvPath -ErrorAction Stop
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when importing thumbnail csv [$ThumbCsvPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred when importing thumbnail csv [$ThumbCsvPath]: $PSItem"
}
if ($ReplaceAll) {
@@ -111,22 +111,22 @@ function Set-JVEmbyThumbs {
$thumbPostUrl = "$Url/emby/Items/$($actress.Id)/RemoteImages/Download?Type=Thumb&ImageUrl=$thumbUrl&api_key=$ApiKey"
try {
- Write-JVLog -Level Debug -Message "Performing [POST] on URL [$thumbPostUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [POST] on URL [$thumbPostUrl]"
Invoke-RestMethod -Method Post -Uri "$Url/emby/Items/$($actress.Id)/RemoteImages/Download?Type=Thumb&ImageUrl=$thumbUrl&api_key=$ApiKey" -ErrorAction Continue -Verbose:$false | Out-Null
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred on [POST] on URL [$thumbPostUrl]: $PSItem" -Action 'Continue'
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred on [POST] on URL [$thumbPostUrl]: $PSItem" -Action 'Continue'
}
$primaryPostUrl = "$Url/emby/Items/$($actress.Id)/RemoteImages/Download?Type=Primary&ImageUrl=$thumbUrl&api_key=$ApiKey"
try {
- Write-JVLog -Level Debug -Message "Performing [POST] on URL [$primaryPostUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "Performing [POST] on URL [$primaryPostUrl]"
Invoke-RestMethod -Method Post -Uri "$Url/emby/Items/$($actress.Id)/RemoteImages/Download?Type=Primary&ImageUrl=$thumbUrl&api_key=$ApiKey" -ErrorAction Continue -Verbose:$false | Out-Null
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred on [POST] on URL [$primaryPostUrl]: $PSItem" -Action 'Continue'
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occurred on [POST] on URL [$primaryPostUrl]: $PSItem" -Action 'Continue'
}
- Write-JVLog -Level Info -Message "Set [$($actress.Name)] => [$thumbUrl]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Info -Message "Set [$($actress.Name)] => [$thumbUrl]"
}
}
}
diff --git a/src/Javinizer/Public/Set-JVMovie.ps1 b/src/Javinizer/Public/Set-JVMovie.ps1
index b82f864d..201b4586 100644
--- a/src/Javinizer/Public/Set-JVMovie.ps1
+++ b/src/Javinizer/Public/Set-JVMovie.ps1
@@ -187,10 +187,10 @@ function Set-JVMovie {
try {
if (!(Test-Path -LiteralPath $folderPath)) {
New-Item -Path $folderPath -ItemType Directory -Force:$Force | Out-Null
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Directory] created at path [$folderPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Directory] created at path [$folderPath]"
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating destination folder path [$folderPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating destination folder path [$folderPath]: $PSItem"
}
if ($CreateNfo) {
@@ -198,9 +198,9 @@ function Set-JVMovie {
$nfoPath = Join-Path -Path $folderPath -ChildPath "$nfoName.nfo"
$nfoContents = $Data | Get-JVNfo -NameOrder $NameOrder -AddTag $AddTag
$nfoContents | Out-File -LiteralPath $nfoPath -Force:$Force
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Nfo] created at path [$nfoPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Nfo] created at path [$nfoPath]"
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating nfo file [$nfoPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating nfo file [$nfoPath]: $PSItem"
}
}
@@ -214,9 +214,9 @@ function Set-JVMovie {
} elseif ((!(Test-Path -LiteralPath $thumbPath))) {
$webClient.DownloadFile(($Data.CoverUrl).ToString(), $thumbPath)
}
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Thumbnail - $($Data.CoverUrl)] downloaded to path [$thumbPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Thumbnail - $($Data.CoverUrl)] downloaded to path [$thumbPath]"
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating thumbnail image file [$thumbPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating thumbnail image file [$thumbPath]: $PSItem"
}
if ($DownloadPosterImg) {
@@ -240,12 +240,12 @@ function Set-JVMovie {
python3 $cropScriptPath $pythonThumbPath $pythonPosterPath
}
}
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Poster - $thumbPath] cropped to path [$posterPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [Poster - $thumbPath] cropped to path [$posterPath]"
} else {
Write-JLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Crop.py file is missing or cannot be found at path [$cropScriptPath]"
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating poster image file [$posterPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating poster image file [$posterPath]: $PSItem"
}
}
}
@@ -271,11 +271,11 @@ function Set-JVMovie {
} elseif (!(Test-Path -LiteralPath $actressThumbPath)) {
$webClient.DownloadFile($actress.thumb, $actressThumbPath)
}
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [ActressImg - $($actress.thumb)] downloaded to path [$actressThumbPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [ActressImg - $($actress.thumb)] downloaded to path [$actressThumbPath]"
}
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating actress image files: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating actress image files: $PSItem"
}
}
}
@@ -298,10 +298,10 @@ function Set-JVMovie {
$webClient.DownloadFile($screenshot, $screenshotPath)
}
$index++
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [ScreenshotImg - $screenshot] downloaded to path [$screenshotPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [ScreenshotImg - $screenshot] downloaded to path [$screenshotPath]"
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating screenshot image files: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating screenshot image files: $PSItem"
}
}
}
@@ -315,9 +315,9 @@ function Set-JVMovie {
} elseif (!(Test-Path -LiteralPath $trailerPath)) {
$webClient.DownloadFile($Data.TrailerUrl, $trailerPath)
}
- Write-JVLog -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [TrailerVid - $($Data.TrailerUrl)] downloaded to path [$trailerPath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Debug -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] [TrailerVid - $($Data.TrailerUrl)] downloaded to path [$trailerPath]"
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating trailer video file [$($Data.TrailerUrl)] to [$trailerName]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when creating trailer video file [$($Data.TrailerUrl)] to [$trailerName]: $PSItem"
}
}
}
@@ -327,21 +327,21 @@ function Set-JVMovie {
$filePath = Join-Path -Path $folderPath -ChildPath "$fileName$((Get-Item -LiteralPath $Path).Extension)"
if ((Get-Item -LiteralPath $DestinationPath).Directory -ne (Get-Item -LiteralPath $Path).Directory) {
Move-Item -LiteralPath $Path -Destination $filePath -Force:$Force
- Write-JVLog -Level Info "Completed [$Path] => [$filePath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Info "Completed [$Path] => [$filePath]"
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when renaming and moving file [$Path] to [$filePath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when renaming and moving file [$Path] to [$filePath]: $PSItem"
}
} else {
try {
$filePath = Join-Path -Path $folderPath -ChildPath (Get-Item -LiteralPath $Path).Name
if ((Get-Item -LiteralPath $DestinationPath).Directory -ne (Get-Item -LiteralPath $Path).Directory) {
Move-Item -LiteralPath $Path -Destination $filePath -Force:$Force
- Write-JVLog -Level Info "Completed [$Path] => [$filePath]"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Info "Completed [$Path] => [$filePath]"
}
} catch {
- Write-JVLog -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when renaming and moving file [$Path] to [$filePath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($Data.Id)] [$($MyInvocation.MyCommand.Name)] Error occurred when renaming and moving file [$Path] to [$filePath]: $PSItem"
}
}
}
diff --git a/src/Javinizer/Public/Update-JVNfo.ps1 b/src/Javinizer/Public/Update-JVNfo.ps1
new file mode 100644
index 00000000..1537e5a0
--- /dev/null
+++ b/src/Javinizer/Public/Update-JVNfo.ps1
@@ -0,0 +1,36 @@
+function Update-JVNfo {
+ [CmdletBinding(SupportsShouldProcess = $true)]
+ param (
+ [Parameter(Mandatory = $true)]
+ [System.IO.FileInfo]$Path,
+
+ [Parameter()]
+ [Switch]$Recurse,
+
+ [Parameter()]
+ [System.IO.DirectoryInfo]$ThumbCsvPath = (Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvThumbs.csv'),
+
+ [Parameter()]
+ [System.IO.DirectoryInfo]$GenreCsvPath = (Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvGenres.csv'),
+
+ [Parameter()]
+ [Boolean]$FirstNameOrder
+ )
+
+ begin {
+ if (-not $PSBoundParameters.ContainsKey('Confirm')) {
+ $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference')
+ }
+ if (-not $PSBoundParameters.ContainsKey('WhatIf')) {
+ $WhatIfPreference = $PSCmdlet.SessionState.PSVariable.GetValue('WhatIfPreference')
+ }
+ }
+
+ process {
+
+
+ if ($PSCmdlet.ShouldProcess("")) {
+
+ }
+ }
+}
diff --git a/src/Javinizer/Public/Update-JVThumbCsv.ps1 b/src/Javinizer/Public/Update-JVThumbCsv.ps1
index 9f97c48d..42dc2983 100644
--- a/src/Javinizer/Public/Update-JVThumbCsv.ps1
+++ b/src/Javinizer/Public/Update-JVThumbCsv.ps1
@@ -81,18 +81,18 @@ function Update-JVThumbCsv {
if ($null -ne $actressCsv) {
if (!(Compare-Object -ReferenceObject $actressCsv -DifferenceObject $actress -IncludeEqual -ExcludeDifferent -Property @('JapaneseName', 'ThumbUrl'))) {
$actressString = "$($actress.LastName) $($actress.FirstName)".Trim()
- Write-JVLog -Level Info -Message "[Page $x] Actress [$actressString - $($actress.JapaneseName)] written to thumb csv"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Info -Message "[Page $x] Actress [$actressString - $($actress.JapaneseName)] written to thumb csv"
$actress | Export-Csv -LiteralPath $ThumbCsvPath -Append -Encoding utf8
}
} else {
$actressString = "$($actress.LastName) $($actress.FirstName)".Trim()
- Write-JVLog -Level Info -Message "[Page $x] Actress [$actressString - $($actress.JapaneseName)] written to thumb csv"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Info -Message "[Page $x] Actress [$actressString - $($actress.JapaneseName)] written to thumb csv"
$actress | Export-Csv -LiteralPath $ThumbCsvPath -Append -Encoding utf8
}
}
}
} catch {
- Write-JVLog -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occured when updating Javinizer thumb csv at path [$ThumbCsvPath]: $PSItem"
+ Write-JVLog -Write:$script:JVLogWrite -LogPath $script:JVLogPath -WriteLevel $script:JVLogWriteLevel -Level Error -Message "[$($MyInvocation.MyCommand.Name)] Error occured when updating Javinizer thumb csv at path [$ThumbCsvPath]: $PSItem"
}
}
}