您可以使用Powershell设置视频的详细信息吗?
我有一个NAS,我把我的大部分DVD都撕了下来。这个问题与系列有关。当我必须翻拍一季时,必须手动输入详细信息(标题、评论等) 为了解决这个问题,我写了以下脚本:您可以使用Powershell设置视频的详细信息吗?,powershell,powershell-5.0,Powershell,Powershell 5.0,我有一个NAS,我把我的大部分DVD都撕了下来。这个问题与系列有关。当我必须翻拍一季时,必须手动输入详细信息(标题、评论等) 为了解决这个问题,我写了以下脚本: $array = @() (Get-ChildItem -Path 'c:\Videos\Dead Like Me\*.mpg' ).FullName | foreach{ $array += $_ } $i = 0 Do { $Episode = $i + 1 $NewName = "Dead Lik
$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)
似乎Set-ItemProperty不识别文件的“详细信息”选项卡中的标题或注释,而不识别其他属性
我也试过了
Get-ChildItem $array[$i] | Set-ItemProperty -Name "Title" -Value $NewName
无论哪种方式,我都会得到类似以下的错误:
get-itemproperty "C:\Videos\Dead Like Me\video.mpg" | Format-List -Property * -Force
Set ItemProperty:property字符串Title=Dead Like Me S1 D1 E3.mpg
不存在或找不到。
在c:\Videos\Dead Like Me\tmp.ps1:20 char:30
+ ... ChildItem$array[$i]| Set-ItemProperty-名称“Title”-值$NewName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+CategoryInfo:ReadError:(字符串Title=Dead Like Me S1 D1 E3.mpg:PSNoteProperty)[Set ItemProperty],I OException
+FullyQualifiedErrorId:SetPropertyError,Microsoft.PowerShell.Commands.SetItemPropertyCommand
Set-ItemProperty不应该能够处理这些属性吗
@树码更新
我运行了以下命令:
get-itemproperty "C:\Videos\Dead Like Me\video.mpg" | Format-List -Property * -Force
它返回:
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
有一个名为的开源库,支持在音频和视频文件上设置元数据。它非常容易使用-有一些示例代码-其要点是:
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()
如果将项目和输出设置为“格式列表”或“格式标题”,它会显示哪些属性?这是关于metadeta而不是项目属性的。你对元数据的称呼不同。