Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: track.artists is undefined #37

Open
bluepuma77 opened this issue Dec 26, 2020 · 7 comments
Open

Uncaught (in promise) TypeError: track.artists is undefined #37

bluepuma77 opened this issue Dec 26, 2020 · 7 comments

Comments

@bluepuma77
Copy link

For hours I have been trying to get mopidy.js to run, my major challenges:

  1. Does not build with node 15 (seems to work with 12 and 14)
  2. Parcel needs to be installed
  3. Changing the script to connect to remote mopidy
  4. Configure mopidy to enable remote hosts to access
  5. Finally "Uncaught (in promise) TypeError: track.artists is undefined"

It seems to work now, I play a radio stream on the Raspi3+ (latest Raspberry Pi OS Lite), can access remotely via Iris and mopidy.js seems to connect, I can see web socket messages. But the console shows the exception and it displays "Unknown - Unknown".

MopidyJS-track artists_is_undefined-2

@bluepuma77
Copy link
Author

bluepuma77 commented Dec 26, 2020

I need to add that 4) is well documented: "Make sure the Mopidy config http/allowed_origins includes pi3.local:1234"

I just had the challenge that a basic sudo apt install mopidy installation would not read /etc/mopidy/mopidy.conf. It would tell me it reads the file, no error message, but then would not for example enable Iris.

Using a "professional" script does the trick of a working installation:

# install mopidy with Pimoroni script
curl https://raw.githubusercontent.com/pimoroni/pirate-audio/master/mopidy/install.sh | sudo bash

# roll back some changes :)
sudo sed -i '/hifiberry/d' /boot/config.txt
sudo sed -i '/\[pidi\]/,+3d' /etc/mopidy/mopidy.conf

@bluepuma77
Copy link
Author

bluepuma77 commented Dec 26, 2020

MP3 stream does not work, MP3 local file does not work, but Spotify does work.

I started the MP3 stream with mpc clear && mpc add "https://starfm-2.explodio.com/berlin.mp3" && mpc play.
The local MP3 I selected from within Iris file browser.
Spotify I started with mpc clear && mpc add "spotify:playlist:37i9dQZF1DX0rCrO4CFRfM" && mpc play

@kingosticks
Copy link
Member

Is there an actual problem/question regarding Mopidy.js here? If not, I'm going to close this.

If you are having problems with playing mp3 files or Mopidy in general then we can work on that at discuss.mopidy.com (you can also search for the similar issues on there already, it's likely a missing gstreamer plugin package).

@bluepuma77
Copy link
Author

bluepuma77 commented Dec 27, 2020

Sorry, if I wasn't clear.

Mopidy.js throws an exception when playing MP3 streams or local MP3 files.

Uncaught (in promise) TypeError: track.artists is undefined

This prevents the Mopidy.js UI from updating the displayed information.

I would say it's a bug in Mopidy.js.

@kingosticks
Copy link
Member

kingosticks commented Dec 27, 2020

Track model attributes are optional. If there are no artist tags present, then, like any other attribute, track.artists is undefined. You need to handle this in your client code. Sometimes attributes are not set by a backend because they don't make any sense for that backend. Hence they are optional. If this was to be considered a bug it would be in mopidy-local (and it's not a bug, a track may not have any artists tags, or album tags, or whatever tags).

@jodal
Copy link
Member

jodal commented Dec 28, 2020

It seems that the code that triggered the bug was the example web app bundled with Mopidy.js, so I guess that could be made more robust.

@zoechi
Copy link

zoechi commented Jun 10, 2022

@kingosticks in https://github.com/mopidy/mopidy.js/blob/master/src/mopidy.d.ts#L227-L289 only track_no, disc_no, length, and last_modified are marked optional.

I just stumbled upon this because

{
  jsonrpc=2.0,
  id=0,
  method=core.tracklist.add,
  params={uris: [orfradio:oe3/live]},
}

returns

{"jsonrpc": "2.0", "id": 0, "result": [{"__model__": "TlTrack", "tlid": 12, "track": {"__model__": "Track", "uri": "orfradio:oe3/live", "name": "Live"}}]}

where most fields are actually missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants