Hi List,

I found a problem when i try to rename a Chinese character based playlist
name using API provided by MPD.
I run MPD 0.16.8 on Windows 7 Professional Services Pack 1 (*English Edition
*).

I've asked the developer of python-mpd2, after discussion, he suggested
that i ask for help from here.


Since the description is a bit long,  you can find the detailed description
at:

https://github.com/Mic92/python-mpd2/issues/6


In essential, i think it would be much clear if i paste some code.

But i have no C skills, so forgive me to paste a bit *Python* code below:
(Please check especially to the fonts in red color )

==============================================================

In [1]: import mpd, sys
In [2]: sys.getfilesystemencoding()       # Get the file system
encoding of Windows 7 Professional SP1, English Edition.
Out[2]: 'mbcs'
In [3]: old_playlist_name = u"大"         # Which is a Chinese
character, means 'Big' in English.In [4]: old_playlist_nameOut[4]:
u'\u5927'
In [5]: client = mpd.MPDClient(use_unicode=True)
In [6]: client.connect('localhost', 6600)
In [7]: client.listplaylists()Out[7]: []
In [8]: client.save(old_playlist_name)
In [9]: client.listplaylists()Out[9]: [{u'last-modified':
u'2012-05-26T09:11:01Z', u'playlist': u'\u5927'}]
In [10]: *client.rename(old_playlist_name, "New_Name")*

---------------------------------------------------------------------------CommandError
                             Traceback (most recent call
last)C:\Documents and
Settings\Administrator\<ipython-input-10-fcec17c403c0> in
<module>()----> 1 client.rename(old_playlist_name, "New_Name")
C:\Python27\lib\site-packages\mpd.pyc in decorator(self, *args)
    489 def newFunction(wrapper, name, returnValue):
    490     def decorator(self, *args):--> 491         return
wrapper(self, name, args, bound_decorator(self, returnValue))
    492     return decorator
    493
C:\Python27\lib\site-packages\mpd.pyc in _execute(self, command, args, retval)
    211             self._write_command(command, args)
    212             if isinstance(retval, Callable):--> 213
     return retval()
    214             return retval
    215
C:\Python27\lib\site-packages\mpd.pyc in decorator(*args, **kwargs)
    484     """ bind decorator to self """
    485     def decorator(*args, **kwargs):--> 486         return
function(self, *args, **kwargs)
    487     return decorator
    488
C:\Python27\lib\site-packages\mpd.pyc in _fetch_nothing(self)
    312
    313     def _fetch_nothing(self):--> 314         line = self._read_line()
    315         if line is not None:
    316             raise ProtocolError("Got unexpected return value:
'%s'" % line)
C:\Python27\lib\site-packages\mpd.pyc in _read_line(self)
    233         if line.startswith(ERROR_PREFIX):
    234             error = line[len(ERROR_PREFIX):].strip()--> 235
         raise CommandError(error)
    236         if self._command_list is not None:
    237             if line == NEXT:
*CommandError: [50@0] {rename} No such playlist*
In [11]:
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to