Closed GoogleCodeExporter closed 8 years ago
a) make sure the image really exists
b) check (or post) your MediaPortal log files (C:\ProgramData\Team
MediaPortal\MediaPortal\log\MediaPortal.log)
Original comment by mail.bgm...@gmail.com
on 24 May 2011 at 9:09
Here's the extract from the log...
2011-05-28 11:12:01.156000 [Warn.][(30)]: [WIFI_REMOTE] WifiRemote
Communication Error: Bad JSON escape sequence: \P. Line 1, position 33.
So it seems to be complaining about the backslash before ProgramData.
Note that when I compile the string for the JSON command, I am putting double
backslashes in to combat the escape sequence.
If I don't do that, then I DO get a IMAGE message come back, but it doesn't
contain the image because it can't be found because it ends up trying to locate
C:ProgramDataTeam MediaportalMediaportal humbs ... etc (i.e the backslashes
have been removed because it thinks they are escape characters.
thoughts? thanks a lot...
Original comment by mbarn...@googlemail.com
on 28 May 2011 at 10:17
Could you please check if you are really using double-backslashes? It looks
like you are using single backslashes in the JSON which makes the plugin think
you are trying to escape the P with \P ...
Original comment by shuku...@gmail.com
on 29 May 2011 at 11:11
Hi.
Nope. Definately using double backslashes (see 1. above). However, I would add
that if I remove one of them (i.e. only set up a string with Single
Backslashes), then I DO get an Image message returned - but there is no image.
And the ImagePath key has the pathname with no slashes at all (i.e the "t" from
thumbs has been removed).
I've tried one slash, two, three, four, five, six......
ahhh.. :-(
Original comment by mbarn...@googlemail.com
on 30 May 2011 at 7:25
So in summary;
If I send an Imagepath with no slashes, I get an Image message come back, but
no image (of course, because it can't find it).
If I send an Imagepath with double-slashes, I get no message back at all, but a
WARN in the log saying that it doesn't like /P (for Programdata).
Can you change the debug level so that you print more information in the Log
about what might be going on?
thanks
Original comment by mbarn...@googlemail.com
on 30 May 2011 at 8:22
I will add additional debug output tonight. Please send me a PM on the
mediaportal website (username: Shukuyen) so that I can send you a download link
for the test dll. I also need to know if you are using MediaPortal 1.2.0 beta
or below.
Original comment by shuku...@gmail.com
on 30 May 2011 at 8:28
[deleted comment]
I know it's been a while since this was commented on, but could this be as
simple as not enough slashes being used? I am using C++ and setting string
using this:
"{\"Type\":\"image\",\"ImagePath\":\"C:\\ProgramData\\Team
MediaPortal\\MediaPortal\\thumbs\\Music\\Artists\\Abba.jpg\"}"
will evaluate to a string containing this:
{"Type":"image","ImagePath":"C:\ProgramData\Team
MediaPortal\MediaPortal\thumbs\Music\Artists\Abba.jpg"}
because double-slashes evaluate to one slash before sending. However WifiRemote
needs to *receive* double-slashes, meaning you should set the string like this:
"{\"Type\":\"image\",\"ImagePath\":\"C:\\\\ProgramData\\\\Team
MediaPortal\\\\MediaPortal\\\\thumbs\\\\Music\\\\Artists\\\\Abba.jpg\"}"
This could explain the '/P' error, because when it received the command it will
think you're trying to escape the letter P rather than specify a backslash.
EDIT: Just re-read comment number 4 stating that four slashes have been tried,
however this still seems like it could be the issue. With one slash the letters
are being escaped on the client-side, with double-slashes the letters are being
escaped on the server-side. With quadruple-slashes you'll get through the
client-side and server-side escaping.
Original comment by nik.ro...@gmail.com
on 20 Jun 2011 at 9:27
I am also quite certain that the error is due to the wrong number of
backslashes used. Did you solve this?
Original comment by shuku...@gmail.com
on 21 Jun 2011 at 9:41
You're right guys... sorry i've been away on holiday and only got back at the
weekend.
YES... i did get it working with four slashes... I must have had large thumbs
of something when I'd said that i tried that earlier..
So.. I now have an image returned (sorry, for complaining, and thanks for the
extra debug - that really helped)..
Only thing now is i need to find a way to convert the image string returned
into an image.... it's Base64 right? Anyone know of a converter?
thanks guys.
Original comment by mbarn...@googlemail.com
on 21 Jun 2011 at 7:35
Happens to the best of us :)
I code in Qt which has B64 functions built-in, but a quick Google search for C#
(this is what you're using, no?) gives this:
http://www.vbforums.com/showthread.php?t=287324
Original comment by nik.ro...@gmail.com
on 22 Jun 2011 at 3:55
The image is converted to a byte array, you can see how it is done here:
http://code.google.com/p/wifiremote/source/browse/trunk/Sources/WifiRemote/WifiR
emote.cs#599
If you are using C# you should be able to do something like this to get an
image out of the byte array:
MemoryStream stream = new MemoryStream(imageByteArray);
System.Drawing.Image theImage = Image.FromStream(stream);
Original comment by shuku...@gmail.com
on 22 Jun 2011 at 8:05
Original issue reported on code.google.com by
mbarn...@googlemail.com
on 24 May 2011 at 6:16