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
podcast.m3u8
preload
instance.hist

View File

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