# AURA Web Client

**URL:** <https://discourse.beets.io/t/aura-web-client/1569>\
**Category:** Show and Tell\
**Created:** [November 5, 2020, 5:13pm UTC](https://discourse.beets.io/t/aura-web-client/1569 "2020-11-05T17:13:56Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [November 5, 2020, 5:13pm UTC](https://discourse.beets.io/t/aura-web-client/1569/1 "2020-11-05T17:13:57Z")

</div>

Hello everyone,

I’ve made a client for the [AURA](https://auraspec.readthedocs.io/en/latest/) specification which can be used with the [beets AURA plugin I made](https://discourse.beets.io/t/new-aura-plugin/1512).

It has a very unoriginal name and it’s not beautiful, but I quite like how it works (not surprising since I made it). Take a look at it [here](https://sr.ht/~callum/aura-web-client/).

I don’t generally like web apps so at some point I might make something more like cmus (maybe fork it so I don’t have to do the hard bits), but I thought for a first client it made sense to make something that can be used instead of the web plugin.

Let me know what you think 🙂

Callum

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [November 6, 2020, 1:13am UTC](https://discourse.beets.io/t/aura-web-client/1569/2 "2020-11-06T01:13:15Z")

</div>

Aaa, this is so awesome! It doesn’t have to be beautiful to be very very cool. I really like that it uses a queue-based player! I will definitely use this. 🎉

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [November 6, 2020, 9:04am UTC](https://discourse.beets.io/t/aura-web-client/1569/3 "2020-11-06T09:04:55Z")

</div>

Thanks! In quite a few other players I’ve found the queue to be a bit of an afterthought so I wanted to make it more important

---

<div class="post-metadata">

**Author:** ![martin](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/martin/32/414_2.png) [@martin](https://discourse.beets.io/u/martin)\
**Post date:** [November 21, 2020, 6:25pm UTC](https://discourse.beets.io/t/aura-web-client/1569/4 "2020-11-21T18:25:47Z")

</div>

Thanks Callum ! I’m switching to this client too.

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [January 26, 2021, 8:13pm UTC](https://discourse.beets.io/t/aura-web-client/1569/5 "2021-01-26T20:13:00Z")

</div>

other beets users seem to be able to make this work, but i get a ‘failed to fetch’ exception, both when i use `xdg-open index.html` or open the `index.html` directly from a browser.

here’s the full stack trace:

> ```
> pi@raspberrypi:~ $ [2021-01-19 13:23:24,357] ERROR in app: Exception on /aura/server [GET]
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/flask/app.py", line 1974, in make_response
> rv = self.response_class.force_type(rv, request.environ)
> File "/usr/lib/python3/dist-packages/werkzeug/wrappers.py", line 921, in force_type
> response = BaseResponse(*_run_wsgi_app(response, environ))
> File "/usr/lib/python3/dist-packages/werkzeug/wrappers.py", line 59, in _run_wsgi_app
> return _run_wsgi_app(*args)
> File "/usr/lib/python3/dist-packages/werkzeug/test.py", line 923, in run_wsgi_app
> app_rv = app(environ, start_response)
> TypeError: 'dict' object is not callable
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/flask/app.py", line 2292, in wsgi_app
> response = self.full_dispatch_request()
> File "/usr/lib/python3/dist-packages/flask/app.py", line 1816, in full_dispatch_request
> return self.finalize_request(rv)
> File "/usr/lib/python3/dist-packages/flask/app.py", line 1831, in finalize_request
> response = self.make_response(rv)
> File "/usr/lib/python3/dist-packages/flask/app.py", line 1982, in make_response
> reraise(TypeError, new_error, sys.exc_info()[2])
> File "/usr/lib/python3/dist-packages/flask/_compat.py", line 34, in reraise
> raise value.with_traceback(tb)
> File "/usr/lib/python3/dist-packages/flask/app.py", line 1974, in make_response
> rv = self.response_class.force_type(rv, request.environ)
> File "/usr/lib/python3/dist-packages/werkzeug/wrappers.py", line 921, in force_type
> response = BaseResponse(*_run_wsgi_app(response, environ))
> File "/usr/lib/python3/dist-packages/werkzeug/wrappers.py", line 59, in _run_wsgi_app
> return _run_wsgi_app(*args)
> File "/usr/lib/python3/dist-packages/werkzeug/test.py", line 923, in run_wsgi_app
> app_rv = app(environ, start_response)
> TypeError: 'dict' object is not callable
> The view function did not return a valid response. The return type must be a string, tuple, Response instance, or WSGI callable, but it was a dict.
> 127.0.0.1 - - [19/Jan/2021 13:23:24] "GET /aura/server HTTP/1.1" 500 
> 
> ```

[i sent this to your sr.ht list, too; let me know which forum you prefer.]

```
Rik

```

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [January 26, 2021, 9:57pm UTC](https://discourse.beets.io/t/aura-web-client/1569/6 "2021-01-26T21:57:54Z")

</div>

Hi, I sent a response via email, which you should also be able to see on [the sr.ht email list](https://lists.sr.ht/~callum/aura-web-client/%3C2c971006-3748-3e92-e095-46501a81d148%40electronicArtifacts.com%3E#%3CC8TF8FPDFXDY.1KJT38UNWB87I@arbrovji%3E).

I don’t mind using this forum but I’d like to see how sr.ht works as much as anything 🙂

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 17, 2021, 9:58pm UTC](https://discourse.beets.io/t/aura-web-client/1569/7 "2021-03-17T21:58:15Z")

</div>

Hi again Callum, i apologize for my long gap in conversation. Real Life keeps getting in the way of music(:

when we last left our thread, we thought the issue was my using an old flask module. i’ve since updated  
\>\>\> import flask  
\>\>\> flask. **version**  
‘1.1.2’  
but now the fetch is failing because something is adding `server/` to the request URL? see attached  
any ideas? need to see more debugging output? - Rik

 ![fetchFail-2021-03-17-144315](https://canada1.discourse-cdn.com/flex029/uploads/beets/original/1X/a6137a11ebd796b248d710cf77d8d1613e1b8cdd.png)

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 18, 2021, 7:54am UTC](https://discourse.beets.io/t/aura-web-client/1569/8 "2021-03-18T07:54:13Z")

</div>

Hi, don’t worry about the gap!

The client accesses the /server endpoint to check the server is running and what features it supports.

I have a suspicion the failure is due to cross-origin resource sharing. Maybe try adding something like this to your config:

```auto
aura:
    cors:
        - 'null'

```

If that doesn’t work you could open the network tab in developer tools, reload the page and try again. It might give more info on what’s going on.

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 18, 2021, 6:33pm UTC](https://discourse.beets.io/t/aura-web-client/1569/9 "2021-03-18T18:33:08Z")

</div>

i had the `aura.cors` parameter set to `127.0.0.1`. changing it to `null` didn’t change anything. but using the devp tools was a good idea! it points to `	getAuraDoc	@	aura-web-client.js:77` view attached.

 ![aura-fetchFail2-2021-03-18-112215](https://canada1.discourse-cdn.com/flex029/uploads/beets/original/1X/0bf518c65781f484788cd50965c4a4843eee724e.png)

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 18, 2021, 7:07pm UTC](https://discourse.beets.io/t/aura-web-client/1569/10 "2021-03-18T19:07:26Z")

</div>

Yep that’s a CORS problem. Do you have [flask-cors](https://flask-cors.readthedocs.io/en/latest/) installed?

If you already do using null should work, but make sure to have quotes around it, like `"null"`.  
You could also try setting it to allow all origins by adding `"*"` to the list, but it’s better to be specific.

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 18, 2021, 7:09pm UTC](https://discourse.beets.io/t/aura-web-client/1569/11 "2021-03-18T19:09:33Z")

</div>

Also, unless you’ve set the port to `80` in the config you’ll want to include it in the server URL:

`http://127.0.0.1:8337/aura/`

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 19, 2021, 9:27pm UTC](https://discourse.beets.io/t/aura-web-client/1569/12 "2021-03-19T21:27:57Z")

</div>

duh! sorry i had forgot the :8337 port last time. and now i can navigate albums, add to queue, etc. but when i try to play a track i get this 404 error: `GET /aura/tracks/15/audio HTTP/1.1" 404 -`. the devTools console shows only `Failed to load resource: the server responded with a status of 404 (Not Found)`

perhaps related are these (still CORS-related?) Issues:

` 1. Indicate whether to send a cookie in a cross-site request by specifying its SameSite attribute`

```
  1. Because a cookie’s `SameSite` attribute was not set or is invalid, it defaults to `SameSite=Lax` , which prevents the cookie from being sent in a cross-site request. This behavior protects user data from accidentally leaking to third parties and cross-site request forgery.

Resolve this issue by updating the attributes of the cookie:

    * Specify `SameSite=None` and `Secure` if the cookie should be sent in cross-site requests. This enables third-party use.
    * Specify `SameSite=Strict` or `SameSite=Lax` if the cookie should not be sent in cross-site requests.
```

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 20, 2021, 10:54am UTC](https://discourse.beets.io/t/aura-web-client/1569/13 "2021-03-20T10:54:23Z")

</div>

Hmm. The only things I can think of is that there is no file where it should be, or there is something funky going on with mime types.

What happens if you go to [http://127.0.0.1:8337/aura/tracks/15/audio](http://127.0.0.1:8337/aura/tracks/15/audio) ?

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 23, 2021, 2:03am UTC](https://discourse.beets.io/t/aura-web-client/1569/14 "2021-03-23T02:03:01Z")

</div>

the files are there, i can access them using other tools (eg VLC). i can also get them using the new beetle client.

doing your experiment was interesting: it nicely displays a n error in JSON :

```
{"errors":[{"status":"404 Not Found","title":"No audio file for the requested track.","detail":"There is no audio file for track 15 at the expected location"}]}
```

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 23, 2021, 7:27am UTC](https://discourse.beets.io/t/aura-web-client/1569/15 "2021-03-23T07:27:21Z")

</div>

Hmm. Are you by any chance using an old version? I fixed something recently which could theoretically cause an error like you’re seeing.

The up to date aura plugin is now on the master branch of beets.

I should probably try to figure out how to display that error directly in the web client.

---

<div class="post-metadata">

**Author:** ![rik](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/rik/32/315_2.png) [@rik](https://discourse.beets.io/u/rik)\
**Post date:** [March 23, 2021, 11:43pm UTC](https://discourse.beets.io/t/aura-web-client/1569/16 "2021-03-23T23:43:15Z")

</div>

just downloaded the freshest version (Mar 7) but same behavior.

```
	could not get filesize: [Errno 2] No such file or directory: b"/media/pi/music4beets/music4beets/music-ornette/Cannonball Adderley/Somethin'' Else/01 Autumn Leaves.m4a"
	...

	127.0.0.1 - - [23/Mar/2021 16:37:03] "GET /aura/tracks/8426?include=artists%2Calbums HTTP/1.1" 200 -
	127.0.0.1 - - [23/Mar/2021 16:37:30] "GET /aura/tracks/8426/audio HTTP/1.1" 404 -

```

also: what takes so long on startup? there is a good 5+ minute wait while aura builds some index?

---

<div class="post-metadata">

**Author:** ![out-of-range](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/out-of-range/32/428_2.png) [@out-of-range](https://discourse.beets.io/u/out-of-range)\
**Post date:** [March 24, 2021, 9:23am UTC](https://discourse.beets.io/t/aura-web-client/1569/17 "2021-03-24T09:23:55Z")

</div>

This is getting stranger and stranger.

There definitely shouldn’t be a five minute wait, it should be ready no more than a couple seconds after typing `beet aura`. Do you have any more info on what that looks like?

I’m assuming that the Autumn Leaves file does actually exist where it says it is?

Could you try copying this into a file in the beets source directory and running it with `python <filename>.py`

```auto
from os.path import isfile
from beets import config
from beets.ui import _open_library
from beets.util import py3_path
from beets.library import Item
lib = _open_library(config)
track = lib.get_item(15)
path3 = py3_path(track.path)
print("track.path:", track.path)
print("isfile:", isfile(track.path))
print("")
print("py3_path:", path3)
print("isfile:", isfile(path3))

```
