;ELC ;;; Compiled by heimdall@localhost on Mon Mar 3 15:42:29 2008 ;;; from file /home/heimdall/repos/emms/emms-stream-info.el ;;; in Emacs version 23.0.60.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. (if (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19.29"))) (error "`emms-stream-info.el' was compiled for Emacs 19.29 or later")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'emms) #@27 Byte limit for downloads. (defconst emms-stream-info-max 120000 (#$ . 614)) #@48 Seconds to timeout connection (dead or alive). (defconst emms-stream-info-timeout 10 (#$ . 696)) #@52 Output real-time information about the connection. (defconst emms-stream-info-verbose t (#$ . 799)) #@19 Software version. (defconst emms-stream-info-version "$Revision: 1.8 $" (#$ . 905)) #@63 Unified character alternative clause for regular expressions. (defconst emms-stream-info-char-alter-regexp "[-,'=:%+&0-9A-Za-z.()/ ]" (#$ . 995)) #@35 Regular expression for Shoutcast. (defconst emms-stream-info-shoutcast-regexp (concat emms-stream-info-char-alter-regexp ".*?") (#$ . 1147)) #@33 Regular expression for Icecast. (defconst emms-stream-info-icecast-regexp (concat emms-stream-info-char-alter-regexp "+") (#$ . 1294)) #@35 Regular expression for Shoutcast. (defconst emms-stream-info-shoutcast-title-regexp (concat "StreamTitle='\\(" emms-stream-info-shoutcast-regexp "\\)';") (#$ . 1435)) #@64 Regular Expression for the beggining of an Ogg bitstream page. (defconst emms-stream-info-icecast-capture-pattern "Oggs\\(.*\\)BCV" (#$ . 1608)) #@49 Regular expression for metainformation headers. (defconst emms-stream-info-stream-header-regexp (concat emms-stream-info-char-alter-regexp "+") (#$ . 1759)) #@41 Regular expression for streamlist URLs. (defconst emms-stream-info-streamlist-regexp "\\(^http://.*\\)\\|^File.=\\(http://.*\\)" (#$ . 1922)) #@126 If t then emms-stream-info will spill the stream into a buffer. Set to NIL unless you want a buffer filled with binary junk. (defconst emms-stream-info-debugging nil (#$ . 2071)) #@35 Buffer for debugging information. (defconst emms-stream-info-debug-buffer "*emms-stream-info-debug*" (#$ . 2256)) #@22 List of header keys. (defconst emms-stream-info-vocab (list "name" "genre" "pub" "metaint" "br" "bitrate" "description" "public" "audio-info") (#$ . 2376)) #@258 The following %-sequences are supported: %b Bitrate %s Song title and artist name %c Station/Channel name and short description %t Song title %g Station/Channel genre %a Artist name Note that some stations do not supply artist and song title information. (defconst emms-stream-info-format-string "Now streaming:%s, %c %bKb/sec" (#$ . 2539)) #@151 Some streaming audio stations/channels do not provide artist and songtitle information. This string specifies an alternate format for those stations. (defconst emms-stream-info-format-string-notitle "Now streaming: %c %bKb/sec %g" (#$ . 2889)) #@48 Regular expression for a .pls streamlist file. (defconst emms-stream-info-pls-regexp ".*.pls" (#$ . 3139)) #@48 Regular expression for a .m3u streamlist file. (defconst emms-stream-info-m3u-regexp ".*.m3u" (#$ . 3252)) #@13 Server URL. (defvar emms-stream-info-url nil (#$ . 3365)) #@14 Server port. (defvar emms-stream-info-port nil (#$ . 3429)) #@24 Results of our search. (defvar emms-stream-info-found nil (#$ . 3495)) #@35 Results of our streamlist search. (defvar emms-stream-info-streamlist-found nil (#$ . 3572)) #@37 Name of network connection process. (defvar emms-stream-info-procname "emms-stream-info-process" (#$ . 3671)) #@35 Amount of stream data downloaded. (defvar emms-stream-info-downloaded 0 (#$ . 3787)) #@57 When t do not attempt to read 'emms-stream-info-found'. (defvar emms-stream-info-read-inhibit nil (#$ . 3878)) #@68 Activated after the disconnection from the streaming audio server. (defvar emms-stream-info-return-hook nil (#$ . 3995)) #@170 Activated after the disconnection from the streaming audio server. This hook is for integration purposes, for general user functions use 'emms-stream-info-return-hook'. (defvar emms-stream-info-read-hook nil (#$ . 4123)) #@53 Non-nil means header information has been captured. (defvar emms-stream-info-header-flag nil (#$ . 4350)) #@52 Non-nil means title information has been captured. (defvar emms-stream-info-title-flag nil (#$ . 4462)) #@57 Non-nil means streamlist information has been captured. (defvar emms-stream-info-streamlist-flag nil (#$ . 4572)) #@40 String sent to streaming audio server. (defvar emms-stream-info-request-string nil (#$ . 4692)) #@60 Return a vector containing the elements of the URI URLSTR. (defalias 'emms-stream-info-decompose-url #[(urlstr) "\306\211\211\211\211\211\211\211\211\307\310\311!\312\216rq\210c\210eb\210\313\314!\203<\315u\210\316`\"`\317\306w\210`\320\306w\210`{\321\322\"\203d\323\324\307\"!\325\211\224O`\211d{ed{+\326 \f \n & .\n\207" [pos full attr refs pass user nil 1 generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1=#:temp-buffer buffer-name kill-buffer] 2)) looking-at "http" 4 buffer-substring-no-properties "://" "^/" string-match ":\\([0-9+]+\\)" string-to-number match-string 0 vector protocol port file host #1# urlstr] 11 (#$ . 4794)]) #@181 State of sequential connections. true at index 0 means output formatted message. true at index 1 means insert formatted message. trye at index 2 means continue to next connection. (defvar emms-stream-info-state-bv (byte-code "\300\301!\203 \301\302\303\"\207\304\302\303\"\207" [fboundp make-bool-vector 3 nil make-vector] 3) (#$ . 5519)) (defalias 'emms-stream-info-set-message #[nil "\301\302I\207" [emms-stream-info-state-bv 0 t] 3]) (defalias 'emms-stream-info-unset-message #[nil "\301\302I\207" [emms-stream-info-state-bv 0 nil] 3]) (defalias 'emms-stream-info-message-p #[nil "\301H\207" [emms-stream-info-state-bv 0] 2]) (defalias 'emms-stream-info-set-insert #[nil "\301\302I\207" [emms-stream-info-state-bv 1 t] 3]) (defalias 'emms-stream-info-unset-insert #[nil "\301\302I\207" [emms-stream-info-state-bv 1 nil] 3]) (defalias 'emms-stream-info-insert-p #[nil "\301H\207" [emms-stream-info-state-bv 1] 2]) (defalias 'emms-stream-info-set-continue #[nil "\301\302I\207" [emms-stream-info-state-bv 2 t] 3]) (defalias 'emms-stream-info-unset-continue #[nil "\301\302I\207" [emms-stream-info-state-bv 2 nil] 3]) (defalias 'emms-stream-info-continue-p #[nil "\301H\207" [emms-stream-info-state-bv 2] 2]) (defalias 'emms-stream-info-streamlist-type #[(str) ";\205\303 \"\203\304\207\303\n\"\203\305\207\306\207" [str emms-stream-info-pls-regexp emms-stream-info-m3u-regexp string-match pls m3u nil] 3]) (defalias 'emms-stream-info-format #[(str format-alist) "\303\304\"\303\304\"\305\306 \"\210)\n\207" [format-alist key-list str mapcar car mapc #[(e) "\303\304 \"A\n#\211\207" [e format-alist str emms-replace-regexp-in-string assoc] 5]] 3]) #@110 Output a human readable message. If STRING-OUT is non-nil, do not output a message and only return a string. (defalias 'emms-stream-info-pretty-print #[(&optional string-out) "\306\307\310\311!\206\310\312!\206\313B\314\310\315!\206\313B\316\310\317!\206\"\313B\320\310\321!\206+\313B\322\310\323!\2064\313B\324\310\325!\206=\313B\326\313B\257\310\321!\204N\f\327\n \"\330\331\332 #\310\317!\205k \203g \202k\333\314 \"+\207" [emms-stream-info-format-string format-alist format-string str emms-stream-info-format-string-notitle string-out nil "%b" emms-stream-info-get-key "br" "bitrate" "" "%s" "songtitle" "%c" "name" "%t" "title" "%g" "genre" "%a" "artist" "%. " emms-stream-info-format emms-replace-regexp-in-string "%" "%%" message] 10 (#$ . 7200)]) #@65 Insert the formatted output of 'emms-stream-info-get' at point. (defalias 'emms-stream-info-pretty-print-insert #[nil "\300\301!\206\302c\207" [emms-stream-info-pretty-print t ""] 2 (#$ . 7983)]) (defalias 'emms-stream-info-continue #[nil "\301 \210\203\302\303 \304 \305$\207\306\307!\207" [emms-stream-info-streamlist-found emms-stream-info-unset-continue emms-stream-info-get emms-stream-info-message-p emms-stream-info-insert-p nil error "No streamlist found at URL"] 5]) #@66 Return a STRING which is the concatenation of the elements of L. (defalias 'list-to-string #[(l) "\205@;\203@\301A!P\207\301A!\207" [l list-to-string] 3 (#$ . 8471)]) #@36 Return STRING associated with KEY. (defalias 'emms-stream-info-get-key #[(key) "?\205\n\303 \n\"A\207" [emms-stream-info-read-inhibit key emms-stream-info-found assoc] 3 (#$ . 8653)]) #@94 Return a list of strings associated with each key in KEYS. KEYS should be a list of strings. (defalias 'emms-stream-info-get-keys #[(keys) "\301\302\"\207" [keys mapcar #[(e) "\301!\207" [e emms-stream-info-get-key] 2]] 3 (#$ . 8845)]) #@45 Parse Ogg stream segment from BEGIN to END. (defalias 'emms-stream-info-decode-ogg #[(begin end) "\305\211\nb\210\306\307 \310Q\f\311#\210\312\313!\nb\210\306\314 \310Q\f\311#\210\312\313! \204,\205E\315 \211\203:\203:\316\202;\317QB\320 B\321BE*\207" [title artist begin emms-stream-info-icecast-regexp end nil re-search-forward "artist=\\(" "\\)" t emms-match-string-no-properties 1 "title=\\(" "songtitle" " - " " " "artist" "title"] 4 (#$ . 9089)]) #@56 Parse Shoutcast/Icecast-MP3 segment from BEGIN to END. (defalias 'emms-stream-info-decode-mp3 #[(begin end) "\306\211\211\211\fb\210\f {\307\n\310\"\211A\203! @\311 A!\312\nB\313 B\314BE,\207" [title artist songtitle split begin end nil split-string "-" list-to-string "songtitle" "artist" "title"] 5 (#$ . 9561)]) #@94 Filter function for the network process. Argument PROC Process. Argument STR Quanta of data. (defalias 'emms-stream-info-filter #[(proc str) "\203\fr q\210\nc\210)\306\307!\310\216r q\210\f\nG\\\nc\210 \204(\311\312\"\210\204f`\nGZb\210\313d\314#\203N\315\316\317\224\317\225\"\"\314\202f\313d\314#\203f\315\320\317\224\317\225\"\"\314\321 \203\212\204\212eb\210\313d\314#\203\212\322\317!\206\205\322\323!\314+ \203\233\324\325\326!!\f\"$\210\f\"V\204\260 \203\253\204\260\205\264\327!!\207" [emms-stream-info-debugging emms-stream-info-debug-buffer str #1=#:temp-buffer emms-stream-info-downloaded emms-stream-info-header-flag generate-new-buffer " *temp*" ((byte-code "\301!\203\n\302!\210\301\207" [#1# buffer-name kill-buffer] 2)) mapc #[(term) "eb\210\303\304\305\306D!\307 \310\260d\311#\205!\312\313\314\315!B\"\210\311\211\207" [term emms-stream-info-stream-header-regexp emms-stream-info-header-flag re-search-forward regexp-opt "icy-" "ice-" ":\\(" "\\)" t add-to-list emms-stream-info-found emms-match-string-no-properties 1] 6] re-search-forward t append emms-stream-info-decode-ogg 1 emms-stream-info-decode-mp3 emms-stream-info-set-continue emms-match-string-no-properties 2 message "Connection %s. Downloaded %d/%d bytes." process-status emms-stream-info-kill-process emms-stream-info-vocab emms-stream-info-title-flag emms-stream-info-icecast-capture-pattern emms-stream-info-found emms-stream-info-shoutcast-title-regexp emms-stream-info-streamlist-flag emms-stream-info-streamlist-regexp emms-stream-info-streamlist-found emms-stream-info-verbose proc emms-stream-info-max] 5 (#$ . 9892)]) #@73 Hold Emacs while trying to close the connection. Argument PROC Process. (defalias 'emms-stream-info-kill-process #[(proc) "\302!\303\232\204\304!\210\202\305!\203\306\307\"\210 \310U\205\"\311 \207" [proc emacs-major-version process-status closed delete-process process-filter set-process-filter nil 21 emms-stream-info-after-function] 3 (#$ . 11570)]) #@38 Evalutated when the connection ends. (defalias 'emms-stream-info-after-function #[nil "\301\302\303!\210\302\304!\207" [emms-stream-info-read-inhibit nil run-hooks emms-stream-info-read-hook emms-stream-info-return-hook] 2 (#$ . 11940)]) #@89 Sentinel function for network process. Argument PROC Process. Argument EV Event string. (defalias 'emms-stream-info-sentinel #[(proc ev) "\301U?\205 \302 \207" [emacs-major-version 21 emms-stream-info-after-function] 2 (#$ . 12185)]) #@56 Return a valid HTTP request string with FILE as a URI. (defalias 'emms-stream-info-make-request-string #[(file) "\301\302\232\203 \303\202\f\304\305\306\307\260\207" [file "GET " "" "/" " HTTP/1.0 \n" "User-Agent: Free software (see www.gnu.org), reads title of currently playing track (discards audio). \n" "Icy-MetaData:1 \n" " \n"] 6 (#$ . 12427)]) #@85 Set the global variables for connecting to the streaming audio server at URLSTRING. (defalias 'emms-stream-info-parse-url #[(urlstring) "\306!\211\307\234 \310\234 \311\234 \312\234\211\313\232\203 \n\314\232\203'\315\316!\210\202i\317\f!\2037 \2037 \202i\317\f!\204U \314\232\204O \320\232\204O \312\232\203U\321\202i\317\f!\204e \203e \202i\315\316!\210\n\322\f!\211-\207" [urlstring url hostname port file protocol emms-stream-info-decompose-url 3 4 5 0 "http" "" error "Invalid URL" empty-string-p nil 80 emms-stream-info-make-request-string emms-stream-info-port emms-stream-info-url emms-stream-info-request-string] 3 (#$ . 12790)]) #@47 Return t if STR is equal to the empty string. (defalias 'empty-string-p #[(str) "\301\232\207" [str ""] 2 (#$ . 13465)]) (defalias 'emms-stream-info-reset-state #[nil "\306\307\211\307\211\307\310\311 \210\312 \210\313 \210\314\315\316\"\210\314\315\317\"\210\314\315\320\"\207" [emms-stream-info-downloaded emms-stream-info-title-flag emms-stream-info-header-flag emms-stream-info-found emms-stream-info-streamlist-found emms-stream-info-streamlist-flag 0 nil t emms-stream-info-unset-message emms-stream-info-unset-insert emms-stream-info-unset-continue remove-hook emms-stream-info-return-hook emms-stream-info-pretty-print emms-stream-info-continue emms-stream-info-pretty-print-insert emms-stream-info-read-inhibit] 4]) #@305 Get streaming audio server header metadata and song title from stream at URL. Argument URLSTRING Address of streaming audio server as a string. If URLSTRING is nil then get the latest stream played via emms. Optional argument SAY boolean. Optional argument WRITE boolean. Optional argument CONT boolean. (defalias 'emms-stream-info-get #[(&optional urlstring say write cont) "\203 \306!\210\202!\307\301!\203!\310\311!\203! \203!\306\311 !!\210\312 \210\n\2030\313\314\315\"\210\316 \210 \203<\313\314\317\"\210\320 \210\f\203H\313\314\321\"\210\322 \210 \203]\323$!\203X\324$!\210\325$!\210\326\327\330\217\210\331%!\211&\205\223\332'\326\333&$\210\334%(\"\210\335&\336\"\210\337&\340\"\210\341&!?\205\223\342\343!)\207" [urlstring emms-stream-last-stream say write cont emms-stream-info-debugging emms-stream-info-parse-url boundp fboundp emms-stream-url emms-stream-info-reset-state add-hook emms-stream-info-return-hook emms-stream-info-pretty-print emms-stream-info-set-message emms-stream-info-pretty-print-insert emms-stream-info-set-insert emms-stream-info-continue emms-stream-info-set-continue get-buffer kill-buffer get-buffer-create nil (byte-code "\303\304!\203\304\305\306\307\310 \311\n&\210\202\312\307 \n$\210\307\207" [emms-stream-info-procname emms-stream-info-url emms-stream-info-port fboundp make-network-process :name :buffer nil :host :service open-network-stream] 9) ((error (byte-code "\301 \210\302\303\"\207" [emms-stream-info-url emms-stream-info-reset-state message "Error connecting to streaming audio sever at %s"] 3))) get-process run-at-time emms-stream-info-kill-process process-send-string set-process-sentinel emms-stream-info-sentinel set-process-filter emms-stream-info-filter process-sentinel error "No process sentinel" emms-stream-info-debug-buffer emms-stream-info-procname proc emms-stream-info-timeout emms-stream-info-request-string] 6 (#$ . 14206) nil]) (defalias 'emms-stream-info-input-sanity #[(&optional urlstring) ";\203\207\301\302!\207" [urlstring error "URL must be in string format"] 2]) #@117 Get information from streaming audio server at URLSTRING. Return a formatted message. URLSTRING should be a string. (defalias 'emms-stream-info-message #[(&optional urlstring) "\302!\303 !\304\232\203\305 \306\307\306$\202*\303 !\310\232\203&\305 \306\307\306$\202*\305 \306\")\207" [urlstring url emms-stream-info-input-sanity emms-stream-info-streamlist-type pls emms-stream-info-get t nil m3u] 5 (#$ . 16295) nil]) #@126 Get information from streaming audio server at URLSTRING. Insert a formatted message at point. URLSTRING should be a string. (defalias 'emms-stream-info-insert #[(&optional urlstring) "\302!\303 !\304\232\203\305 \306\307\211$\202+\303 !\310\232\203&\305 \306\307\211$\202+\305 \306\307#)\207" [urlstring url emms-stream-info-input-sanity emms-stream-info-streamlist-type pls emms-stream-info-get nil t m3u] 5 (#$ . 16727) nil]) (provide 'emms-stream-info)