0

The default filename looks like this ubuntupodcast_s11e36.mp3
But I want to combine the feed and title

Feed: Ubuntu Podcast
Title: S11E36 – Thirty-Six Hours

The current state
Save as: ~/storage/podcast/ubuntupodcast_s11e36.mp3

And I want to get this state
Save as: ~/storage/podcast/Ubuntu Podcast - S11E36 – Thirty-Six Hours.mp3

enter image description here

dmin
  • 373
  • 2
  • 10
  • Welcome! How does it save the mp3 file? You could find the command name via C-h l after saving, then find the help about that command to see if there is a way provided by that command. – whatacold Dec 09 '18 at 12:47

1 Answers1

0

The default file name is generated by the variable elfeed-show-enclosure-filename-function (Its value is a function and the function returns a filename). For example, the following does what you described

(defun my-elfeed-show-enclosure-filename (entry _url-enclosure)
  (let* ((title (elfeed-entry-title entry))
         (feed (elfeed-entry-feed entry))
         (feed-title (elfeed-feed-title feed)))
    (format "%s - %s.mp3" feed-title title)))

(setq elfeed-show-enclosure-filename-function #'my-elfeed-show-enclosure-filename)
xuchunyang
  • 14,527
  • 1
  • 19
  • 39
  • Thanks for the code and explanation. How do you debug this elisp code? If I want to expand the filename and add additional information, can I debug this function in scratch buffer and see the result? – dmin Dec 09 '18 at 19:01
  • @dmin I used message for debugging, for example, insert (message "%s" entry) to the function body to find out the value of entry. – xuchunyang Dec 09 '18 at 22:55