MatthiasLienhard / flowkey_dl

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

New songs with different format of url no longer work #33

Closed hannah-jj closed 9 months ago

hannah-jj commented 9 months ago

Hi Matthias,

Your repo is one of the reasons that I decided to purchase Flowkey, I needed a way to download pdf. Thank you so much!!!

EDITED: I want to report that with the new releases of songs, cli doesn't work for this url https://cdn.flowkey.com/rendered-sheets/uBN7egyxyRY29DvkY/c7d206a3/0@2x.png

command ran: flowkey-dl-cli https://cdn.flowkey.com/rendered-sheets/uBN7egyxyRY29DvkY/c7d206a3/0@2x.png ~/Downloads/O-Holy-Night-Beginner/O-Holy-Night-Beginner.pdf -t "O Holy Night" -a "Adolphe Adam"

error:

downloaded 24 patches form https://cdn.flowkey.com/rendered-sheets/uBN7egyxyRY29DvkY/c7d206a3/{}@2x.png
Traceback (most recent call last):
  File "/opt/homebrew/bin/flowkey-dl-cli", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/flowkey_dl/flowkey_dl_cli.py", line 31, in main
    image, _, _ = flowkey_dl(args.baseurl)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/flowkey_dl/flowkey_dl.py", line 45, in flowkey_dl
    return np.hstack(imgs), None, None
           ^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/numpy/core/shape_base.py", line 359, in hstack
    return _nx.concatenate(arrs, 1, dtype=dtype, casting=casting)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: all the input array dimensions except for the concatenation axis must match exactly, but along dimension 0, the array at index 0 has size 377 and the array at index 19 has size 387

FYI I've created a locally run Chrome extension that will extract the song title, artist, and first song image URL from HTML, and the extension then calls a locally hosted webserver that will download the mp4 and call flowkey-dl-cli and save the pdf in a subfolder.

Now if I spent as much time coding as playing piano, it would be an even happier day!

Cheers!

MatthiasLienhard commented 9 months ago

Is this the only song with the issue? It looks like they rendered it with a slightly higher resolution, and than again with a lower one, yielding less files - but they did not delete the remaining obsolete files. Anyway, I think this is solved with your fix, thank you!

PS: sounds like a convenient setup, well done!