Christophe Weblog Wiki Code Publications Music
slightly nicer iplayer-progress management
[iplayer-el.git] / iplayer.el
index ce773e5e02b24469a69608a25e80770e856d736e..6c4352021471045b4a493591bd23ed3d17f01a08 100644 (file)
@@ -1,6 +1,6 @@
 ;;; iplayer.el --- Browse and download BBC TV/radio shows
 
 ;;; iplayer.el --- Browse and download BBC TV/radio shows
 
-;; Copyright (C) 2012-2013  Christophe Rhodes
+;; Copyright (C) 2012-2014  Christophe Rhodes
 
 ;; Author: Christophe Rhodes <csr21@cantab.net>
 ;; Version: 0.1
 
 ;; Author: Christophe Rhodes <csr21@cantab.net>
 ;; Version: 0.1
     ("2" . "BBC Two")
     ("3" . "BBC Three")
     ("4" . "BBC Four")
     ("2" . "BBC Two")
     ("3" . "BBC Three")
     ("4" . "BBC Four")
+    ("8" . "CBBC")
+    ("9" . "CBeebies")
 
     ("!" . "BBC Radio 1")
     ("\"" . "BBC Radio 2")
 
     ("!" . "BBC Radio 1")
     ("\"" . "BBC Radio 2")
@@ -224,17 +226,20 @@ The presets are defined in the variable `iplayer-presets'."
         (state (process-get process 'iplayer-state))
         (progress (process-get process 'iplayer-progress)))
     (with-current-buffer (get-buffer-create "*iplayer-progress*")
         (state (process-get process 'iplayer-state))
         (progress (process-get process 'iplayer-progress)))
     (with-current-buffer (get-buffer-create "*iplayer-progress*")
-      (goto-char (point-min))
-      (let ((found (re-search-forward (format "^%s:" id) nil 'end)))
-        (unless found
-          (unless (= (point) (progn (forward-line 0) (point)))
-            (goto-char (point-max))
-            (newline)))
-        (forward-line 0)
-        (let ((beg (point)))
-          (end-of-line)
-          (delete-region beg (point)))
-        (insert (format "%s: %s %s%%" id state progress))))))
+      (special-mode)
+      (save-excursion
+        (goto-char (point-min))
+        (let ((found (re-search-forward (format "^%s:" id) nil 'end))
+              (inhibit-read-only t))
+          (unless found
+            (unless (= (point) (progn (forward-line 0) (point)))
+              (goto-char (point-max))
+              (newline)))
+          (forward-line 0)
+          (let ((beg (point)))
+            (end-of-line)
+            (delete-region beg (point)))
+          (insert (format "%s: %s %s%%" id state progress)))))))
 
 (defun iplayer-download-process-filter (process string)
   (catch 'no-progress
 
 (defun iplayer-download-process-filter (process string)
   (catch 'no-progress