I have a NAS to which I Rip most of my DVD's. The problem comes with series. When I have to RIP a season, the Details (Title, Comments, etc) must be manually entered.
To combat this, I wrote the following script:
$array = @()
(Get-ChildItem -Path 'c:\Videos\Dead Like Me\*.mpg' ).FullName |
foreach{
$array += $_
}
$i = 0
Do {
$Episode = $i + 1
$NewName = "Dead Like Me S1E$Episode.mpg"
Set-ItemProperty -Path $array[$i] -Name "Title" -Value $NewName
Set-ItemProperty -Path $array[$i] -Name "Comments" -Value $NewName
Rename-Item -Path $array[$i] -NewName $NewName
$i += 1
} While ($i -lt $array.length)
It seems that Set-ItemProperty does not recognize the Title nor Comments, not other properties from the "Details" tab for the file.
I've also tried
Get-ChildItem $array[$i] | Set-ItemProperty -Name "Title" -Value $NewName
Either way, I get an error similar to the following:
Set-ItemProperty : The property string Title=Dead Like Me S1 D1 E3.mpg does not exist or was not found. At c:\Videos\Dead Like Me\tmp.ps1:20 char:30 + ... ChildItem $array[$i] | Set-ItemProperty -Name "Title" -Value $NewName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ReadError: (string Title=Dead Like Me S1 D1 E3.mpg:PSNoteProperty) [Set-ItemProperty], I OException + FullyQualifiedErrorId : SetPropertyError,Microsoft.PowerShell.Commands.SetItemPropertyCommand
Shouldn't Set-ItemProperty be able to address those properties?
@trebleCode Update
I ran the following:
get-itemproperty "C:\Videos\Dead Like Me\video.mpg" | Format-List -Property * -Force
It returns:
PSPath : Microsoft.PowerShell.Core\FileSystem::C:\Video\Dead Like Me\video.mpg
PSParentPath : Microsoft.PowerShell.Core\FileSystem::C:\Video\Dead Like Me Renamer
PSChildName : video.mpg
PSDrive : C
PSProvider : Microsoft.PowerShell.Core\FileSystem Mode : -a----
VersionInfo :
File: C:\Video\Dead Like Me\video.mpg
InternalName:
OriginalFilename:
FileVersion:
FileDescription:
Product:
ProductVersion:
Debug: False
Patched: False
PreRelease: False
PrivateBuild: False
SpecialBuild: False
Language:
BaseName : video
Target : {}
LinkType :
Name : video.mpg
Length : 321536
DirectoryName : C:\Video\Dead Like Me
Directory : C:\Video\Dead Like Me
IsReadOnly : False
Exists : True
FullName : C:\Video\Dead Like Me\video.mpg
Extension : .mpg
CreationTime : 2019-02-04 10:15:51
CreationTimeUtc : 2019-02-04 16:15:51
LastAccessTime : 2019-02-04 13:03:31
LastAccessTimeUtc : 2019-02-04 19:03:31
LastWriteTime : 2018-07-09 15:00:47
LastWriteTimeUtc : 2018-07-09 20:00:47
Attributes : Archive
There's an open source library called TagLib-Sharp that supports setting metadata on audio and video files. It's pretty easy to use - there's some sample code at this blog - the gist of it is:
Import-Module "D:\powershell\modules\MPTag\taglib-sharp.dll"
$BOXTYPE_TVSH = "tvsh"; # TV Show or series
$mediaFile = [TagLib.File]::Create($file.FullName)
[TagLib.Mpeg4.AppleTag]$customTag = $mediaFile.GetTag([TagLib.TagTypes]::Apple, 1)
$customTag.SetText($BOXTYPE_TVSH, $showName)
$mediaFile.Save()