mkchromecast icon indicating copy to clipboard operation
mkchromecast copied to clipboard

Tray mode doesn't find device, crashes when searching, device perms issue? - KDE, Ubuntu 16.04.1

Open chuqster opened this issue 8 years ago • 25 comments

Hello,

So running from a terminal runs perfectly fine and chromecast devices show up in pavucontrol and everything works. In tray mode the chromecast device is never found and running a search will crash. OS is Kubuntu 16.04.1 and I verified all dependencies were met by your specs. Running in debug mode I got the following at search [see below]. Now if I run the same thing under sudo it works. Well, kind of. The Chromecast audio device isn't available in pavucontrol for obvious reasons (ran as root) but a search will find the device, it shows up in the GUI, can be selected and connected to.

charles@muadib:~$ mkchromecast --debug -t ('ALSA device name:', None) ('Google Cast name:', None) ('backends: ', ['ffmpeg', 'avconv', 'parec']) ('ALSA device name:', None) ('Google Cast name:', None) ('backends: ', ['ffmpeg', 'avconv', 'parec']) USER =charles PATH =/home/charles/bin:/home/charles/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin mkchromecast v0.3.6 (':::audio::: chunk_size: ', 1024) :::audio::: tray =True Configuration file exist Using defaults set there ('ffmpeg', 'aac', '192', '44100') :::audio::: Program /usr/bin/ffmpeg found in /usr/bin/ffmpeg :::audio::: backend dictionary {'/usr/bin/ffmpeg': 'ffmpeg', 'ffmpeg': 'ffmpeg'} Selected backend: /usr/bin/ffmpeg Selected audio codec: aac Default bitrate used: 192k Default sample rate used: 44100Hz :::audio::: command ['/usr/bin/ffmpeg', '-ac', '2', '-ar', '44100', '-f', 'pulse', '-i', 'mkchromecast.monitor', '-acodec', 'aac', '-f', 'adts', '-ac', '2', '-ar', '44100', '-b:a', '192k', '-cutoff', '18000', 'pipe:'] :::cast::: sockets method 192.168.105.153 Configuration file exist Using defaults set there (':::systray::: Screen resolution: ', 1920, 1080) :::systray::: High-DPI screen detected... Configuration file exist Using defaults set there Traceback (most recent call last): File "/usr/share/mkchromecast/mkchromecast/systray.py", line 259, in search_cast self.search_notification() File "/usr/share/mkchromecast/mkchromecast/systray.py", line 878, in search_notification gi.require_version('Notify', '0.7') File "/usr/lib/python2.7/dist-packages/gi/init.py", line 102, in require_version raise ValueError('Namespace %s not available' % namespace) ValueError: Namespace Notify not available Aborted (core dumped)

chuqster avatar Nov 19 '16 23:11 chuqster

Can you install gir1.2-notify package and tell me if it works?

muammar avatar Nov 20 '16 03:11 muammar

Installing the package stops the python error and now the gui silently dies when running a search although I do now get the notification when devices are found. Also, it still won't default to the first discovered device at startup. Watching the terminal messages I can see the device index returns okay right after the gui dies. The process continues to run after the gui dies and no errors are returned.

Running it under sudo does work as mentioned before although I still need to run a search and select a device from the gui.

chuqster avatar Nov 20 '16 21:11 chuqster

Attached a strace file if it helps.

chuqster avatar Nov 20 '16 21:11 chuqster

Attached a strace file if it helps.

I do not see the attached file. The strace will help me to understand better. Thanks for your feedback.

muammar avatar Nov 20 '16 21:11 muammar

Sorry about that.

mkchromecast.strace.txt

chuqster avatar Nov 20 '16 22:11 chuqster

@chuqster thank you. Could you also send the errors shown in the terminal, please?.

muammar avatar Nov 21 '16 00:11 muammar

Hi,

Not getting any errors since adding gir-notify, the tray gui just quietly dies after searching for devices unless I run the command under sudo. See attached for the output I do get. This is just past running a search and after the gui died. Hope that helps!

BTW, if there's a way to increase verbosity of output or run it from python interpreter under a debug let me know how and I can do that if it helps. Also, is there anything like a file or device that I have to have any special permissions to? I just ask as it seems fine run under sudo. I'm using Pulse audio.

Thanks, Chuck

mkchromecast.output.txt

chuqster avatar Nov 21 '16 01:11 chuqster

Just out of curiosity, could you delete the directory $HOME/.config/mkchromecast, and try to run again without sudo?. As a regular user, it should work. I haven't work yet in adding more verbosity. It is something I have to improve. Thanks again for your feedback!.

muammar avatar Nov 21 '16 01:11 muammar

Hi,

Yeah, same results other than it reloaded defaults because the conf file was rm'd. I attached the output. Happy I can give you some feedback. I'm a sysadmin by trade with a little bit of coding experience so feel free to ask.

