devsnd / cherrymusic

Stream your own music collection to all your devices! The easy to use free and open-source music streaming server.
http://www.fomori.org/cherrymusic
GNU General Public License v3.0
1.03k stars 187 forks source link

Unable to generate thumbnails with convert on Windows #596

Closed eldosrado closed 8 years ago

eldosrado commented 8 years ago

Cherrymusic don't convert images to thumbnails using convert.

albumArtFetcher.programAvailable() and albumArtFetcher.AlbumArtFetcher.resize() use subprocess.Popen to start ImageMagick's convert in oder to resize images to thumbnails. Popen fails to find ImageMagick's convert and instead uses win\system32\convert.exe which seems to be a bug in python. Resizing fails silently without any exeception or logging. User's don't know what happend.

Steps to reproduce

  1. Get cherrymusic (devel@5c0aa31218)
  2. Intall ImageMagick for Automatic resizing of displayed cover art
  3. Add ImageMagick to path
  4. Open Terminal on Windows (Win+R) -> cmd
  5. Run python and verify that ImageMagick is in env path (code below)
  6. Start cherrymusic and get default images
import os
from pprint import pprint
pprint(os.environ['PATH'].replace("\\", "/").split(";"))

Fix worked for me: add shell=True to Popen params subprocess.Popen(..., shell=True ) I don't know if this workaround works on *unix or mac

On Windows 7 x64 Python 3.5 x68 ImageMagick 6.9.2-4 Q16 x64 2015-10-10

devsnd commented 8 years ago

Hey Eduard,

Thanks for your report and investigation! I'd be happy to accept a pull request that sets shell=True to if sys.platform.startswith('win'). But before that happens we need to find out if and how to sanetize the input, because I don't know if it would be possible to call an image e.g. &format c: &.jpg...

Thanks again, tom.

devsnd commented 8 years ago

Hi Eduard!

I did not want to change the behavior in windows because I was afraid that it would open up security issues. So instead I just added support for Pillow/PIL the most common python imaging library. Please check our the devel branch, install pillow and tell me how it goes!