From 58f79b2c359acdc4695669b7c56da81b810cbd34 Mon Sep 17 00:00:00 2001 From: AdmiringWorm Date: Tue, 12 Mar 2024 20:14:02 +0100 Subject: [PATCH] (tinymediamanager) Update to expected format --- automatic/tinymediamanager/Readme.md | 6 +-- .../tinymediamanager/legal/VERIFICATION.txt | 26 ++++------ automatic/tinymediamanager/package.Tests.ps1 | 37 ++++++++++++++ .../tinymediamanager/tinymediamanager.nuspec | 18 ++++--- .../tools/chocolateyInstall.ps1 | 51 ++++++++++++++----- .../tools/chocolateyUninstall.ps1 | 27 ++++++++-- automatic/tinymediamanager/update.ps1 | 40 ++++++++++----- 7 files changed, 147 insertions(+), 58 deletions(-) create mode 100644 automatic/tinymediamanager/package.Tests.ps1 diff --git a/automatic/tinymediamanager/Readme.md b/automatic/tinymediamanager/Readme.md index 28547bf84..20d125858 100644 --- a/automatic/tinymediamanager/Readme.md +++ b/automatic/tinymediamanager/Readme.md @@ -9,7 +9,7 @@ tinyMediaManager will run on Windows, Linux and macOS (and possible more OS). ### Movie Management -![Movie Management](screenshots/movies.png) +![Movie Management](https://cdn.jsdelivr.net/gh/AdmiringWorm/chocolatey-packages@f7ecb4a5879a829f63b4ad078a918e9595cef15a/automatic/tinymediamanager/screenshots/movies.png) - Get data from **TheMovieDB.org, Imdb.com, Ofdb.de, HD-Trailers.net**, ... - Create NFO for use with Kodi (XBMC) and MediaPortal @@ -17,7 +17,7 @@ tinyMediaManager will run on Windows, Linux and macOS (and possible more OS). ### Movie Set Management -![Movie Set Management](screenshots/moviesets.png) +![Movie Set Management](https://cdn.jsdelivr.net/gh/AdmiringWorm/chocolatey-packages@f7ecb4a5879a829f63b4ad078a918e9595cef15a/automatic/tinymediamanager/screenshots/moviesets.png) - Organize movies into collections - Set artwork for moviesets @@ -25,7 +25,7 @@ tinyMediaManager will run on Windows, Linux and macOS (and possible more OS). ### TV Show Management -![TV Show Management](screenshots/tvshows.png) +![TV Show Management](https://cdn.jsdelivr.net/gh/AdmiringWorm/chocolatey-packages@f7ecb4a5879a829f63b4ad078a918e9595cef15a/automatic/tinymediamanager/screenshots/tvshows.png) - find TV shows and episodes in subdirectories - powerful episode/season detection diff --git a/automatic/tinymediamanager/legal/VERIFICATION.txt b/automatic/tinymediamanager/legal/VERIFICATION.txt index 48aab4a89..ff5d87f34 100644 --- a/automatic/tinymediamanager/legal/VERIFICATION.txt +++ b/automatic/tinymediamanager/legal/VERIFICATION.txt @@ -1,26 +1,18 @@ VERIFICATION - Verification is intended to assist the Chocolatey moderators and community in verifying that this package's contents are trustworthy. -The embedded software has been downloaded from the listed download -location on +The embedded software have been downloaded from the listed download +location on and can be verified by doing the following: -1. Download the following: - - url: - -2. You can obtain the checksum using one of the following methods: - - Use powershell function 'Get-FileHash' - - Use Chocolatey utility 'checksum.exe' +1. Download the following +2. Get the checksum using one of the following methods: + - Using powershell function 'Get-FileHash' + - Use chocolatey utility 'checksum.exe' +3. The checksums should match the following: checksum type: sha256 - checksum: 2BC86688454FE57AF1FA66A5818EC69EE1ABCDCC8CE93C5DF357AD4475B1CE91 - -Using AU: - - Get-RemoteChecksum + checksum: D40AC6EC29DE25163DCBAAD86958CD53A2FA46C52056F8E9C2DD3B45DF961AB1 -The file 'LICENSE.txt' is obtained from: - +The file 'LICENSE.txt' has been obtained from diff --git a/automatic/tinymediamanager/package.Tests.ps1 b/automatic/tinymediamanager/package.Tests.ps1 new file mode 100644 index 000000000..1ea1054c4 --- /dev/null +++ b/automatic/tinymediamanager/package.Tests.ps1 @@ -0,0 +1,37 @@ +. "$PSScriptRoot\..\..\scripts\Run-PesterTests.ps1" + +$packageName = Split-Path -Leaf $PSScriptRoot + +Run-PesterTests ` + -packageName "$packageName" ` + -packagePath "$PSScriptRoot" ` + -expectedEmbeddedMatch "^tinyMediaManager-[\d\.]+-windows-amd64\.zip$" ` + -expectedDefaultDirectory "C:\tools\tinyMediaManager" ` + -expectedShimFiles "tinyMediaManagerCMD.exe" ` + -customInstallChecks @( + { + It "Should create tinyMediaManager Start Menu shortcut" { + $startMenu = [System.Environment]::GetFolderPath('Programs') + "$startMenu\tinyMediaManager.lnk" | Should -Exist + } + + It "Should create tinyMediaManager desktop shortcut" { + $desktop = [System.Environment]::GetFolderPath('Desktop') + "$desktop\tinyMediaManager.lnk" | Should -Exist + } + } +) ` + -customUninstallChecks @( + { + It "Should remove tinyMediaManager Start Menu shortcut" { + $startMenu = [System.Environment]::GetFolderPath('Programs') + "$startMenu\tinyMediaManager.lnk" | Should -Not -Exist + } + + It "Should remove tinyMediaManager desktop shortcut" { + $desktop = [System.Environment]::GetFolderPath('Desktop') + "$desktop\tinyMediaManager.lnk" | Should -Not -Exist + } + } +) ` + -failsOn32bit diff --git a/automatic/tinymediamanager/tinymediamanager.nuspec b/automatic/tinymediamanager/tinymediamanager.nuspec index 974d7c158..c91f85f2c 100644 --- a/automatic/tinymediamanager/tinymediamanager.nuspec +++ b/automatic/tinymediamanager/tinymediamanager.nuspec @@ -4,8 +4,8 @@ tinymediamanager 5.0.3 tinyMediaManager - https://gitlab.com/tinyMediaManager/tinyMediaManager/-/graphs/devel - JourneyOver AdmiringWorm + Manuel Laggner + AdmiringWorm,JourneyOver false https://gitlab.com/tinyMediaManager/tinyMediaManager/-/blob/devel/LICENSE https://www.tinymediamanager.org/ @@ -22,12 +22,16 @@ #### Package * Automatically built and uploaded by [JourneyOver](https://chocolatey.org/profiles/JourneyOver) * If you have any requests or issues with this package please make an issue [here](https://github.com/JourneyOver/chocolatey-packages) instead of "Contact Maintainers" - © 2022 Manuel Laggner - tinymediamanager media managment tinyMediaManager metadata XBOX Media Center XBMC Plex Emby Freemium + © 2024 Manuel Laggner + tinymediamanager media-managment media-manager kodi xbmc plex emby + foss cross-platform https://gitlab.com/tinyMediaManager/tinyMediaManager - https://github.com/AdmiringWorm/chocolatey-packages/tree/master/automatic/tinymediamanager - https://www.tinymediamanager.org/docs - https://forum.kodi.tv/forumdisplay.php?fid=204 + https://github.com/admiringworm/chocolatey-packages/tree/master/automatic/tinymediamanager + https://www.tinymediamanager.org/docs/ https://gitlab.com/tinyMediaManager/tinyMediaManager/-/issues + + + + diff --git a/automatic/tinymediamanager/tools/chocolateyInstall.ps1 b/automatic/tinymediamanager/tools/chocolateyInstall.ps1 index 097fd7587..47fa007ff 100644 --- a/automatic/tinymediamanager/tools/chocolateyInstall.ps1 +++ b/automatic/tinymediamanager/tools/chocolateyInstall.ps1 @@ -1,19 +1,42 @@ $ErrorActionPreference = 'Stop'; +Write-Host "Cleaning up leftover from old packages" + +$linkName = 'tinyMediaManager.lnk' +$publicDesktop = "${env:Public}\Desktop\$linkName" +$publicStartMenu = "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\$linkName" + +if (Test-Path $publicDesktop) { + Remove-Item $publicDesktop -EA 0 +} + +if (Test-Path $publicStartMenu) { + Remove-Item $publicStartMenu -EA 0 +} + +$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$destination = Get-ToolsLocation + $packageArgs = @{ - packageName = '' - fileType = '' - softwareName = '' - - checksum = '' - checksum64 = '' - checksumType = '' - checksumType64= '' - url = '' - url64bit = '' - - silentArgs = "/VERYSILENT" - validExitCodes= @() + packageName = $env:ChocolateyPackageName + file64 = "$toolsDir\" + SpecificFolder = 'tinyMediaManager' + Destination = $destination } -Install-ChocolateyPackage @packageArgs +Get-ChocolateyUnzip @packageArgs + +$destination = "$destination\tinyMediaManager" +$env:ChocolateyPackageInstallLocation = $destination + +$guiTarget = "$destination\tinyMediaManager.exe" +$cmdTarget = "$destination\tinyMediaManagerCMD.exe" + +$startMenu = [System.Environment]::GetFolderPath('Programs') +Install-ChocolateyShortcut -ShortcutFilePath "$startMenu\$linkName" -TargetPath "$guiTarget" +$desktop = [System.Environment]::GetFolderPath('Desktop') +Install-ChocolateyShortcut -ShortcutFilePath "$desktop\$linkName" -TargetPath $guiTarget + +Install-BinFile -Name "tinyMediaManagerCMD" -Path $cmdTarget + +Remove-Item $packageArgs.file64 -Force diff --git a/automatic/tinymediamanager/tools/chocolateyUninstall.ps1 b/automatic/tinymediamanager/tools/chocolateyUninstall.ps1 index 172f9b353..929f7cf08 100644 --- a/automatic/tinymediamanager/tools/chocolateyUninstall.ps1 +++ b/automatic/tinymediamanager/tools/chocolateyUninstall.ps1 @@ -1,6 +1,23 @@ -$packageName = 'tinymediamanager' -$shortcutName = 'tinyMediaManager.lnk' +$ErrorActionPreference = 'Stop'; -Remove-Item "$env:Public\Desktop\$shortcutName" -Force -ErrorAction 'SilentlyContinue' -Remove-Item "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\$shortcutName" -Force -ErrorAction 'SilentlyContinue' -Remove-Item -r "C:\Tools\tinyMediaManager*" -ea 0 -Force +$startMenu = [System.Environment]::GetFolderPath("Programs") +$desktop = [System.Environment]::GetFolderPath('Desktop') +$linkName = "tinyMediaManager.lnk" + +Uninstall-BinFile tinyMediaManagerCMD + +if (Test-Path "$startMenu\$linkName") { + Write-Host "Removing Start Menu Icon" + Remove-Item "$startMenu\$linkName" +} +if (Test-Path "$desktop\$linkName") { + Write-Host "Removing Desktop Icon" + Remove-Item "$desktop\$linkName" +} + +$installPath = "$(Get-ToolsLocation)\tinyMediaManager" + +if (Test-Path $installPath) { + Write-Host "Removing installed files." + Remove-Item $installPath -Recurse -Force +} diff --git a/automatic/tinymediamanager/update.ps1 b/automatic/tinymediamanager/update.ps1 index 678249b5f..2c076710d 100644 --- a/automatic/tinymediamanager/update.ps1 +++ b/automatic/tinymediamanager/update.ps1 @@ -1,29 +1,45 @@ import-module au -$releases = '' +$releases = 'https://release.tinymediamanager.org' + +function global:au_BeforeUpdate { + Get-RemoteFiles -Purge -NoSuffix +} function global:au_SearchReplace { @{ + ".\legal\VERIFICATION.txt" = @{ + "(?i)(^\s*location on\:?\s*)\<.*>" = "`${1}<$releases>" + "(?i)(\s*1\..+)\<.*\>" = "`${1}<$($Latest.URL64)>" + "(?i)(^\s*checksum\s*type\:).*" = "`${1} $($Latest.ChecksumType64)" + "(?i)(^\s*checksum(64)?\:).*" = "`${1} $($Latest.Checksum64)" + } ".\tools\chocolateyInstall.ps1" = @{ - "(^[$]url32\s*=\s*)('.*')" = "`$1'$($Latest.URL32)'" - "(^[$]url64\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'" - "(^[$]checksum32\s*=\s*)('.*')" = "`$1'$($Latest.Checksum32)'" - "(^[$]checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'" - "(^[$]checksumType32\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType32)'" - "(^[$]checksumType64\s*=\s*)('.*')" = "`$1'$($Latest.ChecksumType64)'" + "(?i)(^\s*file64\s*=\s*`"[$]toolsDir\\).*" = "`${1}$($Latest.FileName64)`"" } } } +function global:au_AfterUpdate($Package) { + Update-Changelog -useIssueTitle + Invoke-VirusTotalScan $Package +} + function global:au_GetLatest { $download_page = Invoke-WebRequest -Uri $releases - $re = '' - $url = $download_page.links | ? href -match $re | select -First 1 -expand href + $re = 'windows.*.zip$' + $url = $download_page.links | ? href -match $re | select -First 1 -expand href + + $version = $url -split '[-]' | select -Last 1 -Skip 2 - $version = $url -split '[._-]|.exe' | select -Last 1 -Skip 2 + $url = [uri]::new([uri]$releases, $url) - return @{ URL32 = $url; Version = $version } + return @{ + URL64 = $url + ChecksumType64 = 'sha256' + Version = $version + } } -update +update -ChecksumFor none