diff options
author | jerous <jerous@gmail.com> | 2008-10-15 21:19:29 +0200 |
---|---|---|
committer | jerous <jerous@gmail.com> | 2008-10-15 21:19:29 +0200 |
commit | bd543fb9c6683f72019fca66463f033ecb7dff5f (patch) | |
tree | dbe5ec57af0f6291c90e43d56a052727d1a69fd9 /plugins | |
parent | 7e75e58fa770368fb84800a0127927498782e63d (diff) |
better handling of UTF in mpd
showing progress when adding song to playlist
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Library.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugins/Library.py b/plugins/Library.py index 40c634a..5c2d34d 100644 --- a/plugins/Library.py +++ b/plugins/Library.py @@ -40,8 +40,19 @@ class pluginLibrary(Plugin): doEvents() # add filepaths of selected songs to path - paths=map(lambda song: song.getFilepath(), songs) - monty.addToPlaylist(paths) + paths=map(lambda song: unicode(song.getFilepath()), songs) + # add in chunks of 1000 + CHUNK_SIZE=1000 + start=0 + while start<len(paths): + if start+CHUNK_SIZE<len(paths): + end=start+CHUNK_SIZE + else: + end=len(paths) + self.setStatus('Adding '+str(len(songs))+' songs to library: %i%%'%(int(100*start/len(paths)))) + doEvents() + monty.addToPlaylist(paths[start:end]) + start+=CHUNK_SIZE self.setStatus('') doEvents() |