Thanks for the feedback, and for looking into the clashing playback behaviour.
I would quite like to add to the functionality so that - say - it’s easy to choose between the top few results rather than just always playing the top match.
I just install the skill and let them install all necessary requirements. VLC was a part of it.
Is there a reason why the skill used vlc instead of other ones? I think NewPipe (the app) used another technique, or? https://newpipe.schabi.org/ or https://github.com/TeamNewPipe/NewPipe/
Is it possible to have this skill play the audio on some other audio rendering device? ie. push the url to a different audio device (“Play Clapton Crossroads upstairs”). End devices may be an mpd client, volumio, vlc client on remote computer, chrome cast device, others…?
@suisat I think VLC is used because of the HTTPS connection and possibly the OPUS codec used by Youtube for most “best” audio streams.
Or at least, when I configured my system for it I needed to tweak my VLC install to support openssl for the https connection and needed to add the OPUS codec for it to work. I can imagine that the default mpg123 might be a bit to minimal for it all.
But… Just guessing here.
@pcwii Was wondering the exact same. Chromecast is integrated within Mycroft ini some extend, as I see something mention about it in the audio.log Wondering if you could say;
@j1nx, I did some playing around in my spare time and managed to get some youtube casted to my chromecast. It looks like the discovery portion of pychromecast, pychromecast.get_chromecasts() does not work on systems with more than one network interface as it uses the wrong interface to find the devices?? not sure if this is the mycroft issue or not.
Yes, you’re right. I think sometimes one of the audio streams might be something that mpg123 could play codec-wise, but from my initial experiments it seemed like vlc was consistently able to cope with the stream URLs pafy / youtube-dl return.
I’d be happy to include an option to use something other than the “best” audio stream, and/or use mpg123 if an appropriate stream is returned… but it looked to me like this might sometimes mean none of the streams returned would be playable for a given search result.
I mostly use picroft with no video/screen at all and haven’t noticed this.
Do you have any examples of streams / searches which come back with no audio-only streams?
I did file an issue on gitlab the other day when I stumbled across a result which seemed to do something like return null for bestaudio - perhaps that’s relevant:
Not going round to looking at the code yet, but a working test case would be good as I can’t reproduce the issue myself now.
I encountered it once and thought, will save the song. However, YouTube probably logs those things and puts the encoding in a queue of some kind because double checking the song the next day it played without video.
So hard to debug, by just asking it for songs. I believe the best way is to ask for old and / or not so popular songs. Perhaps in your native language if other than English.
When I evoke a stream by (typing) “spiele Hendrix” (=“play Hendrix”) mycroft says “eine sekunde bitte” (=“a second please”) but than an error is thrown out, saying “Bei der Bearbeitung ist ein Fehler im Skill Youtube Skill aufgetreten” (Roughly=“there was an error in the Skill youtube Skill”). Skill’s log says:
2019-12-17 09:52:54.439 | INFO | 8167 |
mycroft.skills.skill_loader:load:112 | ATTEMPTING TO LOAD SKILL:
mycroft-youtube-audio
2019-12-17 09:52:54.675 | INFO | 8167 |
mycroft.skills.settings:get_local_settings:78 | /opt/mycroft/skills
/mycroft-youtube-audio/settings.json
2019-12-17 09:52:54.710 | INFO | 8167 |
mycroft.skills.skill_loader:_communicate_load_status:270 | Skill
mycroft-youtube-audio loaded successfully
2019-12-17 09:54:19.921 | INFO | 8167 |
mycroft.skills.settings:save_settings:109 | Skill settings successfully
saved to /opt/mycroft/skills/mycroft-youtube-audio/settings.json
2019-12-17 09:54:24.072 | INFO | 8167 | Playback Control Skill |
Playing with: mycroft-youtube-audio
File “/opt/mycroft/skills/mycroft-youtube-audio/init.py”, line 67,
in CPS_start
self.search_youtube(data)
File “/opt/mycroft/skills/mycroft-youtube-audio/init.py”, line 91,
in search_youtube
Also there was a regex error, so I’ve added de-de in locale; so this message is gone.
As I am totally new to mycroft my understanding of how things work is very few. It would be great if someone could point me to the place where this error-message comes from. Is it from the skill or from mycroft itself? Does anyone know if I could try some translations somewhere?
As you can see, this skill is not even on the list because still is so new. So, the best should be waiting for a proper translation, but you can contribute it in your own language directly with the developer, translating yourself the vocabulary files like those https://gitlab.com/mcdruid/mycroft-youtube-audio/tree/master/locale
Thank you malevolent for your reply.
I set up a locale “de-de” folder locally and would be glad to share it. But as I am not aware of how translating a skill actually works, I would keep checking/understanding for a while first… If someone could hint me with files would need a translation, I could to that…
Cheers
Well, translation is a priori quite straight forward.
You need to create all the files inside the folders dialog and vocab or locale just like “en-us” does. That’s the easy part. Now, depending on the skill, the author has used more or less regular expressions. Let’s take an example:
You will create a directory de-de on locale folder, and inside the de-de folder, you need to create the file on_youtube.regex which content is \s*(on|with|using) (youtube|you tube)\s*
I’m not an regex expert, but here you should translate just (on|with|using) into german and you will be ok. If you know nothing about regex, the character | (vertical bar, pipe, or) means it need to search one of these terms, so you can use any combination of “on”, “with”, and “using” with “youtube” or “you tube”, but both elements are needed (the to parenthesis groups).
My advice, copy all the english files into the german directories, and translate just the english words into your language, leaving all the symbols untouched.
Here you have a two useful links which can help you understand regex a little better. https://pythex.org/
Thanx, the link looks interesting… As my coding skills are very few, I avoided thinking about regex too much… but now it seems time : )
And, well, I was (intuitively) setting up de-de as you described it right after installing the skill, using the equivalent german terms, but there must be somewhere more than that. 'Cause the initial term “play” does not show up in the en-us file, but using the german term “spiele” (=“play”), the skill is evoked, but the errors described above occur. So the skill starts, but than fails at some point…
Installed on Picroft (clean flash) on Raspberry Pi 3 b+ (3.5 jack audio out, usb mic in)
note for those who (same as me) got silence instead youtube stream:
Seems pulseaudio have some troubles with config, so you need just do:
pactl set-default-sink alsa_output.platform-soc_audio.analog-mono (use tabs to find exact name in your case, in case it says no such device)
pactl set-sink-volume @DEFAULT_SINK@ +100% - to set non zero value.
Sorry if duplicating info from middle of thread but I spend hour to finding this.
Traceback (most recent call last):
File “/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py”, line 66, in wrapper
handler(message)
File “/home/pi/mycroft-core/mycroft/skills/common_play_skill.py”, line 153, in __handle_play_start
self.CPS_start(phrase, data)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/init.py”, line 67, in CPS_start
self.search_youtube(data)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/init.py”, line 85, in search_youtube
self.stream_url = self.get_stream_url(self.vid_url)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/init.py”, line 108, in get_stream_url
return bestaudio.url
AttributeError: ‘NoneType’ object has no attribute ‘url’