Re: importing entries

Bill Mill <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
On Apr 7, 2005 12:06 PM, will guaraldi <[email protected]> wrote:
> On Thu, 7 Apr 2005, Bill Mill wrote:
> >
> > Anybody have a better suggestion for file naming? I can't think of one.
> 
> 200 characters is a _long_ filename.  I think I'd strip bad characters out
> (quotes, punctuation, ...) by converting them to _.

done already

> Then convert
> instances where there are multiple _ next to each other to just one _.

yeah, that makes sense

> Then, I'd split on _, and take out "stop words" like "and", "but",
> "then", "the", ...  Then join on _ again.

perhaps. Do other people like this? I'm unsure on it.

> 
> If nothing is left, I'd label it "untitled".  That handles entries with
> titles like "$#($8!!!" better than just naming it _.

Agreed.

> 
> Then I'd check to see if there's already an entry with that filename and
> do something like this:
> 
>     fn = "somefilename"
>     if os.path.isfile(fn):
>        index = 1
>        base, ext = os.path.splitext(fn)
>        while os.path.isfile("%s%d%s" % (base, index, ext)):
>           index += 1
> 
>        fn = "%s%d%s" % (base, index, ext)
> 

Yup, I forgot about entries with duplicate titles.

> Or something like that--this is ultra-off-the-cuff and wholly untested and
> might cause accidental dismemberment, so use it with caution.
> 
> On the flip side, it might be interesting to give the user the option of
> using the date in the filename.

Maybe, instead of appending an index to the filename, as above, append
a date and then an index?

> 
> Also, in preparation of us fixing the problem we have with mtime and
> metadata, I'd toss an mtime into the entry in the metadata.  Call it
> something like "creationdate" or something like that.  Maybe toss other
> things in the metadata as well.  Can't hurt.  Maybe ask the user what they
> want in the metadata?
> 

In what metadata format? Mine (<!-- key: value1, value2 -->) or
somebody else's? I call my datetime key "date" (clever, I know). I
could make command-line options to embed values in the metadata, if
that's desired.

Are we planning to stop using mtime as a sorting mechanism? How are we
"preparing to fix the problem we have with mtime and metadata"?

Peace
Bill Mill
bill.mill at gmail.com

> /will
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.