URI: 
       bitreich-con-teaser-shell - bitreich-conference - Bitreich Conference System
  HTML git clone git://bitreich.org/bitreich-conference git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-conference
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
       bitreich-con-teaser-shell (728B)
       ---
            1 #!/bin/sh
            2 
            3 if [ $# -lt 1 ];
            4 then
            5         year="$(date +%Y)"
            6 else
            7         year="$1"
            8 fi
            9 
           10 function shell() {
           11         cd "/home/presenter/con/${year}"
           12         bash
           13 }
           14 
           15 adpath="/br/gopher/con/${year}/ads"
           16 framelines=25
           17 
           18 while /bin/true;
           19 do
           20         clear
           21         adfile="${adpath}/$(ls -1 "${adpath}" | shuf -n 1)"
           22         nframes=$(( "$(wc -l < "${adfile}")" / $framelines))
           23 
           24         i=0
           25         # Change the ad every 30 seconds.
           26         while [ $i -lt 20 ];
           27         do
           28                 tput cup 0 0        
           29                 tput civis
           30                 tail -n +$((1+i%$nframes*$framelines)) "$adfile" | head -n $framelines
           31                 # Redisplay every second, in case someone freshly attached.
           32                 i=$(($i + 1))
           33 
           34                 userinput=""
           35                 read -t 1 userinput
           36                 if [ $? -eq 0 ];
           37                 then
           38                         # Be clear and clean.
           39                         clear
           40                         tput cvvis
           41                         shell
           42                         clear
           43                         tput civis
           44                 fi
           45         done
           46 done
           47