# tested on macos # make sure you have installed mpv and youtube-dl via homebrew # this code file is created by ai # add x permission: chmod u+x ./random_music.zsh #!/bin/zsh # 定义一个选项数组,每项一行 options=( "https://www.youtube.com/watch?v=3C_KO2Fmqes" # Lofi cat • lofi ambient music | chill beats to relax/study to "https://www.youtube.com/watch?v=DXT9dF-WK-I" # 4-HOUR STUDY WITH ME / calm piano / A Rainy Day in Shinjuku, Tokyo / with countdown+alarm "https://www.youtube.com/watch?v=J4d-a7dVtiQ" # 【2M VIEWS】 Soothing Rain Sounds | Come in to the bed and close your eyes to feel the rain "https://www.youtube.com/watch?v=JdqL89ZZwFw" # Quiet Lofi Keep You Safe Deep focus Study//Work [ Lofi hip hop - Lofi chill ] "https://www.youtube.com/watch?v=bP9gMpl1gyQ" # Relaxing Sleep Music + Insomnia - Stress Relief, Relaxing Music, Deep Sleeping Music "https://www.youtube.com/watch?v=woeg9ODUWmY" # Ghibli music brings positive energy Studio Ghibli OST Spirited Away, My Neighbor Totoro "https://www.youtube.com/watch?v=CfPxlb8-ZQ0" # Work & Study Lofi Jazz - Relaxing Smooth Background Jazz Music for Work, Study, Focus, Coding "https://www.youtube.com/watch?v=CLeZyIID9Bo" # Chill Lofi Mix [chill lo-fi hip hop beats] "https://www.youtube.com/watch?v=5glPHD3Dsoo" # 2013 was 11 years ago... # 可以继续添加更多选项 ) titles=( "Lofi cat • lofi ambient music | chill beats to relax/study to" "4-HOUR STUDY WITH ME / calm piano / A Rainy Day in Shinjuku, Tokyo / with countdown+alarm" "【2M VIEWS】 Soothing Rain Sounds | Come in to the bed and close your eyes to feel the rain" "Quiet Lofi Keep You Safe Deep focus Study//Work [ Lofi hip hop - Lofi chill ]" "Relaxing Sleep Music + Insomnia - Stress Relief, Relaxing Music, Deep Sleeping Music" "Ghibli music brings positive energy Studio Ghibli OST Spirited Away, My Neighbor Totoro" "Work & Study Lofi Jazz - Relaxing Smooth Background Jazz Music for Work, Study, Focus, Coding" "Chill Lofi Mix [chill lo-fi hip hop beats]" "2013 was 11 years ago..." # 可以继续添加更多选项 ) # 生成一个随机数,用于选择选项 RANDOM_CHOICE=$(( RANDOM % ${#options[@]} + 1 )) # 自动选择 echo "play: ${titles[$RANDOM_CHOICE-1]}, have a good day!" mpv --no-video "${options[$RANDOM_CHOICE-1]}"