;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (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" (#$ . 491)) #@18 Transfer method. (defvar emms-librefm-scrobbler-method "https" (#$ . 603)) #@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 (#$ . 685)) #@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 (#$ . 918)) #@44 Debugging variable to store communication. (defvar emms-librefm-scrobbler-debug "" (#$ . 1114)) #@26 Session ID for Libre.fm. (defvar emms-librefm-scrobbler-session-id nil (#$ . 1216)) #@36 URL for getting the track playing. (defvar emms-librefm-scrobbler-now-playing-url "" (#$ . 1306)) #@22 URL for submissions. (defvar emms-librefm-scrobbler-submission-url "" (#$ . 1410)) #@36 Time when a track started playing. (defvar emms-librefm-scrobbler-track-play-start-timestamp nil (#$ . 1499)) #@56 Whether to display a user message on every submission. (defvar emms-librefm-scrobbler-display-submissions t (#$ . 1615)) #@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 (#$ . 1742)]) #@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 (#$ . 2118)]) #@31 Return password for libre.fm. (defalias 'emms-librefm-scrobbler--password #[0 "\301\302!\303!\203\211 \202\304!\203\211\202\207" [emms-librefm-scrobbler-password emms-librefm-scrobbler--get-auth-detail :secret functionp characterp] 3 (#$ . 2321)]) #@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\313\315\313\316\313\317\320!\313\321\313\322\323\211!P!\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] 26 (#$ . 2586)]) #@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 (#$ . 3105)]) #@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 (#$ . 3480)]) #@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 (#$ . 4337)]) #@62 Format the url parameters for scrobbling. (fn TRACK RATING) (defalias 'emms-librefm-scrobbler-make-query #[514 "\211\302\232\203\n\303\202\211\304\232\203\305\202\211\306\232\203\307\202\310\262\311\312\"\311\313\"\311\314\"\2061\310\311\315\"\310\316\311\317\"\206@\320!\203y\203y\321\322\323 !\324\323\n!\325\323 \206^\326\327!!\330\331\332\323!\333 \334\323!\335\336\260\202|\337\340!\207" [emms-librefm-scrobbler-session-id emms-librefm-scrobbler-track-play-start-timestamp love "L" ban "B" skip "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."] 28 (#$ . 4678)]) #@44 Check the HTTP header and return the body. (defalias 'emms-librefm-scrobbler-get-response-status #[0 "\300d\301W\203 \302\303!\210\211\304e\305\"\230\204\302\306!\210eb\210\307\310!\210\304\311 \312 \"\207" ["HTTP/1.1 200 OK" 1 error "No response from submission server" buffer-substring-no-properties 16 "submission server not responding correctly" re-search-forward "\n\n" point-at-bol point-at-eol] 5 (#$ . 5527)]) #@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 (#$ . 5954)]) #@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\"\"\202-\307\230\203*\310 \210\311@A\"\202-\312\313!\262\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 (#$ . 6414)]) (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\"\262\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 (#$ . 7143)]) #@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 (#$ . 7590) 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 (#$ . 8007) nil]) (provide 'emms-librefm-scrobbler)