A
Anonymous
Guest
I got tired of adding my Channel numbers everytime I did a clean install of MediaPortal so I came up with this script.
Your channel name format must be Numer Name (5 WTTG), because this script splits the name @ the space and takes the first array.
Install Apache and PHP5 (with SQLite support) on your MediaPortal PC. Copy and past this code into a new php page. Access the page via a web browser.
Your channel name format must be Numer Name (5 WTTG), because this script splits the name @ the space and takes the first array.
Install Apache and PHP5 (with SQLite support) on your MediaPortal PC. Copy and past this code into a new php page. Access the page via a web browser.
Code:
<?php
$db = sqlite_open("c:\Program Files\Team MediaPortal\MediaPortal\database\TVDatabasev4.db") or
die("failed to open the database");
$res = sqlite_query($db,
"SELECT idChannel, strChannel
FROM Channel
WHERE iChannelNr = 0
OR iChannelNr = 'Array'");
if (!$res) {
// This should happen :)
echo "All channels have numbers assigned";
} else {
while ($row = sqlite_fetch_array($res)) {
$idChan = $row[idChannel];
$Channel = $row[strChannel];
$ChanNum = explode(" ",$Channel);
$res2 = sqlite_query($db,
"UPDATE Channel
SET iChannelNr = '$ChanNum[0]'
WHERE idChannel = $idChan");
echo "$Channel done.";
}
}
?>