Skip to content

Commit

Permalink
Feature/116 (#117)
Browse files Browse the repository at this point in the history
* Add originalpath field in nfo (#116)
  • Loading branch information
jvlflame committed Oct 3, 2020
1 parent 0e3337b commit 4e02b01
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A rebuild of my previous project [JAV-Sort-Scrape-javlibrary](https://github.com
- [Python 3](https://www.python.org/downloads/)
- [Pillow](https://pypi.org/project/Pillow/)
- [Googletrans](https://pypi.org/project/googletrans/)
- [MediaInfo](https://mediaarea.net/en/MediaInfo) *MediaInfo will need to be added to your PATH
- [MediaInfo](https://mediaarea.net/en/MediaInfo/Download) *You will need the CLI version. MediaInfo will also need to be added to your PATH

```powershell
# Python
Expand Down Expand Up @@ -570,6 +570,7 @@ For example, if your jvGenres.csv file looks like this:
| `sort.metadata.nfo.format.tagline` | Specifies the format string to add a tagline to the aggregated data object | [Format Strings](#Metadata-Format-Strings)
| `sort.metadata.nfo.actresslanguageja` | Specifies to prefer Japanese names when creating the metadata nfo. | 0, 1
| `sort.metadata.nfo.unknownactress` | Specifies to add an 'Unknown' actress to scraped movies without any actresses | 0, 1
| `sort.metadata.nfo.originalpath` | Specifies to add an 'originalpath' field to the nfo specifying the location the movie was last sorted from | 0, 1
| `sort.metadata.thumbcsv` | Specifies to use the thumbnail csv when aggregating metadata. | 0, 1
| `sort.metadata.thumbcsv.autoadd` | Specifies to automatically add missing actresses to the thumbnail csv when scraping using the R18 or R18Zh scrapers. | 0, 1
| `sort.metadata.thumbcsv.convertalias` | Specifies to use the thumbnail csv alias field to replace actresses in the metadata. | 0, 1
Expand Down
1 change: 1 addition & 0 deletions src/Javinizer/Private/Test-JVSettings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function Test-JVSettings {
'sort.metadata.nfo.actresslanguageja',
'sort.metadata.nfo.firstnameorder',
'sort.metadata.nfo.translatedescription',
'sort.metadata.nfo.originalpath',
'sort.metadata.thumbcsv.convertalias',
'sort.metadata.thumbcsv.autoadd',
'sort.metadata.thumbcsv',
Expand Down
14 changes: 13 additions & 1 deletion src/Javinizer/Public/Get-JVNfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ function Get-JVNfo {
[Boolean]$ActressLanguageJa,

[Parameter()]
[Boolean]$NameOrder
[Boolean]$NameOrder,

[Parameter()]
[String]$OriginalPath
)

process {
Expand Down Expand Up @@ -128,6 +131,15 @@ function Get-JVNfo {
"@

if ($OriginalPath) {
$originalPathNfoString = @"
<originalpath>$OriginalPath</originalpath>
"@
$nfoString = $nfoString + $originalPathNfoString

}

foreach ($item in $Tag) {
$tagNfoString = @"
<tag>$item</tag>
Expand Down
17 changes: 13 additions & 4 deletions src/Javinizer/Public/Set-JVMovie.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,17 @@ function Set-JVMovie {
[Alias('sort.metadata.nfo.firstnameorder')]
[Boolean]$FirstNameOrder,

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Parameter(ValueFromPipelineByPropertyName = $true)]
[Alias('sort.format.delimiter')]
[String]$DelimiterFormat,

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Parameter(ValueFromPipelineByPropertyName = $true)]
[Alias('sort.metadata.nfo.actresslanguageja')]
[Boolean]$ActressLanguageJa
[Boolean]$ActressLanguageJa,

[Parameter(ValueFromPipelineByPropertyName = $true)]
[Alias('sort.metadata.nfo.originalpath')]
[Boolean]$OriginalPath
)

begin {
Expand Down Expand Up @@ -151,6 +155,7 @@ function Set-JVMovie {
$FirstNameOrder = $Settings.'sort.metadata.nfo.firstnameorder'
$DelimiterFormat = $Settings.'sort.format.delimiter'
$ActressLanguageJa = $Settings.'sort.metadata.nfo.actresslanguageja'
$OriginalPath = $Settings.'sort.metadata.nfo.originalpath'
}

if ($RenameFile) {
Expand Down Expand Up @@ -215,7 +220,11 @@ function Set-JVMovie {
if ($CreateNfo) {
try {
$nfoPath = Join-Path -Path $folderPath -ChildPath "$nfoName.nfo"
$nfoContents = $Data | Get-JVNfo -NameOrder $FirstNameOrder -ActressLanguageJa:$ActressLanguageJa
if ($OriginalPath) {
$nfoContents = $Data | Get-JVNfo -NameOrder $FirstNameOrder -ActressLanguageJa:$ActressLanguageJa -OriginalPath:$Path
} else {
$nfoContents = $Data | Get-JVNfo -NameOrder $FirstNameOrder -ActressLanguageJa:$ActressLanguageJa
}
$nfoContents | Out-File -LiteralPath $nfoPath -Force:$Force
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 {
Expand Down
1 change: 1 addition & 0 deletions src/Javinizer/jvSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"sort.metadata.nfo.firstnameorder": 0,
"sort.metadata.nfo.actresslanguageja": 0,
"sort.metadata.nfo.unknownactress": 1,
"sort.metadata.nfo.originalpath": 0,
"sort.metadata.nfo.format.tag": ["<SET>"],
"sort.metadata.nfo.format.tagline": "",
"sort.metadata.thumbcsv": 1,
Expand Down

0 comments on commit 4e02b01

Please sign in to comment.