]> gitweb.fluxo.info Git - awesompd.git/commitdiff
Bugfixes and tidy up
authorAlexander Yakushev <yakushev.alex@gmail.com>
Fri, 19 Aug 2011 09:20:15 +0000 (12:20 +0300)
committerAlexander Yakushev <yakushev.alex@gmail.com>
Fri, 19 Aug 2011 09:51:03 +0000 (12:51 +0300)
README
awesompd.lua
jamendo.lua
rcsample.lua

diff --git a/README b/README
index 2a2e3bc6a4a7967f3af7b328bc0b5aedc57bf5ba..b1c3ecc9dce93a385637b9683a93e943ffcdfa90 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
-This is a MPD widget for AwesomeWM.
+This is an advanced MPD widget\client for AwesomeWM.
 
 For the detailed installation guide see http://awesome.naquadah.org/wiki/Awesompd_widget .
+
+Also you can find an example of widget configuration in file rcsample.lua.
index 0d28991cfebecdc291f2902cf33d79a4acec2087..88c147be64b6705a6ecaeefe594cd265a5f0dc43 100644 (file)
@@ -1,7 +1,7 @@
 ---------------------------------------------------------------------------
--- @author Alexander Yakushev &lt;yakushev.alex@gmail.com&gt;
+-- @author Alexander Yakushev <yakushev.alex@gmail.com>
 -- @copyright 2010-2011 Alexander Yakushev
--- @release v1.0.2
+-- @release v1.0.4
 ---------------------------------------------------------------------------
 
 require('utf8')
@@ -52,7 +52,7 @@ function awesompd.try_load(file)
    end
 end
 
--- Just like awful.util.pread, but takes an argument to read like
+-- Just like awful.util.pread, but takes an argument how to read like
 -- "*line" or "*all".
 function awesompd.pread(com, mode)
    local f = io.popen(com, 'r')
@@ -651,6 +651,10 @@ end
 
 function awesompd.split(s)
    local l = { n = 0 }
+   if s == "" then
+      return l
+   end
+   s = s .. "\n"
    local f = function (s) 
                 l.n = l.n + 1
                l[l.n] = s
@@ -879,6 +883,7 @@ end
 -- folders. If there is no cover art either returns the default album
 -- cover.
 function awesompd:get_cover(track)
+   dbg(self.ICONS.DEFAULT_ALBUM_COVER)
    return jamendo.try_get_cover(track) or 
    self:try_get_local_cover() or self.ICONS.DEFAULT_ALBUM_COVER
 end
@@ -887,27 +892,23 @@ end
 -- playing.
 function awesompd:try_get_local_cover()
    if self.mpd_config then
+      local result
       -- First find the music directory in MPD configuration file
       local _, _, music_folder = string.find(
          self.pread('cat ' .. self.mpd_config .. ' | grep -v "#" | grep music_directory', "*line"),
          'music_directory%s+"(.+)"')
       music_folder = music_folder .. "/"
-      dbg("musfolder", music_folder)
 
       -- Get the path to the file currently playing.
       local _, _, current_file_folder = 
          string.find(self:command_read('current -f "%file%"', "*line"), '(.+%/).*')
 
       local folder = music_folder .. current_file_folder
-      dbg("folder", folder)
       
       -- Get all images in the folder
       local covers = self.pread('ls "' .. folder .. '" | grep -P "\.jpg\|\.png\|\.gif"', "*all")
       local covers_table = self.split(covers)
       
-      dbg('wtf', 'ls "' .. folder .. '" | grep "\.jpg\|\.png\|\.gif"')
-      dbg('first', covers)
-
       if covers_table.n > 0 then
          result = folder .. covers_table[1]
          if covers_table.n > 1 then
@@ -921,6 +922,6 @@ function awesompd:try_get_local_cover()
             end
          end
       end
+      return result
    end   
-   return result
 end
index 1dd421c1eed87679dcafe9d7e496a0e50420c85c..78dc962f3c511b57afcbfbd968dcaeaa72852b80 100644 (file)
@@ -1,7 +1,7 @@
 ---------------------------------------------------------------------------
--- @author Alexander Yakushev &lt;yakushev.alex@gmail.com&gt;
+-- @author Alexander Yakushev <yakushev.alex@gmail.com>
 -- @copyright 2011 Alexander Yakushev
--- @release v1.0.2
+-- @release v1.0.4
 ---------------------------------------------------------------------------
 
 module('jamendo', package.seeall)
index 2cf593875251e2d47fb1550d506f41ac97669260..94c46affd4b118cb157221c45c1da07298b93b03 100644 (file)
@@ -97,14 +97,18 @@ mysystray = widget({ type = "systray" })
   -- possible formats: awesompd.FORMAT_MP3, awesompd.FORMAT_OGG
   musicwidget.jamendo_format = awesompd.FORMAT_MP3
 
-  -- If true, song notifications for Jamendo tracks will also contain
-  -- album cover image.
-  musicwidget.show_jamendo_album_covers = true
+  -- If true, song notifications for Jamendo tracks and local tracks
+  -- will also contain album cover image.
+  musicwidget.show_album_cover = true
 
   -- Specify how big in pixels should an album cover be. Maximum value
   -- is 100.
   musicwidget.album_cover_size = 50
-
+  
+  -- This option is necessary if you want the album covers to be shown
+  -- for your local tracks.
+  musicwidget.mpd_config = "/home/username/.mpdconf"
+  
   -- Specify decorators on the left and the right side of the
   -- widget. Or just leave empty strings if you decorate the widget
   -- from outside.
@@ -129,7 +133,7 @@ mysystray = widget({ type = "systray" })
   musicwidget:run() -- After all configuration is done, run the widget
 
 -- END OF AWESOMPD WIDGET DECLARATION
--- Don't forget to add the widget to the wibox. It is done on the line 202.
+-- Don't forget to add the widget to the wibox. It is done on the line 207.
 
 mywibox = {}
 mypromptbox = {}