bongo-devel
[Top][All Lists]
Advanced

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

[bongo-devel] Re: Insert commands


From: Daniel Jensen
Subject: [bongo-devel] Re: Insert commands
Date: Fri, 02 Mar 2007 18:52:34 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux)

Daniel Brockman <address@hidden> writes:

> Dieter Deyke <address@hidden> writes:
>
>> Another way to solve the mplayer -playlist problem would
>> be to resolve playlists coming from urls in Bongo, and
>> just pass song references to the backend.
>
> It would be relatively straightforward to do this for `i l',
> at least:  If given an URL, download it and look inside.

I don't doubt this would be useful for some, but I'm not sure it is a
good default behaviour for Bongo to fetch things from the net.

> What if when you selected to insert a directory containing both
> playable files and subdirectories, you were asked, ``Recursively
> insert all subdirectories of `/foo/bar'?''.  We could have an
> `always'/`ask'/`never' customization option for this.

Sounds good.

> The code in `i u' that looks for a URI on the clipboard can
> be carried over to `i' and extended to look for any absolute
> file name _or_ URI.

Should the paste function check for existing files then? I'm not sure
about this extension, it doesn't sound very useful to me.

> I just realized that it would be really convenient if there
> were some way to get Bongo to download the content of a URL
> and then play the content locally.  I mean, for arbitrary
> content types --- not just playlists.

I wrote something very simple for this:

(defun bongo-insert-and-download (url local-file)
  "Download a file from URL, save it and insert it as LOCAL-FILE."
  (interactive
   (let ((url (read-string "Download URL: ")))
     (list url (read-file-name "Save local file: "
                               temporary-file-directory
                               nil nil
                               (file-name-nondirectory url)))))
  (url-retrieve url 'bongo-url-retrieved-callback (list local-file))
  (bongo-insert-file local-file))

(defun bongo-url-retrieved-callback (status file-name)
  (if status
      (error "Error downloading %s" (file-name-nondirectory file-name))
    (write-file file-name)
    (message "Finished downloading %s" (file-name-nondirectory file-name)))
  (kill-buffer (current-buffer)))





reply via email to

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