false
FlyingDiver wrote:Widgets are dead.
from datetime import date
import calendar
my_date = date.today()
day = calendar.day_name[my_date.weekday()]
indigo.variable.updateValue(VAR_ID, str(day))
Traceback (most recent call last):
File "plugin.py", line 286, in actionControlThermostat
File "plugin.py", line 340, in _handleChangeSetpointAction
ValueError: zero length field name in format
matt (support) wrote:
... but you know us – no ETA.
matt (support) wrote:
matt (support) wrote:
... We do plan on providing a more flexible mechanism in the future.
Jays-Indigo-mini:other root# cat /private/etc/apache2/other/indigo.conf
Listen 8177
<VirtualHost *:8177>
CustomLog /var/log/httpd/indigo-access.log combined
ErrorLog /var/log/httpd/indigo-error.log
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
SSLEngine on
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPass /indigo https://localhost:8176/indigo
ProxyPassReverse /indigo https://localhost:8176/indigo
Header set Cache-Control "no-store"
SSLCertificateFile /etc/apache2/server.crt
SSLCertificateKeyFile /etc/apache2/server.key
<Location /indigo/>
ProxyPass http://localhost:8176/indigo/
ProxyPassReverse http://localhost:8176/indigo/
AuthType Digest
AuthName "Indigo Control Server"
AuthUserFile /private/etc/apache2/other/htdigest
Require user jay
Allow from all
</Location>
<Location /serverrequest>
ProxyPass http://localhost:8176/indigo/serverrequest
ProxyPassReverse http://localhost:8176/indigo/serverrequest
AuthType Digest
AuthName "Indigo Control Server"
AuthUserFile /private/etc/apache2/other/htdigest
Require user jay
Allow from all
</Location>
<Location /servercommand>
ProxyPass http://localhost:8176/indigo/servercommand
ProxyPassReverse http://localhost:8176/indigo/servercommand
AuthType Digest
AuthName "Indigo Control Server"
AuthUserFile /private/etc/apache2/other/htdigest
Require user jay
Allow from all
</Location>
</VirtualHost>
Jays-Indigo-mini:other root# htdigest -c htdigest Indigo\ Control\ Server jay
Adding password for jay in realm Indigo Control Server.
New password:
Jays-Indigo-mini:IndigoWebServer root# diff IndigoWebServer.py IndigoWebServer.py.orig
236,237c236
< #app_root_path = cherrypy.config.get('app_root_path', "")
< app_root_path = "/indigo/"
---
> app_root_path = cherrypy.config.get('app_root_path', "")
Jays-Indigo-mini:IndigoWebServer root#
Jays-Indigo-mini:apache2 root# diff httpd.conf httpd.conf.4
83c83
< LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
---
> #LoadModule auth_digest_module libexec/apache2/mod_auth_digest.so
Jays-Indigo-mini:apache2 root#
tell application "Image Events"
launch
set tempImageRef to open outputTempFN
scale tempImageRef to size targetSize
save tempImageRef as PNG in outputPNGFN with icon
close tempImageRef
end tell
Korey wrote:Different Computers wrote:I'm probably way ahead of myself on this, since this is day 2 of the free trial for me, but could someone point me at the documentation for attaching applescripts to control pages?
This is what I use:
Applescript code:
- Code:
-- configuration properties to set specific to your
-- own setup
property outputTempFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.tiff"
property outputPNGFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.png"
property noArtworkFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNoArtworkAvailable.png"
property notPlayingFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNotPlaying.png"
property targetSize : 256
-- main run routine
on run
-- checks to ensure that itunes is running and available
if my checkItunesIsActive() is false then
-- uncomment below to show an error or add your own logging
-- set opt to (display dialog "iTunes is not running." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
my outputPlaceholderImage(notPlayingFN)
return false
end if
-- ensure that itunes will respond, apparently some version will not if a modal dialog
-- window is showing
if my itunesIsNotAccesible() is true then
-- uncomment below to show an error or add your own logging
-- set opt to (display dialog "Close any utility windows that may be open in iTunes." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
my outputPlaceholderImage(notPlayingFN)
return false
end if
-- itunes should be available… attempt to process now
tell application id "com.apple.iTunes"
if (player state is playing) or (player state is paused) then
if (artworks of current track exists) then
-- the current track has artwork available, attempt to output
-- that to a PNG now
set artwork_data to (get raw data of first artwork of current track)
my outputAlbumArtwork(artwork_data)
else
-- export the "no artwork available" file to the output
my outputPlaceholderImage(noArtworkFN)
end if
else
-- export the "not playing" artwork file to the output
my outputPlaceholderImage(notPlayingFN)
end if
end tell
end run
-- this routine checks to see if iTunes is running
to checkItunesIsActive()
tell application "System Events" to return (exists (some process whose name is "iTunes"))
end checkItunesIsActive
-- this routine ensures that itunes is responding to applescript commands
to itunesIsNotAccesible()
try
with timeout of 1 second
tell application id "com.apple.iTunes" to get name of library playlist 1
end timeout
on error
return true
end try
return false
end itunesIsNotAccesible
-- this routine will output the artwork data provided to the artwork
-- file specified in the properties at top
to outputAlbumArtwork(artwork_data)
set tempFileHandle to (open for access outputTempFN with write permission)
try
tell application "System Events"
write artwork_data to tempFileHandle starting at 0
set file type of (outputTempFN as alias) to ".tiff"
end tell
close access tempFileHandle
tell application "Image Events"
launch
set tempImageRef to open outputTempFN
scale tempImageRef to size targetSize
save tempImageRef as PNG in outputPNGFN with icon
close tempImageRef
end tell
on error err_msg
close access tempFileHandle
-- log error message if desired
-- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
end try
end outputAlbumArtwork
-- this rouitne will output the given filename, assumed to already be a PNG,
-- to the output filename defined in the properties up top
to outputPlaceholderImage(filename)
set outputFileHandle to (open for access (outputPNGFN as alias) with write permission)
try
write (read (filename as alias)) to outputFileHandle starting at 0
close access outputFileHandle
on error err_msg
close access outputFileHandle
-- log error message if desired
-- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
end try
end outputPlaceholderImage
on idle
beep
return 5
end idle
tell application "Album Art for Indigo" of machine "eppc://user:pass@remote.local" to open
set remoteMachine to "eppc://username:password@remotemachine_ip"
using terms from application "iTunes"
try
tell application "iTunes" of machine remoteMachine
<some code here>
end tell
end try
end using terms from
tell application "iTunes"
set pd to data of first artwork of current track
end tell
property fs : "Users:gregtreece:Pictures:MyArt.tiff"
tell application "iTunes"
set pd to data of first artwork of current track
end tell
set rn to (open for access fs with write permission)
try
write pd to rn starting at 0
close access rn
on error err_mess
close access rn
error err_mess
end try
tell application "Finder"
set file type of (fs as alias) to "tiff"
end tell
property pngFile : "Users:gregtreece:Pictures:iTunes.png"
property targetSize : 256
tell application "Image Events"
launch
set theImageReference to open fs
-- create the png file
scale theImageReference to size targetSize
save theImageReference as PNG in pngFile with icon
close theImageReference
end tell
-- configuration properties to set specific to your
-- own setup
property outputTempFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.tiff"
property outputPNGFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesCurrentAlbum.png"
property noArtworkFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNoArtworkAvailable.png"
property notPlayingFN : "Library:Application Support:Perceptive Automation:Indigo 6:IndigoWebServer:images:iTunesNotPlaying.png"
property targetSize : 256
-- main run routine
on run
-- checks to ensure that itunes is running and available
if my checkItunesIsActive() is false then
-- uncomment below to show an error or add your own logging
-- set opt to (display dialog "iTunes is not running." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
my outputPlaceholderImage(notPlayingFN)
return false
end if
-- ensure that itunes will respond, apparently some version will not if a modal dialog
-- window is showing
if my itunesIsNotAccesible() is true then
-- uncomment below to show an error or add your own logging
-- set opt to (display dialog "Close any utility windows that may be open in iTunes." buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
my outputPlaceholderImage(notPlayingFN)
return false
end if
-- itunes should be available… attempt to process now
tell application id "com.apple.iTunes"
if (player state is playing) or (player state is paused) then
if (artworks of current track exists) then
-- the current track has artwork available, attempt to output
-- that to a PNG now
set artwork_data to (get raw data of first artwork of current track)
my outputAlbumArtwork(artwork_data)
else
-- export the "no artwork available" file to the output
my outputPlaceholderImage(noArtworkFN)
end if
else
-- export the "not playing" artwork file to the output
my outputPlaceholderImage(notPlayingFN)
end if
end tell
end run
-- this routine checks to see if iTunes is running
to checkItunesIsActive()
tell application "System Events" to return (exists (some process whose name is "iTunes"))
end checkItunesIsActive
-- this routine ensures that itunes is responding to applescript commands
to itunesIsNotAccesible()
try
with timeout of 1 second
tell application id "com.apple.iTunes" to get name of library playlist 1
end timeout
on error
return true
end try
return false
end itunesIsNotAccesible
-- this routine will output the artwork data provided to the artwork
-- file specified in the properties at top
to outputAlbumArtwork(artwork_data)
set tempFileHandle to (open for access outputTempFN with write permission)
try
tell application "System Events"
write artwork_data to tempFileHandle starting at 0
set file type of (outputTempFN as alias) to ".tiff"
end tell
close access tempFileHandle
tell application "Image Events"
launch
set tempImageRef to open outputTempFN
scale tempImageRef to size targetSize
save tempImageRef as PNG in outputPNGFN with icon
close tempImageRef
end tell
on error err_msg
close access tempFileHandle
-- log error message if desired
-- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
end try
end outputAlbumArtwork
-- this rouitne will output the given filename, assumed to already be a PNG,
-- to the output filename defined in the properties up top
to outputPlaceholderImage(filename)
set outputFileHandle to (open for access (outputPNGFN as alias) with write permission)
try
write (read (filename as alias)) to outputFileHandle starting at 0
close access outputFileHandle
on error err_msg
close access outputFileHandle
-- log error message if desired
-- set opt to (display dialog "Error: " & err_msg buttons {"OK"} default button 1 with title "Cannot proceed..." with icon 0 giving up after 30)
end try
end outputPlaceholderImage
caffeinate -i -w <pid of indigo service>