Repository: beetbox/beets

Issue:
`beet move`: AssertionError: Query is not unicode: 'singleton:true'
### Problem

Running this command in verbose (`-vv`) mode:

``` sh
$ beet -vv move
```

Led to this problem:

```
user configuration: /home/intelfx/.config/beets/config.yaml
data directory: /home/intelfx/.config/beets
plugin paths: 
Sending event: pluginload
inline: adding item field multidisc
library database: /mnt/archive/Music.blb
library directory: /mnt/archive/Music
Sending event: library_opened
Traceback (most recent call last):
  File "/usr/bin/beet", line 9, in <module>
    load_entry_point('beets==1.3.18', 'console_scripts', 'beet')()
  File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1238, in main
    _raw_main(args)
  File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1228, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 1505, in move_func
    opts.timid)
  File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 1466, in move_items
    objs = [o for o in objs if (isalbummoved if album else isitemmoved)(o)]
  File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 1464, in <lambda>
    isitemmoved = lambda item: item.path != item.destination(basedir=dest)
  File "/usr/lib/python2.7/site-packages/beets/library.py", line 787, in destination
    query, _ = parse_query_string(query, type(self))
  File "/usr/lib/python2.7/site-packages/beets/library.py", line 1175, in parse_query_string
    assert isinstance(s, unicode), u"Query is not unicode: {0!r}".format(s)
AssertionError: Query is not unicode: 'singleton:true'
```
### Setup
- OS: Arch Linux
- Python version: Python 2.7.11
- beets version: 1.3.17.r114.gabf2511
- Turning off plugins made problem go away (yes/no): no

My configuration (output of `beet config`) is:

``` yaml
directory: /mnt/archive/Music
library: /mnt/archive/Music.blb
paths:
        default: $albumartist/%if{$year, $year - }$album%aunique{}/%if{$multidisc,Disc $disc/}$track - $title
        singleton: $artist/Non-Album/$artist - $title
        comp: Various Artists/%if{$year, $year - }$album%aunique{}/%if{$multidisc,Disc $disc/}$track - $artist - $title

import:
        move: yes
        write: yes

plugins: chroma fetchart embedart replaygain edit lyrics lastimport inline convert zero scrub missing
chroma:
        auto: yes
embedart:
        remove_art_file: no
replaygain:
        backend: gstreamer
lyrics:
        sources: lyricwiki musixmatch lyrics.com
lastfm:
        user: intelfx
        api_key: 28d84ae8a201ea5152439f91565bd36b
zero:
        fields: comments
        update_database: true
item_fields:
        multidisc: 1 if disctotal > 1 else 0
convert:
        dest: /home/intelfx/Музыка
        never_convert_lossy_files: yes
        embed: yes
        copy_album_art: yes
        formats:
                flac: bash -c "ffmpeg -i \"$1\" -f wav -acodec pcm_s16le - | flac --best - -o \"$2\"" "" $source $dest
                mp3: ffmpeg -i $source -acodec libmp3lame -aq 2 $dest
                aac: ffmpeg -i $source -acodec libfdk_aac -vbr 4 $dest
                m4a: ffmpeg -i $source -acodec libfdk_aac -vbr 4 -vn $dest
                ogg: ffmpeg -i $source -acodec libvorbis -aq 5 -vn $dest
```



Discussion:

Resolving patch:
diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py
--- a/beets/ui/__init__.py
+++ b/beets/ui/__init__.py
@@ -59,8 +59,8 @@
 
 
 PF_KEY_QUERIES = {
-    'comp': 'comp:true',
-    'singleton': 'singleton:true',
+    'comp': u'comp:true',
+    'singleton': u'singleton:true',
 }
 
 
diff --git a/beetsplug/mbsync.py b/beetsplug/mbsync.py
--- a/beetsplug/mbsync.py
+++ b/beetsplug/mbsync.py
@@ -75,7 +75,7 @@ def singletons(self, lib, query, move, pretend, write):
         """Retrieve and apply info from the autotagger for items matched by
         query.
         """
-        for item in lib.items(query + ['singleton:true']):
+        for item in lib.items(query + [u'singleton:true']):
             item_formatted = format(item)
             if not item.mb_trackid:
                 self._log.info(u'Skipping singleton with no mb_trackid: {0}',


Test patch: