Author: bklaas
Date: Thu Jan 28 10:04:30 2010
New Revision: 8416

URL: http://svn.slimdevices.com/jive?rev=8416&view=rev
Log:
 r38...@daddymac-520 (orig r8405):  andy | 2010-01-26 16:24:40 -0500
 Update init script for start/stop artwork resizer daemon
 r38...@daddymac-520 (orig r8406):  andy | 2010-01-26 16:25:03 -0500
 Bump rev
 r38...@daddymac-520 (orig r8407):  adrian | 2010-01-26 16:38:49 -0500
 Bug: N/A
 Description: only return rtmp meta data to the server if requested
 
 r38...@daddymac-520 (orig r8408):  bklaas | 2010-01-26 17:17:07 -0500
 Bug: n/a
 Description: only display cancel touch button on alarm window popup (this 
affects Touch only)
 r38...@daddymac-520 (orig r8409):  ayoung | 2010-01-27 03:21:50 -0500
 Add kill() method
 r38...@daddymac-520 (orig r8410):  michael | 2010-01-27 04:30:58 -0500
 Fixed Bug: 15245
 Description: try harder to shut down SBS before the update, use 
squeezeos.kill() if os.execute() fails to stop it. This might help with bug 
15522 too.
 r38...@daddymac-520 (orig r8411):  michael | 2010-01-27 04:38:36 -0500
 Bug: n/a
 Description: stop resize helper daemon too
 r38...@daddymac-520 (orig r8412):  michael | 2010-01-27 06:28:54 -0500
 Bug: 15245
 Description: try reading the pid from /var/run
 r38...@daddymac-520 (orig r8413):  michael | 2010-01-28 11:42:14 -0500
 Bug: 15522
 Description: don't pretend to be downloading when download has failed 
miserably. Return with an error message.
 r38...@daddymac-520 (orig r8415):  bklaas | 2010-01-28 12:04:09 -0500
  r38...@daddymac-520 (orig r8414):  bklaas | 2010-01-28 12:03:16 -0500
  Bug: n/a
  Description: make logging item available in Settings->Advanced->Logging, 
always. And there was much rejoicing.
  
 

Modified:
    7.6/trunk/   (props changed)
    
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/files/squeezecenter
    
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/squeezecenter_svn.bb
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/LogSettings/LogSettingsMeta.lua
    7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterMeta.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
    
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
    7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/src/squeezeos.c

Propchange: 7.6/trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Thu Jan 28 10:04:30 2010
@@ -12,8 +12,8 @@
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-autoswitch:5831
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/fab4-skin:4552
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/private-branches/new-alsa:6567
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8401
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8402
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.4/trunk:8414
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/7.5/trunk:8415
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:2013
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/files/squeezecenter
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/files/squeezecenter?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/files/squeezecenter
 (original)
+++ 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/files/squeezecenter
 Thu Jan 28 10:04:30 2010
@@ -6,6 +6,7 @@
 
 PID=/var/run/squeezecenter.pid
 SCANNERPID=/var/run/scanner.pid
+RESIZERPID=/var/run/gdresized.pid
 
 # Some stuff does not seem to work without this
 cd $BASE
@@ -27,11 +28,27 @@
                # XXX I've disabled --noinfolog and --nodebuglog for now, we 
will need logging for debugging
                nice -n 5 $BASE/slimserver.pl --charset utf8 --noweb 
--notranscoding --nosb1slimp3sync --nostatistics --logfile syslog &
                echo $! > $PID
+               
+               $0 startresizer
+               ;;
+               
+       startresizer)
+               if [ -s $RESIZERPID ] && kill -0 $(cat $RESIZERPID)
+               then
+                       echo "Artwork Resizer is already running"
+                       exit 1
+               fi
+               
+               echo "Starting Artwork Resizer"
+               
+               nice -n 10 $BASE/gdresized.pl &
+               echo $! > $RESIZERPID
                ;;
 
        stop)
                $0 stopscan
                $0 stopserver
+               $0 stopresizer
                ;;
 
        stopserver)
@@ -62,6 +79,21 @@
                        echo "Scanner is not running"
                fi      
                ;;
+               
+       stopresizer)
+               if [ -s $RESIZERPID ] && kill -0 $(cat $RESIZERPID)
+               then
+                       echo "Stopping Artwork Resizer"
+                       if [ -s $RESIZERPID ]; then
+                               /bin/kill $(cat $RESIZERPID)
+                               
+                               /bin/rm $RESIZERPID
+                       fi
+               else
+                       echo "Artwork Resizer is not running"
+               fi
+               ;;
+               
        rescan)
                $0 restart
        

