stevenleeg / geemusic

A bridge between Google Music and Amazon's Alexa
GNU General Public License v3.0
662 stars 178 forks source link

Support Library as well as Store (part 1 at least) #255

Closed mikeage closed 5 years ago

mikeage commented 6 years ago

Implements much of #145

Radio, podcast, and related are not supported, but this should offer a reasonable first implementation of library support in geemusic

mikeage commented 6 years ago

Note that this PR definitely needs testing with a purchased account to make sure I didn't break anything. I can only confirm that songs, albums, and artists work for free accounts ;-)

mikeage commented 6 years ago

rebased, and added two commits:

  1. Add an environment variable for forcibly disable the store for registered users (good for testing)
  2. Defensive code in case we're still indexing when the first request comes in. Edge case, but you never know (plus, it's quite common while testing)
fergyfresh commented 6 years ago

can you add this to it too. somehow you broke the english yaml https://github.com/fergyfresh/geemusic/commit/e626a7d833892f51c1731841bd63a0cf2f0c0b52

fergyfresh commented 6 years ago

https://github.com/fergyfresh/geemusic/tree/18a859563f2ea1f2b8df1c2fa25b5cf7aa6e7771

This is the last setup to work.

mikeage commented 6 years ago

That's really strange, since none of this code seems to have changed. See https://github.com/stevenleeg/geemusic/blame/master/geemusic/templates/en.yaml . Perhaps it's related to the PyYAML upgrade? I will look into today

fergyfresh commented 6 years ago

Yeah. After I posted that I noticed that as well. Here's the error:

[2018-10-30 22:29:39,472] ERROR in app: Exception on /alexa [POST]
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask_ask/core.py", line 767, in _flask_view_func
    result = self._map_intent_to_view_func(self.request.intent)()
  File "/home/travis/build/fergyfresh/geemusic/geemusic/intents/selection.py", line 284, in play_IFL_radio
    speech_text = render_template("play_IFL_radio_text")
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/flask/templating.py", line 133, in render_template
    return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/environment.py", line 869, in get_or_select_template
    return self.get_template(template_name_or_list, parent, globals)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/environment.py", line 830, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/environment.py", line 804, in _load_template
    template = self.loader.load(self, name, globals)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/loaders.py", line 125, in load
    code = environment.compile(source, name, filename)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/environment.py", line 581, in compile
    defer_init=defer_init)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/environment.py", line 543, in _generate
    optimized=self.optimized)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/jinja2/compiler.py", line 78, in generate
    raise TypeError('Can\'t compile non template nodes')
TypeError: Can't compile non template nodes
mikeage commented 6 years ago

It's just this one, right? Not any other templates?

mikeage commented 6 years ago

in any case, I presume this should be on the tip of master, not this branch

mikeage commented 6 years ago

Hmmm, with a new virtualenv, and this branch + upstream/master (which I'm pushing now to the branch), I was not able to reproduce it. ask gee music for help worked just fine

fergyfresh commented 6 years ago

Can you roll pyaml back to the version that worked? Then I can get this merged in.

mikeage commented 6 years ago

Re: pyyaml, I'm running with the newer 3.13, and I don't have the problem you saw. Any suggestions for how to reproduce and investigate it? Are you on python 3.6 or 3.7?

fergyfresh commented 6 years ago

I'm on 3.6. I am referring to the failed build on travis where I have all the environment variables. It was passing up until the pyyaml updates. I have traced it back that far.

fergyfresh commented 6 years ago

This is the last commit that was passing https://github.com/fergyfresh/geemusic/commit/18a859563f2ea1f2b8df1c2fa25b5cf7aa6e7771.

And this commit caused it to fail https://github.com/fergyfresh/geemusic/commit/a191e338f18f161e03fe258aa25ff386ba62a690.

And its been failing ever since.

mikeage commented 6 years ago

Sorry, maybe I’m missing something, but is there any way I can see that? The Travis links I see on your repo fail because of missing environment cars, just like on this repo, and everywhere else I’ve tried, the newer pyyaml works with both 3.6 and 3.7.

Alternatively, why don’t you just revert the python 3.7 fix on master here, and then Travis should pass on your private branch. No?