I have been using this for years:

print 'free space: %s gig' % round(gigfree,1)
print 'room for: %s min' % round(minutes,1)
if minutes>5:
else:
  print "%s minutes is not enough." % (minutes)

https://github.com/CarlFK/dvsmon/blob/master/sink_find_dir.py#L48

I hardly ever look at it.

The "not enough" has never been useful.

My point: this seems like a good idea when you have lost a recording due to
running out of disk space, but in practice I don't think it will help.   So
I wouldn't bother adding code to dvswitch.

What does work for me:
Before the event starts look at the schedule and estimate how much space is
needed.  Check to make sure you have that much free space.






On Sat, Oct 18, 2014 at 6:12 AM, Ben Hutchings <b...@decadent.org.uk> wrote:

> On Sat, 2014-10-18 at 10:42 +0200, Petter Reinholdtsen wrote:
> > > I don't see the point of doing this in DVswitch.  There are applets
> > > for this and a stock GNOME installation will warn on low disk space.
> >
> > I believe it would be nice to see the amount of disk free where I look
> > to check if the dvsink is working, and made a untested draft patch to
> > do so.
> >
> > Something along these lines would help me a bit when doing video
> > recordings:
> >
> > Index: src/dvsink-files.c
> > ===================================================================
> > --- src/dvsink-files.c  (revision 414)
> > +++ src/dvsink-files.c  (working copy)
> > @@ -17,6 +17,7 @@
> >  #include <sys/types.h>
> >  #include <sys/stat.h>
> >  #include <unistd.h>
> > +#include <sys/statfs.h>
> >
> >  #include "config.h"
> >  #include "dif.h"
> > @@ -162,6 +163,19 @@
> >      return total;
> >  }
> >
> > +/* Return the amount of megabyte free on the disk of the file
> descriptor */
> > +static long freespace(int fd)
> > +{
> > +    struct statfs stat;
> > +    long free;
> > +    if (0 == fstatfs(fd, &stat))
>
> From statfs(2):
> >        Linux-specific.  The Linux statfs() was inspired by the 4.4BSD
> one (but
> >        they do not use the same structure).
> [...]
> >        LSB  has  deprecated the library calls statfs() and fstatfs() and
> tells
> >        us to use statvfs(2) and fstatvfs(2) instead.
>
> > +    {
> > +        free = stat.f_bsize * stat.f_bavail / (1024*1024) ;
> > +    } else {
> > +        free = -1;
> > +    }
> > +}
>
> This is not even self-consistent in brace placement!
>
> >  static void transfer_frames(struct transfer_params * params)
> >  {
> >      static uint8_t buf[SINK_FRAME_HEADER_SIZE + DIF_MAX_FRAME_SIZE];
> > @@ -207,7 +221,8 @@
> >             file = create_file(output_name_format, &name);
> >             if (starting)
> >                 printf("INFO: Started recording\n");
> > -           printf("INFO: Created file %s\n", name);
> > +           long free = freespace(file);
>
> Local variable free hides global function free().
>
> > +           printf("INFO: Created file %s - free space $ld MiB\n", name,
> free);
>
> So it prints "free space -1 MiB" in case of error??
>
> Ben.
>
> >             fflush(stdout);
> >         }
> >
> > Perhaps something to include?
> >
>
> --
> Ben Hutchings
> Life is what happens to you while you're busy making other plans.
>                                                                - John
> Lennon
>
> --
> dvswitch-devel mailing list
> dvswitch-de...@lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/dvswitch-devel
>



-- 
Carl K

Reply via email to