Modified: 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/squeezecenter_svn.bb
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/squeezecenter_svn.bb?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/squeezecenter_svn.bb
 (original)
+++ 
7.6/trunk/squeezeos/poky/meta-squeezeos/packages/squeezecenter/squeezecenter_svn.bb
 Thu Jan 28 10:04:30 2010
@@ -2,7 +2,7 @@
 LICENSE = "GPL"
 
 PV = "7.5+svnr${SRCREV}"
-PR = "r27"
+PR = "r28"
 
 RDEPENDS += "perl perl-modules libcompress-raw-zlib-perl 
libclass-xsaccessor-perl"
 RDEPENDS += "libdbi-perl sqlite3 libdbd-sqlite-perl"

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/AlarmSnooze/AlarmSnoozeApplet.lua
 Thu Jan 28 10:04:30 2010
@@ -503,6 +503,9 @@
 
        menu:setHeaderWidget(headerGroup)
 
+       window:setButtonAction('rbutton', 'cancel')
+        window:setButtonAction('lbutton', nil, nil)
+
        window:addWidget(menu)
        window:setShowFrameworkWidgets(false)
        window:setAllowScreensaver(false)

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/LogSettings/LogSettingsMeta.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/LogSettings/LogSettingsMeta.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/LogSettings/LogSettingsMeta.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/LogSettings/LogSettingsMeta.lua
 Thu Jan 28 10:04:30 2010
@@ -36,23 +36,7 @@
 
 
 function registerApplet(meta)
