SnapCast-Mopidy實現(xiàn)多房間同步

安裝mopify

首先安裝mopify來當(dāng)做音樂播放器

apt-get install mopidy

pip install Mopidy-Local-SQLite #安裝數(shù)據(jù)庫插件

配置mopify

sudo vi ~/.config/mopidy/mopidy.conf

內(nèi)容都統(tǒng)一修改為:

[m3u]

playlists_dir = /var/lib/mopidy/playlists

[core]

cache_dir = /var/cache/mopidy

config_dir = /etc/mopidy

data_dir = /var/lib/mopidy

max_tracklist_length = 10000

restore_state = false

[logging]

color = true

console_format = %(levelname)-8s %(message)s

debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s

debug_file = /var/log/mopidy/mopidy-debug.log

config_file = /etc/mopidy/logging.conf

[audio]

mixer = software

mixer_volume =

#output = autoaudiosink

output = audioresample ! audio/x-raw,rate=48000,channels=2,format=S16LE ! audioconvert ! wavenc ! filesink location=/tmp/snapfifo? #輸出音頻到snapserver

buffer_time =

[proxy]

scheme =

hostname =

port =

username =

password =

[mpd]

enabled = true

hostname = ::

port = 6600

password =

max_connections = 20

connection_timeout = 60

zeroconf = Mopidy MPD server on $hostname

command_blacklist =

? listall

? listallinfo

default_playlist_scheme = m3u

[http]

enabled = true

hostname = ::

port = 6680

static_dir =

zeroconf = Mopidy HTTP server on $hostname

[stream]

enabled = true

protocols =

? http

? https

? mms

? rtmp

? rtmps

? rtsp

metadata_blacklist =

timeout = 5000

[m3u]

enabled = true

base_dir =

default_encoding = latin-1

default_extension = .m3u8

playlists_dir = /var/lib/mopidy/playlists

[softwaremixer]

enabled = true

[file]

enabled = true

media_dirs =

? $XDG_MUSIC_DIR|Music

? ~/|Home

excluded_file_extensions =

? .jpg

? .jpeg

show_dotfiles = false

follow_symlinks = false

metadata_timeout = 1000

[local]

enabled = true

#library = json

library = sqlite? #安裝Mopidy-Local-SQLite后使用此配置,會把樂庫的歌曲索引成數(shù)據(jù)庫,讀寫速度更快,掃描后不用重啟程序

#media_dir = /var/lib/mopidy/media

media_dir = /home/Music #根據(jù)自己的文件夾修改

scan_timeout = 1000

scan_flush_threshold = 100

scan_follow_symlinks = false

excluded_file_extensions =

? .directory

? .html

? .jpeg

? .jpg

? .log

? .nfo

? .png

? .txt


確認(rèn)配置文件是否正確:

sudo mopidyctl config

沒問題后直接運(yùn)行掃描程序

sudo mopidyctl local scan

安裝snapcast

sudo apt-get install git

git clone https://github.com/badaix/snapcast.git

$ cd <snapcast dir>/externals

$ git submodule update --init --recursive

$ sudo apt-get install build-essential

$ sudo apt-get install libasound2-dev libvorbisidec-dev libvorbis-dev libflac-dev alsa-utils libavahi-client-dev avahi-daemon


Build Snapclient and Snapserver

cdinto the Snapcast src-root directory:

$ cd <snapcast dir>

$ make

Install Snapclient and/or Snapserver:

$ sudo make installserver

$ sudo make installclient


安裝mopidy-snapcast插件

Installation

To install:

git clone https://github.com/aawsome/mopidy-snapcast.git

sudo pip install .

PyPi distribution is coming soon...

Configuration

The extension is enabled by default.

Snapcast Server

Examples:

Use snapcast group with ID 'abc' of snapcastserver 'snapserver.local' on port 1234:

? ? [audio]

? ? mixer = snapcast

? ? [snapcast]

? ? enabled = true

? ? host = snapserver.local

? ? port = 1234

Use snapcast server on localhost:1705 and automatically detect group from stream connected to output:

? ? [audio]

? ? mixer = snapcast

? ? output = audioresample ! audio/x-raw,rate=48000,channels=2,format=S16LE ! audioconvert ! wavenc ! filesink location=/tmp/snapfifo

(-> Group linked to stream which is connected to /tmp/snapfifo is used!)



安裝完成后重啟電腦 mopidy和snapcast自動啟動

android客戶端

mopidy客戶端https://github.com/gateship-one/malp

snapcast客戶端https://github.com/badaix/snapdroid


參考:

http://docs.mopidy.com/en/latest/audio/

https://github.com/aawsome/mopidy-snapcast

https://github.com/badaix/snapcast

https://github.com/mopidy/mopidy

https://github.com/jxjhheric/homeassistant-with-snapcast

https://www.home-assistant.io/blog/2016/02/18/multi-room-audio-with-snapcast/

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容