[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] filename using time-stamp in GRC

From: ematlis
Subject: Re: [Discuss-gnuradio] filename using time-stamp in GRC
Date: Tue, 23 Aug 2011 15:09:54 -0700 (PDT)


I thought I would revisit the "dynamic file creation" issue under GRC.  The 
last suggestion was to simply code this up as a GRC custom block.  I was hoping 
to get some help from you on this, since my GRC/python programming skills are 
very limited.  I have modified a simple GRC-created python code by hand to 
implement your dynamic filename creation capability.  It seems to work- a new 
file is created each time I click the button, but as I said it is 
hand-generated in python.  Any chance you could try to implement this as a GRC 
block?  I've attached the code, and annotated the relevant sections with the 
"File Recording".

I really think this would be a great addition to GRC.  Any help would be 


--- On Thu, 1/20/11, Alexandru Csete <address@hidden> wrote:

> From: Alexandru Csete <address@hidden>
> Subject: Re: [Discuss-gnuradio] filename using time-stamp in GRC
> To: address@hidden
> Date: Thursday, January 20, 2011, 11:41 AM
> On Thu, Jan 20, 2011 at 5:41
> PM,  <address@hidden>
> wrote:
> >
> ...
> > Following up on this, I found this site that had some
> useful suggestions:http://www.oz9aec.net/index.php/gnu-radio/grc-examples
> >
> > A grc example is provided that implements a dynamic
> time stamp, but NOT a button to control it.  So I am trying
> to use a Variable Chooser to select between "/dev/null" and
> the filename that is based on the time-stamp.  However,
> nothing is generated.  In particular, I have:
> >
> > A file sink with File: recfile
> > A Variable with ID prefix with Value "./"
> > A Variable Chooser with ID: recfile, Default Value:
> "/dev/null" and
> > Choices of "/dev/null" or "prefix +
> datetime.now().strftime("%Y.%m.%d.%H.%M.%S") + ".bin"
> >
> > I was hoping this would dynamically create a file with
> the current time stamp for the name, but no files are
> actually being generated.  Could this be and issue related
> to a bug that is described in the link below?
> >
> > http://lists.gnu.org/archive/html/discuss-gnuradio/2011-01/msg00080.html
> >
> > If so, will this approach work if I upgrade via git?
> >
> Hi Eric,
> The problem with this simple example is that the variable
> containing
> "prefix + datetime.now().strftime("%Y.%m.%d.%H.%M.%S") +
> ".bin"
> is evaluated when you start the script, so it will only
> work for a
> single file per execution. I believe it is for the same
> reason that
> you see no file with your modification: The file sink is
> initialized
> with /dev/null as filename and it can not change the file
> name during
> runtime because the required code for "close file, set new
> file name,
> open new file" is not generated by GRC - I am not exactly
> sure about
> this but it should be obvious if you look in the generated
> code. I
> would try to do as Josh said in the other mail, implement
> the required
> code yourself and embed it as a custom block.
> Alex
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: dynamic_file_prototype.py
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]