Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
iPhone web app supporting long button presses
Re: iPhone web app supporting long button presses
I would first like to say that this remote app is great!!!
I have been modifing it to my home configuration and I do have three questions.
1. when the app starts up it turns the status bar at the top of the Iphone to white and
I can't figure out how to keep it black.
2. Can you keep the Iphone from rotating the orientation?
3. Do you know of someway to turn on the proximity sensor to save the battery?
Thanks
Darbman
I have been modifing it to my home configuration and I do have three questions.
1. when the app starts up it turns the status bar at the top of the Iphone to white and
I can't figure out how to keep it black.
2. Can you keep the Iphone from rotating the orientation?
3. Do you know of someway to turn on the proximity sensor to save the battery?
Thanks
Darbman
- CommandFusion
- Experienced User
- Posts: 59
- Joined: Thu Jun 25, 2009 9:36 am
- Location: Melbourne, Australia
- Contact:
Re: iPhone web app supporting long button presses
Darbman: The features you want can only be done in a native application. Try our app, iViewer, which we have a plugin available for EventGhost.
See this post for more info:
http://www.eventghost.org/forum/viewtop ... f=2&t=1995
See this post for more info:
http://www.eventghost.org/forum/viewtop ... f=2&t=1995
Jarrod Bell
CommandFusion
CommandFusion
Re: iPhone web app supporting long button presses
Just to clarify, this is a web site, not an iPhone app. It has code to enable some iPhone look & feel and other features.
With that said...
1. I don't have this issue
2. yes, this is in the header of the web page. do a google search for the code.
3. not sure, again a google search should render this answer.
If you find the answers please post back.
Also, some alternatives...
commercial priced apps: CommandFusion
free apps: Logitech Touch Mouse
low priced apps: Mobile AirMouse, Remotely Possible, Bobby, etc
With that said...
1. I don't have this issue
2. yes, this is in the header of the web page. do a google search for the code.
3. not sure, again a google search should render this answer.
If you find the answers please post back.
Also, some alternatives...
commercial priced apps: CommandFusion
free apps: Logitech Touch Mouse
low priced apps: Mobile AirMouse, Remotely Possible, Bobby, etc
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
Re: iPhone web app supporting long button presses
Hi,
I've added a spotify page to the remote pages to show how to poll data from the webserver and see, e.g., what's currently playing spotify. In the attachment below you can find my current web app and its corresponding eventghost configuration file. The spotify page can be accessed from the devices page.
A little explanation about how it works: the relevant data is updated on the browser when the function "checkSpotifyData(delay)" is called. This function can be added to any table cell. For example:
The optional argument in checkSpotifyData() defines the delay in executing the function, because some actions, e.g., changing the playlist, requires some time to be executed. When the function is executed it sends the event 'Spotify-UpdateData' to eventghost that then writes the relevant info to a file 'data/spotify.txt'. This file has pairs "name=value" separated by the newline character. It is requested by the web client through an ajax call that changes the innerHTML content of the table cells of class="egvar" acordingly. For example, if we have the pairs "status=Running" and "artist=Adele" in 'spotify.txt', then in the cells:
the innerHTML is changed to "runnning" and "Adele" respectively upon execution of "checkSpotifyData()". To prevent the file 'spotify.txt' to be cached by the browser it is necessary to include the following in the cache.manifest file:
I have not included a regular poll to call the update function (it is called upon any action like play, pause, next track, etc and in addition you always can update the info by touching the corresponding info cell) but it would be easy to implement if desired.
Hope it is useful to somebody. Regards.
I've added a spotify page to the remote pages to show how to poll data from the webserver and see, e.g., what's currently playing spotify. In the attachment below you can find my current web app and its corresponding eventghost configuration file. The spotify page can be accessed from the devices page.
A little explanation about how it works: the relevant data is updated on the browser when the function "checkSpotifyData(delay)" is called. This function can be added to any table cell. For example:
Code: Select all
<td egevent="Spotify-PlayLastPlaylist" action="checkSpotifyData(1000)" >Last Playlist</td>
Code: Select all
<td egvar="status" class="egvar" action="checkSpotifyData()"></td>
<td egvar="artist" class="egvar" action="checkSpotifyData()"></td>
Code: Select all
NETWORK:
data/spotify.txt
Hope it is useful to somebody. Regards.
- Attachments
-
- Remote.zip
- (289 KiB) Downloaded 297 times
Re: iPhone web app supporting long button presses
Wow, your Spotify configuration is working great! Thanks for your help.
One small thing though, do you also have erros with artists or titles with special characters? Like R├Âyksopp,... I have erros in the log of EventGhost and the playing song doesn't show up in the browser. However, I know it doesn't occur with Dynamic Webserver.
One small thing though, do you also have erros with artists or titles with special characters? Like R├Âyksopp,... I have erros in the log of EventGhost and the playing song doesn't show up in the browser. However, I know it doesn't occur with Dynamic Webserver.
Re: iPhone web app supporting long button presses
I don't know very much about text encodings but here is a way to solve the problem.
Add the command "eg.globals.Data = eg.globals.Data.decode('cp1252')" to the end of the "Set Spotify Info" python script in the macro "Spotify UpdateData". Then set the output data coding of the Write file operation in the same macro to "utf-8". This should get rid of the problem.
Here it is the "Spotify UpdateData" macro for copy-paste if prefered.
I want to mention that it is posible to use the dynamic webserver plugin with this web app. For it you simply create a file "data/spotify.html" with the following contents:
modify the "Spotify UpdateData" macro to simply adjust the necessary variables
and finally change "spotify.txt" to "spotify.html" in the definition of function "checkSpotifyDataAux" in file "remote.js". Problem is that now I have the same problem with non ascii characters and don't know how to solve it. Could you tell me how did you manage to make it work? Putting a non ascii character in the "light.html" example fo the dynamic webserver makes it stop working for me.
Add the command "eg.globals.Data = eg.globals.Data.decode('cp1252')" to the end of the "Set Spotify Info" python script in the macro "Spotify UpdateData". Then set the output data coding of the Write file operation in the same macro to "utf-8". This should get rid of the problem.
Here it is the "Spotify UpdateData" macro for copy-paste if prefered.
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1366">
<Macro Name="Spotify UpdateData" Expanded="True">
<Action Name="Set Spotify Info">
EventGhost.PythonScript(u'# transform none into empty string\ndef xstr(s):\n if s is None:\n return \'\'\n return str(s)\n\nartist = xstr(eg.plugins.MySpotify.GetCurrentArtist())\ntitle = xstr(eg.plugins.MySpotify.GetCurrentTrack())\nstatus = xstr(eg.plugins.MySpotify.GetStatus())\n\nif status is \'\':\n status = \'Spotify not running\'\n\nif artist is not \'\':\n status = artist + \' - \' + title\n\neg.globals.Data = \'artist=\' + artist + \'\\n\' + \'title=\' + title + \'\\n\' + \'status=\' + status\n\neg.globals.Data = eg.globals.Data.decode("cp1252")\n\n#print eg.globals.Data')
</Action>
<Action>
FileOperations.Write(1, u'{eg.globals.Data}', u'E:\\Programs\\Webs\\Eventghost\\Remote\\data\\spotify.txt', 0, 0, True, False, False, 'utf8')
</Action>
</Macro>
</EventGhost>
Code: Select all
artist={{eg.globals.spotifyArtist}}
title={{eg.globals.spotifyTitle}}
status={{eg.globals.spotifyStatus}}
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1366">
<Macro Name="Spotify UpdateData" Expanded="True">
<Event Name="Spotify-UpdateData" />
<Action Name="Set Spotify Info">
EventGhost.PythonScript(u'\neg.globals.spotifyArtist = eg.plugins.MySpotify.GetCurrentArtist()\neg.globals.spotifyTitle = eg.plugins.MySpotify.GetCurrentTrack()\neg.globals.spotifyStatus = eg.plugins.MySpotify.GetStatus()\n\n')
</Action>
</Macro>
</EventGhost>
Re: iPhone web app supporting long button presses
Yes!!! Thanks, working fine.paseant wrote:Add the command "eg.globals.Data = eg.globals.Data.decode('cp1252')" to the end of the "Set Spotify Info" python script in the macro "Spotify UpdateData". Then set the output data coding of the Write file operation in the same macro to "utf-8". This should get rid of the problem.
Hum, I didn't do anything else than using the code Jostein taught me, modified to work with Dynamic Webserver:paseant wrote:Could you tell me how did you manage to make it work?
Code: Select all
nowplaying = eg.plugins.MySpotify.GetStatus()
nowplaying = nowplaying.split('!')
eg.globals.SpotifyStatus = nowplaying[1]
a = nowplaying[1]
b = a.strip("Now playing ")
c = b.split(" - ")
eg.globals.SpotifyArtist = c[0]
eg.globals.SpotifyTitle = c[1]Sheugel
Re: iPhone web app supporting long button presses
I'm calling for help once again but I think it could interest other people using EG to control Spotify with iPhone/iPod Touch.
I'm using a script to fetch artist pictures related to the playing song from Last.fm and display it in the web app. It makes a more eye catching Spotify remote.
The script is inserted in the index.html and uses jQuery.js. It also requires an api key which you can have freely with your Last.fm account: http://www.lastfm.fr/api/account. It has to be inserted in the script under var api_key = "";
Right now, it only works with this Python code that Jostein taught me under Spotify Play, Next, Previous controls in EG tree... and needs a page refresh to update:
I would like to make it interact with your Spotify config that I'm using, paseant.
I attach a picture of it and the Webserver file.
Thanks,
Sheugel
I'm using a script to fetch artist pictures related to the playing song from Last.fm and display it in the web app. It makes a more eye catching Spotify remote.
The script is inserted in the index.html and uses jQuery.js. It also requires an api key which you can have freely with your Last.fm account: http://www.lastfm.fr/api/account. It has to be inserted in the script under var api_key = "";
Right now, it only works with this Python code that Jostein taught me under Spotify Play, Next, Previous controls in EG tree... and needs a page refresh to update:
Code: Select all
nowplaying = eg.plugins.MySpotify.GetStatus()
nowplaying = nowplaying.split('!')
eg.globals.SpotifyStatus = nowplaying[1]
a = nowplaying[1]
b = a.strip("Now playing ")
c = b.split(" - ")
eg.globals.SpotifyArtist = c[0]
eg.globals.SpotifyTitle = c[1]I attach a picture of it and the Webserver file.
Thanks,
Sheugel
- Attachments
-
- SpotiMote.zip
- (287.34 KiB) Downloaded 242 times
Re: iPhone web app supporting long button presses
Hi.
Thanks again paseant got it working. The artist pictures looks great Sheugel, would be great to get it to change without refreshing the page
Any luck?
Best regards Jostein
Thanks again paseant got it working. The artist pictures looks great Sheugel, would be great to get it to change without refreshing the page
Best regards Jostein
Re: iPhone web app supporting long button presses
Hi, I found a way to achieve it with an iframe.Jostein wrote:The artist pictures looks great Sheugel, would be great to get it to change without refreshing the pageAny luck?
I attach the webserver folder along with the xml file (set to work under C:\Program Files\EventGhost).
It works with the Dynamic Webserver plugin and the Last.fm api key must be filled in the lastfm.html.
Also I noticed that there's a way to search a playlist with keyboard presses (list must be in alphabetical order either by title, artist or album).
It's therefore possible to look for a specific song with a multitap (sms-like) config (by entering the first 2-3 letters) that I've put on the "second" page of the webserver. The reordering of files depend on the window position and is specific to my configuration (the lParam of the Send Message actions should then be changed accordingly if it's not working...).
I reattach a picture of how the main page looks like.
Sheugel
- Attachments
-
- SpotiMote.xml
- (10.6 KiB) Downloaded 230 times
-
- SpotiMote.zip
- (186.74 KiB) Downloaded 244 times
Re: iPhone web app supporting long button presses
Hi paseant,
I've customized your webpage to fit my needs and its works wonderfully;
my half-working webpage was slow and bulky. This was a great solution for me.
However,
I'm trying to expand the abilities of eventghost and your webpage and I was looking for some help.
I'm wondering how to integrate a form into the code like for a text box.
For example, if I wanted to set a timer at a certain time of day.
Could I somehow get from a text box where I can type in the time I want to a payload on eventghost without having to reload the page?
I have already modified the javascript to allow for a "payload" parameter that can be put in the td and be passed with the event trigger.
I guess I'm just stuck on how to display the textbox and how to pull the text out of the textbox in javascript.
Thanks for all your help,
Carson
I've customized your webpage to fit my needs and its works wonderfully;
my half-working webpage was slow and bulky. This was a great solution for me.
However,
I'm trying to expand the abilities of eventghost and your webpage and I was looking for some help.
I'm wondering how to integrate a form into the code like for a text box.
For example, if I wanted to set a timer at a certain time of day.
Could I somehow get from a text box where I can type in the time I want to a payload on eventghost without having to reload the page?
I have already modified the javascript to allow for a "payload" parameter that can be put in the td and be passed with the event trigger.
Code: Select all
function TriggerEvent (eventname, payload){
if (payload == null) {
Request(eventname + "&withoutRelease");
} else {
Request(eventname + "&withoutRelease&" + payload);
}
return false;
}
function doProcessThing() {
var egevent = objThis.getAttribute("egevent");
var payload = objThis.getAttribute("payload");
if (egevent) {
TriggerEvent(egevent, payload);
}
}
Thanks for all your help,
Carson
Re: iPhone web app supporting long button presses
does any one els get this error some times with long butten presses? i am useing the unmodded remote webpage from this post
viewtopic.php?f=2&t=2045#p12388
viewtopic.php?f=2&t=2045#p12388
Exception happened during processing of request from ('10.99.65.76', 50471)
Traceback (most recent call last):
File "SocketServer.pyc", line 558, in process_request_thread
File "SocketServer.pyc", line 320, in finish_request
File "SocketServer.pyc", line 615, in __init__
File "BaseHTTPServer.pyc", line 329, in handle
File "BaseHTTPServer.pyc", line 312, in handle_one_request
File "socket.pyc", line 406, in readline
error: [Errno 10054] An existing connection was forcibly closed by the remote host
Re: iPhone web app supporting long button presses
Greate plugin
but it unfortently lacks support when playing song that contains the follwoing characters "├Ñ ├ñ ├ ├╝" etc...
¨
This is the error i get.
15:42:51 File Operations: Write {eg.globals.Data} to file: C:\Users\user\Desktop\Remote\Remote\data\spotify.txt
15:42:51 Error in Action: "File Operations: Write {eg.globals.Data} to file: C:\Users\user\Desktop\Remote\Remote\data\spotify.txt"
15:42:51 Traceback (most recent call last) (1540):
15:42:51 File "C:\Program Files\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
15:42:51 return self(*args)
15:42:51 File "C:\Program Files\EventGhost\plugins\FileOperations\__init__.py", line 899, in __call__
15:42:51 string = eg.ParseString(string)
15:42:51 File "C:\Program Files\EventGhost\eg\Utils.py", line 205, in ParseString
15:42:51 chunks.append(unicode(res))
15:42:51 UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 38: ordinal not in range(128)
All otehr songs seems to workk
Song you can try with:
http://open.spotify.com/track/2SzvmYiWPsjearfYl2asCl
http://open.spotify.com/track/0L6T1XYGxIGWeyBMpW2Pba
¨
This is the error i get.
15:42:51 File Operations: Write {eg.globals.Data} to file: C:\Users\user\Desktop\Remote\Remote\data\spotify.txt
15:42:51 Error in Action: "File Operations: Write {eg.globals.Data} to file: C:\Users\user\Desktop\Remote\Remote\data\spotify.txt"
15:42:51 Traceback (most recent call last) (1540):
15:42:51 File "C:\Program Files\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
15:42:51 return self(*args)
15:42:51 File "C:\Program Files\EventGhost\plugins\FileOperations\__init__.py", line 899, in __call__
15:42:51 string = eg.ParseString(string)
15:42:51 File "C:\Program Files\EventGhost\eg\Utils.py", line 205, in ParseString
15:42:51 chunks.append(unicode(res))
15:42:51 UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in position 38: ordinal not in range(128)
All otehr songs seems to workk
Song you can try with:
http://open.spotify.com/track/2SzvmYiWPsjearfYl2asCl
http://open.spotify.com/track/0L6T1XYGxIGWeyBMpW2Pba