Christophe Weblog Wiki Code Publications Music
iplayer-el.git
9 years agoupdate copyright dates
Christophe Rhodes [Thu, 22 May 2014 20:04:16 +0000 (21:04 +0100)]
update copyright dates

9 years agoimplement process sentinel for iplayer downloads
Christophe Rhodes [Thu, 22 May 2014 07:21:47 +0000 (08:21 +0100)]
implement process sentinel for iplayer downloads

process state, in principle, goes

  connecting -> downloading -> transcoding -> finished
     |               v             |
     '-----------> failed <--------'

thoughat the moment there's a wrong edge from downloading to finished
if the get-iplayer process is terminated at an unfortunate time.

9 years agorudimentary progress display
Christophe Rhodes [Wed, 21 May 2014 21:07:51 +0000 (22:07 +0100)]
rudimentary progress display

needs a lot of polishing:

* could do with a sentinel to indicate done / aborted on process exit
* progress bars would be nice
* clearing old downloads
* RET on each line should do something useful (e.g. jump to file in dired?)
* we could display the title not the iplayer id

but it might be basically functional

10 years agodon't startup by default in "show all" mode
Christophe Rhodes [Mon, 17 Mar 2014 07:38:58 +0000 (07:38 +0000)]
don't startup by default in "show all" mode

my emacs takes a good couple of seconds merely to execute navigation
commands through the buffer with all the content, and isearch chews up
a *lot* of CPU.  It'd be nice to find out why and fix it, but in the
meantime start up in "BBC One" mode (by default; there's a customize
variable).

Also include emacs-style next/previous and refresh key bindings.

10 years agoDerive from special-mode
Steve Purcell [Mon, 30 Dec 2013 10:11:06 +0000 (10:11 +0000)]
Derive from special-mode

- Ensures buffer is read-only, and responds to "q"
- Buffer is made temporarily writable while inserting programme tree

10 years agoAllow user configuration of download directory
Steve Purcell [Sat, 28 Dec 2013 17:34:01 +0000 (17:34 +0000)]
Allow user configuration of download directory

10 years agofix preset-handling code on emacs24
Christophe Rhodes [Tue, 25 Jun 2013 20:03:46 +0000 (21:03 +0100)]
fix preset-handling code on emacs24

only observable symptom was that £ for Radio 3 didn't work

10 years agomake sure to select window/buffer/frame in emacs24
Christophe Rhodes [Fri, 17 May 2013 10:18:04 +0000 (11:18 +0100)]
make sure to select window/buffer/frame in emacs24

(much easier than using the emacs23 method)

10 years agoavoid using cl primitives
Christophe Rhodes [Tue, 23 Apr 2013 14:47:14 +0000 (15:47 +0100)]
avoid using cl primitives

use nth where possible, multiple cars where not

10 years agosupport other versions of get-iplayer
Christophe Rhodes [Tue, 23 Apr 2013 14:44:38 +0000 (15:44 +0100)]
support other versions of get-iplayer

use --modes=best to avoid errors from not having a particular kind of
stream available.  (I'm not at all clear where the errors come from: I
have never needed this before, but some users do).

10 years agosupport emacs 24
Christophe Rhodes [Tue, 23 Apr 2013 11:37:04 +0000 (12:37 +0100)]
support emacs 24

Well this is horrible.  Now that execute-extended-command is in Lisp,
using completing read, (this-command-keys-vector) ends up returing
[13] for a function executed using M-x iplayer RET (rather than the
more useful whole extended command key sequence).  This means that
storing the key sequence for the last command and trying to execute it
later mostly has the effect of adding linebreaks.  (The old code works
if the command was invoked through a key sequence rather than through
extended command; I think this suggests that execute-extended-command
should be modified to update the various key variables/functions
specially, like it already has been for this-command, but that is not
helpful right now).

So, as well, store the function name and funcall that.  Oh, but wait,
some of the functions dispatch on the key sequence used to invoke
them (presets).  So we need to pass the key sequence we were invoked
with back.  That means we need to have a common signature for
iplayer-functions.  This is all so horrible.

