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,13 +144,23 @@ 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
"Recently used")
if [ -s $instance_hist ]; then
touch $instance_hist && instance=$(cat $instance_hist | fzy)
else else
echo "Type instance (ex. $instance):" echo 'No recently used instances...'
read instance empty=1
fi 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
export instance_point="https://$instance/api/v1" export instance_point="https://$instance/api/v1"
conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy) conf_instance_state=$(echo 'Permanent\nTemporaly' | fzy)
@ -159,7 +170,8 @@ case "$choice" in
echo '' echo ''
fi fi
clear clear
get_all_avalaible_count_tracks ;; get_all_avalaible_count_tracks
fi ;;
"$checkapilimits") "$checkapilimits")