Discussion:
[emms-help] [bug?] libre.fm scrobbing when offline
Rasmus
2015-03-15 02:52:08 UTC
Permalink
Hi,

I was working at a cafe today. EMMS doesn't behave nicely when there's no
internet. In particular I got the message

open-network-stream: turtle.libre.fm/80 Name or service not known

and I had to call emms-smart-browse twice to open the browser.

At the very least EMMS should catch the error and write out a message or
something, but otherwise ignore the error. Even better would be start the
EMMS scrobber in offline-mode, where played songs and times are stored and
uploaded on next connection. Bonus points if it will eventually also be
able to upload the scrobbled-log from my Rockbox music player.

—Rasmus
--
Hooray!
Yoni Rabkin
2015-03-15 03:01:42 UTC
Permalink
Post by Rasmus
Hi,
I was working at a cafe today. EMMS doesn't behave nicely when there's no
internet. In particular I got the message
open-network-stream: turtle.libre.fm/80 Name or service not known
and I had to call emms-smart-browse twice to open the browser.
To be fair, the issue is emms-librefm and not Emms in general. I use
Emms with the playlist mode and don't scrob (is that a word), so I
haven't seen this issue come up.
Post by Rasmus
At the very least EMMS should catch the error and write out a message or
something, but otherwise ignore the error.
That's a good starting point.
Post by Rasmus
Even better would be start the EMMS scrobber in offline-mode, where
played songs and times are stored and uploaded on next connection.
That would entail figuring out if there is a connection or not.
Post by Rasmus
Bonus points if it will eventually also be able to upload the
scrobbled-log from my Rockbox music player.
That's a cool idea.
--
"Cut your own wood and it will warm you twice"
Rasmus
2015-03-15 11:36:52 UTC
Permalink
Post by Yoni Rabkin
Post by Rasmus
I was working at a cafe today. EMMS doesn't behave nicely when there's no
internet. In particular I got the message
open-network-stream: turtle.libre.fm/80 Name or service not known
and I had to call emms-smart-browse twice to open the browser.
To be fair, the issue is emms-librefm and not Emms in general. I use
Emms with the playlist mode and don't scrob (is that a word), so I
haven't seen this issue come up.
The error is conditional on using the libre.fm part, I guess.
Post by Yoni Rabkin
Post by Rasmus
At the very least EMMS should catch the error and write out a message or
something, but otherwise ignore the error.
That's a good starting point.
Post by Rasmus
Even better would be start the EMMS scrobber in offline-mode, where
played songs and times are stored and uploaded on next connection.
That would entail figuring out if there is a connection or not.
I don't know much about networking. You could catch the error, or if you
want it more explicitly do something like.

(condition-case nil
(url-retrieve-synchronously "http://www.gnu.org")
(error nil))

(condition-case nil
(url-retrieve-synchronously "www.nonexisting.domain.somewhere.out.there123")
(error nil))

You'd probably need to clean up the buffer as well.

http://www.gnu.org/software/emacs/manual/html_node/elisp/Handling-Errors.html

Cheers,
Rasmus
--
Sådan en god dansk lagereddike kan man slet ikke bruge mere
Yoni Rabkin
2015-03-17 01:13:36 UTC
Permalink
Post by Rasmus
I don't know much about networking. You could catch the error, or if you
want it more explicitly do something like.
(condition-case nil
(url-retrieve-synchronously "http://www.gnu.org")
(error nil))
(condition-case nil
(url-retrieve-synchronously "www.nonexisting.domain.somewhere.out.there123")
(error nil))
You'd probably need to clean up the buffer as well.
http://www.gnu.org/software/emacs/manual/html_node/elisp/Handling-Errors.html
All of those would hang Emacs. It makes more sense to asynchronously ask
something like ping to do it and check back on that. I'm sure that there
is a canonical way for Emacs to check if it has an Internet connection,
and I even remember reading a conversation about this issue on
emacs-devel... who knows how long ago that was.
--
"Cut your own wood and it will warm you twice"
Loading...