But at least now it works with emacs24.  *sigh*.

11 years agoAutoload the iplayer interactive function
Steve Purcell [Sun, 31 Mar 2013 19:38:57 +0000 (20:38 +0100)]
Autoload the iplayer interactive function

11 years agoAdd headers/footers for package.el compatibility
Steve Purcell [Sun, 31 Mar 2013 10:17:41 +0000 (11:17 +0100)]
Add headers/footers for package.el compatibility

11 years agoslightly-confusing iplayer-{previous,next} commands
Christophe Rhodes [Mon, 26 Nov 2012 22:02:20 +0000 (22:02 +0000)]
slightly-confusing iplayer-{previous,next} commands

Bind them to ?k and ?j in iplayer-mode.

11 years agocosmetic change
Christophe Rhodes [Fri, 6 Jul 2012 20:56:13 +0000 (21:56 +0100)]
cosmetic change

Use this-command-keys-vector rather than this-command-keys --
marginally easier to debug with.

11 years agofix iplayer commands invoked using M-x
Christophe Rhodes [Fri, 6 Jul 2012 20:55:43 +0000 (21:55 +0100)]
fix iplayer commands invoked using M-x

Sure, I only notice this when I have to restart my emacs.  But once is
annoying enough.  The problem was that running M-x iplayer would cause
an error from within execute-extended-command, within the process
sentinel.  After trying to debug this and generating a nifty
unbreakable infinite loop, I finally twigged that it was the
frame/window/buffer frobbing that was the problem.  Piling hack upon
hack, the answer is that we only want to do the frobbing once before
the first command in the command keys, and once after the execution
has finished.  Make it so.

11 years agorework commands in light of long cache refresh time
Christophe Rhodes [Mon, 11 Jun 2012 10:33:21 +0000 (11:33 +0100)]
rework commands in light of long cache refresh time

The issue is that of get-iplayer itself managing its cache: if at any
point it decides that the cache is sufficiently stale, it goes off and
refreshes everything, which seems to take a long time -- if I'm
unlucky, breaking my ERC sessions (and in any case making the rest of
the editor session unusable).

Construct a background process and sentinel to manage the cache
updating before calling the real get-iplayer command.  The tricky bit
here is to make sure that the sentinel and real body get executed in
the right context.  Many things in the world are simpler with lexical
scoping; this would have been one of them, but I am still on emacs 23
and lexical binding is a thing of the future, so instead of making a
bunch of thunks to be called later, we have to save commands (well,
key sequences), but then those key sequences are divorced from the
window and frame that they were originally typed into, so we have to
get that context back.  Naive ways of doing that turn out not to work,
because execute-kbd-macro runs its own command loop, which first of
all selects a current frame and window, so if we've navigated away
from the *iplayer* window/buffer we end up adding keystrokes to
e.g. an ERC buffer, which is suboptimal; however, (ab)using the pre
and post command hooks seems to make things work.  So do that, and all
is well.

11 years ago(ab)use mode-line-process to display preset in the mode line
Christophe Rhodes [Tue, 24 Apr 2012 11:33:41 +0000 (12:33 +0100)]
(ab)use mode-line-process to display preset in the mode line

11 years agoremove debugging call to message in iplayer-preset
Christophe Rhodes [Tue, 24 Apr 2012 11:33:03 +0000 (12:33 +0100)]
remove debugging call to message in iplayer-preset

11 years agofirst cut of iPlayer interface for Emacs
Christophe Rhodes [Mon, 23 Apr 2012 20:19:36 +0000 (21:19 +0100)]
first cut of iPlayer interface for Emacs

Very raw.  Uses get_iplayer (spelled "get-iplayer" on my system); "parses"
the tree output; uses Orgstruct for presentation, and text properties for
user interface.  Uncached calls to get-iplayer (the first in any four hours,
unless the user has a cron job) blocks the whole of emacs for a good little
while as get-iplayer spends its time pulling down metadata, and there is
almost no useful feedback when downloading.

On the other hand, it's easier for me than the command-line interface.