;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\207" [require emms-playing-time auth-source] 2) #@32 Endpoint for client handshake. (defvar emms-librefm-scrobbler-handshake-url "turtle.libre.fm" (#$ . 170)) #@18 Transfer method. (defvar emms-librefm-scrobbler-method "https" (#$ . 282)) #@171 Libre.fm username. Note that the preferred way of authenticating is using authinfo and only setting `emms-librefm-scrobbler-handshake-url'. See the manual for details. (defvar emms-librefm-scrobbler-username nil (#$ . 364)) #@135 Libre.fm user password. Note that the preferred way of authenticating is using authinfo. See also `emms-librefm-scrobbler-username'. (defvar emms-librefm-scrobbler-password nil (#$ . 597)) #@44 Debugging variable to store communication. (defvar emms-librefm-scrobbler-debug "" (#$ . 793)) #@26 Session ID for Libre.fm. (defvar emms-librefm-scrobbler-session-id nil (#$ . 894)) #@36 URL for getting the track playing. (defvar emms-librefm-scrobbler-now-playing-url "" (#$ . 983)) #@22 URL for submissions. (defvar emms-librefm-scrobbler-submission-url "" (#$ . 1086)) #@36 Time when a track started playing. (defvar emms-librefm-scrobbler-track-play-start-timestamp nil (#$ . 1175)) #@56 Whether to display a user message on every submission. (defvar emms-librefm-scrobbler-display-submissions t (#$ . 1291)) #@71 Return TOKEN from auth-source. TOKEN is :user of :secret. (fn TOKEN) (defalias 'emms-librefm-scrobbler--get-auth-detail #[257 "\302\303\304\305D\306 \307\232?\205 \310\311\312\313&@\"\207" [emms-librefm-scrobbler-handshake-url emms-librefm-scrobbler-username plist-get auth-source-search :host "libre.fm" :user "" :max 1 :require (:user :secret)] 11 (#$ . 1418)]) #@31 Return username for libre.fm. (defalias 'emms-librefm-scrobbler--username #[0 "\301\302!\206\207" [emms-librefm-scrobbler-username emms-librefm-scrobbler--get-auth-detail :user] 2 (#$ . 1794)]) #@31 Return password for libre.fm. (defalias 'emms-librefm-scrobbler--password #[0 "\301\302!\303!\203\f\211 \207\304!\203\207\207" [emms-librefm-scrobbler-password emms-librefm-scrobbler--get-auth-detail :secret functionp characterp] 3 (#$ . 1997)]) #@65 Return the client handshake string. (fn URL USERNAME PASSWORD) (defalias 'emms-librefm-scrobbler-handshake-string #[771 "G\301U\203 \302\303!\210G\301U\203\302\304!\210\211G\301U\203!\302\305!\210\306\307!\310\311\312!\313\314\315\211 !\nP!\260 \207" [emms-librefm-scrobbler-method 0 error "bad url" "bad username" "bad password" format-time-string "%s" "://" "/?hs=true&p=1.2&c=emm&v=1.0&u=" url-encode-url "&t=" "&a=" md5] 15 (#$ . 2255)]) #@89 Perform client handshake and return a response in a buffer. (fn URL USERNAME PASSWORD) (defalias 'emms-librefm-scrobbler-handshake-call #[771 "\302\303\304#!r\211q\210\305ed\")\211\262)\207" [url-request-method emms-librefm-scrobbler-debug "POST" url-retrieve-synchronously emms-librefm-scrobbler-handshake-string buffer-substring-no-properties] 8 (#$ . 2718)]) #@59 Handle the client handshake server response. (fn RESBUF) (defalias 'emms-librefm-scrobbler-handle-handshake-response #[257 "\303!\204\n\304\305!\210r\211q\210eb\210\306\307\310 \311#\204\304\312!\210\306\313d\311#\204*\304\314!\210\315 \310 {\211\316\230\204:\304\317\"\210\320\211\211\321y\210\315 \310 {\262\321y\210\315 \310 {\262\321y\210\315 \310 {\262G\322U\204pG\322U\204p\211G\322U\203t\304\323!\210\211\324\325!\266\203\262)\207" [emms-librefm-scrobbler-session-id emms-librefm-scrobbler-now-playing-url emms-librefm-scrobbler-submission-url bufferp error "response not a buffer" re-search-forward "^.*200 OK$" point-at-eol t "bad HTTP server response" "\n\n" "bad FM server response" point-at-bol "OK" "FM server returned: %s" nil 1 0 "couldn't parse FM server response" message "handshake successful"] 7 (#$ . 3093)]) #@52 Perform client handshake call and handle response. (defalias 'emms-librefm-scrobbler-handshake #[0 "\301\302\303 \304 #!\207" [emms-librefm-scrobbler-handshake-url emms-librefm-scrobbler-handle-handshake-response emms-librefm-scrobbler-handshake-call emms-librefm-scrobbler--username emms-librefm-scrobbler--password] 5 (#$ . 3950)]) #@62 Format the url parameters for scrobbling. (fn TRACK RATING) (defalias 'emms-librefm-scrobbler-make-query #[514 "\211\302\267\202\303\202\304\202\305\202\306\262\307\310\"\307\311\"\307\312\"\206%\306\307\313\"\314\307\315\"\2063\316!\203f\203f\317\320\321!\322\321 !\323\321 \206Q\324\325!!\326\321!\327 \330\321!\331\332\260\207\333\334!\207" [emms-librefm-scrobbler-session-id emms-librefm-scrobbler-track-play-start-timestamp #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (love 6 ban 10 skip 14)) "L" "B" "S" "" emms-track-get info-artist info-title info-album info-tracknumber number-to-string info-playing-time 0 "s=" "&a[0]=" url-encode-url "&t[0]=" "&i[0]=" format-time-string "%s" "&o[0]=P&r[0]=" "&l[0]=" "&b[0]=" "&n[0]=" "&m[0]=" error "Track title and artist must be known."] 24 (#$ . 4291)]) #@44 Check the HTTP header and return the body. (defalias 'emms-librefm-scrobbler-get-response-status #[0 "d\300W\203\n\301\302!\210\303e\304\"\305\230\204\301\306!\210eb\210\307\310!\210\303\311 \312 \"\207" [1 error "No response from submission server" buffer-substring-no-properties 16 "HTTP/1.1 200 OK" "submission server not responding correctly" re-search-forward "\n\n" point-at-bol point-at-eol] 3 (#$ . 5176)]) #@55 Make asynchronous submission call. (fn TRACK RATING) (defalias 'emms-librefm-scrobbler-make-async-submission-call #[514 "\304\"\305\211\306 \210\210\307 \310BC#+\207" [url-request-method url-request-data url-request-extra-headers emms-librefm-scrobbler-submission-url emms-librefm-scrobbler-make-query "POST" (("Content-type" . "application/x-www-form-urlencoded")) url-retrieve emms-librefm-scrobbler-async-submission-callback] 8 (#$ . 5600)]) #@89 Pass response of asynchronous submission call to handler. (fn STATUS &optional CBARGS) (defalias 'emms-librefm-scrobbler-async-submission-callback #[513 "\301 @\302\230\203\205)\303\304\305\306\"\"\207\307\230\203&\310 \210\311@A\"\207\312\313!\207" [emms-librefm-scrobbler-display-submissions emms-librefm-scrobbler-get-response-status "OK" message "Libre.fm: Submitted %s" emms-track-get info-title "BADSESSION" emms-librefm-scrobbler-handshake emms-librefm-scrobbler-make-async-submission-call error "unhandled submission failure"] 9 (#$ . 6060)]) (defalias 'emms-librefm-scrobbler-start-hook #[0 "\301\302!\211\207" [emms-librefm-scrobbler-track-play-start-timestamp format-time-string "%s"] 2]) #@101 Submit the track to libre.fm if it has been played for 240 seconds or half the length of the track. (defalias 'emms-librefm-scrobbler-stop-hook #[0 "\301 \302\303\"\211\205&\304!\305=\205&\211\306V\205&\307\310\245^V\205&\311\312\"\207" [emms-playing-time emms-playlist-current-selected-track emms-track-get info-playing-time emms-track-type file 30 240 2 emms-librefm-scrobbler-make-async-submission-call nil] 6 (#$ . 6780)]) #@48 Enable the scrobbler and submit played tracks. (defalias 'emms-librefm-scrobbler-enable #[0 "\204\301 \210\302\303\304\305#\210\302\306\307\"\210\302\310\307\"\207" [emms-librefm-scrobbler-session-id emms-librefm-scrobbler-handshake add-hook emms-player-started-hook emms-librefm-scrobbler-start-hook t emms-player-stopped-hook emms-librefm-scrobbler-stop-hook emms-player-finished-hook] 4 (#$ . 7222) nil]) #@55 Disable the scrobbler and don't submit played tracks. (defalias 'emms-librefm-scrobbler-disable #[0 "\301\302\303\304\"\210\302\305\306\"\210\302\307\306\"\207" [emms-librefm-scrobbler-session-id nil remove-hook emms-player-started-hook emms-librefm-scrobbler-start-hook emms-player-stopped-hook emms-librefm-scrobbler-stop-hook emms-player-finished-hook] 3 (#$ . 7639) nil]) (provide 'emms-librefm-scrobbler)