On Mon, Mar 12, 2007 at 10:09:25PM -0700, Daniel Burrows wrote:
> On Mon, Mar 12, 2007 at 08:59:15AM -0500, John Goerzen <[EMAIL PROTECTED]>
> was heard to say:
> > The first patch, to DownloadQueue.hs, doesn't actually make a difference
>
> Oh, ok. I just noticed that while reading the source, and partial
> functions always set off alarm bells for me. (there are few things more
> annoying than a program that aborts with the laconic comment "pattern
> matching failure") I wasn't sure if this was safe, because
> getProcessStatus's documentation just says that Nothing is returned if
> the status is "unavailable" without commenting on what makes it
> available or not.
Yeah, it's a little vague. The function is an interface to waitpid(2),
and if it is asked to be non-blocking (passing WNOHANG to waitpid), then
it is possible that the process it's looking at hasn't exited yet.
However, we are not wanting to run it in non-blocking mode (or, at least
weren't in the code you were looking at; that's since changed), it would
never return Nothing.
> I had a lot of stuff written here, but then I re-read it and
> realized it was incoherent. I'll try again tomorrow. :) Suffice
> it to say for the moment that I didn't even see that the configuration
> file had per-podcast sections until you mentioned it. Are the podcast
> numbers guaranteed not to be reused?
Yes. See the manpage section "HPODDER CONFIGURATION FILE" for details
on how the config file works. You might use it like this:
case get cp idstr "posthook" of
Nothing -> return () -- Proceed without a hook
Just hook -> blah -- Use the hook
....
where
idstr = show (castid podcast)
This will look first in the section named for the podcast ID, and if
nothing is there, in the DEFAULT section. If there is no posthook key
either place, it will return Nothing. This behavior is as per the
manpage. If you're curious, hpodder is using my ConfigFile module
behind the scenes for its config file handling; you can get docs on it at
http://software.complete.org/configfile
As far as the podcast ID not being reused, it is defined in DB.hs as:
castid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
and if you look at the addPostcast function in the same file, you will
see that the Haskell code leaves castid assignment to the underlying
database (Sqlite3 in this case). In fact, it later has to ask the DB
what castid got assigned.
Hope this helps.
-- John
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]