-       -- only make this available if an SD card is slotted in and
-       -- a /media/*/log directory is present
-       local media = false
-       if lfs.attributes("/media", "mode") ~= nil then
-               for dir in lfs.dir("/media") do
-                       if lfs.attributes("/media/" .. dir .. "/log", "mode") 
== "directory" then
-                               media = true
-                               break
-                       end
-               end
-       end
-
-       local desktop = not System:isHardware()
-
-       if desktop or media then
-               jiveMain:addItem(meta:menuItem('appletLogSettings', 
'advancedSettings', 'DEBUG_LOG', function(applet, ...) applet:logSettings(...) 
end))
-       end
+       jiveMain:addItem(meta:menuItem('appletLogSettings', 'advancedSettings', 
'DEBUG_LOG', function(applet, ...) applet:logSettings(...) end))
 end
 
 

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/Rtmp.lua Thu Jan 28 
10:04:30 2010
@@ -275,6 +275,9 @@
                                           return 0
                                   else
                                           changeState("Playing")
+                                          if rtmpMessages["meta"] ~= nil then
+                                                  slimproto:send({ opcode = 
"RESP", headers = "" })
+                                          end
                                   end
                           end
 
@@ -288,13 +291,18 @@
 
        [18] = function(stream, rtmp)
                           log:info("message type 18 - metadata")
-                          slimproto:send({ opcode = "META", data = 
rtmp["body"] })
+
+                          if rtmpMessages["meta"] == nil or 
rtmpMessages["meta"] == "send" then
+                                  slimproto:send({ opcode = "META", data = 
rtmp["body"] })
+                          end
                   end,
 
        [20] = function(stream, rtmp)
                           log:info("message type 20")
 
-                          slimproto:send({ opcode = "META", data = 
rtmp["body"] })
+                          if rtmpMessages["meta"] == nil or 
rtmpMessages["meta"] == "send" then
+                                  slimproto:send({ opcode = "META", data = 
rtmp["body"] })
+                          end
 
                           if string.match(rtmp["body"], "_result") then
 

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterApplet.lua
 Thu Jan 28 10:04:30 2010
@@ -21,6 +21,7 @@
 local Task                   = require("jive.ui.Task")
 local Timer                  = require("jive.ui.Timer")
 local Window                 = require("jive.ui.Window")
+local squeezeos              = require("squeezeos_bsp")
 
 local appletManager          = appletManager
 local jiveMain               = jiveMain
@@ -268,6 +269,35 @@
 
 end
 
+function stopSqueezeCenter(self)
+       -- first try the regular way
+       self:_stopServer(true)
+
+       -- try harder if this didn't work
+       if self:serverRunning() then
+
+               -- stop server
+               self:_killByPidFile("/var/run/squeezecenter.pid")
+               
+               -- stop resize helper daemon
+               self:_killByPidFile("/var/run/gdresized.pid")
+
+               -- stop scanner
+--             local pid = _pidfor('scanner.pl')
+--             if pid then
+--                     squeezeos.kill(pid, 15)
+--             end
+       end
+end
+
+function _killByPidFile(self, file)
+       local pid = _readPidFile(file)
+
+       if pid then
+               squeezeos.kill(pid, 15)
+       end
+       os.remove(file)
+end
 
 function _getStatusText(self)
 
@@ -1260,20 +1290,15 @@
 
 
 function serverRunning(self)
-       local sc = _pidfor('slimserver.pl')
-       if (sc ~= nil) then
+       if _pidfor("squeezecenter") then
                return true
        end
-       return false
+       return self:processRunning('slimserver.pl')
 end
 
 
 function scannerRunning(self)
-       local scanner = _pidfor('scanner.pl')
-       if (scanner ~= nil) then
-               return true
-       end
-       return false
+       return self:processRunning('scanner.pl')
 end
 
 
@@ -1287,8 +1312,12 @@
 
 
 function _pidfor(process)
-       local pid
-
+       local pid = _readPidFile("/var/run/" .. process .. ".pid")
+
+       if pid and squeezeos.kill(pid, 0) == 0 then
+               return pid
+       end
+       
        local pattern = "%s*(%d+).*" .. process
 
        log:debug("pattern is ", pattern)
@@ -1305,6 +1334,21 @@
        end
        cmd:close()
 
+       return pid
+end
+
+function _readPidFile(file)
+       local fh = io.open(file, "r")
+
+       if fh == nil then
+               return
+       end
+
+       local pid = fh:read("*all")
+       fh:close()
+
+       log:debug("found pid " .. pid .. " reading " .. file)
+       
        return pid
 end
 

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterMeta.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterMeta.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterMeta.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_fab4/share/applets/SqueezeCenter/SqueezeCenterMeta.lua
 Thu Jan 28 10:04:30 2010
@@ -28,6 +28,7 @@
        meta:registerService("udevEventHandler")
        meta:registerService("squeezecenterStartupCheck")
        meta:registerService("isBuiltInSCRunning")
+       meta:registerService("stopSqueezeCenter")
 end
 
 function configureApplet(meta)

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/SetupFirmwareUpgradeApplet.lua
 Thu Jan 28 10:04:30 2010
@@ -541,6 +541,11 @@
        -- interrupted during the firmware upgrade.
        appletManager:callService("disconnectPlayer")
 
+       -- stop memory hungry services before upgrading
+       if (System:getMachine() == "fab4") then
+               appletManager:callService("stopSqueezeCenter")
+       end     
+
        -- start the upgrade
        Task("upgrade", self, _t_upgrade, _upgradeFailed):addTask()
 

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/SetupFirmwareUpgrade/UpgradeUBI.lua
 Thu Jan 28 10:04:30 2010
@@ -303,6 +303,11 @@
                        self.downloadBytes = self.downloadBytes + #chunk
 
                        if _action == "store" then
+                               if not _fhsink then
+                                       log:error("_fhsink not defined")
+                                       return nil, "Something went wrong... 
_fhsink not defined"
+                               end
+                       
                                -- write content to fhsink
                                local t, err = _fhsink(chunk)
                                if not t then

Modified: 7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/src/squeezeos.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/src/squeezeos.c?rev=8416&r1=8415&r2=8416&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/src/squeezeos.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay_squeezeos/src/squeezeos.c Thu Jan 28 
10:04:30 2010
@@ -207,6 +207,22 @@
        return 1;
 }
 
+/* kill - Send a signal to a process
+ *  pid, signal (both integers)
+ */
+static int squeezeos_kill(lua_State *L)
+{
+       const int pid = lua_tointeger(L, 1);
+       const int signal = lua_tointeger(L, 2);
+       const int ret = kill(pid, signal);
+       if (ret < 0) {
+               lua_pushinteger(L, errno);
+               return 1;
+       } else {
+               lua_pushinteger(L, 0);
+               return 1;
+       }
+}
 
 static const struct luaL_Reg squeezeos_bsp_lib[] = {
        { "reboot", squeezeos_reboot },
@@ -216,6 +232,7 @@
        { "hwclock2sys", squeezeos_hwclock_hc2sys },
        { "getTimezone", squeezeos_get_timezone },
        { "setTimezone", squeezeos_set_timezone },
+       { "kill", squeezeos_kill },
        { NULL, NULL }
 };
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to