Neat project, by the way. Thanks for doing this! I just started collecting chromecast audios as I'm building an inexpensive multi-room system so this is good to have. I use quite a few chromecast devices at work too so I've got all sorts of ideas brewing.

Just a suggestion for a future enhancement if I may. The ability to create groups of devices and to multicast, please and thanks. It's supported on the audio model with the Android and iOS clients.

Keep up the good work!

-Chuck

On Sun, Nov 20, 2016 at 5:49 PM, Muammar El Khatib <[email protected]

wrote:

Just out of curiosity, could you delete $HOME/.config/mkchromecast, and try to run again without sudo?. As a regular user, it should work. I haven't work yet in adding more verbosity. It is something I have to improve. Thanks again for your feedback!.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/muammar/mkchromecast/issues/29#issuecomment-261824294, or mute the thread https://github.com/notifications/unsubscribe-auth/AVZTHFKKn6dr_TwWwbx-PaIJ6L1Wyq60ks5rAPikgaJpZM4K3ZYf .

charles@muadib:~$ rm -rf .config/mkchromecast/ charles@muadib:~$ mkchromecast --debug -t ('ALSA device name:', None) ('Google Cast name:', None) ('backends: ', ['ffmpeg', 'avconv', 'parec']) ('ALSA device name:', None) ('Google Cast name:', None) ('backends: ', ['ffmpeg', 'avconv', 'parec']) USER =charles PATH =/home/charles/bin:/home/charles/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin mkchromecast v0.3.6 (':::audio::: chunk_size: ', 1024) :::audio::: Program /usr/bin/parec found in /usr/bin/parec :::audio::: backend dictionary {'parec': 'parec', '/usr/bin/parec': 'parec'} Selected backend: /usr/bin/parec Selected audio codec: mp3 Default bitrate used: 192k Default sample rate used: 44100Hz :::audio::: command ['lame', '-b', '192', '-r', '-'] :::cast::: sockets method 192.168.105.153 :::systray::: self.notifications disabled :::systray::: self.searchatlaunch disabled :::systray::: self.colors black (':::systray::: Screen resolution: ', 1920, 1080) :::systray::: High-DPI screen detected... :::systray::: self.notifications disabled :::systray::: self.searchatlaunch disabled :::systray::: self.colors black :::cast::: sockets method 192.168.105.153 self.cclist [u'ChromecastAudio4032'] elif len(self.cclist) != 0 and self.select_cc == True and self.tray == True:

List of Google Cast devices available in your network:

Index Friendly name ===== ============= 0 ChromecastAudio4032 availablecc received :::systray::: self.notifications disabled :::systray::: self.searchatlaunch disabled :::systray::: self.colors black ('Available Google Cast Devices', [[0, u'ChromecastAudio4032']]) ^C charles@muadib:~$

chuqster avatar Nov 21 '16 02:11 chuqster

@chuqster I am sorry to get back so late, if you are still using the app, did it ever work for you?.

muammar avatar Jan 29 '17 17:01 muammar

Sorry, I missed your response. To be honest I haven't used it much lately. I've been streaming more from my phone than that computer.

On Sun, Jan 29, 2017 at 9:56 AM, Muammar El Khatib <[email protected]

wrote:

@chuqster https://github.com/chuqster I am sorry to get back so late, if you are still using the app, did it ever work for you?.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/muammar/mkchromecast/issues/29#issuecomment-275932319, or mute the thread https://github.com/notifications/unsubscribe-auth/AVZTHLjMrtxJk79iQ867ToSpad6b7Xt3ks5rXNLGgaJpZM4K3ZYf .

chuqster avatar Feb 17 '17 22:02 chuqster

Hi Muammar, I'm trying to use this and came across this issue. If you're inclined to reopen, I'm happy to help test, or produce whatever debug outputs you might want.

brockrob avatar May 31 '17 11:05 brockrob

@brockrob I am reopening the issue. I would be glad if you could help me to debug this. Thanks.

muammar avatar May 31 '17 15:05 muammar

Sure thing. I'm on Kali-rolling, kernel 4.11.3, pulse-audio, and KDE plasma. Running mkchromecast from their repo, which mirrors debian-testing:

robert@CrashBox:~/Documents$ apt show mkchromecast
Package: mkchromecast
Version: 0.3.7+git20170130-2
Priority: optional
Section: sound
Maintainer: Muammar El Khatib <[email protected]>
Installed-Size: 4,911 kB
Depends: python:any (>= 2.7.5-5~), python-flask, python-pychromecast, python-psutil, vorbis-tools (>= 1.4.0), sox (>= 14.4.1), lame (>= 3.99.0), flac (>= 1.3.0), python-pyqt5, youtube-dl, gir1.2-notify-0.7
Suggests: libav-tools, ffmpeg, mkchromecast-pulseaudio, mkchromecast-alsa
Homepage: http://mkchromecast.com
Tag: admin::hardware, hardware::detection, hardware::video,
 interface::commandline, role::program, scope::utility, use::playing,
 works-with::audio
