MatthiasLienhard / flowkey_dl

helper to create sheet music from flowkey songs
MIT License
70 stars 15 forks source link

All patches being ignored #15

Closed mhchu closed 2 years ago

mhchu commented 2 years ago

In both the CLI and the GUI version, all the URLs I have tried so far result in all patches being ignored because length(patch.shape) is 2 instead of 3.

For example (the first tutorial Ode to Joy):

$ flowkey-dl-cli https://.../150/0.png
/home/.../anaconda3/lib/python3.7/site-packages/PIL/Image.py:952: UserWarning: Palette images with Transparency   expressed in bytes should be converted to RGBA images
  ' expressed in bytes should be converted ' +
loaded patch 0 with shape (292, 1024)
patch 0 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
shape: (292, 1024)
loaded patch 1 with shape (292, 1024)
patch 1 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
shape: (292, 1024)
loaded patch 2 with shape (292, 1024)
patch 2 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
shape: (292, 1024)
loaded patch 3 with shape (292, 409)
patch 3 looks strange, ignoring: [[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
shape: (292, 409)
downloaded 0 patches form https://.../300/{}.png
Traceback (most recent call last):
  File "/home/.../anaconda3/bin/flowkey-dl-cli", line 11, in <module>
    sys.exit(main())
  File "/home/.../anaconda3/lib/python3.7/site-packages/flowkey_dl/flowkey_dl_cli.py", line 30, in main
    image, _, _ = flowkey_dl(args.baseurl)
  File "/home/.../anaconda3/lib/python3.7/site-packages/flowkey_dl/flowkey_dl.py", line 45, in flowkey_dl
    imgs_comb = np.hstack(imgs)
  File "/home/.../anaconda3/lib/python3.7/site-packages/numpy/core/shape_base.py", line 288, in hstack
    return _nx.concatenate(arrs, 1)
ValueError: need at least one array to concatenate

Did flowkey change their image format resulting in this behavior or is my python setup incorrectly configured?

MatthiasLienhard commented 2 years ago

I checked the link you used, it worked fine on my system. I guess it has to do with the version of imageio but both versions I tried, imageio-2.13.3 as well as imageio-2.19.3 did not replicate the issue. Anyway, I tried to handle the case, assuming that the reader returns a b/w image. Let me know if this resolves the issue. Also, I used the update to publish the package on PyPI, so you can now install directly from there without cloning the github.

MatthiasLienhard commented 2 years ago

Also, please do not publish any links (not even from the free songs), I do not want to give flowkey any reason to shut this down. Can you please censor them in your text?

mhchu commented 2 years ago

Thanks! I've update my post to remove links. Maybe this problem is unique to me or it could be my imageio version (I'm on 2.4.1). I'm also running this on Ubuntu installed via Windows Subsystem for Linux so there are a bunch of unusual things in my situation. I'm unable to try additional things to see how to fix this because my subscription to flowkey just expired yesterday. I'll go ahead and close this issue.