question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Play feature is broken in Non Root access on termux in Android env.

See original GitHub issue

I’m using a non-rooted android device with termux.
Surprisingly I was able to build PyRadio from source, however upon selecting a station I get roughly 5 seconds of audio and I receive a KeyError & Permission error on /proc directory.

PyRadio clearly is working however fundamentally does not work with my environment.

~/.local/bin $ ./pyradio --play
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_common.py", line 403, in wrapper
    return cache[key]
KeyError: (('/proc',), frozenset())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_pslinux.py", line 302, in <module>
    set_scputimes_ntuple("/proc")
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_common.py", line 405, in wrapper
    ret = cache[key] = fun(*args, **kwargs)
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_pslinux.py", line 269, in set_scputimes_ntuple
    with open_binary('%s/stat' % procfs_path) as f:
  File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/psutil/_common.py", line 711, in open_binary
    return open(fname, "rb", **kwargs)
PermissionError: [Errno 13] Permission denied: '/proc/stat'

For me to make this change I would allow the user to decide if a stream is indeed playing and continue playing it versus what appears to be happening is pyradio checks with /proc to see if the stream is healthy in some way and KeyError on that check… Since I’m building from source this may be a easy adjustment.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
sp33dsk8commented, Feb 15, 2021

Unfortunately vlc (installed from app store) is not accessible from command line ($ vlc) so pyradio wouldn’t be able to call it. I can’t install mplayer either, using apt or pkg.

mpv works fine $ mpv http://somafm.com/secretagent.pls will directly play audio.

I know you’re not targeting android with pyradio but the closest to getting something working officially would be using this Simple Protocol Player method. https://android.stackexchange.com/a/205711

You’ve guarded user inputs in the config files well, I tried to break connection_timeout high and low but it constrains it back to default.

I’ve stripped out the lines for the timeout counter to activate in player.py ln1126-ln1137 Plays fine now :] Just a message about “Opening connection…” , I tried setting the connection_timeout_thread = True in hopes that that would short circuit it to think the job was done but to no avail.

0reactions
s-n-gcommented, Feb 15, 2021

BTW, If you do post a tutorial or guide or something about how you did this, please do send us a link.

It would be really interesting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ - Termux Wiki
Termux is a terminal emulator for Android OS with its own package ecosystem. ... This can't be done, at least if your device...
Read more >
Here's why the Termux app is no longer getting updates on ...
The Termux team has stopped updating the Play Store version. To continue getting updates, users should migrate to the F-Droid build.
Read more >
Termux turns Android into a Linux development environment
Termux is Linux, but it is based on Android and runs in a container. That means you can install it with no root...
Read more >
How to Get ROOT Access in Termux Without ROOT - YouTube
In this video, learn How to Get ROOT Access in Termux Without ROOT - Complete Tutorial. Find all the videos of the Hacking...
Read more >
Termux:API - Apps on Google Play
The Termux:API add-on provides command line access to device API:s: * Read and send sms messages from your terminal. * Access device GPS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found