added history instances usage

This commit is contained in:
localhost_frssoft 2022-04-02 22:44:45 +03:00
parent 04bda6adc4
commit 09c2fd191e
2 changed files with 30 additions and 17 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
playlist.m3u8 playlist.m3u8
podcast.m3u8 podcast.m3u8
preload preload
instance.hist

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
instance=$(jj -i config.json instance) instance=$(jj -i config.json instance)
instance_hist='instance.hist'
ordering='title' ordering='title'
default_player_command='mpv --no-vid --no-ytdl --network-timeout=30' default_player_command='mpv --no-vid --no-ytdl --network-timeout=30'
@ -143,23 +144,34 @@ case "$choice" in
"$changepod") "$changepod")
if [ 'Choice from list' = "$(echo 'Choice from list\nManual input' | fzy)" ]; then empty=0
instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy) case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in
else "Recently used")
echo "Type instance (ex. $instance):" if [ -s $instance_hist ]; then
read instance touch $instance_hist && instance=$(cat $instance_hist | fzy)
fi else
echo 'No recently used instances...'
empty=1
fi ;;
export instance "Choice from list") instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy) ;;
export instance_point="https://$instance/api/v1"
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy) "Manual input") echo "Type instance (ex. $instance):" && read instance ;;
if [ "$conf_instance_state" = 'Permanent' ]; then esac
jj -i config.json instance -v $instance -o config.json if [ $empty -eq 0 ]; then
else echo $instance >> $instance_hist
echo '' cat $instance_hist | sort | uniq | tee $instance_hist 1>>/dev/null
fi export instance
clear export instance_point="https://$instance/api/v1"
get_all_avalaible_count_tracks ;; conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
if [ "$conf_instance_state" = 'Permanent' ]; then
jj -i config.json instance -v $instance -o config.json
else
echo ''
fi
clear
get_all_avalaible_count_tracks
fi ;;
"$checkapilimits") "$checkapilimits")