Skip to content

Commit

Permalink
Merge pull request #187 from jvlflame/dev
Browse files Browse the repository at this point in the history
2.2.10
  • Loading branch information
jvlflame authored Jan 19, 2021
2 parents 302fa56 + 9c2074c commit 0eb54dd
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 24 deletions.
15 changes: 15 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.2.10]

### Added

- Added `-Preview` parameter to display file matcher details
- Added `-OutSettings` parameter to passthru Javinizer settings object to shell
- Added `admin.updates.check` setting to check for module updates on first run
- **Experimental** Added `-UpdateModule` parameter to perform Javinizer module update with settings persistence

### Fixed

- `sort.metadata.nfo.translate.keeporiginaldescription` no longer fails to check true/false value
- Using `-Update` will no longer recreate the nfo file with a filename title
- Directories with a file extension appended to the path name will no longer be detected as a movie

## [2.2.9]

### Added
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

FROM ubuntu:18.04

ADD docker-entrypoint.sh /home/
ADD src/Javinizer/Universal/Repository/javinizergui.ps1 /home/
ADD docker-entrypoint.sh /home
ADD src/Javinizer/Universal/Repository/javinizergui.ps1 /home
RUN chmod +x /home/docker-entrypoint.sh
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update -y && apt-get install -y curl unrar wget software-properties-common apt-transport-https
Expand Down Expand Up @@ -31,9 +31,7 @@ RUN pwsh -Command "Set-PSRepository -Name 'PSGallery' -InstallationPolicy Truste
RUN pwsh -Command "Install-Module UniversalDashboard.Style; Install-Module UniversalDashboard.UDPlayer; Install-Module UniversalDashboard.UDSpinner; Install-Module UniversalDashboard.UDScrollUp; Install-Module UniversalDashboard.CodeEditor"
RUN pwsh -Command "Install-Module Javinizer"



WORKDIR /
WORKDIR /home
EXPOSE 8600
VOLUME ["/data"]
ENV Data__RepositoryPath ./data/Repository
Expand Down
10 changes: 9 additions & 1 deletion src/Javinizer/Javinizer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Version number of this module.

ModuleVersion = '2.2.9'
ModuleVersion = '2.2.10'

# Supported PSEditions
# CompatiblePSEditions = @('Core')
Expand Down Expand Up @@ -74,6 +74,7 @@
'Invoke-JVParallel',
'Javinizer',
'Get-CfSession',
'Get-DLgetchuData',
'Get-DmmData',
'Get-DmmUrl',
'Get-Jav321Data',
Expand All @@ -86,11 +87,18 @@
'Get-JVData',
'Get-JVItem',
'Get-JVNfo',
'Get-JVSettings',
'Get-JVSortData',
'Get-MgstageData',
'Get-MgstageUrl',
'Get-R18Data',
'Get-R18Url',
'Install-JVGui',
'Set-JavlibraryOwned',
'Set-JVEmbyThumbs',
'Set-JVMovie',
'Start-JVGUI',
'Update-JVModule',
'Update-JVThumbCsv',
'Write-JVWebLog'
)
Expand Down
31 changes: 31 additions & 0 deletions src/Javinizer/Private/Get-JVModuleInfo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function Get-JVModuleInfo {
[CmdletBinding()]
param (
[Parameter()]
[String]$ModuleManifestUrl
)

begin {
if ($PSBoundParameters.ContainsKey('ModuleManifestUrl')) {
try {
$moduleManifest = Invoke-RestMethod -Uri $ModuleManifestUrl -Verbose:$false
} catch {
Write-Error "Error occurred when checking for new version: $PSItem" -ErrorAction Stop
}
} else {
$moduleManifest = Get-Content -LiteralPath (Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'Javinizer.psd1')
}
}

process {
$moduleInfo = [PSCustomObject]@{
Version = ($moduleManifest | Select-String -Pattern "ModuleVersion\s*= '(.*)'").Matches.Groups[1].Value
Prerelease = ($moduleManifest | Select-String -Pattern "Prerelease\s*= '(.*)'").Matches.Groups[1].Value
Project = ($moduleManifest | Select-String -Pattern "ProjectUri\s*= '(.*)'").Matches.Groups[1].Value
License = ($moduleManifest | Select-String -Pattern "LicenseUri\s*= '(.*)'").Matches.Groups[1].Value
ReleaseNotes = ($moduleManifest | Select-String -Pattern "ReleaseNotes\s*= '(.*)'").Matches.Groups[1].Value
}

Write-Output $moduleInfo
}
}
6 changes: 3 additions & 3 deletions src/Javinizer/Public/Get-JVAggregatedData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function Get-JVAggregatedData {

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Alias('sort.metadata.nfo.translate.keeporiginaldescription')]
[String]$KeepOriginalDescription,
[Boolean]$KeepOriginalDescription,

