Tặng anh em script nghe FM trên CLI dùng Mplayer

huyhaover

New member
** Một kịch bản đơn giản để phát nhạc trên thiết bị đầu cuối **

Bạn có thích nghe nhạc trên thiết bị đầu cuối không?Nếu vậy, bạn sẽ thích kịch bản này!Nó cho phép bạn chơi nhạc từ nhiều nguồn trực tuyến, bao gồm Shoutcast và Icecast.

Để sử dụng tập lệnh, chỉ cần tải xuống và chạy nó bằng lệnh sau:

`` `
Sh Listentoshoutcast.Sh
`` `

Kịch bản sau đó sẽ nhắc bạn chọn một trạm từ danh sách các trạm có sẵn.Khi bạn đã chọn một trạm, kịch bản sẽ bắt đầu phát nhạc từ trạm đó.

Bạn cũng có thể sử dụng tập lệnh để kiểm soát việc phát lại âm nhạc.Để tạm dừng âm nhạc, nhấn phím `p`.Để tiếp tục âm nhạc, nhấn phím `r`.Để bỏ qua bản nhạc tiếp theo, nhấn phím `n`.Để quay lại bản nhạc trước, nhấn phím `b`.

Để thoát tập lệnh, nhấn phím `0`.

** Đây là mã cho tập lệnh: **

`` `
#!/Bin/bash

trong khi đúng;LÀM
printf "Danh sách các trạm có sẵn: \ n"
printf "[1] hit danh sách frome ngày hôm qua và hôm nay \ n"
printf "[2] pop cổ điển \ n"
printf "[3] nhấn Danh sách tất cả \ n"
printf "[4] rock thay thế \ n"
printf "[5] Pure Classic Rock \ n"
printf "[6] hôm nay quốc gia tốt nhất \ n"
Đọc -P "Bạn muốn nghe cái nào? [Số]:" Trả lời
trường hợp $ trả lời trong
[1]) MPlayer http://wm1.108.fm/acm ;;
[2]) MPlayer http://207.200.96.230:8040 ;;
.
[4]) MPlayer http://wm1.108.fm/hi ;;
[5]) MPlayer http://wm1.108.fm/cr ;;
[6]) MPlayer http://wm1.108.fm/mcountry ;;
[0]) phá vỡ ;;
*) printf "%s \ n" "Bạn phải nhập một số vào đây!";;
ESAC
xong
=======================================
**A Simple Script to Play Music on the Terminal**

Do you like listening to music on the terminal? If so, you'll love this script! It allows you to play music from a variety of online sources, including Shoutcast and Icecast.

To use the script, simply download it and run it with the following command:

```
sh listentoshoutcast.sh
```

The script will then prompt you to select a station from the list of available stations. Once you have selected a station, the script will start playing music from that station.

You can also use the script to control the playback of music. To pause the music, press the `P` key. To resume the music, press the `R` key. To skip to the next track, press the `N` key. To go back to the previous track, press the `B` key.

To exit the script, press the `0` key.

**Here is the code for the script:**

```
#!/Bin/bash

while true; do
printf "List of Available Stations:\n"
printf "[1] Hit List Frome Yesterday and Today\n"
printf "[2] Classic Pop\n"
printf "[3] Hit List All\n"
printf "[4] Alternative Rock\n"
printf "[5] Pure Classic Rock\n"
printf "[6] Today Best Country\n"
read -p "Which one do you want to hear? [Number]:" reply
case $reply in
[1]) mplayer http://wm1.108.fm/acm ;;
[2]) mplayer http://207.200.96.230:8040 ;;
[3]) mplayer http://scfire-mtc-aa03.stream.aol.com-:80/stream/1030 ;;
[4]) mplayer http://wm1.108.fm/hi ;;
[5]) mplayer http://wm1.108.fm/Cr ;;
[6]) mplayer http://wm1.108.fm/mcountry ;;
[0]) break ;;
*) printf "%s\n" "You must enter a number here!" ;;
esac
done
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top