From 3bfa576a73e474d51543c642f10a3ac906d770be Mon Sep 17 00:00:00 2001 From: topfs2 Date: Wed, 7 Apr 2010 17:52:51 +0000 Subject: Cleaned up webinterface so its easier to read and made it use the new XBMC.Play git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29119 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 --- web/poc_jsonrpc/albums.html | 12 ++++++------ web/poc_jsonrpc/artists.html | 26 ++++++++++++------------- web/poc_jsonrpc/development.html | 18 +++++++++--------- web/poc_jsonrpc/movies.html | 29 ++++++++++++++++------------ web/poc_jsonrpc/musicfiles.html | 24 +++++++++++------------ web/poc_jsonrpc/nowplaying.html | 38 ++++++++++++++++++------------------- web/poc_jsonrpc/tvshowepisodes.html | 29 ++++++++++++++++++++-------- web/poc_jsonrpc/tvshows.html | 11 +++++------ web/poc_jsonrpc/tvshowseasons.html | 20 +++++++++---------- web/poc_jsonrpc/videofiles.html | 22 ++++++++++----------- 10 files changed, 123 insertions(+), 106 deletions(-) (limited to 'web') diff --git a/web/poc_jsonrpc/albums.html b/web/poc_jsonrpc/albums.html index f49fcfdcc6..67b3d276f0 100644 --- a/web/poc_jsonrpc/albums.html +++ b/web/poc_jsonrpc/albums.html @@ -7,7 +7,7 @@ function CallPlay(album) { var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"AudioPlaylist.Play\", \"params\": { \"albumid\": " + album + " }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "XBMC.Play", "params": { "albumid": ' + album + ' }, "id": 1}'); } @@ -35,19 +35,19 @@ function CallPlay(album) { diff --git a/web/poc_jsonrpc/artists.html b/web/poc_jsonrpc/artists.html index 86daed3f30..bc962ae61c 100644 --- a/web/poc_jsonrpc/artists.html +++ b/web/poc_jsonrpc/artists.html @@ -7,15 +7,15 @@ function CallPlay(album) { var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"AudioPlaylist.Play\", \"params\": { \"albumid\": " + album + " }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "XBMC.Play", "params": { "albumid": ' + album + ' }, "id": 1}'); } -function writeArtist( artist ) { - document.write("

" + artist["label"] + "

"); +function writeArtist(artist) { + document.write('

' + artist["label"] + '

'); var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"MusicLibrary.GetAlbums\", \"params\": { \"artistid\": " + artist["artistid"] + " }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "MusicLibrary.GetAlbums", "params": { "artistid": ' + artist["artistid"] + ' }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); var result = the_object["result"]; @@ -23,12 +23,12 @@ function writeArtist( artist ) { for (var property in array) { var item = array[property]; - document.write(""); + document.write(''); if (item["thumbnail"]) - document.write("\"""); + document.write('' + item['); else - document.write("\"""); - document.write(""); + document.write('' + item['); + document.write(''); } } @@ -57,23 +57,23 @@ function writeArtist( artist ) { diff --git a/web/poc_jsonrpc/development.html b/web/poc_jsonrpc/development.html index 7e6f4175c1..59105288b5 100644 --- a/web/poc_jsonrpc/development.html +++ b/web/poc_jsonrpc/development.html @@ -18,23 +18,23 @@ diff --git a/web/poc_jsonrpc/movies.html b/web/poc_jsonrpc/movies.html index 31b6078c70..afa59ad240 100644 --- a/web/poc_jsonrpc/movies.html +++ b/web/poc_jsonrpc/movies.html @@ -4,9 +4,10 @@ @@ -34,29 +35,33 @@ function PlayMovie(movieid) diff --git a/web/poc_jsonrpc/musicfiles.html b/web/poc_jsonrpc/musicfiles.html index 96478ec31e..69e6470ed6 100644 --- a/web/poc_jsonrpc/musicfiles.html +++ b/web/poc_jsonrpc/musicfiles.html @@ -42,9 +42,9 @@ var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); if (directory) - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetDirectory\", \"params\": { \"type\": \"music\", \"directory\": \"" + Url.decode(directory) + "\", \"sortmethod\": \"label\", \"sortorder\": \"ascending\" }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": { "type": "music", "directory": "' + Url.decode(directory) + '", "sortmethod": "label", "sortorder": "ascending" }, "id": 1}'); else - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetSources\", \"params\": { \"type\": \"music\" }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "Files.GetSources", "params": { "type": "music" }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); @@ -56,30 +56,30 @@ if (result) { else array = result["shares"]; - document.write(""); + document.write('
'); for (var i in array) { var item = array[i]; - document.write(""); + document.write(''); } - document.write("
"); + document.write('
'); if (item["file"].endsWith("/")) { - document.write(""); - document.write("\"""); + document.write(''); + document.write('' + item['); } else { - document.write("\"""); + document.write('' + item['); } - document.write(""); + document.write(''); if (item["file"].endsWith("/")) { - document.write(""); - document.write(item["label"] + ""); + document.write(''); + document.write(item["label"] + ''); } else { document.write(item["label"]); } - document.write("
"); + document.write(''); } else { document.write("Error"); } diff --git a/web/poc_jsonrpc/nowplaying.html b/web/poc_jsonrpc/nowplaying.html index e81e4ca520..7830aad9a9 100644 --- a/web/poc_jsonrpc/nowplaying.html +++ b/web/poc_jsonrpc/nowplaying.html @@ -8,7 +8,7 @@ function CallMethod(method) { var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"" + method + "\", \"params\": { \"fields\": [\"title\", \"plot\"] }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "' + method + '", "params": { "fields": ["title", "plot"] }, "id": 1}'); window.location.reload( false ); } @@ -16,7 +16,7 @@ function CallPlay(player, playlistItem) { var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"" + player + "Playlist.Play\", \"params\": " + playlistItem + ", \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "' + player + 'Playlist.Play", "params": ' + playlistItem + ', "id": 1}'); } function refresh() @@ -41,7 +41,7 @@ function refresh() setTimeout( "refresh()", 5*1000 ); var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); -http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"Player.GetActivePlayers\", \"id\": 1}"); +http_request.send('{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'); var players = JSON.parse(http_request.responseText)["result"]; if (players.length > 0) { @@ -49,7 +49,7 @@ if (players.length > 0) { http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"" + player + "Playlist.GetItems\", \"params\": { \"fields\": [\"title\", \"plot\"] }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "' + player + 'Playlist.GetItems", "params": { "fields": ["title", "plot"] }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); var result = the_object["result"]; @@ -58,32 +58,32 @@ if (players.length > 0) { if (activeItem >= 0) { if (array[activeItem]["thumbnail"]) - document.write(""); + document.write('"'); else - document.write(""); + document.write(''); - document.write("

"); + document.write('

'); - document.write(""); - document.write(""); - document.write(""); - document.write(""); + document.write(''); + document.write(''); + document.write(''); + document.write(''); - document.write("

"); + document.write('

'); - document.write(""); + document.write('
'); for (var i in array) { var item = array[i]; - document.write(""); - document.write(""); + document.write(''); + document.write(''); if (i == activeItem) - document.write(""); + document.write(''); else - document.write(""); - document.write(""); + document.write(''); + document.write(''); } - document.write("
" + item["label"] + "
' + item["label"] + '
"); + document.write(''); } } else { document.write("Nothings playing"); diff --git a/web/poc_jsonrpc/tvshowepisodes.html b/web/poc_jsonrpc/tvshowepisodes.html index 1c0af92202..d8d7406f2b 100644 --- a/web/poc_jsonrpc/tvshowepisodes.html +++ b/web/poc_jsonrpc/tvshowepisodes.html @@ -3,6 +3,13 @@ @@ -31,27 +38,33 @@ var season = gup("season"); var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); -http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetEpisodes\", \"params\": { \"tvshowid\": " + tvshowid + ", \"season\": " + season + ", \"fields\": [\"plot\"] }, \"id\": 1}"); +http_request.send('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": { "tvshowid": ' + tvshowid + ', "season": ' + season + ', "fields": ["plot"] }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); var result = the_object["result"]; if (result) { var array = result["episodes"]; - document.write(""); + document.write('
ThumbnailInfo
'); for (var i in array) { var item = array[i]; - document.write(""); + document.write(''); } - document("
ThumbnailInfo
"); - document.write("\"""); - document.write(""); + document.write('
'); + var thumbnail = "images/DefaultVideo.png"; + if (item["thumbnail"]) + thumbnail = "thumb/" + item["thumbnail"] + ".jpg"; + + document.write(''); + document.write(''); + document.write(''); + document.write(''); - document.write("

" + item["label"] + "

"); + document.write('

' + item["label"] + '

'); if (item["plot"]) document.write(item["plot"]); - document.write("
"); + document(''); } else { document.write("Error"); } diff --git a/web/poc_jsonrpc/tvshows.html b/web/poc_jsonrpc/tvshows.html index c17ab86a1a..17d7090f98 100644 --- a/web/poc_jsonrpc/tvshows.html +++ b/web/poc_jsonrpc/tvshows.html @@ -27,18 +27,17 @@ diff --git a/web/poc_jsonrpc/tvshowseasons.html b/web/poc_jsonrpc/tvshowseasons.html index 2ca7638a15..8f00917de3 100644 --- a/web/poc_jsonrpc/tvshowseasons.html +++ b/web/poc_jsonrpc/tvshowseasons.html @@ -30,29 +30,29 @@ var tvshowid = gup("tvshowid"); var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); -http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.GetSeasons\", \"params\": { \"tvshowid\": " + tvshowid + ", \"fields\": [ \"season\" ] }, \"id\": 1}"); +http_request.send('{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": { "tvshowid": ' + tvshowid + ', "fields": [ "season" ] }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); var result = the_object["result"]; if (result) { var array = result["seasons"]; - document.write(""); + document.write('
ThumbnailInfo
'); for (var i in array) { var item = array[i]; - document.write(""); + document.write(''); } - document("
ThumbnailInfo
"); - document.write(""); - document.write("\"""); - document.write(""); - document.write(""); - document.write("

" + item["label"] + "

"); + document.write('
'); + document.write(''); + document.write('' + item['); + document.write(''); + document.write(''); + document.write('

' + item["label"] + '

'); if (item["plot"]) document.write(item["plot"]); - document.write("
"); + document(''); } else { document.write("Error"); } diff --git a/web/poc_jsonrpc/videofiles.html b/web/poc_jsonrpc/videofiles.html index d5d4a37c7d..c246eb118a 100644 --- a/web/poc_jsonrpc/videofiles.html +++ b/web/poc_jsonrpc/videofiles.html @@ -42,9 +42,9 @@ var http_request = new XMLHttpRequest(); http_request.open( "POST", "jsonrpc", false ); if (directory) - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetDirectory\", \"params\": { \"type\": \"video\", \"directory\": \"" + Url.decode(directory) + "\" }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": { "type": "video", "directory": "' + Url.decode(directory) + '" }, "id": 1}'); else - http_request.send("{\"jsonrpc\": \"2.0\", \"method\": \"Files.GetSources\", \"params\": { \"type\": \"video\" }, \"id\": 1}"); + http_request.send('{"jsonrpc": "2.0", "method": "Files.GetSources", "params": { "type": "video" }, "id": 1}'); var the_object = JSON.parse(http_request.responseText); @@ -56,30 +56,30 @@ if (result) { else array = result["shares"]; - document.write(""); + document.write('
'); for (var i in array) { var item = array[i]; - document.write(""); + document.write(''); } - document.write("
"); + document.write('
'); if (item["file"].endsWith("/")) { - document.write(""); - document.write("\"""); + document.write(''); + document.write('' + item['); } else { - document.write("\"""); + document.write('' + item['); } - document.write(""); + document.write(''); if (item["file"].endsWith("/")) { - document.write(""); + document.write(''); document.write(item["label"] + ""); } else { document.write(item["label"]); } - document.write("
"); + document.write(''); } else { document.write("Error"); } -- cgit v1.2.3