Hi,

Here is something I had up and running with my freevo-1.3.2-pre4, I haven't
ported it to the latest release yet (but the maintainer of "idlebar.py"
might be interested of doing that ?).

Good luck!

1) You need to make sure that your DIR_RECORD path is set and add the
following lines to your "local_conf.py":


# Set the number om Megabytes consumed for each minute of recorded video
here.
# This is used by the 'disk_usage' plugin to calculate recording time left
# on your recoding media, which is pointed out by DIR_RECORD.
MB_PER_MIN = 10

#
# Use the plugin interface to activate or remove plugins.
#
plugin.activate('idlebar.interface')
plugin.activate('idlebar.tv',      level=10)
plugin.activate('idlebar.clock',   level=10)
#plugin.activate('idlebar.mail',    level=10, args=('/var/spool/mail',))
plugin.activate('idlebar.weather', level=10, args=('ESGP', ))
plugin.activate('idlebar.disk_usage', level=10)



2) Add the following lines of code to your ./src/plugins/idlebar.py



class disk_usage(IdleBarPlugin):
    def __init__(self):
        IdleBarPlugin.__init__(self)
        self.DF_CACHE = config.FREEVO_CACHEDIR + '/disk_usage'
        # Check that Recording is configured
        if os.path.exists(config.DIR_RECORD):
            self.DF_CMD = ('df -m ' + config.DIR_RECORD + " | tail -1 | awk
'{print $3 ; print $4}' > " + self.DF_CACHE)

        self.CLOCKFONT = 'skins/fonts/Trebuchet_MS.ttf'
        if not os.path.isfile(self.CLOCKFONT):
            # XXX Get this from the skin, but for now this will allow it to
work
            self.CLOCKFONT = config.OSD_DEFAULT_FONTNAME

    def checkdisk(self):

        #
        # Get disk usage info from OS

        os.system(self.DF_CMD)

    def draw(self):

        #
        # Make sure that Recording is configured
        if os.path.exists(config.DIR_RECORD):

            self.checkdisk()

            #
            # Read result from DF_CACHE.
            # First line is MBytes used, second line is MB left

            cachefile = open(self.DF_CACHE,'r')
            newlist = map(string.rstrip, cachefile.readlines())
            used,left = newlist
            cachefile.close()

            mbytes_used = int(used)
            mbytes_left = int(left)

            #
            # Report recording time left in a user friendly way.

            if (mbytes_left / config.MB_PER_MIN) > 100:
                # Convert time to Hours
                time_left = '%d Hrs' % (mbytes_left / (config.MB_PER_MIN *
60))
            else:
                # Keep time as Minutes
                time_left = '%d Mins' % mbytes_left / config.MB_PER_MIN

            #
            # Report disk usage with bargraph

            bar = (mbytes_used * 100 / (mbytes_used + mbytes_left))

            #
            # Draw everything now.

            cent = 28

            osd.drawbox(210,cent,264,cent+22,color=0x80777777,width=-1)

            if bar > 80:

osd.drawbox(212,cent+4,212+(bar/2),cent+18,color=0x00CC2200,width=-1)
            else:

osd.drawbox(212,cent+4,212+(bar/2),cent+18,color=0x00008855,width=-1)

            osd.drawstring('%02d' % bar +
'%',228,cent+4,fgcolor=0xdddddd,font=self.CLOCKFONT,ptsize=12)

osd.drawstring(time_left,215,cent+27,fgcolor=0xbbbbbb,font=self.CLOCKFONT,pt
size=14)




> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Gray, Tim
> Sent: den 19 augusti 2003 14:32
> To: '[EMAIL PROTECTED]'
> Subject: [Freevo-users] idlebar plugin idea
>
>
> I have a simple idea for an idlebar plugin.
>
> parse the output of the df command to display the % of the disk used.
>
> Or has someone already made a disk-useage indicator plugin?
>
>
> thanks.
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072
> 303_01/01
> _______________________________________________
> Freevo-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/freevo-users
>



-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code=104
_______________________________________________
Freevo-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to