微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从 TRIAX TSS-400 通道列表生成 M3U 文件,用于其他软件,如 Kodi、VLC 等

如何解决从 TRIAX TSS-400 通道列表生成 M3U 文件,用于其他软件,如 Kodi、VLC 等

如何从 SAT-IP 接收器 TRIAX TSS-400 生成 M3U 文件? 在 SAT-Receiver 的 web-GUI 中,我只能导出一个 XML 文件,但不能在 kodi、VLC 等中导入。

解决方法

我最终编写了一个 Powershell 脚本,该脚本通过 UPnP 查找 TRIAX,自动登录并根据需要创建 M3U 文件。 这里的脚本:

# script to generate an M3U file from the TRIAX TSS-400 channel list to be used in other software like Kodi,VLC etc.

cls
$m3uFile = 'c:\temp\triax_channel_list.m3u'

write-host 'reading channel list from TRIAX TSS-400...'
$finder = New-Object -ComObject UPnP.UPnPDeviceFinder
$serverList = $finder.FindByType('urn:schemas-upnp-org:device:MediaServer:1',0)
$triax = $serverList | where {$_.ModelName -eq 'TSS400'}
$triaxIp = [regex]::Match($triax.PresentationURL,'(?<=//).*?(?=:)').value

$url = "http://$triaxIp/exportChannelList"
$response = Invoke-WebRequest -Uri $url
[xml]$xml = $response.ToString()

$m3u = [System.Collections.Generic.List[string]]::new()
$m3u.Add('#EXTM3U')
foreach($c in $xml.channelTable.channel) {
    $m3u.Add([string]::Concat('#EXTINF:-1,',$c.name))
    $m3u.Add([string]::Concat("http://$triaxIp/dlna/?type=DVB-S-AUTO&src=",$c.src,'&freq=',$c.freq,'&pol=',$c.pol,'&sr=',$c.sr,'&pids=',$c.pids))
}
$m3u | out-file $m3uFile -Force -Encoding utf8
write-host "file '$m3uFile' was generated."
'done.'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。