mpd - music player daemon

Razmjena savjeta i trikova o podešavanju sustava i programa.

Moderator/ica: Moderatori/ce

Odgovori
devil
Postovi: 536
Pridružen/a: 13 ruj 2008, 17:35

mpd - music player daemon

Post Postao/la devil »

mpd dakle:)
dosadno mi je naime pa reko zasto en pomoci ljudima:)
mpd je music player daemon. iliti daemon koji svira:) svira razne muzicke formate ali ne i wma pa pripazite ne to.
stavicu dolje i kod za wma 2 mp3 converter pa neka se ljudi zabavljaju.
mpd sajt i wiki:http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki
dakle daemon se instalira sa apt-get install, yum install ili cim vec. odaberite sami svoj omiljen package manager iako na ububutuu preporucam aptitude zbog rada s dependencijima.
sad kad je daemon isntaliran trenba ga podesiti da radi. updatedb kao root pa locate mpd,conf.example.
vjeorjatno se nalazi u /etc. onda kopirate taj example. sa

Kod: Označi sve

cp /etc/mpd.conf.example /etc/mpd.conf
to sve kao super user ili root jer korisnk nemoze pisati po /etc.
kao super user otvorite /etc/mpd.conf sa omiljenim editorom teksta.
potrebna polja(koja trepa otkomentirat(maknuti # s pocetka reda) su music_directory, playlist_directory, db_file, log_file, error_file, pid_file i state_file.
u music_directori stavite filder gdje vams e nalazi muzika(kod mene je u /home/matija/Music).
playlist_directory stavite isto u /home/USER/Playlists. pa kreiratje taj direktorij sa mkdir ~/Playlists
za db, log, error, pid i state stavite u /home/USER/.mpd. dakle:

Kod: Označi sve

 db_file               "/home/USER/.mpd/db"
 log_file              "/home/USER/.mpd/log"
 error_file            "/home/USER/.mpd/error"
 pid_file              "/home/USER/.mpd/mpd.pid"
 state_file            "/home/USER/.mpd/mpdstate"
pa moramo napraviti .mpd dir i mpd.pid file u njemu. touch ~/.mpd/mpd.pid

sljedeca stvar koju radimo u mpd.conf fajlu je micanje # ispred polja user. user je "mpd"

Kod: Označi sve

bind_to_address polje stavite "127.0.0.1"
port "6600"
log_level                       "default"
default_permissions             "read,add,control,admin"
metadata_to_use                  "artist,album,title,track,name,genre,date,composer,performer,disc"
save i to je to za taj file.

sljedeca stvar je kreiranje databaze za mpd. to moze potrajati ovisno o vasoj muzickoj kolekciji.
dakle u terminal: mpd --create-db
dok zavrsi pokrenete mpd da naredbom:mpd
sad je tezi dio posla obavljen. dodate mpd u daemone koji se podizu sa sustavom. u archu je to da se doda mpd u DAEMON polje u /etc/rc,conf
sljedece je potrebno instalirati player za to. preporucam instaalciju mpc-a koji je klijent za komandnu liniju i sonate(apt-get install sonata) koja ima gui i super je. ako pak zelite melo opsirnije rjesenje instalirajte gmpc/qmpc za gnome/kde.
to bi trebalo biti to. plejer radi na tom priincipu da se(u sonati) duplim klikom dodaje pjesma u media player te ona svira. sonatu mozete kasnije komotno ugasiti bez ikakve bojazni da ce se glazba ugasiti.
ako ugasite sutav dok pjesma svira pjesma ce nataviti svirati prilikom sljedeceg podizanja sutava na mjestu na kojem je stala.
plejer koji ja koristim je ncmpc++ ili ncmpcpp koji je u terminalu i radi odlicno. probajte.
posto sam ljencina uz mpd sam instalirao i keytouch i keytouch-editor kojemu sam reko da pomocu multimaedijskih tipki na tipkovnici regurila mpd.
tu je dobro imati mpc. tako da je play/pause tipka sa akcijom mpc toggle, stop je mpc stop, next je mpc next i previous je mpc prev.
posto ja na racunalu enmam pulseaudio nisam siguran kako ce mpd raditi s njim. radim s alsom i moj mpd.conf izgleda ovako:

Kod: Označi sve

# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.

######################## REQUIRED PATHS ########################
 music_directory       "/home/matija/Music"
 playlist_directory    "/home/matija/Playlists"
 db_file               "/home/matija/.mpd/db"
 log_file              "/home/matija/.mpd/log"
 error_file            "/home/matija/.mpd/error"
 pid_file              "/home/matija/.mpd/mpd.pid"
 state_file            "/home/matija/.mpd/mpdstate"


# music_directory                 "path_to_your_music_collection"
# playlist_directory              "/var/lib/mpd/playlists"
# db_file                         "/var/lib/mpd/mpd.db"
# log_file                        "/var/log/mpd/mpd.log"
# error_file                      "/var/log/mpd/mpd.error"

# Note: ~ is the home directory of user set in the "user" option
################################################################


######################## OPTIONAL PATHS ########################
#
# If you wish to use mpd --kill to stop MPD, then you must
# specify a file here in which to store MPD's process ID.
#
# pid_file                        "~/.mpd/mpd.pid"
# pid_file                        "/var/run/mpd/mpd.pid"
#
# If specified, MPD will save its current state (playlist,
# current song, playing/paused, etc.) at exit.  This will be
# used to restore the session the next time it is run.
#
# state_file                      "~/.mpd/mpdstate"
# state_file                      "/var/lib/mpd/mpdstate"
#
################################################################


######################## DAEMON OPTIONS ########################
#
# If started as root, MPD will drop root privileges and run as
# this user instead.  Otherwise, MPD will run as the user it was
# started by.  If left unspecified, MPD will not drop root
# privileges at all (not recommended).

user                            "mpd"

# The address and port to listen on.
#
bind_to_address                 "127.0.0.1"
#bind_to_address                 "any"
port                            "6600"
#
# Controls the amount of information that is logged.  Can be
# "default", "secure", or "verbose".
#
log_level                       "default"
#
################################################################


########################## PERMISSIONS #########################
#
# MPD can require that users specify a password before using it.
# You may specify one ore more here, along with what users who
# log in with that password are allowed to do.
#
#password                        "password@read,add,control,admin"
#
# Specifies what permissions a user who has not logged in with a
# password has.  By default, all users have full access to MPD
# if no password is specified above, or no access if one or
# more passwords are specified.
#
default_permissions             "read,add,control,admin"
#
################################################################


########################## AUDIO OUTPUT ########################
#
# MPD supports many audio output types, as well as playing
# through multiple audio outputs at the same time.  You can
# specify one or more here.  If you don't specify any, MPD will
# automatically scan for a usable audio output.
#
# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs>
# for examples of other audio outputs.
#
# An example of an ALSA output:
#
audio_output {
        type                    "alsa"
        name                    "Sound Card"
        options                 "dev=dmixer"
        device                  "plug:dmix"
}
#
# An example of an OSS output:
#
#audio_output {
#        type                    "oss"
#        name                    "My OSS Device"
#        device                  "/dev/dsp"   # optional
#        format                  "44100:16:2" # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
#        type                    "shout"
#        name                    "My Shout Stream"
#        host                    "localhost"
#        port                    "8000"
#        mount                   "/mpd.ogg"
#        password                "hackme"
#        quality                 "5.0"
#        bitrate                 "128"
#        format                  "44100:16:1"
#        user                    "source"                # optional
#        description             "My Stream Description" # optional
#        genre                   "jazz"                  # optional
#        public                  "no"                    # optional
#}
#
# Force all decoded audio to be converted to this format before
# being passed to the audio outputs.
#
#audio_output_format             "44100:16:2"
#
################################################################


############################# MIXER ############################
#
# MPD needs to know what mixer settings to change when you
# adjust the volume.  If you don't specify one here, MPD will
# pick one based on which ones it was compiled with support for.
#
# An example for controlling an ALSA mixer:
#
#mixer_type                      "alsa"
#mixer_device                    "default"
#mixer_control                   "PCM"
#
# An example for controlling an OSS mixer:
#
#mixer_type                      "oss"
#mixer_device                    "/dev/mixer"
#mixer_control                   "PCM"
#
# If you want MPD to adjust the volume of audio sent to the
# audio outputs, you can tell it to use the software mixer:
#
#mixer_type                      "software"
#
################################################################


######################### NORMALIZATION ########################
#
# Specifies the type of ReplayGain to use.  Can be "album" or
# "track".  ReplayGain will not be used if not specified.  See
# <http://www.replaygain.org> for more details.
#
#replaygain                      "album"
#
# Sets the pre-amp used for files that have ReplayGain tags.
#
#replaygain_preamp               "0"
#
# Enable on the fly volume normalization.  This will cause the
# volume of all songs played to be adjusted so that they sound
# as though they are of equal loudness.
#
#volume_normalization            "no"
#
################################################################


########################### BUFFERING ##########################
#
# The size of the buffer containing decoded audio.  You probably
# shouldn't change this.
#
#audio_buffer_size               "2048"
#
# How much of the buffer to fill before beginning to play.
#
#buffer_before_play              "0%"
#
# Similar options for the HTTP stream buffer.  If you hear
# skipping while playing HTTP streams, you may wish to increase
# these.
#
#http_buffer_size                "128"
#http_prebuffer_size             "25%"
#
################################################################


########################### HTTP PROXY #########################
#
# Specifies the HTTP proxy to use for playing HTTP streams.
#
#http_proxy_host                 "proxy.isp.com"
#http_proxy_port                 "8080"
#http_proxy_user                 "user"
#http_proxy_password             "password"
#
################################################################


############################# LIMITS ###########################
#
# These are various limits to prevent MPD from using too many
# resources.  You should only change them if they start
# restricting your usage of MPD.
#
#connection_timeout              "60"
#max_connections                 "5"
#max_playlist_length             "16384"
#max_command_list_size           "2048"
#max_output_buffer_size          "8192"
#
################################################################


###################### CHARACTER ENCODINGS #####################
#
# If file or directory names do not display correctly, then you
# may need to change this.  In most cases it should be either
# "ISO-8859-1" or "UTF-8".  You must recreate your database
# after changing this (use mpd --create-db).
#
#filesystem_charset              "ISO-8859-1"
#
# The encoding that ID3v1 tags should be converted from.
#
#id3v1_encoding                  "ISO-8859-1"
#
################################################################


######################### OTHER OPTIONS ########################
#
# The metadata types MPD will recognize.
#
metadata_to_use                  "artist,album,title,track,name,genre,date,composer,performer,disc"
#
# Enable this if you wish to use your MPD created playlists in
# other music players.
#
#save_absolute_paths_in_playlists "no"
#
################################################################
a wma 2 mp3 o kojem sam pisao izgleda ovako:

Kod: Označi sve

#!/bin/bash

current_directory=$( pwd )

#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done

#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done

#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader $i && lame -m s audiodump.wav -o $i; done

#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done

rm audiodump.wav
jedna napomena za skriptu koja pretvara wma u mp3 - ne radi bas najbolje na sviojetu i treba ju malo podesiti, meni je malo usrala fajlove + obrise wma fajl dok ga prekodira u mp3 pa pazite s tim. eto
ako imate neko pitanje tu sam:) samo nemojte pitati kako stavljati daemon u ubuntuu ili fedori jer sam stavrno vec zaboravil


wma2mp3 skriptu snimite kao naprijemer wma2mp3. pa onda dozvolite svim userima da ju izvrse: chmod +x wma2mp3
pa ju kopirate kao usuper user u /usr/bin/
Odgovori