Skip to content

Commit

Permalink
Add custom output folder (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Oct 4, 2020
1 parent b7495cb commit 3c5186f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Javinizer/Public/Set-JVMovie.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ function Set-JVMovie {
[Alias('sort.format.folder')]
[String]$FolderFormat,

[Parameter(ValueFromPipelineByPropertyName = $true)]
[Alias('sort.format.outputfolder')]
[String]$OutputFolderFormat,

[Parameter(ValueFromPipelineByPropertyName = $true)]
[Alias('sort.format.posterimg')]
[Array]$PosterFormat,
Expand Down Expand Up @@ -144,6 +148,7 @@ function Set-JVMovie {
$DownloadTrailerVid = $Settings.'sort.download.trailervid'
$FileFormat = $Settings.'sort.format.file'
$FolderFormat = $Settings.'sort.format.folder'
$OutputFolderFormat = $Settings.'sort.format.outputfolder'
$PosterFormat = $Settings.'sort.format.posterimg'
$ThumbnailFormat = $Settings.'sort.format.thumbimg'
$TrailerFormat = $Settings.'sort.format.trailervid'
Expand All @@ -156,13 +161,17 @@ function Set-JVMovie {
$DelimiterFormat = $Settings.'sort.format.delimiter'
$ActressLanguageJa = $Settings.'sort.metadata.nfo.actresslanguageja'
$OriginalPath = $Settings.'sort.metadata.nfo.originalpath'

}

if ($RenameFile) {
$fileName = Convert-JVString -Data $Data -Format $FileFormat -PartNumber $PartNumber -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder
} else {
$fileName = (Get-Item -LiteralPath $Path).BaseName
}
if ($outputFolderFormat -ne '') {
$outputFolderName = Convert-JVstring -Data $Data -Format $OutputFolderFormat -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder
}
$folderName = Convert-JVString -Data $Data -Format $FolderFormat -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder
$thumbName = Convert-JVString -Data $Data -Format $ThumbnailFormat -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder
$trailerName = Convert-JVString -Data $Data -Format $TrailerFormat -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder
Expand All @@ -184,9 +193,17 @@ function Set-JVMovie {

if ($MoveToFolder) {
if ($DestinationPath) {
$folderPath = Join-Path -Path $DestinationPath -ChildPath $folderName
if ($outputFolderName -ne '' -and $null -ne $outputFolderName) {
$folderPath = Join-Path -Path $DestinationPath -ChildPath $outputFolderName -AdditionalChildPath $folderName
} else {
$folderPath = Join-Path -Path $DestinationPath -ChildPath $folderName
}
} else {
$folderPath = Join-Path -Path $Path -ChildPath $folderName
if ($outputFolderName -ne '' -and $null -ne $outputFolderName) {
$folderPath = Join-Path -Path $Path -ChildPath $outputFolderName -AdditionalChildPath $folderName
} else {
$folderPath = Join-Path -Path $Path -ChildPath $folderName
}
}
} else {
if ($DestinationPath) {
Expand Down
1 change: 1 addition & 0 deletions src/Javinizer/jvSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"sort.format.delimiter": ", ",
"sort.format.file": "<ID>",
"sort.format.folder": "<ID> [<STUDIO>] - <TITLE> (<YEAR>)",
"sort.format.outputfolder": "",
"sort.format.posterimg": ["folder"],
"sort.format.thumbimg": "fanart",
"sort.format.trailervid": "<ID>-trailer",
Expand Down

0 comments on commit 3c5186f

Please sign in to comment.