File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,29 @@ mpvctui_notify()
173173 } '
174174}
175175
176+ mpvctui_suggest ()
177+ {
178+ awk '
179+ BEGIN {
180+ srand()
181+ }
182+ ! /https:/ {
183+ gsub($1,"")
184+ gsub($1,"")
185+ if(length($0) > 0)
186+ {
187+ tracks[n++]=$0
188+ seen[$0]++
189+ }
190+ }
191+ END {
192+ r=int(rand() * n)
193+ t=tracks[r]
194+ print r,seen[t],t
195+ }
196+ ' " $MPVC_SCROBBLER "
197+ }
198+
176199mpvctui_usage ()
177200{
178201 echo " usage: $PROGNAME -[$optflags ] args # @version $PROGVERSION (c) $PROGAUTHOR $PROGURL "
@@ -184,7 +207,7 @@ mpvctui_usage()
184207 exit ;
185208}
186209
187- optflags=" d:htTm:nN:P :x"
210+ optflags=" d:htTm:nN:sP :x"
188211mpvctui_main ()
189212{
190213 mpvctui_config
@@ -204,6 +227,7 @@ mpvctui_main()
204227 m) shift ; mpvctui_notify " $OPTARG " ;;
205228 n) shift ; mpvc idleloop | mpvctui_notify ;;
206229 N) shift ; mpvc idleloop | mpvctui_notify " $OPTARG " ;;
230+ s) shift ; mpvctui_suggest ;;
207231 x) shift ; quiet command -v $MPVC_TERM && $MPVC_TERM -e " $0 " " $@ " ; exit ;;
208232 * ) mpvctui_usage;;
209233 esac
You can’t perform that action at this time.
0 commit comments