MatthiasLienhard / flowkey_dl

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

Which URL to load? #1

Closed juancalvof closed 4 years ago

juancalvof commented 4 years ago

Hi!

Great work. Thanks for sharing. What URL must be load? The one of the song? Example: https://app.flowkey.com/player/E2kCpqHCwB2xYf7LL?title=Clair%20de%20Lune&artist=Claude%20Debussy

With this URL I get a 404 answer in line 18.

Thanks for your time.

MatthiasLienhard commented 4 years ago

Hi, if you click on the link you provided, you see the notes on the bottom. Click right on these notes and than on "copy image link" or something similar, depending on the browser. Now this is the url of the first part of the sheet music, if you copy this url in the respective filed it should work. I don't want to copy the link in here, since I don't know whether this is free content. Let me know if this wasn't clear or didn't work for you.

juancalvof commented 4 years ago

Ok. Thanks for your quick answer. Now I get the following error with the metion URL when dowloading ("download").: https://flowkeycdn.com/sheets/xxxxxxxxxxxxxxxxxxx/xxx/x.png

I understand that at this moment "load" is not implemented.

Thanks.

Traceback (most recent call last):
  File "...lib\tkinter\__init__.py", line 1883, in __call__
    return self.func(*args)
  File "...flowkey_gui.py", line 108, in download
    self.image = flowkey_dl(url)
  File "...flowkey.py", line 17, in flowkey_dl
    im = imageio.imread(url.format(i))
  File "...lib\site-packages\imageio\core\functions.py", line 265, in imread
    reader = read(uri, format, "i", **kwargs)
  File "...lib\site-packages\imageio\core\functions.py", line 178, in get_reader
    format = formats.search_read_format(request)
  File "...lib\site-packages\imageio\core\format.py", line 689, in search_read_format
    if format.can_read(request):
  File "...lib\site-packages\imageio\core\format.py", line 192, in can_read
    return self._can_read(request)
  File "...lib\site-packages\imageio\plugins\pillow.py", line 107, in _can_read
    if request.firstbytes and accept(request.firstbytes):
  File "...lib\site-packages\imageio\core\request.py", line 442, in firstbytes
    self._read_first_bytes()
  File "...lib\site-packages\imageio\core\request.py", line 451, in _read_first_bytes
    f = self.get_file()
  File "...lib\site-packages\imageio\core\request.py", line 353, in get_file
    self._file = urlopen(self.filename, timeout=float(timeout))
  File "...lib\site-packages\imageio\core\util.py", line 34, in urlopen
    return urlopen(*args, **kwargs)
  File "...lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "...lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "...lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "...lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "...lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "...lib\urllib\request.py", line 649, in http_error_default
   raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
MatthiasLienhard commented 4 years ago

Not sure about this, if you copy your URL (https://flowkeycdn.com/sheets/xxxxxxxxxxxxxxxxxxx/xxx/1.png) in the browser, does it show the first part of the sheet? If this works, the tool should work. It has minor issues, but everything essential (including formatting the sheet, scale, define line breaks, exclude measures,...) should work.

MatthiasLienhard commented 4 years ago

I just checked, the code still works, maybe the error is related to some missing local directories. Make sure that there is a subdirectory "raw" and a subdirectory "sheets". The first is used to save the "raw" images, and the latter for the final pdf sheets.

juancalvof commented 4 years ago

Hi!

1) I see images like this with URL (https://flowkeycdn.com/sheets/xxxxxxxxxxxxxxxxxxx/xxx/1.png)

Capture

2) If I understood properly, I have created 2 folders/directories ("raw" and "sheets") where the flowkey_dl.py and flowkey_dl_gui.py are. Same error.

By the way, in which line and file do you specify these 2 directories, I don't see it.

Thanks again for your time.

MatthiasLienhard commented 4 years ago

Good point, I forgot to commit the code, no wonder it did not work. Please try again.

juancalvof commented 4 years ago

:thumbsup: Works like a charm. Great job man. Thanks!

Just with some songs, the app gets blocked, on all the occasions I try it. For example with Viva La vida, from Coldplay.

MatthiasLienhard commented 4 years ago

OK, fixed this one as well, Viva la vida should work now. Apparently the last 18 pixels where on a sepererate patch, but as it was only white the image did not have rgba chanels. This caused the crash.

juancalvof commented 4 years ago

Great! Thanks. Works with other songs that had the same problem. 100% working right now in all the songs and learning lessons I tried.