File: porting.rst

package info (click to toggle)
python-mpd 3.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: python: 3,148; makefile: 201; sh: 9
file content (44 lines) | stat: -rw-r--r-- 1,434 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
=============
Porting guide
=============

Until the versions 0.4.x, `python-mpd2`_ was a drop-in replacement for application
which were using the original `python-mpd`_. That is, you could just replace the
package's content of the latter one by the former one, and *things should just
work*.

However, starting from version 0.5, `python-mpd2`_ provides enhanced features
which are *NOT* backward compatibles with the original `python-mpd`_ package.
This goal of this document is to explains the differences the releases and if it
makes sense, how to migrate from one version to another.


Stickers API
============

When fetching stickers, `python-mpd2`_ used to return mostly the raw results MPD
was providing::

    >>> client.sticker_get('song', 'foo.mp3', 'my-sticker')
    'my-sticker=some value'
    >>> client.sticker_list('song', 'foo.mp3')
    ['my-sticker=some value', 'foo=bar']

Starting from version 0.5, `python-mpd2`_ provides a higher-level representation
of the stickers' content::

    >>> client.sticker_get('song', 'foo.mp3', 'my-sticker')
    'some value'
    >>> client.sticker_list('song', 'foo.mp3')
    {'my-sticker': 'some value', 'foo': 'bar'}

This removes the burden from the application to do the interpretation of the
stickers' content by itself.

.. versionadded:: 0.5


.. _python-mpd: http://jatreuman.indefero.net/p/python-mpd/
.. _python-mpd2: https://github.com/Mic92/python-mpd2/

.. vim:ft=rst