Download-Size: 1,430 kB
APT-Manual-Installed: yes
APT-Sources: http://http.kali.org/kali kali-rolling/main amd64 Packages
Description: Cast your Linux audio to your Google Cast devices
 It is written in Python, and it streams via node.js, ffmpeg, or avconv.
 mkchromecast is capable of using lossy and lossless audio formats provided
 that ffmpeg is installed. It also supports Multi-room group playback, and
 24-bits/96kHz high audio resolution. Additionally, a system tray menu is also
 available.
 .
 By default, mkchromecast streams with node.js (or parec in Linux) together
 with mp3 audio coding format at a sample rate of 44100Hz and average bitrate
 of 192k. These defaults can be changed using the --sample-rate and -b flags.
 It is useful to modify these parameters when your wireless router is not very
 powerful, or in the case you don't want to degrade the sound quality.
 .
 mkchromecast can cast using either pulseaudio or ALSA. The respective
 dependencies can be pulled by mkchromecast-pulseaudio and mkchromecast-alsa
 dependency packages respectively. For more information, please read the
 README.Debian file shipped in this package.

robert@CrashBox:~/Documents$

I didn't dig too hard. It works fine in the command line, but if I run the tray it disappears from the tray after I click the bit to find a chromecast device. There is still an mkchromecast process alive after this happens, however, and the debug output smells like a threading issue at first glance:

robert@CrashBox:~$ mkchromecast --debug -t
('ALSA device name:', None)
('Google Cast name:', None)
('backends: ', ['ffmpeg', 'avconv', 'parec', 'gstreamer'])
('ALSA device name:', None)
('Google Cast name:', None)
('backends: ', ['ffmpeg', 'avconv', 'parec', 'gstreamer'])
USER =robert
PATH =/home/robert/bin/Sencha/Cmd/6.1.2.15/..:/home/robert/bin/Sencha/Cmd:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
mkchromecast v0.3.7
(':::audio::: chunk_size: ', 1024)
:::audio::: tray =True
Configuration file exists
Using defaults set there
('parec', 'flac', '192', '44100', None)
:::audio::: Program /usr/bin/parec found in /usr/bin/parec
:::audio::: backend dictionary {'parec': 'parec', '/usr/bin/parec': 'parec'}
Selected backend: /usr/bin/parec
Selected audio codec: flac
Default bitrate used: 192k
Default sample rate used: 44100Hz
:::audio::: command ['flac', '-', '-c', '--channels', '2', '--bps', '16', '--sample-rate', '44100', '--endian', 'little', '--sign', 'signed', '-s']
:::cast::: sockets method 192.168.0.211
Configuration file exists
Using defaults set there
(':::systray::: Screen resolution: ', 1920, 1080)
:::systray::: High-DPI screen detected...
Configuration file exists
Using defaults set there
:::cast::: sockets method 192.168.0.211
self.cclist [u'Marantz']
elif len(self.cclist) != 0 and self.select_cc == True and self.tray == True:
 
List of Google Cast devices available in your network:
------------------------------------------------------
 
Index   Friendly name
=====   ============= 
0       Marantz
availablecc received
Configuration file exists
Using defaults set there
('Available Google Cast Devices', [[0, u'Marantz']])

Any other info you'd like?

brockrob avatar May 31 '17 16:05 brockrob

Any other info you'd like?

That would be enough. I can work with that. I will install Kali and check it out. Just out of curiosity -- when the icon disappears, you can still click on the systray menus?. I will get back to you soon. Thanks.

muammar avatar May 31 '17 16:05 muammar

No, it disappears entirely from the systray.

Note that if you want to reproduce in kali I have installed KDE and removed gnome. Given that OP was also using KDE, I'm thinking it's worthwhile you do the same?

brockrob avatar May 31 '17 16:05 brockrob

Note that if you want to reproduce in kali I have installed KDE and removed gnome. Given that OP was also using KDE, I'm thinking it's worthwhile you do the same?

Once I set up the vbox I will install only KDE.

muammar avatar May 31 '17 18:05 muammar

@brockrob you were right about the icon disappearing completely from the systray. I will try to fix this.

muammar avatar Jun 04 '17 02:06 muammar

Hi @muammar, I'm facing the same non-appearing systray (actually before I set the search on launch option it was appearing and disappering on search) icon on Kubuntu 17.10 but executing via debug on cli I receive a slightly different output may be it helps to fix the issue:

