Преглед изворни кода

Option to rescan icecast playlist

Bob Mottram пре 7 година
родитељ
комит
1d6b9e7402
1 измењених фајлова са 17 додато и 3 уклоњено
  1. 17
    3
      src/freedombone-app-icecast

+ 17
- 3
src/freedombone-app-icecast Прегледај датотеку

53
                    ICECAST_CODE
53
                    ICECAST_CODE
54
                    DEFAULT_LANGUAGE)
54
                    DEFAULT_LANGUAGE)
55
 
55
 
56
+function icecast_rescan {
57
+    if [ -d $ICECAST_DIR ]; then
58
+        if [ -f $ICECAST_PLAYLIST_FILE ]; then
59
+            rm $ICECAST_PLAYLIST_FILE
60
+        fi
61
+        icecast_add_file_to_playlist $ICECAST_DIR
62
+    fi
63
+}
64
+
56
 function icecast_update_daemon {
65
 function icecast_update_daemon {
57
     systemctl stop icecast2
66
     systemctl stop icecast2
58
     if [ -f /etc/init.d/icecast2 ]; then
67
     if [ -f /etc/init.d/icecast2 ]; then
338
         trap "rm -f $data" 0 1 2 5 15
347
         trap "rm -f $data" 0 1 2 5 15
339
         dialog --backtitle $"Freedombone Control Panel" \
348
         dialog --backtitle $"Freedombone Control Panel" \
340
                --title $"Icecast" \
349
                --title $"Icecast" \
341
-               --radiolist $"Choose an operation:" 15 70 8 \
350
+               --radiolist $"Choose an operation:" 16 70 9 \
342
                1 $"Import stream files from directory" off \
351
                1 $"Import stream files from directory" off \
343
                2 $"Import stream files from USB drive" off \
352
                2 $"Import stream files from USB drive" off \
344
                3 $"Manually edit playlist" off \
353
                3 $"Manually edit playlist" off \
346
                5 $"Format a USB drive for stream file storage" off \
355
                5 $"Format a USB drive for stream file storage" off \
347
                6 $"Enable login for stream visitors" off \
356
                6 $"Enable login for stream visitors" off \
348
                7 $"Change password for stream visitors" off \
357
                7 $"Change password for stream visitors" off \
349
-               8 $"Exit" on 2> $data
358
+               8 $"Re-scan playlist" off \
359
+               9 $"Exit" on 2> $data
350
         sel=$?
360
         sel=$?
351
         case $sel in
361
         case $sel in
352
             1) break;;
362
             1) break;;
360
             5) icecast_format_drive;;
370
             5) icecast_format_drive;;
361
             6) icecast_enable_login;;
371
             6) icecast_enable_login;;
362
             7) icecast_change_login;;
372
             7) icecast_change_login;;
363
-            8) break;;
373
+            8) clear
374
+               echo $'Rescanning playlist'
375
+               icecast_rescan;;
376
+            9) break;;
364
         esac
377
         esac
365
     done
378
     done
366
 }
379
 }
661
     icecast_update_daemon
674
     icecast_update_daemon
662
     nginx_ensite icecast
675
     nginx_ensite icecast
663
     systemctl restart nginx
676
     systemctl restart nginx
677
+    icecast_rescan
664
     start_icecast
678
     start_icecast
665
 
679
 
666
     APP_INSTALLED=1
680
     APP_INSTALLED=1