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

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

Open
chuqster opened this issue Nov 19, 2016 · 25 comments

Comments

@chuqster
Copy link

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)

@muammar
Copy link
Owner

muammar commented Nov 20, 2016

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

@chuqster
Copy link
Author

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 chuqster reopened this Nov 20, 2016
@chuqster
Copy link
Author

Attached a strace file if it helps.

@muammar
Copy link
Owner

muammar commented Nov 20, 2016

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 muammar added the bug label Nov 20, 2016
@chuqster
Copy link
Author

Sorry about that.

mkchromecast.strace.txt

@muammar
Copy link
Owner

muammar commented Nov 21, 2016

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

@chuqster
Copy link
Author

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

@muammar
Copy link
Owner

muammar commented Nov 21, 2016

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!.

@chuqster
Copy link
Author

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 <notifications@github.com

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
#29 (comment),
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:~$

@muammar
Copy link
Owner

muammar commented Jan 29, 2017

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

@chuqster
Copy link
Author

chuqster commented Feb 17, 2017 via email

@brockrob
Copy link

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.

@muammar
Copy link
Owner

muammar commented May 31, 2017

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

@muammar muammar reopened this May 31, 2017
@muammar muammar removed the wontfix label May 31, 2017
@brockrob
Copy link

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 <muammar@debian.org>
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?

@muammar
Copy link
Owner

muammar commented May 31, 2017 via email

@brockrob
Copy link

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?

@muammar
Copy link
Owner

muammar commented May 31, 2017

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
Copy link
Owner

muammar commented Jun 4, 2017

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

@muammar muammar added this to the v0.3.8 milestone Jun 25, 2017
@muammar muammar removed this from the v0.3.8 milestone Dec 22, 2017
@DrNik
Copy link

DrNik commented Jan 8, 2018

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

muammar added a commit that referenced this issue Sep 20, 2018
@muammar
Copy link
Owner

muammar commented Sep 20, 2018

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

@Yanislavcore
Copy link

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']]

@r7xf
Copy link

r7xf commented Jan 14, 2019

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.

@ghost
Copy link

ghost commented Jan 18, 2019

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.

@RitwickVerma
Copy link

RitwickVerma commented Mar 13, 2019

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.

@vannaka
Copy link

vannaka commented May 12, 2021

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

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

No branches or pull requests

8 participants