Skip to content

Commit

Permalink
Add credits to nfo (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvlflame committed Dec 12, 2020
1 parent 212b200 commit 70cda15
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Javinizer/Public/Get-JVAggregatedData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ function Get-JVAggregatedData {
[Alias('sort.metadata.nfo.format.tagline')]
[String]$Tagline,

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Alias('sort.metadata.nfo.format.credits')]
[Array]$Credits,

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Alias('scraper.option.idpreference')]
[String]$IdPreference,
Expand Down Expand Up @@ -200,6 +204,7 @@ function Get-JVAggregatedData {
$UnknownActress = $Settings.'sort.metadata.nfo.unknownactress'
$Tag = $Settings.'sort.metadata.nfo.format.tag'
$Tagline = $Settings.'sort.metadata.nfo.format.tagline'
$Credits = $Settings.'sort.metadata.nfo.format.credits'
$IdPreference = $Settings.'scraper.option.idpreference'
$GroupActress = $Settings.'sort.format.groupactress'
$TranslateModule = $Settings.'sort.metadata.nfo.translate.module'
Expand Down Expand Up @@ -227,6 +232,7 @@ function Get-JVAggregatedData {
Series = $null
Tag = $null
Tagline = $null
Credits = $null
Actress = $null
Genre = $null
CoverUrl = $null
Expand Down Expand Up @@ -613,6 +619,19 @@ function Get-JVAggregatedData {
}
}

if ($null -ne $Credits[0]) {
$aggregatedDataObject.Credits = @()
foreach ($entry in $Credits) {
$credit = (Convert-JVString -Data $aggregatedDataObject -FormatString $entry -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder -GroupActress:$GroupActress)
if ($null -ne $credit -and $credit -ne '') {
$aggregatedDataObject.Credits += $credit
}
}
if ($null -eq $aggregatedDataObject.Credits[0]) {
$aggregatedDataObject.Credits = $null
}
}

$dataObject = [PSCustomObject]@{
Data = $aggregatedDataObject
}
Expand Down
12 changes: 12 additions & 0 deletions src/Javinizer/Public/Get-JVNfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ function Get-JVNfo {
[Parameter(ValueFromPipelineByPropertyName = $true)]
[String]$Tagline,

[Parameter(ValueFromPipelineByPropertyName = $true)]
[Array]$Credits,

[Parameter(ValueFromPipelineByPropertyName = $true)]
[PSObject]$MediaInfo,

Expand Down Expand Up @@ -149,6 +152,15 @@ function Get-JVNfo {
$tagNfoString = @"
<tag>$item</tag>
"@
$nfoString = $nfoString + $tagNfoString
}

foreach ($item in $Credits) {
$item = Convert-NfoChar -String $item -ErrorAction SilentlyContinue
$tagNfoString = @"
<credits>$item</credits>
"@
$nfoString = $nfoString + $tagNfoString
}
Expand Down
1 change: 1 addition & 0 deletions src/Javinizer/jvSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"sort.metadata.nfo.originalpath": false,
"sort.metadata.nfo.format.tag": ["<SET>"],
"sort.metadata.nfo.format.tagline": "",
"sort.metadata.nfo.format.credits": [],
"sort.metadata.thumbcsv": true,
"sort.metadata.thumbcsv.autoadd": true,
"sort.metadata.thumbcsv.convertalias": true,
Expand Down

0 comments on commit 70cda15

Please sign in to comment.