[...] Configuration file exists Using defaults set there :::systray::: Screen resolution: 1920 1080 :::systray::: High-DPI screen detected... Icon theme "papirus" not found. Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/16/" Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/22/" Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/24/" Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/32/" Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/48/" Invalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/64/" nvalid Context= "stock" line for icon theme: "/usr/share/icons/ubuntu-mono-dark/stock/128/" Icon theme "Mint-X" not found. Icon theme "elementary" not found. Icon theme "gnome" not found. Configuration file exists Using defaults set there :::cast::: sockets method 192.168.116.126 [...]

Of course if you'd need any other info let me know.

Bests, Nicola

DrNik avatar Jan 08 '18 15:01 DrNik

I cannot reproduce this: screenshot from 2018-09-19 23-20-30

muammar avatar Sep 20 '18 03:09 muammar

I have the same problem with KDE. I'm using KDE Neon 18.04. Configuration is default. Here the output:

➜  ~ mkchromecast --debug -t
ALSA device name: None.
Google Cast name: None.
backends:  ['ffmpeg', 'avconv', 'parec', 'gstreamer']
ALSA device name: None.
Google Cast name: None.
backends:  ['ffmpeg', 'avconv', 'parec', 'gstreamer']
USER =yanislavcore
PATH =/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Mkchromecast v0.3.8.1
:::cast::: sockets method 10.0.12.105
:::audio::: chunk_size, frame_size, buffer_size: 64, 2048, 8192
:::audio::: Program /usr/bin/parec found in /usr/bin/parec
:::audio::: backend dictionary {'parec': 'parec', '/usr/bin/parec': 'parec'}
Selected backend: /usr/bin/parec
Selected audio codec: mp3
Default bitrate used: 192k
Default sample rate used: 44100Hz.
:::audio::: command ['lame', '-b', '192', '-r', '-']
:::cast::: sockets method 10.0.12.105
:::systray::: self.notifications disabled
:::systray::: self.searchatlaunch disabled
:::systray::: self.colors black
:::systray::: Screen resolution:  1920 1080
:::systray::: High-DPI screen detected...
:::systray::: self.notifications disabled
:::systray::: self.searchatlaunch disabled
:::systray::: self.colors black
:::cast::: sockets method 10.0.12.105
self.cclist [[0, 'MIBOX3', 'Gcast']]
elif len(self.cclist) != 0 and self.select_cc == True  and self.tray == True:
 
List of Devices Available in Network:
-------------------------------------

Index   Types   Friendly Name 
=====   =====   ============= 
0       Gcast   MIBOX3
availablecc received
:::systray::: self.notifications disabled
:::systray::: self.searchatlaunch disabled
:::systray::: self.colors black
Available Media Streaming Devices [[0, 'MIBOX3', 'Gcast']]

Yanislavcore avatar Nov 02 '18 12:11 Yanislavcore

Same is happening here as well./Systray Icon disappears when I press the search for devices option, totally gone and not just the icon. Strange enough I can get things running normally when launched as su, which, for security reasons, is not a solution : ), let me know if I can run a test for you, ill gladly help. Kind regards.

r7xf avatar Jan 14 '19 14:01 r7xf

I just resolved this issue on a fresh install of Kubuntu 18.10 with the following:

sudo apt install python3-pip pip3 install PyQt5

Hopefully that helps anyone else experiencing this.

ghost avatar Jan 18 '19 01:01 ghost

I have kind of isolated the issue. The difference in KDE comes between pyqt5 version 5.11.2 and pyqt5 version 5.12.2. When we use pyqt5 v 5.12.2 (latest), the problem comes into play and the icon disappears from the system tray when 'search for media streaming devices' is clicked. This problem does not occur when we use pyqt5 v 5.11.2 i.e. when we install from source and use requirements.txt to install the needed packages. Thus, problem will occur as in my case, when installing from AUR or pretty much any time when not installing from sources.

EDIT: After tinkering a bit more, I found out that installing pyqt5 from pacman ie arch repos will result in the problem while if we install using pip, the problem goes away as experienced by @otlinton. so, Icon problem occurs when I run sudo pacman -S python-pyqt5 which installs pyqt5 v5.12.2

Icon problem solves when I run sudo pip install pyqt5 which installs pyqt5 v5.12

Thus finally, if you're experiencing the problem of disappearing system tray icon, use pip to install the pyqt5 package instead. Still not sure though why the problem exists in one source but not in the other. ~Maybe the difference is in versions of pyqt5.~(Tried installing older version of pyqt5 from arch archive. Problem still persists) This can only be answered by @muammar though.

I hope this helps out a bit.

RitwickVerma avatar Mar 13 '19 07:03 RitwickVerma

I'm running KDE on Manjaro and can confirm installing pyqt5 through pip fixed the system tray crash issue. Here's the command I used: sudo pip install --upgrade --force-reinstall pyqt5

vannaka avatar May 12 '21 15:05 vannaka