I've been attempting the same thing. I believe you can use the FileDownload command in the API or use the CopyFile command which would allow you to copy the thumb to a folder that is exposed to the web server.
Hopefully, someone can confirm or set me straight.
do the getthumb. mime64-decode the data. you have your thumb.
or use the CopyFile/FileDownload stuff but that will surely be much slower if you plan to grab many thumbs..
http://en.wikipedia.org/wiki/Base64
I may be being really dim but I can't seem to decode any thumbnails should the below code work?
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://10.0.0.2/xbmcCmds/xbmcHttp?command=GetThumb(C:\Documents%20and%20Settings\jenkins\Application%20Data\XBMC\userdata\Thumbnails\Video\9\99caa6a6.tbn)');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$test = curl_exec($curl_handle);
curl_close($curl_handle);
$ifp = fopen( "image.jpg", "wb" );
fwrite( $ifp, base64_decode( $test) );
fclose( $ifp );
It creates the image but the image doesn't open. Can anyone help.
Can anyone help me with this? I am wanting to create a new web interface to control XBMC but am coming across this stumbling block and can't get round it.
is there anyone who can give me a clue on this?
the above code was in PHP.
I've tried GetThumb and couldn't get it to work either (C#).
I'm using FileDownload to get the now playing cover art...
Code:
public bool FileExists(string filePath)
{
string[] response = parent.Request("FileExists", filePath);
return parent.CreateBoolRespose(response);
}
public MemoryStream FileDownload(string filePath)
{
MemoryStream msFile;
string[] aDownloadData;
byte[] aFileBytes;
if (this.FileExists(filePath))
{
try
{
aDownloadData = parent.Request("FileDownload(" +filePath+ ";[bare])");
if (aDownloadData != null)
{
aFileBytes = Convert.FromBase64String(aDownloadData[0]);
msFile = new MemoryStream(aFileBytes, 0, aFileBytes.Length);
//msFile.Write(aFileBytes, 0, aFileBytes.Length);
}
else
msFile = null;
}
catch (Exception e)
{
parent.WriteToLog(DateTime.Now.ToString("dd.MM.yyyy hh:mm:ss") + " - DEBUG: " + e.Message + " || " + filePath);
msFile = null;
}
}
else
{
MessageBox.Show("File does not exist");
msFile = null;
}
return msFile;
}
This returns a MemoryStream which you won't be using in PHP.
I'm an idiot, I just didn't have the bare parameter set!
I'm trying to do that with
Code:
GetCurrentlyPlaying([thumbFilename],[nothingPlayingFilename],[onlyIfChanged])
but I've not been succesful.