WD My Cloud에 MPD 설치하여 음악 재생 머신으로 사용하기 - 2편
컨텐츠 정보
- 45,994 조회
- 12 댓글
- 0 추천
- 목록
본문
5. MPD 설정 수정하기
본격적으로 수정하기 전에
MC에서 USB사운드카드를 어떤 번호로 인식하는지 알아야 합니다.
aplay -l
위 명령어로 알 수 있습니다.
WDMyCloud:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Set [USB Headphone Set], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
WDMyCloud:~#
여기서 중요한 것은 빨간 숫자 2개입니다.
지금 보면 1 다음에 0입니다. 이걸 꼭 기억해야 합니다.
nano /etc/mpd.conf
위 명령어로 설정으로 들어갑니다.
# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory "/shares"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory "/var/lib/mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file "/var/lib/mpd/tag_cache"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file "/var/log/mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file "/var/run/mpd/pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file "/var/lib/mpd/state"
#
# The location of the sticker database. This is a database which
# manages dynamic information attached to songs.
#
sticker_file "/var/lib/mpd/sticker.sql"
#
###############################################################################
# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
user "mpd"
#
# This setting specifies the group that MPD will run as. If not specified
# primary group of user specified with "user" setting will be used (if set).
# This is useful if MPD needs to be a member of group such as "audio" to
# have permission to use sound card.
#
#group "nogroup"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address
#
# For network
bind_to_address "0.0.0.0"
#
# And for Unix Socket
#bind_to_address "/var/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level "default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available as vbrfix in the debian archive), at which
# point gapless MP3 playback can be enabled.
#
#gapless_mp3_playback "yes"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. Optionally, 'comment' can be added to this
# list.
#
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# This setting enables automatic update of MPD's database when files in
# music_directory are changed.
#
#auto_update "yes"
#
# Limit the depth of the directories being watched, 0 means only watch
# the music directory itself. There is no limit by default.
#
#auto_update_depth "3"
#
###############################################################################
# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
#follow_inside_symlinks "yes"
#
###############################################################################
# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name "Music Player"
#
###############################################################################
# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions "read,add,control,admin"
#
###############################################################################
# Input #######################################################################
#
input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}
#
###############################################################################
# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# See for examples of
# other audio outputs.
#
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "My Cloud"
device "hw:0,0" # optional 여기가 가장 중요합니다.
format "*:16:*" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
mixer_type "software"
}
위의 빨간 글자들을 주의해서 수정합니다.
아까 봤던 1 다음에 0은
device "hw:1,0" # optional
위 옵션에 들어갑니다.
기본은 0,0인데, 1 다음에 0이 왔다면 위와 같이 1,0으로 바꿔야 MPD에서 소리가 납니다.
/etc/init.d/mpd start
위 명령어로 mpd를 시작합니다.
6. mpc 설치하기
MPC는 음악을 플레이하는 프로그램이라 보면 됩니다.
apt-get install mpc
위 명령어로 설치합니다.
WDMyCloud:~# apt-get install mpc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libmpdclient2
The following NEW packages will be installed:
libmpdclient2 mpc
0 upgraded, 2 newly installed, 0 to remove and 78 not upgraded.
Need to get 58.7 kB of archives.
After this operation, 189 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main libmpdclient2 armhf 2.3-1 [26.4 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main mpc armhf 0.22-1 [32.2 kB]
Fetched 58.7 kB in 8s (7219 B/s)
Selecting previously unselected package libmpdclient2.
dpkg: warning: files list file for package 'libxau6:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libssh2-1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'liblockfile1:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libkrb5-3:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libwrap0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libtagc0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libcap2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libglib2.0-0:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libgphoto2-port0:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libpng12-0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libtalloc2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libevent-2.0-5:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libedit2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libldap-2.4-2:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libavahi-client3:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libgphoto2-2:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libtag1c2a:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'liblua5.1-0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libpkcs11-helper1:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libpcre3:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libavahi-common3:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libsensors4:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libx11-6:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libnfsidmap2:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libbsd0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libavahi-common-data:armhf' missing; assuming
package has no files currently installed
dpkg: warning: files list file for package 'libjpeg8:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libsasl2-2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libcurl3:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libtirpc1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libkrb5support0:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'librtmp0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libpcap0.8:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libdevmapper1.02.1:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libexpat1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libltdl7:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libkeyutils1:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libreadline5:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libantlr3c-3.2-0:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libasound2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libxcb1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libtdb1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libxpm4:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libtag1-vanilla:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'liblzo2-2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libogg0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libfontconfig1:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libmagic1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libk5crypto3:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libgssglue1:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libunistring0:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libwbclient0:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libfuse2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libgssapi-krb5-2:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libparted0debian1:armhf' missing; assuming package
has no files currently installed
dpkg: warning: files list file for package 'libgd2-xpm:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libconfuse0:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libexif12:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libffi5:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libflac8:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libdbus-1-3:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libxml2:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libfreetype6:armhf' missing; assuming package has
no files currently installed
dpkg: warning: files list file for package 'libxdmcp6:armhf' missing; assuming package has no
files currently installed
dpkg: warning: files list file for package 'libpam-cap:armhf' missing; assuming package has no
files currently installed
(Reading database ... 25076 files and directories currently installed.)
Unpacking libmpdclient2 (from .../libmpdclient2_2.3-1_armhf.deb) ...
Selecting previously unselected package mpc.
Unpacking mpc (from .../archives/mpc_0.22-1_armhf.deb) ...
Processing triggers for man-db ...
Setting up libmpdclient2 (2.3-1) ...
Setting up mpc (0.22-1) ...
Processing triggers for libc-bin ...
WDMyCloud:~#
위와 같이 설치가 진행됩니다.
7. NCMPC 설치하기
SSH를 통해서 좀 더 수월하게 음악재생을 조절할 수 있는 패키지입니다.
apt-get install ncmpc
위 명령어로 설치합니다.
WDMyCloud:~# apt-get install ncmpc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
liblircclient0
Suggested packages:
lirc ncmpc-lyrics
The following NEW packages will be installed:
liblircclient0 ncmpc
0 upgraded, 2 newly installed, 0 to remove and 78 not upgraded.
Need to get 176 kB of archives.
After this operation, 646 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main liblircclient0 armhf 0.9.0~pre1-1 [34.3 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main ncmpc armhf 0.17-1 [142 kB]
Fetched 176 kB in 8s (21.4 kB/s)
Selecting previously unselected package liblircclient0.
.
.
.
.
.
files currently installed
(Reading database ... 25201 files and directories currently installed.)
Unpacking liblircclient0 (from .../liblircclient0_0.9.0~pre1-1_armhf.deb) ...
Selecting previously unselected package ncmpc.
Unpacking ncmpc (from .../ncmpc_0.17-1_armhf.deb) ...
Processing triggers for man-db ...
Setting up liblircclient0 (0.9.0~pre1-1) ...
Setting up ncmpc (0.17-1) ...
Processing triggers for libc-bin ...
WDMyCloud:~#
위와 같이 설치가 진행됩니다.
FTP를 통해서 음악을 넣고
mpc update
위 명령어로 리스트 업데이트를 진행합니다.
WDMyCloud:/lib/modules/3.2.26/kernel# mpc update
red.mp3
[paused] #1/1 0:27/1:01 (44%)
Updating DB (#2) ...
volume:100% repeat: off random: off single: off consume: off
WDMyCloud:/lib/modules/3.2.26/kernel#
위와 같이 위와 같이 DB를 업데이트할 수 있습니다.
ncmpc 사용 방법은 콤타강좌를 참조하세요.
위 링크의 중간부터 보시면 됩니다.
8. 윈도우 프로그램 및 안드로이드 앱 소개
외부에서 접속하려면 6600포트를 포트포워딩 하면 됩니다.
DDNS 및 포트포워딩만 된다면 전세계 어디서든 마이클라우드의 음악을 제어할 수 있습니다.
위에 소개되어 있는 프로그램 말고도 칸타타 라는 것도 좋네요. ㅎㅎ
https://code.google.com/p/cantata/downloads/list
위 링크에서 제일 위에 있는 Setup.exe 파일을 받아서 설치합니다. (2014/02/04 현재 Cantata-1.2.2-Setup.exe)
위와 같이 설치 후 사용하면 됩니다.
9. 태그 관리 방법
태그 관리 방법에 있는 파이선 테스트해봤습니다.
apt-get install python
위 명령어로 파이선을 설치합니다.
WDMyCloud:~# apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
python-minimal
Suggested packages:
python-doc python-tk
The following packages will be upgraded:
python python-minimal
2 upgraded, 0 newly installed, 0 to remove and 76 not upgraded.
Need to get 223 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp.us.debian.org/debian/ wheezy/main python all 2.7.3-4+deb7u1 [181 kB]
Get:2 http://ftp.us.debian.org/debian/ wheezy/main python-minimal all 2.7.3-4+deb7u1 [42.8 kB]
Fetched 223 kB in 6s (35.1 kB/s)
.
.
.
.
files currently installed
(Reading database ... 25246 files and directories currently installed.)
Preparing to replace python 2.7.3-3 (using .../python_2.7.3-4+deb7u1_all.deb) ...
Unpacking replacement python ...
Preparing to replace python-minimal 2.7.3-3 (using .../python-minimal_2.7.3-4+deb7u1_all.deb)
...
Unpacking replacement python-minimal ...
Processing triggers for man-db ...
Setting up python-minimal (2.7.3-4+deb7u1) ...
Setting up python (2.7.3-4+deb7u1) ...
WDMyCloud:~#
위와 같이 설치됩니다.
cd /DataVolume
위 명령어로 클라이언트가 설치될 폴더로 이동합니다.
wget http://client175.googlecode.com/files/client175_0.7.tar.gz
위 명령어로 클라이언트를 다운 받습니다.
WDMyCloud:/DataVolume# wget http://client175.googlecode.com/files/client175_0.7.tar.gz
--2014-02-04 23:18:00-- http://client175.googlecode.com/files/client175_0.7.tar.gz
Resolving client175.googlecode.com (client175.googlecode.com)... 173.194.72.82,
2404:6800:4008:c01::52
Connecting to client175.googlecode.com (client175.googlecode.com)|173.194.72.82|:80...
connected.
HTTP request sent, awaiting response... 200 OK
Length: 2460338 (2.3M) [application/x-gzip]
Saving to: `client175_0.7.tar.gz'
100%[======================================>] 2,460,338 866K/s in 2.8s
2014-02-04 23:18:03 (866 KB/s) - `client175_0.7.tar.gz' saved [2460338/2460338]
WDMyCloud:/DataVolume#
위와 같이 받아집니다.
tar xvfz client175_0.7.tar.gz
위 명령어로 압축을 풉니다.
rm -rf client175_0.7.tar.gz
위 명령어로 압축파일을 제거합니다.
chmod -R 755 /DataVolume/client175
위 명령어로 권한을 줍니다.
nohup python /DataVolume/client175/server.py &
위 명령어로 파이선 작동이 계속 됩니다.
엔터를 치면 명령줄로 다시 내려옵니다.
재부팅하거나 끄면 파이선이 정지됩니다.
이제 인터넷 브라우저에서
http://내부IP:8080 을 입력하면
위와 같이 원격제어 가능합니다.
DDNS와 포트포워딩(외부포트8080) 설정하면 외부에서도 접속 가능하겠죠 ㅎㅎ
10. CPU 점유율
위와 같이 대략 15~25% 정도 점유합니다.
상당히 안정적으로 운용이 되네요. ㅎㅎ
이상 MPD 설치 강좌를 마치겠습니다.
-
등록일 2016.01.23
-
등록일 2015.12.23WD My Cloud 시놀로지OS 사용기댓글 102
-
등록일 2014.10.07
-
등록일 2014.10.06
관련자료
-
서명우성짱의 NAS를 운영하고 있습니다.
저의 즐거움이 여러분의 즐거움이면 좋겠습니다.