Author: titmuss
Date: Fri Feb  1 13:56:02 2008
New Revision: 1749

URL: http://svn.slimdevices.com?rev=1749&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r1735):  bklaas | 2008-02-01 16:42:19 +0000
 Bug: 6839
 Description: companion checkin to SC 17096
 
 Remote URLs for artwork are sent via an 'icon' not 'icon-id' flag
 Resize thumbs to 56 pixels for showBrieflys
 Allow for rendering of static image paths in uri generator (e.g., radio icon). 
This section comes largely pasted from SlimBrowser
 

Modified:
    trunk/   (props changed)
    trunk/jive/src/pkg/jive/share/jive/slim/Player.lua

Propchange: trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Fri Feb  1 13:56:02 2008
@@ -1,3 +1,3 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1734
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1735
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: trunk/jive/src/pkg/jive/share/jive/slim/Player.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/slim/Player.lua?rev=1749&root=Jive&r1=1748&r2=1749&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/slim/Player.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/slim/Player.lua Fri Feb  1 13:56:02 2008
@@ -31,7 +31,7 @@
 local debug = require("jive.utils.debug")
 
 -- stuff we need
-local _assert, setmetatable, tonumber, tostring, pairs, ipairs = _assert, 
setmetatable, tonumber, tostring, pairs, ipairs
+local _assert, setmetatable, tonumber, tostring, pairs, type = _assert, 
setmetatable, tonumber, tostring, pairs, type
 
 local os             = require("os")
 local math           = require("math")
@@ -737,7 +737,39 @@
 end
 
 function artworkThumbUri (iconId, size)
-       return '/music/' .. iconId .. '/cover_' .. size .. 'x' .. size .. 
'_f_000000.jpg'
+
+
+       -- we want a 56 pixel thumbnail if it wasn't specified
+       if not size then size = 56 end
+
+       -- sometimes we get a path to a static image rather than an iconId
+       -- if the iconId is a number, this is cover art, otherwise it's static 
content
+       -- do some extra checking instead of just looking for type = number
+       local thisIsAnId = true
+       if type(iconId) == "number" then -- iconId is a number
+               thisIsAnId = true
+       elseif string.find(iconId, "%a") then -- iconID string contains a letter
+               thisIsAnId = false
+       else -- a string with no letters must be an id
+               thisIsAnId = true
+       end
+
+        -- if this is a number, construct the path for a sizexsize cover art 
thumbnail
+        local artworkUri
+        local resizeFrag = '_' .. size .. 'x' .. size .. '_p' -- 'p' is for 
padded
+        if thisIsAnId then
+                -- we want a 56 pixel thumbnail if it wasn't specified
+                artworkUri = '/music/' .. iconId .. '/cover' .. resizeFrag .. 
'.png'
+       elseif string.match(iconId, '.png') then
+               -- if this isn't a number, then we just want the path
+               -- with server-side resizing
+                artworkUri = string.gsub(iconId, '.png', resizeFrag .. '.png')
+        -- otherwise punt and just send back the iconId path
+        else
+                return iconId
+        end
+       log:info(artworkUri)
+        return artworkUri
 end
 
 
@@ -758,13 +790,16 @@
                        -- new song display from server
                        s.text:setValue(table.concat(display["text"], "\n"))
                        s.artIcon:setStyle("icon")
-                       self.slimServer:fetchArtworkThumb(display["icon-id"], 
s.artIcon, artworkThumbUri, nil)
+                       if display['icon'] then
+                               
self.slimServer:fetchArtworkURL(display['icon'], s.artIcon, 56)
+                       else
+                               
self.slimServer:fetchArtworkThumb(display["icon-id"], s.artIcon, 
artworkThumbUri, 56)
+                       end
                else
                        s.text:setValue(table.concat(display["text"], "\n"))
                        s.artIcon:setStyle("noimage")
                        s.artIcon:setValue(nil)
                end
-
                s.window:showBriefly(3000, nil, Window.transitionPushPopupUp, 
Window.transitionPushPopupDown)
        end
 end

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

Reply via email to