『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 10364|回复: 7

[基础教程] Hassbian 0.59.2 安装mopity 填坑

[复制链接]

9

主题

164

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
发表于 2017-12-10 14:25:56 | 显示全部楼层 |阅读模式
本帖最后由 smc326 于 2017-12-10 15:47 编辑

参考https://bbs.hassbian.com/thread-1597-1-1.html   命令各种不好用,只好自己研究官网

一、由于mopidy需要python2.7的pip,先安装依赖包
sudo apt-get install build-essential python-dev python-pip
二、安装多媒体框架
sudo apt-get install python-gst-1.0 \
    gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 \
    gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly \
    gstreamer1.0-tools
三、安装最新的mopidy
sudo pip install -U mopidy
四、安装Moped网页插件
sudo pip install Mopidy-Moped
五、安装SQLite数据库插件,速度可能快点,做个音乐分类什么的
sudo pip install Mopidy-Local-SQLite

六、运行一下mopidy,以便生成配置文件

mopidy

七、编辑配置文件/home/pi/.config/mopidy/mopidy.conf
sudo nano ~/.config/mopidy/mopidy.conf
修改以下有的内容
[audio]
mixer = software
mixer_volume =
output = autoaudiosink
buffer_time =

[proxy]
#scheme =
#hostname =
#port =
#username =
#password =

[mpd]
enabled = true
hostname = 192.168.1.40
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 = 192.168.1.40
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 = /home/homeassistant/.homeassistant/www/playlist

[local]
enabled = true
library = json
media_dir = /media
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions =
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

添加以下内容在配置文件最后方
[local-sqlite]
enabled = true

# top-level directories for browsing, as <name> <uri>
directories =
    Albums                  local:directory?type=album
    Artists                 local:directory?type=artist
    Composers               local:directory?type=artist&role=composer
    Genres                  local:directory?type=genre
    Performers              local:directory?type=artist&role=performer
    Release Years           local:directory?type=date&format=%25Y
    Tracks                  local:directory?type=track
    Last Week's Updates     local:directory?max-age=604800
    Last Month's Updates    local:directory?max-age=2592000

# database connection timeout in seconds
timeout = 10

# whether to use an album's musicbrainz_id for generating its URI
use_album_mbid_uri = true

# whether to use an artist's musicbrainz_id for generating its URI;
# disabled by default, since some taggers do not handle this well for
# multi-artist tracks [[url=https://github.com/sampsyo/beets/issues/907]https://github.com/sampsyo/beets/issues/907[/url]]
use_artist_mbid_uri = false
directories =
    Albums                  local:directory?type=album
    Artists                 local:directory?type=artist
    Composers               local:directory?type=artist&role=composer
    Genres                  local:directory?type=genre
    Performers              local:directory?type=artist&role=performer
    Release Years           local:directory?type=date&format=%25Y
    Tracks                  local:directory?type=track
    Last Week's Updates     local:directory?max-age=604800
    Last Month's Updates    local:directory?max-age=2592000

# database connection timeout in seconds
timeout = 10

# whether to use an album's musicbrainz_id for generating its URI
use_album_mbid_uri = true

# whether to use an artist's musicbrainz_id for generating its URI;
# disabled by default, since some taggers do not handle this well for
# multi-artist tracks [[url=https://github.com/sampsyo/beets/issues/907]https://github.com/sampsyo/beets/issues/907[/url]]
use_artist_mbid_uri = false

# whether to use the sortname field for sorting artist browse results;
# set to false to sort according to displayed name only
use_artist_sortname = true

八、运行下mopidymopidy
mopidy.png
注意有没有错误,安装的两个插件是否启动
九、设置自启动
确定mopidy安装位置
which mopidy
我的在/usr/local/bin/mopidy
sudo nano /etc/systemd/system/mopidy-mpd.service
[Unit]
Description=Mopidy music server
After=avahi-daemon.service
After=dbus.service
After=network.target
After=nss-lookup.target
After=pulseaudio.service
After=remote-fs.target
After=sound.target

[Service]
Type=simple
User=pi
ExecStart=/usr/local/bin/mopidy --config /home/pi/.config/mopidy/mopidy.conf

[Install]
WantedBy=multi-user.target

建立启动链接
sudo systemctl daemon-reload
sudo systemctl enable mopidy-mpd.service
sudo systemctl start mopidy-mpd.service
sudo systemctl status mopidy-mpd.service     //查看下启动状态


完成.png
十、重启完成  


https://docs.mopidy.com/en/latest/ext/web/
安装其他需要的插件请到上面官网说明查询,安装需加sudo



评分

参与人数 1金钱 +12 收起 理由
lidicn + 12 填坑,辛苦了!

查看全部评分

回复

使用道具 举报

219

主题

1287

帖子

7945

积分

超级版主

Rank: 8Rank: 8

积分
7945
金钱
6628
HASS币
86

教程狂人论坛风云人物突出贡献

发表于 2017-12-14 19:44:50 | 显示全部楼层
其实是有两个版本的mopidy
一个是pip安装
一个是apt-get安装的
回复

使用道具 举报

30

主题

997

帖子

4151

积分

论坛元老

Rank: 8Rank: 8

积分
4151
金钱
3149
HASS币
0

活跃会员

发表于 2017-12-14 21:53:57 | 显示全部楼层
感谢分享!!
回复

使用道具 举报

9

主题

164

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
 楼主| 发表于 2017-12-17 12:21:53 | 显示全部楼层
lidicn 发表于 2017-12-14 19:44
其实是有两个版本的mopidy
一个是pip安装
一个是apt-get安装的

恩   apt之前安装有问题~~
回复

使用道具 举报

5

主题

119

帖子

476

积分

中级会员

Rank: 3Rank: 3

积分
476
金钱
356
HASS币
0
发表于 2018-9-19 10:31:54 | 显示全部楼层
感谢分享!
回复

使用道具 举报

9

主题

164

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
 楼主| 发表于 2018-9-23 10:39:55 | 显示全部楼层

客气  能帮助到你就好
回复

使用道具 举报

5

主题

119

帖子

476

积分

中级会员

Rank: 3Rank: 3

积分
476
金钱
356
HASS币
0
发表于 2018-9-25 08:49:48 | 显示全部楼层
smc326 发表于 2018-9-23 10:39
客气  能帮助到你就好

安装全部没问题,就是在播放本地音乐的时候根本不出声音,只有很刺耳的声音,用vlc作tts 又是有声音的正常的。,不知道是我哪里配置有问题。
回复

使用道具 举报

9

主题

164

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
 楼主| 发表于 2018-9-27 19:45:16 | 显示全部楼层
yangyi2587758 发表于 2018-9-25 08:49
安装全部没问题,就是在播放本地音乐的时候根本不出声音,只有很刺耳的声音,用vlc作tts 又是有声音的正 ...

不晓得 找找哪里有错误吧   或者现在版本安装这个不知道有没有问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-25 00:22 , Processed in 0.140230 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表