1
MagicInfo-I Premium / Change time duration on API
« Last post by Chabrior37 on January 12, 2026, 12:55:02 PM »Hello everyone,
I am trying to create an API to download new content into MagicInfo.
Overall, everything works fine. I can add content from a folder, edit playlists, and broadcast them on my screens. My only problem is the display time, which is set to 5 seconds by default. I can't see any options to change this default time. I tried to force it by inserting the entire configuration from my API, but it didn't work. Can anyone take a look and tell me how to modify my program, or if there is a configuration file I can modify to change this default time?
Thanks in advance and have a great day.
Code : with powershell
# ================= CONFIGURATION =================
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$baseUrl = "http://IP:PORT/MagicInfo"
$username = "user"
$password = "password"
$playlistId = "playlistID"
$playTime = 30
$productType = "PREMIUM"
# ================= AUTHENTIFICATION =================
$loginBody = @{ username = $username; password = $password } | ConvertTo-Json
Write-Host "Authentification..." -ForegroundColor Yellow
$loginResponse = Invoke-RestMethod -Uri "$baseUrl/restapi/v2.0/auth" -Method POST -ContentType "application/json;charset=UTF-8" -Body $loginBody
$token = $loginResponse.token
# ================= PLAYLIST DETAILS =================
$playlistDetailsUrl = "$baseUrl/restapi/v2.0/cms/playlists/$playlistId/details?productType=$productType"
$responseFull = Invoke-RestMethod -Uri $playlistDetailsUrl -Method GET -Headers @{ "api_key" = $token }
$playlistData = $responseFull.items
# ================= MODIFICATION =================
Write-Host "Tentative de forçage des durées..." -ForegroundColor Yellow
$totalPlayTime = 0
foreach ($content in $playlistData.contents) {
$content.contentDuration = 30
$content.playTime = 30
$content.hasDefaultPlayTime = $false
if ($content.PSObject.Properties['isChanged']) { $content.isChanged = $true }
if ($content.effects) {
$content.effects.contentDuration = 30
}
$totalPlayTime += 30
}
$playlistData.playTime = $totalPlayTime
$playlistData.defaultContentDuration = 30
function Clean-MagicInfoObject($obj) {
if ($obj -is [System.Collections.IDictionary] -or $obj -is [PSCustomObject]) {
foreach ($prop in $obj.PSObject.Properties) {
if ($prop.Value -eq "N") { $prop.Value = $false }
elseif ($prop.Value -eq "Y") { $prop.Value = $true }
}
}
}
Clean-MagicInfoObject $playlistData
# ================= MISE À JOUR =================
$updateUrl = "$baseUrl/restapi/v2.0/cms/playlists/$playlistId"
$playlistData | ConvertTo-Json -Depth 10 | Write-Host
$updateBody = $playlistData | ConvertTo-Json -Depth 20
$utf8Body = [System.Text.Encoding]::UTF8.GetBytes($updateBody)
$updateResponse = Invoke-RestMethod -Uri $updateUrl `
-Method PUT `
-Headers @{ "api_key" = $token; "Accept" = "application/json" } `
-ContentType "application/json;charset=UTF-8" `
-Body $utf8Body
Write-Host "Réponse du serveur : $($updateResponse.status)" -ForegroundColor Green
# ================= VERIFICATION =================
Start-Sleep -Seconds 2
$check = Invoke-RestMethod -Uri $playlistDetailsUrl -Method GET -Headers @{ "api_key" = $token }
$check.items.contents | Select-Object contentName, contentDuration | Format-Table -AutoSize
I am trying to create an API to download new content into MagicInfo.
Overall, everything works fine. I can add content from a folder, edit playlists, and broadcast them on my screens. My only problem is the display time, which is set to 5 seconds by default. I can't see any options to change this default time. I tried to force it by inserting the entire configuration from my API, but it didn't work. Can anyone take a look and tell me how to modify my program, or if there is a configuration file I can modify to change this default time?
Thanks in advance and have a great day.
Code : with powershell
# ================= CONFIGURATION =================
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$baseUrl = "http://IP:PORT/MagicInfo"
$username = "user"
$password = "password"
$playlistId = "playlistID"
$playTime = 30
$productType = "PREMIUM"
# ================= AUTHENTIFICATION =================
$loginBody = @{ username = $username; password = $password } | ConvertTo-Json
Write-Host "Authentification..." -ForegroundColor Yellow
$loginResponse = Invoke-RestMethod -Uri "$baseUrl/restapi/v2.0/auth" -Method POST -ContentType "application/json;charset=UTF-8" -Body $loginBody
$token = $loginResponse.token
# ================= PLAYLIST DETAILS =================
$playlistDetailsUrl = "$baseUrl/restapi/v2.0/cms/playlists/$playlistId/details?productType=$productType"
$responseFull = Invoke-RestMethod -Uri $playlistDetailsUrl -Method GET -Headers @{ "api_key" = $token }
$playlistData = $responseFull.items
# ================= MODIFICATION =================
Write-Host "Tentative de forçage des durées..." -ForegroundColor Yellow
$totalPlayTime = 0
foreach ($content in $playlistData.contents) {
$content.contentDuration = 30
$content.playTime = 30
$content.hasDefaultPlayTime = $false
if ($content.PSObject.Properties['isChanged']) { $content.isChanged = $true }
if ($content.effects) {
$content.effects.contentDuration = 30
}
$totalPlayTime += 30
}
$playlistData.playTime = $totalPlayTime
$playlistData.defaultContentDuration = 30
function Clean-MagicInfoObject($obj) {
if ($obj -is [System.Collections.IDictionary] -or $obj -is [PSCustomObject]) {
foreach ($prop in $obj.PSObject.Properties) {
if ($prop.Value -eq "N") { $prop.Value = $false }
elseif ($prop.Value -eq "Y") { $prop.Value = $true }
}
}
}
Clean-MagicInfoObject $playlistData
# ================= MISE À JOUR =================
$updateUrl = "$baseUrl/restapi/v2.0/cms/playlists/$playlistId"
$playlistData | ConvertTo-Json -Depth 10 | Write-Host
$updateBody = $playlistData | ConvertTo-Json -Depth 20
$utf8Body = [System.Text.Encoding]::UTF8.GetBytes($updateBody)
$updateResponse = Invoke-RestMethod -Uri $updateUrl `
-Method PUT `
-Headers @{ "api_key" = $token; "Accept" = "application/json" } `
-ContentType "application/json;charset=UTF-8" `
-Body $utf8Body
Write-Host "Réponse du serveur : $($updateResponse.status)" -ForegroundColor Green
# ================= VERIFICATION =================
Start-Sleep -Seconds 2
$check = Invoke-RestMethod -Uri $playlistDetailsUrl -Method GET -Headers @{ "api_key" = $token }
$check.items.contents | Select-Object contentName, contentDuration | Format-Table -AutoSize
Recent Posts