farhansadik / echominal

This script a simple manager for termux. User can use is in a short way. This script is very helpful for beginners
GNU General Public License v3.0
5 stars 0 forks source link

termux-media-player #52

Closed farhansadik closed 3 years ago

farhansadik commented 3 years ago

Task

termux-media-player option will be added in main > 2 > 4 > 12.

  1. termux-media-player
  2. termux-notification
  3. termux-notification-remove [id]
  4. termux-dialog
  5. termux-volume

https://wiki.termux.com/wiki/Termux-notification https://wiki.termux.com/wiki/Termux:API https://wiki.termux.com/wiki/Termux-dialog

squaredevops commented 3 years ago

termux-notification [contant]

termux-notification --title 'Pop up notification' --sound --content 'this is a content'

toast

--action "termux-toast hello "

termux-volume [help]

Usage: termux-volume stream volume
Change volume of audio stream
Valid audio streams are: alarm, music, notification, ring, system, call
Call w/o arguments to show information about each audio stream

termux-volume [music up/down]

~ $ termux-volume music
Invalid argument count
Usage: termux-volume stream volume
Change volume of audio stream
Valid audio streams are: alarm, music, notification, ring, system, call
Call w/o arguments to show information about each audio stream
~ $ termux-volume music 15
~ $ termux-volume music 11
~ $ termux-volume music 12
squaredevops commented 3 years ago

Added Button in termux-notification

song=/sdcard/MP3/test_song.mp3
termux-media-player play $song

termux-notification --id 1 --title "Music Player" --content "playing music using termux-media-player" \
    --button1 'play' --button1-action "termux-media-player play; termux-toast 'playing song' " \
    --button2 'pause' --button2-action "termux-media-player pause" \
    --button3 'stop' --button3-action "termux-media-player stop; termux-toast 'quit' ; termux-notification-remove 1";
farhansadik commented 3 years ago

How a general user gonna choose his desire song for media player ?

squaredevops commented 3 years ago

what if we use termux-dialog ? or dialog

squaredevops commented 3 years ago

dialog and array

declare list;
list=('song1.mp3' 'song2.mp3' 'song3.mp3' 'song3.mp3' 'song3.mp3');
loc=/sdcard/MP3;

# locating file 
# ls $loc/${list[2]}

# termux-dialog -t 'title'

dialog --title "list of dir " --fselect /sdcard/MP3 20 50
batasu commented 3 years ago

Pass a variable through termux-dialog

myvariable="$(termux-dialog -t "Please enter some text" | jq '.text' -r)"
# To test this has worked:
echo "$myvariable

Using Ranger Ranger uses stdout to display its interface and $() redirects stdout to a variable, because of that you don't see the interface. You need to redirect stdout to stderr to display interface:

ranger --show-only-dirs --choosedir="$TMP" 1>&2

https://gist.github.com/gsmitheidw/56541d3117e10cecc1cb9b0ebde78656 https://stackoverflow.com/questions/59692211/selecting-folder-using-ranger-file-manager-using-bash-hanging

farhansadik commented 3 years ago

Notice

There is now way to show file list in termux-dialog. So we're going to let user to input the song name from /sdcard/MP3

squaredevops commented 3 years ago

Notice

New patch on the way! code has been tested in real device! farhansadik/echominal#35 and tested code will be deployed very soon! @squaredevops @farhansadik @batasu