Hallo zusammen,
hier nun eine erste Version.
Bevor Ihr mit der Implementierung anfangt müssen einige Vorraussetzungen erfüllt sein.
Weiter ist zu beachten, dass es sich um eine frühe Version handelt.
Eure XBMC Umgebung muss über einen SQL Server syncronisiert sein.
Eine Anleitung findet Ihr unter: HOW-TO:Synchronize multiple XBMC libraries - XBMC.
Ich habe die Variante gewählt, damit man die XBMC Library auch durchsuchen kann, wenn kein XBMC läuft.
Installationsanleitung:
- Entpackt die xbmcV0.1.zip nach \webfront\user\
- Legt im Objektbaum folgende Struktur an (siehe xbmc01.png) -> Bitte die passenden Varablenprofile nicht vergessen.
Filmauswahl aufrufen
<?
include(IPS_GetKernelDir().'webfront/user/xbmc/xbmc.inc.php');
$data = "";
$data .= "<style type=\"text/css\">
";
$data .= ".movielist {font: normal 14px verdana;position: relative;margin: 0px 20px 10px 0px;padding: 5px 10px 5px 10px;border-color: rgba(255, 255, 255, 0.15);border-style: solid;border-width: 1px;height: 140px;overflow: hidden;white-space: normal;}
";
$data .= ".poster {position: absolute;top:0;left: 0px;width: 107px;height: 150px;text-align: center;border-color: rgba(255, 255, 255, 0.15);border-style: solid;border-width: 0px 1px 0px 0px;}
";
$data .= ".poster img {left: 0px;top: 0px;position: relative;width: 107px;height: 150px}
";
$data .= ".description {position: relative;height: 115px;left: 105px;width: 270px;overflow: hidden;}
";
$data .= ".title {font-size: 11pt;font-family: sans-serif;font-weight: bold;}
";
$data .= ".subtext {font-size: 9pt;font-family: sans-serif;}
";
$data .= ".plot {position: relative;top: -115px;height: 140px;left: 380px;width: 360px;font-size: 8pt;font-family: sans-serif;overflow: hidden;}
";
$data .= ".movieflag {position: relative;top: -131px;height: 18px;left: 105px;width: 270px;font-size: 8pt;font-family: sans-serif;overflow: hidden;}
";
$data .= "#vres, #vtype, #atype, #achan {height: 18px;width: 48px;}
";
$data .= "</style>
";
$movie_sql = 'SELECT ' . $col['id_movie'] . ', ' . $col['id_file'] . ', ' . $col['title'] . ', ' . $col['rating'] . ', ' . $col['year'] . ', ' . $col['poster'] . ', ' . $col['plot'] . ', ' . $col['tagline'] . ', ' . $col['runtime'] . ', ' . $col['fanart'] . ', ' . $col['genre'] . ', ' . $col['country'] . ', ' . $col['director'] . ' FROM movie ORDER by ' . $col['title'] . ' ASC';
$movie_result = mysql_query($movie_sql);
while ($movie = mysql_fetch_array($movie_result)) {
$movie_stream_v_sql = 'SELECT strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight FROM streamdetails WHERE idFile = ' . $movie[$col['id_file']] . ' AND iStreamType = 0';
$movie_stream_v_result = mysql_query($movie_stream_v_sql);
$movie_stream_v = mysql_fetch_array($movie_stream_v_result);
$movie_stream_a_sql = 'SELECT strAudioCodec, iAudioChannels FROM streamdetails WHERE idFile = ' . $movie[$col['id_file']] . ' AND iStreamType = 1';
$movie_stream_a_result = mysql_query($movie_stream_a_sql);
$movie_stream_a = mysql_fetch_array($movie_stream_a_result);
$poster = IPS_GetKernelDir().'webfront/user/xbmc/cache/' . $movie[$col['id_movie']] . '.jpg';
if (!file_exists($poster)) {
preg_match_all('/<thumb.*?>(.*?)<\/thumb>/', $movie[$col['poster']], $poster_path);
preg_match_all('/<thumb.*?>(.*?)<\/thumb>/', $movie[$col['fanart']], $fanart_path);
$poster_path = (isset($poster_path[1]) ? $poster_path[1] : '');
gd_convert($movie[$col['id_movie']], $poster_path);
}
if (!file_exists($poster)) {
$poster = '/user/xbmc/img/d_poster.jpg';
}
// Video Aufloesung
$i = 0;
foreach ($width_height as $key => $val) {
if ($movie_stream_v['iVideoWidth'] >= $key or $movie_stream_v['iVideoHeight'] >= $val) {
$img_flag_vres = '<img id="vres" src="/user/xbmc/img/vres_' . $vres_array[$i] . '.png" alt="">';
}
$i++;
}
// Video Codec
if (isset($vtype[$movie_stream_v['strVideoCodec']])) {
$img_flag_vtype = '<img id="vtype" src="/user/xbmc/img/vcodec_' . $vtype[$movie_stream_v['strVideoCodec']] . '.png" alt="">';
} else {
$img_flag_vtype = '<img id="vtype" src="/user/xbmc/img/vcodec_defaultscreen.png" alt="">';
}
// Audio Codec
if (isset($atype[$movie_stream_a['strAudioCodec']])) {
$img_flag_atype = '<img id="atype" src="/user/xbmc/img/acodec_' . $atype[$movie_stream_a['strAudioCodec']] . '.png" alt="">';
} else {
$img_flag_atype = '<img id="atype" src="/user/xbmc/img/acodec_defaultsound.png" alt="">';
}
// Audio Channel
if (isset($achan[$movie_stream_a['iAudioChannels']])) {
$img_flag_achan = '<img id="achan" src="/user/xbmc/img/achan_' . $achan[$movie_stream_a['iAudioChannels']] . '.png" alt="">';
} else {
$img_flag_achan = '<img id="achan" src="/user/xbmc/img/achan_defaultsound.png" alt="">';
}
$img_flag = $img_flag_vres . $img_flag_vtype . $img_flag_atype . $img_flag_achan;
$data .= "<div class=\"movielist\"><div class=\"poster\" onmousedown=\"dojo.xhrGet({ url: '/user/xbmc/xbmc.con.php?com=playMovie&idMovie=".$movie[$col['id_movie']]."' });\"><img src=\"/user/xbmc/cache/".$movie[$col['id_movie']].".jpg\"/></div><div class=\"description\"><div class=\"titel\">".$movie[$col['title']]."</div><div class=\"subtext\">".$movie[$col['tagline']]."<br/><br/>Jahr: ".$movie[$col['year']]."<br/>Genre: ".$movie[$col['genre']]."<br/>Laufzeit: ".$movie[$col['runtime']]." Minuten</div></div><div class=\"plot\">".$movie[$col['plot']]."</div><div class=\"movieflag\">".$img_flag."</div></div>";
$data .= "";
}
WFC_SendPopup($idwebfront, "Filme", $data);
?>
xbmc.control
Bitte dieses Script unter „Eigene Aktion“ der Steuerungs Variable (Integer) zuweisen.
<?
include(IPS_GetKernelDir().'webfront/user/xbmc/xbmc.inc.php');
if (IPS_GetInstance($idsocket)["InstanceStatus"] != 102)
{
$subject = "XBMC"; //Titel Nachricht
$message = "Bitte schalten Sie Ihr XBMC ein
oder aktivieren Sie die Remotesteuerung!"; //Nachricht
WFC_SendNotification($idwebfront, $subject, '<br />'.$message, 'Meldung_gelb', 5);
exit;
}
$control = $_IPS['VALUE'];
switch ($control)
{
case 1:
case 2:
// Play Pause
CSCK_SendText($idsocket,'{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 1 }, "id": 1}');
break;
case 3:
// Stop
CSCK_SendText($idsocket,'{"jsonrpc": "2.0", "method": "Player.Stop", "params": { "playerid": 1 }, "id": 1}');
case 0:
// Prev
CSCK_SendText($idsocket,'{"jsonrpc": "2.0", "method": "Player.GoPrevious", "params": { "playerid": 1 }, "id": 1}');
case 4:
// Next
CSCK_SendText($idsocket,'{"jsonrpc": "2.0", "method": "Player.GoNext", "params": { "playerid": 1 }, "id": 1}');
}
?>
xbmc.data
<?
include(IPS_GetKernelDir().'webfront/user/xbmc/xbmc.inc.php');
$data = $_IPS['VALUE'];
if ($data == '{"id":1,"jsonrpc":"2.0","result":"OK"}') { exit; };
preg_match_all('/\{"jsonrpc(.*?)xbmc"\}\}/', $data, $output);
foreach ($output[0] as $val) {
$datajson = json_decode($val, true);
switch ($datajson['method'])
{
case "Player.OnPlay":
$poster = IPS_GetKernelDir().'webfront/user/xbmc/cache/' . $datajson['params']['data']['item']['id'] . '.jpg';
if (!file_exists($poster)) {
$poster = '<center><img style="margin-top: 20px" src="/user/xbmc/img/d_poster.jpg"/></center>';
}
else {
$poster = '<center><img style="margin-top: 20px" src="/user/xbmc/cache/' . $datajson['params']['data']['item']['id'] . '.jpg"/></center>';
}
SetValue($idposter, $poster);
SetValue($idcontrol, 1);
$movie_sql = 'SELECT ' . $col['title'] . ' FROM movie WHERE ' . $col['id_movie'] . ' = ' . $datajson['params']['data']['item']['id'] . '';
$movie_result = mysql_query($movie_sql);
$movie = mysql_fetch_array($movie_result);
SetValue($idtitel, $movie[$col['title']]);
break;
case "Player.OnStop":
case "System.OnQuit":
case "VideoLibrary.OnUpdate":
$poster = '<center><img style="margin-top: 20px" src="/user/xbmc/img/d_poster.jpg"/></center>';
SetValue($idposter, $poster);
SetValue($idcontrol, 3);
SetValue($idtitel, " -- ");
break;
case "Player.OnPause":
SetValue($idcontrol, 2);
break;
}
}
?>
-
Legt unter I/O Instanzen einen neuen TCP Socket an (siehe xbmc02.png)
Host: IP - XBMC
Port: 9090
-
Legt darunter eine Register Variable an und wählt als Zielscript xbmc.data (siehe xbmc02.png)
-
Navigiert nach /webfront/user/xbmc/ und öffnet die Datei xbmc.inc.php.
Passt die Einstellungen, wie in der Datei angegeben an.
-
Öffnent nun Euren Webfront Konfigurator und legt die Struktur an (siehe xbmc03.png)
-> xbmc: Aufteilung: Horizontal, Größe: 206, Größeneinheit: Pixel
-> xbmc_nav: Aufteilung: Vertikal, Größe: 171, Größeneinheit: Pixel
-> xbmc_poster: Quellobjekt: ID Poster
-> xbmc_nav: Startkategorie: ID Control
-> xbmc_views: Startkategorie: ID Views
-
Ruft nun über das Webfront die Filmauswahl auf.
Der erste Start dauert, bis der Cache für die Poster aufgebaut wurde.
-
Mit einem klick auf das Poster können Sie den gewünschten Film starten.
Ich hoffe ich habe nichts in meiner Anleitung vergessen.
Weiter möchte ich noch darauf hinweisen, das es sich um eine sehr frühe Version handelt.
Für die Zukunft ist noch die komplette Serienverwaltung geplant sowie die Funktionserweiterung.
Gruss
Michael
xbmcV0.1.zip (149 KB)