summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
J. Alexander Treuman [Mon, 29 Nov 2010 19:11:19 +0000 (14:11 -0500)]
adding sticker commands
J. Alexander Treuman [Mon, 29 Nov 2010 18:51:39 +0000 (13:51 -0500)]
mpd.py: adding support for spaces in command names
J. Alexander Treuman [Mon, 29 Nov 2010 02:17:24 +0000 (21:17 -0500)]
mpd.py: always compare self._sock to None
J. Alexander Treuman [Mon, 29 Nov 2010 01:36:36 +0000 (20:36 -0500)]
mpd.py: updating _connect_tcp() with new socket code
_connect_tcp() is largely based on Python's socket.create_connection().
Previously, this code contained two bugs related to raising exceptions.
The first bug was introduced by my clumsy attempt to update the code to use
the new preferred method of raising exceptions (the same mistake was made
in the Python 3 port of the socket module). Instead of raising
socket.error with the value of the original exception, socket.error was
raised with the original exception as the value of the new exception, thus
nesting an exception within an exception. Python 3.1.3 fixed this by
simply re-raising the original exception.
The second bug is hit when getaddrinfo() returns an empty list. A
socket.error is raised with a single string as its argument, instead of a
2-tuple as required by its parent class, IOError. This bug continues to
persist in Python 3.1.3 as well as the latest svn tree.
This commit updates _connect_tcp() to be a nearly identical copy of the
Python 3.1.3 version of socket.create_connection(), except that
ConnectionError is raised when getaddrinfo() returns an empty list.
J. Alexander Treuman [Thu, 15 Jul 2010 22:22:32 +0000 (18:22 -0400)]
removing TODO.txt
I maintain a separate personal TODO file for python-mpd which supercedes
this one, but it's really not fit for inclusion.
J. Alexander Treuman [Thu, 15 Jul 2010 22:17:59 +0000 (18:17 -0400)]
CHANGES.txt: adding changes in prep for 0.3.0 release
J. Alexander Treuman [Thu, 15 Jul 2010 21:52:54 +0000 (17:52 -0400)]
mpd.py: clear command list if an exception is raised
This fixes a very longstanding bug where an MPD command error would raise
an exception, but not clear the command list. This would prevent further
commands from being executed until the command list was completed, which
was impossible since the MPD command error broke out of the command list
on the server side.
J. Alexander Treuman [Thu, 15 Jul 2010 21:49:53 +0000 (17:49 -0400)]
mpd.py: unset iterating flag if an exception is raised
This fixes a bug where an MPD command error would raise an exception, but
leave the iterating flag set, preventing further commands from being
executed.
J. Alexander Treuman [Thu, 15 Jul 2010 21:27:23 +0000 (17:27 -0400)]
mpd.py: don't allow command_list_end if already iterating
J. Alexander Treuman [Thu, 15 Jul 2010 21:26:27 +0000 (17:26 -0400)]
mpd.py: set iterating flag before returning iterator
J. Alexander Treuman [Thu, 15 Jul 2010 21:12:53 +0000 (17:12 -0400)]
mpd.py: check if iterating before fetching response
If an iterator is currently in progress, all functions which fetch a
response (such as <cmd>() and fetch_<cmd>()) will be disabled, as well as
command lists. This makes iterators much more reliable by preventing code
from reading a response while an iterator is trying to read another
response. Previously this was allowed, and would corrupt the library state
by providing false responses to both the iterator and the code trying to
fetch a different response.
J. Alexander Treuman [Thu, 15 Jul 2010 20:48:19 +0000 (16:48 -0400)]
mpd.py: remove superfluous StopIteration exceptions
J. Alexander Treuman [Thu, 15 Jul 2010 18:44:45 +0000 (14:44 -0400)]
README.txt: give an example that actually works
J. Alexander Treuman [Thu, 15 Jul 2010 18:43:54 +0000 (14:43 -0400)]
updating copyright years
J. Alexander Treuman [Thu, 15 Jul 2010 18:38:55 +0000 (14:38 -0400)]
setup.py: updating URL
J. Alexander Treuman [Thu, 15 Jul 2010 17:52:40 +0000 (13:52 -0400)]
mpd.py: adding fileno() to export socket FD
This allows access to the socket FD for polling if it can be written
to/read from. This is useful with, for example, the idle command. Simply
call send_idle(), poll the socket FD with select/poll/etc to check if it's
ready for reading, and if it is, call fetch_idle() to see what changed.
Note that select et al. call fileno() on any objects you pass to them, so
you can simply pass the MPDClient instance itself to these functions
instead of the FD returned by fileno().
J. Alexander Treuman [Thu, 15 Jul 2010 17:34:44 +0000 (13:34 -0400)]
mpd.py: tidying up _execute()
J. Alexander Treuman [Thu, 15 Jul 2010 17:19:57 +0000 (13:19 -0400)]
mpd.py: adding support for asynchronous commands
send_<cmd>/fetch_<cmd> may now be used to send/fetch the command <cmd>.
fetch_<cmd> may be called multiple times to queue up various commands, but
they must be fetched in the same order they were sent. This functionality
cannot be mixed with command lists.
J. Alexander Treuman [Fri, 11 Sep 2009 23:22:11 +0000 (19:22 -0400)]
mpd.py: don't use has_key()
key in obj is easier to read, and even a little faster.
J. Alexander Treuman [Fri, 11 Sep 2009 23:20:50 +0000 (19:20 -0400)]
doc/commands.txt: updating to match the new internal API
J. Alexander Treuman [Fri, 11 Sep 2009 23:15:23 +0000 (19:15 -0400)]
mpd.py: internal API cleanup
Function names should be more readable now, and the new naming scheme will
fit in better with the upcoming asynchronous API.
J. Alexander Treuman [Wed, 10 Jun 2009 01:49:35 +0000 (21:49 -0400)]
mpd.py: raise ConnectionError if unix sockets aren't supported
J. Alexander Treuman [Sun, 7 Jun 2009 19:39:38 +0000 (15:39 -0400)]
preliminary unix socket support
If the host passed to connect() starts with a "/", then a connection
attempt is made to the unix socket at the specified path. The port
argument is currently still required, but will be ignored. Attempting to
connect to a unix socket on Windows will raise an AttributeError (because
socket.AF_UNIX isn't defined), however this will later be changed.
J. Alexander Treuman [Mon, 1 Jun 2009 22:33:49 +0000 (18:33 -0400)]
adding consume and single commands
J. Alexander Treuman [Mon, 1 Jun 2009 22:16:54 +0000 (18:16 -0400)]
adding idle and noidle commands
Note that these commands aren't very usable in their current form. idle()
blocks while waiting for events, and will thus hang if none are received.
Calling noidle() from another thread will cause idle() to return, but
python-mpd isn't considered re-entrant, so sharing instances between
threads isn't recommended.
J. Alexander Treuman [Mon, 1 Jun 2009 21:53:40 +0000 (17:53 -0400)]
adding listplaylists command
J. Alexander Treuman [Mon, 1 Jun 2009 16:41:30 +0000 (12:41 -0400)]
rearranging commands to match new protocol documentation
J. Alexander Treuman [Mon, 30 Jun 2008 22:01:01 +0000 (18:01 -0400)]
setup.py: incrementing version number to 0.2.1
J. Alexander Treuman [Mon, 30 Jun 2008 21:59:19 +0000 (17:59 -0400)]
CHANGES.txt: document change in previous commit
J. Alexander Treuman [Mon, 30 Jun 2008 19:14:10 +0000 (15:14 -0400)]
mpd.py: adding a workaround for systems missing socket.AI_ADDRCONFIG
Python on Windows doesn't define socket.AI_ADDRCONFIG. This is likely
because the flag is only supported by getaddrinfo() on Vista or later.
J. Alexander Treuman [Thu, 3 Apr 2008 18:52:41 +0000 (14:52 -0400)]
setup.py: incrementing version number to 0.2.0
J. Alexander Treuman [Thu, 3 Apr 2008 04:23:36 +0000 (00:23 -0400)]
mpd.py: catch all exceptions raised by _hello()
I normally consider it bad form to catch all exceptions, since it can
result in lost KeyboardInterrupts. But in this case we re-raise the
exception after cleaning up, so it's ok.
While _hello() itself only raises socket.error or an MPDError subclass, a
KeyboardInterrupt would previously go uncaught. Since the connection was
never cleaned up, it could be left in an unusable state. So just
disconnect on all exceptions instead.
J. Alexander Treuman [Thu, 3 Apr 2008 03:55:07 +0000 (23:55 -0400)]
TODO.txt: removing pre- and post-release sections
J. Alexander Treuman [Sun, 23 Mar 2008 21:20:46 +0000 (17:20 -0400)]
mpd.py: changing exception raising to comply with the Python Style Guide
J. Alexander Treuman [Sun, 23 Mar 2008 21:10:41 +0000 (17:10 -0400)]
mpd.py: strip trailing \n from MPD's hello line for a nicer error message
J. Alexander Treuman [Sun, 23 Mar 2008 21:07:55 +0000 (17:07 -0400)]
mpd.py: reset to disconnected state if _hello() fails in connect()
J. Alexander Treuman [Sun, 23 Mar 2008 20:51:48 +0000 (16:51 -0400)]
TODO.txt: removing completed TODO item
J. Alexander Treuman [Sun, 23 Mar 2008 20:50:49 +0000 (16:50 -0400)]
CHANGES.txt: document change in previous commit
J. Alexander Treuman [Sun, 23 Mar 2008 20:47:06 +0000 (16:47 -0400)]
mpd.py: loop over addresses returned by getaddrinfo to connect to
This allows us to support IPv6 and multi-homed hostnames. getaddrinfo is
called with the same flags as libmpdclient uses, making address resolution
consistent between the two.
J. Alexander Treuman [Sun, 23 Mar 2008 20:05:53 +0000 (16:05 -0400)]
CHANGES.txt: document change in previous commit
J. Alexander Treuman [Sun, 23 Mar 2008 20:01:31 +0000 (16:01 -0400)]
mpd.py: raise ConnectionError if connect() is called when already connected
J. Alexander Treuman [Sun, 23 Mar 2008 19:57:37 +0000 (15:57 -0400)]
mpd.py: use a separate file object for reading and writing sockets
This is to make it easier to read command output from a file instead of a
socket. Useful for testing and benchmarking.
J. Alexander Treuman [Sun, 23 Mar 2008 19:50:48 +0000 (15:50 -0400)]
mpd.py: raise ConnectionError when trying to use an unconnected socket
ConnectionError will now be raised when trying to read from/write to a
socket before calling connect() or after calling disconnect(). In the past
it would try to complete the operation on the unconnected socket, resulting
in a socket.error exception.
J. Alexander Treuman [Sun, 23 Mar 2008 04:27:29 +0000 (00:27 -0400)]
TODO.txt: cleaning up and splitting into pre- and post-release sections
J. Alexander Treuman [Sun, 23 Mar 2008 04:22:12 +0000 (00:22 -0400)]
TODO.txt: changing header for consistency
J. Alexander Treuman [Sun, 23 Mar 2008 04:21:19 +0000 (00:21 -0400)]
adding CHANGES.txt
J. Alexander Treuman [Sun, 23 Mar 2008 03:18:48 +0000 (23:18 -0400)]
TODO.txt: removing completed TODO item
J. Alexander Treuman [Sun, 23 Mar 2008 03:16:31 +0000 (23:16 -0400)]
mpd.py: raise ConnectionError on EOF
J. Alexander Treuman [Wed, 5 Mar 2008 22:29:10 +0000 (17:29 -0500)]
TODO.txt: adding TODO item
J. Alexander Treuman [Sat, 1 Mar 2008 20:03:47 +0000 (15:03 -0500)]
mpd.py: making _getitem return None if no item is returned
update and addid should normally always return a single item, so previously
an exception was raised if we got nothing. However, when used in a
command_list, only the *last* call to update will return an item. So
return None instead of raising an exception if we get nothing.
J. Alexander Treuman [Thu, 28 Feb 2008 00:19:13 +0000 (19:19 -0500)]
setup.py: commenting out license/platforms
The license and platforms fields should be filled out *only* if appropriate
classifiers don't already exist (which in our case, they do).
J. Alexander Treuman [Thu, 28 Feb 2008 00:04:30 +0000 (19:04 -0500)]
MANIFEST.in: exclude setup.cfg
Like MANIFEST.in, setup.cfg is (currently) only used for building
distributions. So don't include it in the distribution itself.
J. Alexander Treuman [Wed, 27 Feb 2008 23:59:36 +0000 (18:59 -0500)]
mpd.py: adding one line description at top of file
J. Alexander Treuman [Wed, 27 Feb 2008 23:57:56 +0000 (18:57 -0500)]
TODO.txt: removing completed TODO item and pre-release section
J. Alexander Treuman [Wed, 27 Feb 2008 23:56:53 +0000 (18:56 -0500)]
adding setup.py, setup.cfg, and MANIFEST.in
J. Alexander Treuman [Wed, 27 Feb 2008 23:17:59 +0000 (18:17 -0500)]
TODO.txt: removing a completed TODO item
J. Alexander Treuman [Wed, 27 Feb 2008 23:09:52 +0000 (18:09 -0500)]
adding README.txt
J. Alexander Treuman [Wed, 27 Feb 2008 21:28:15 +0000 (16:28 -0500)]
TODO.txt: changing a couple TODO items
J. Alexander Treuman [Wed, 27 Feb 2008 21:24:45 +0000 (16:24 -0500)]
addding doc/commands.txt to document supported commands
J. Alexander Treuman [Wed, 27 Feb 2008 21:15:57 +0000 (16:15 -0500)]
renaming TODO to TODO.txt
J. Alexander Treuman [Wed, 27 Feb 2008 21:15:25 +0000 (16:15 -0500)]
TODO: removing completed TODO item
J. Alexander Treuman [Wed, 27 Feb 2008 21:12:18 +0000 (16:12 -0500)]
adding LICENSE.txt and a copyright notice to mpd.py
J. Alexander Treuman [Wed, 27 Feb 2008 21:06:25 +0000 (16:06 -0500)]
mpd.py: removing shebang line
J. Alexander Treuman [Wed, 27 Feb 2008 16:36:50 +0000 (11:36 -0500)]
TODO: adding pre- and post-release sections, and a few more TODO items
J. Alexander Treuman [Mon, 25 Feb 2008 21:34:29 +0000 (16:34 -0500)]
TODO: adding TODO item
J. Alexander Treuman [Mon, 25 Feb 2008 20:40:05 +0000 (15:40 -0500)]
moving TODO list to separate TODO file
J. Alexander Treuman [Mon, 25 Feb 2008 00:43:53 +0000 (19:43 -0500)]
remove argument checking/parsing TODO item
mpd already does a much better job of validating arguments than we ever
could, so no point in us doing it too. Parsing arguments is also rather
pointless, as all arguments are coerced to strings before escaping anyway.
J. Alexander Treuman [Sun, 24 Feb 2008 23:47:32 +0000 (18:47 -0500)]
return an empty dict if no object is read
J. Alexander Treuman [Sun, 24 Feb 2008 22:25:16 +0000 (17:25 -0500)]
adding command_list support
J. Alexander Treuman [Sun, 24 Feb 2008 21:19:17 +0000 (16:19 -0500)]
initial commit