-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpd.txt
159 lines (137 loc) · 4.84 KB
/
mpd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
export MAC="0C:A6:94:99:FA:4A"
sudo apt-get -y install mpd mpc
sudo sed -i '/auto_update\ /s/^#//' /etc/mpd.conf
sudo sed -i '/hw:0,0/s/^#//g' /etc/mpd.conf
sudo sed -i 's/My ALSA Device/Analog Jack/g' /etc/mpd.conf
sudo sed -i '0,/mixer_type "hardware"/s/^#\tmixer_type/\tmixer_type/' /etc/mpd.conf
sudo sed -i '0,/mixer_device/s/^#\tmixer_device/\tmixer_device/' /etc/mpd.conf
sudo sed -i '0,/mixer_control/s/^#\tmixer_control/\tmixer_control/' /etc/mpd.conf
sudo sed -i '/bind_to_address.*localhost/s/localhost/0.0.0.0/' /etc/mpd.conf
echo -e "/An example of an ALSA output/a
audio_output {
\ttype\t\t\"alsa\"
\tname\t\t\"Esquire 2\"
\tdevice\t\t\"bluealsa:HCI=hci0,DEV=${MAC},PROFILE=a2dp\"
\tmixer_type\t\"hardware\"
\tmixer_device\t\"bluealsa:HCI=hci0\"
\tmixer_control\t\"HK Esquire 2 - A2DP\"
}
.
wq" | sudo ed -s /etc/mpd.conf
cat <<EOF | sudo tee /var/lib/mpd/playlists/radio.m3u
http://air.radiorecord.ru:805/rr_aac_64
http://online.kissfm.ua/KissFM
http://bfm.hostingradio.ru:8004/fm
http://kommersant77.hostingradio.ru:8016/kommersant64.mp3
http://pool.cdn.lagardere.cz/fm-evropa2-128
http://icecast.vgtrk.cdnvideo.ru/vestifm_aac_64kbps
http://audio2.video.ria.ru:80/voicerushi
http://ic7.101.ru:8000/a199
http://air.radiorecord.ru:8102/ansh_128
http://ep256.streamr.ru
http://air2.radiorecord.ru:805/rr_320
http://air.radiorecord.ru:8102/ansh_320
EOF
cat <<EOF | sudo tee /var/lib/mpd/playlists/detskoe-radio.m3u
http://ic7.101.ru:8000/a199
http://www.staroeradio.ru/detskoe128.m3u
http://www.staroeradio.ru/ices128.m3u
http://radio.tmstudia.ru:8001/live
http://gamaun.online:8020/radio
http://icecast.russkoeradio.cdnvideo.ru:80/st28.mp3
http://music.myradio.ua:80/fairytales128.mp3
https://rr-detskijkanal.hostingradio.ru/detskijkanal96.aacp
EOF
sudo chown mpd.audio -R /var/lib/mpd/playlists/
sudo chmod 666 /var/lib/mpd/playlists/*
sudo systemctl restart mpd ; sleep 10
mpc enable only "Analog Jack"
[ -d /etc/local ] || sudo mkdir /etc/local && sudo chown pi.pi /etc/local
cat << 'EOF' | tee /etc/local/mpd_start_morning.sh
#!/bin/bash
#skip before NY
if [ `date +%V` -ge 52 ]
then
echo "week number = `date +%V`"
exit 2
fi
/usr/bin/amixer -D hw sset "PCM" 73% ;
/usr/bin/mpc enable only "Analog Jack" ;
/usr/bin/mpc clear ;
/usr/bin/mpc add http://ic7.101.ru:8000/a199 ;
/usr/bin/mpc play ;
EOF
chmod u+x /etc/local/mpd_start_morning.sh
cat <<EOF | tee /etc/local/aa.sh
#!/bin/bash
/bin/echo "Audio Analog"
/usr/bin/amixer cset numid=3 1
EOF
chmod u+x /etc/local/aa.sh
cat <<EOF | tee /etc/local/ahdmi.sh
#!/bin/bash
/bin/echo "Audio Analog"
/usr/bin/amixer cset numid=3 2
EOF
chmod u+x /etc/local/ahdmi.sh
cd ~
crontab -l
#week schedule
crontab -l > mycron
cat << EOF | tee -a mycron
#mpd week schedule
15 06 * * 1-5 /etc/local/mpd_start_morning.sh | /usr/bin/logger -t ALEXM
35 06 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
50 06 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 85\% | /usr/bin/logger -t ALEXM
30 07 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
40 07 * * 1-5 /usr/bin/mpc stop | /usr/bin/logger -t ALEXM
30 22 * * * /usr/bin/mpc stop | /usr/bin/logger -t ALEXM
#40 07 * * 1-5 /etc/local/mpd_start_morning.sh | /usr/bin/logger -t ALEXM
#35 08 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
#50 08 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 85\% | /usr/bin/logger -t ALEXM
#30 09 * * 1-5 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
#40 09 * * 1-5 /usr/bin/mpc stop | /usr/bin/logger -t ALEXM
30 07 * * 6 /etc/local/mpd_start_morning.sh | /usr/bin/logger -t ALEXM
00 08 * * 6 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
00 09 * * 6 /usr/bin/mpc stop | /usr/bin/logger -t ALEXM
00 08 * * 0 /etc/local/mpd_start_morning.sh | /usr/bin/logger -t ALEXM
45 08 * * 0 /usr/bin/amixer -D hw sset "PCM" 80\% | /usr/bin/logger -t ALEXM
00 12 * * 0 /usr/bin/mpc stop | /usr/bin/logger -t ALEXM
EOF
crontab mycron
rm mycron
crontab -l
sudo systemctl enable mpd
sudo systemctl restart mpd
----------------------------------------------------
mpc add http://air2.radiorecord.ru:805/rr_320
mpc playlist
mpc play
mpc stop
mpc next
mpc seek +01:00
mpc seek 70:00
mpc outputs
mpc enable 2
mpc enable only "Analog Jack"
mpc update
mpc listall
-------------------------------------------------------
mcedit /etc/mpd.conf
audio_output {
type "alsa"
name "Bluetooth Speaker"
device "bluealsa:HCI=hci0,DEV=0C:A6:94:99:FA:4A,PROFILE=a2dp"
mixer_type "hardware"
mixer_device "bluealsa:HCI=hci0"
mixer_control "HK Esquire 2 - A2DP"
}
audio_output {
type "alsa"
name "Jack"
device "hw:0"
mixer_type "hardware"
mixer_device "default"
mixer_control "PCM"
}
------------------------------------------------------------