Skip to content

Commit

Permalink
fixxes & logging
Browse files Browse the repository at this point in the history
- Fix plex folder extractions
- fix hashtestpath
- add debug logging
  • Loading branch information
fscorrupt committed Mar 27, 2024
1 parent 3e7f11e commit f68df7b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
38 changes: 34 additions & 4 deletions PlexPosterMaker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ param (
[switch]$Testing
)

$CurrentScriptVersion = "1.0.44"
$CurrentScriptVersion = "1.0.45"
$global:HeaderWritten = $false
$ProgressPreference = 'SilentlyContinue'

Expand Down Expand Up @@ -3273,10 +3273,16 @@ else {
Write-Entry -Subtext "Location: $location" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
Write-Entry -Subtext "Libpath: $libpath" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
$Matchedpath = AddTrailingSlash $libpath
$libpath = $Matchedpath
$extractedFolder = $location.Substring($libpath.Length)
$extractedFolder = $location.Substring($Matchedpath.Length)
if ($extractedFolder -like "*\*") {
$extractedFolder = $extractedFolder.Split("\")[0]
}
elseif ($extractedFolder -like "*/*") {
$extractedFolder = $extractedFolder.Split("/")[0]
}
Write-Entry -Subtext "Matchedpath: $Matchedpath" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
Write-Entry -Subtext "ExtractedFolder: $extractedFolder" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
break # Exit loop once a match is found
}
}
}
Expand Down Expand Up @@ -3479,8 +3485,14 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

Write-Entry -Message "Test Path is: $TestPath" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
Write-Entry -Message "Test File is: $Testfile" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
Write-Entry -Message "Resolved Full Test Path is: $fullTestPath" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
Write-Entry -Message "Resolved hash Test Path is: $hashtestpath" -Path $global:ScriptRoot\Logs\Scriptlog.log -Color Cyan -log Debug
$PosterImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername).jpg"
$PosterImage = $PosterImage.Replace('[', '_').Replace(']', '_').Replace('{', '_').Replace('}', '_')
# Now we can start the Poster Part
Expand Down Expand Up @@ -3697,6 +3709,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$backgroundImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_background.jpg"
Expand Down Expand Up @@ -3951,6 +3966,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$PosterImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername).jpg"
Expand Down Expand Up @@ -4186,6 +4204,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$backgroundImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_background.jpg"
Expand Down Expand Up @@ -4418,6 +4439,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$SeasonImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_$global:season.jpg"
Expand Down Expand Up @@ -4729,6 +4753,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$EpisodeImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_$global:FileNaming.jpg"
Expand Down Expand Up @@ -5043,6 +5070,9 @@ else {
if ($fullTestPath) {
$hashtestpath = ($fullTestPath.Path + "\" + $Testfile).Replace('/', '\')
}
Else {
$hashtestpath = ($TestPath + "\" + $Testfile).Replace('/', '\')
}
}

$EpisodeImage = Join-Path -Path $global:ScriptRoot -ChildPath "temp\$($entry.RootFoldername)_$global:FileNaming.jpg"
Expand Down
2 changes: 1 addition & 1 deletion Release.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.44
1.0.45

1 comment on commit f68df7b

@fscorrupt
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closes #77

Please sign in to comment.