[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = 'Setting')]
[Alias('sort.format.delimiter')]
Expand Down Expand Up @@ -643,7 +643,7 @@ function Get-JVAggregatedData {
# The displayname value is updated after the previous fields have already been scraped and translated
$aggregatedDataObject.DisplayName = Convert-JVString -Data $aggregatedDataObject -FormatString $DisplayNameFormat -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder -GroupActress:$GroupActress

if ($null -ne $Tag[0]) {
if ($Tag[0]) {
$aggregatedDataObject.Tag = @()
foreach ($entry in $Tag) {
$tagString = (Convert-JVString -Data $aggregatedDataObject -FormatString $entry -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder -GroupActress:$GroupActress)
Expand All @@ -663,7 +663,7 @@ function Get-JVAggregatedData {
}
}

if ($null -ne $Credits[0]) {
if ($Credits[0]) {
$aggregatedDataObject.Credits = @()
foreach ($entry in $Credits) {
$credit = (Convert-JVString -Data $aggregatedDataObject -FormatString $entry -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder -GroupActress:$GroupActress)
Expand Down
7 changes: 4 additions & 3 deletions src/Javinizer/Public/Get-JVItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,21 @@ function Get-JVItem {
$RegexPtMatch = $Settings.'match.regex.ptmatch'
}

$extensions = @()
$ExcludedStrings = $ExcludedStrings -join '|'

if ($Depth) {
$files = Get-ChildItem -LiteralPath $Path -Recurse:$Recurse -Depth:$Depth | Where-Object {
$_.Extension -in $IncludedExtensions `
-and $_.Length -ge ($MinimumFileSize * 1MB) `
-and $_.Name -notmatch $ExcludedStrings
-and $_.Name -notmatch $ExcludedStrings `
-and $_.Mode -notlike '*d*'
}
} else {
$files = Get-ChildItem -LiteralPath $Path -Recurse:$Recurse | Where-Object {
$_.Extension -in $IncludedExtensions `
-and $_.Length -ge ($MinimumFileSize * 1MB) `
-and $_.Name -notmatch $ExcludedStrings
-and $_.Name -notmatch $ExcludedStrings `
-and $_.Mode -notlike '*d*'
}
}

Expand Down
24 changes: 24 additions & 0 deletions src/Javinizer/Public/Get-JVSettings.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Get-JVSettings {
[CmdletBinding()]
param (
[Parameter()]
[System.IO.FileInfo]$Path
)

process {
if ($PSBoundParameters.ContainsKey('Path')) {
$settingsPath = $Path
} else {
$settingsPath = Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'jvSettings.json'
}

try {
$rawSettings = Get-Content -Path $settingsPath -Raw
$settings = $rawSettings | ConvertFrom-Json -Depth 32
} catch {
Write-Error "Error occurred when retrieving settings: $PSItem" -ErrorAction Stop
}

Write-Output $settings
}
}
49 changes: 40 additions & 9 deletions src/Javinizer/Public/Javinizer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function Javinizer {
[Parameter(ParameterSetName = 'Path', Position = 0)]
[Parameter(ParameterSetName = 'Nfo', Position = 0)]
[Parameter(ParameterSetName = 'Javlibrary', Position = 0)]
[Parameter(ParameterSetName = 'Preview')]
[AllowEmptyString()]
[System.IO.FileInfo]$Path,

Expand All @@ -265,11 +266,13 @@ function Javinizer {
[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'Nfo')]
[Parameter(ParameterSetName = 'Javlibrary')]
[Parameter(ParameterSetName = 'Preview')]
[Switch]$Recurse,

[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'Nfo')]
[Parameter(ParameterSetName = 'Javlibrary')]
[Parameter(ParameterSetName = 'Preview')]
[Int]$Depth,

[Parameter(ParameterSetName = 'Path')]
Expand All @@ -279,11 +282,13 @@ function Javinizer {
[Parameter(ParameterSetName = 'Nfo')]
[Parameter(ParameterSetName = 'Info')]
[Parameter(ParameterSetName = 'Javlibrary')]
[Parameter(ParameterSetName = 'Preview')]
[System.IO.FileInfo]$SettingsPath,

[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetNAme = 'Info')]
[Parameter(ParameterSetName = 'Javlibrary')]
[Parameter(ParameterSetName = 'Preview')]
[Switch]$Strict,

[Parameter(ParameterSetName = 'Path')]
Expand Down Expand Up @@ -414,6 +419,7 @@ function Javinizer {
[Parameter(ParameterSetName = 'Emby')]
[Parameter(ParameterSetName = 'Thumbs')]
[Parameter(ParameterSetName = 'Javlibrary')]
[Parameter(ParameterSetName = 'Preview')]
[Hashtable]$Set,

[Parameter(ParameterSetName = 'Version', Mandatory = $true)]
Expand All @@ -432,7 +438,16 @@ function Javinizer {

[Parameter(ParameterSetName = 'Gui')]
[ValidateRange(0, 65353)]
[Int]$Port = 8600
[Int]$Port = 8600,

[Parameter(ParameterSetName = 'Update')]
[Switch]$UpdateModule,

[Parameter(ParameterSetName = 'Preview')]
[Switch]$Preview,

[Parameter(ParameterSetName = 'Passthru')]
[Switch]$OutSettings
)

process {
Expand Down Expand Up @@ -542,6 +557,12 @@ function Javinizer {
# Validate the values in the settings file following all command-line transformations
$Settings = $Settings | Test-JVSettings

if (!($IsThread)) {
if ($Settings.'admin.updates.check') {
Update-JVModule -CheckUpdates
}
}

if (!($IsThread)) {
if (($Settings.'scraper.movie.javlibrary' -or $Settings.'scraper.movie.javlibraryja' -or $Settings.'scraper.movie.javlibraryzh' -and $Path) -or ($Javlibrary -or $JavlibraryZh -or $JavlibraryJa) -or ($Find -like '*javlibrary*' -or $Find -like '*g46e*' -or $Find -like '*m45e*') -or $SetOwned) {
if (!($CfSession)) {
Expand Down Expand Up @@ -603,6 +624,23 @@ function Javinizer {
}
}

'Preview' {
if ($Depth) {
Get-JVItem -Settings $Settings -Path $Path -Recurse:$Recurse -Depth:$Depth -Strict:$Strict
} else {
Get-JVItem -Settings $Settings -Path $Path -Recurse:$Recurse -Strict:$Strict
}
}

'Passthru' {
if ($OutSettings) {
Get-JVSettings
}
}

'Update' {
Update-JVModule -Update
}

'Info' {
if ($Find -match 'https?:\/\/') {
Expand Down Expand Up @@ -714,14 +752,7 @@ function Javinizer {
}

'Version' {
$moduleManifest = Get-Content -LiteralPath (Join-Path -Path ((Get-Item $PSScriptRoot).Parent) -ChildPath 'Javinizer.psd1')
[PSCustomObject]@{
Version = ($moduleManifest | Select-String -Pattern "ModuleVersion\s*= '(.*)'").Matches.Groups[1].Value
Prerelease = ($moduleManifest | Select-String -Pattern "Prerelease\s*= '(.*)'").Matches.Groups[1].Value
Project = ($moduleManifest | Select-String -Pattern "ProjectUri\s*= '(.*)'").Matches.Groups[1].Value
License = ($moduleManifest | Select-String -Pattern "LicenseUri\s*= '(.*)'").Matches.Groups[1].Value
ReleaseNotes = ($moduleManifest | Select-String -Pattern "ReleaseNotes\s*= '(.*)'").Matches.Groups[1].Value
}
Get-JVModuleInfo
}

'Emby' {
Expand Down
2 changes: 1 addition & 1 deletion src/Javinizer/Public/Set-JVMovie.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function Set-JVMovie {
$GroupActress = $Settings.'sort.format.groupactress'
}

if ($RenameFile) {
if ($RenameFile -and (!($Update))) {
$fileName = Convert-JVString -Data $Data -Format $FileFormat -PartNumber $PartNumber -MaxTitleLength $MaxTitleLength -Delimiter $DelimiterFormat -ActressLanguageJa:$ActressLanguageJa -FirstNameOrder:$FirstNameOrder -GroupActress:$GroupActress -IsFileName:$true
} else {
$fileName = (Get-Item -LiteralPath $Path).BaseName
Expand Down
Loading

0 comments on commit 0eb54dd

Please sign in to comment.