跳至主内容
非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

安装 Mopidy 扩展

Mopidy Jellyfin 扩展可通过 pip 从 PyPi 安装。

通用安装​

对于工作站或笔记本电脑等通用计算机,建议以用户模式安装 Mopidy 扩展。使用 sudo 或 root 权限通过 pip 安装 Python 包可能导致未来与系统包管理器发生冲突。

  1. 使用您选择的方法安装 Mopidy(参考官方文档)

  2. 安装 Mopidy 的 Jellyfin 扩展:

    pip3 install --user mopidy-jellyfin
  3. (可选)安装其他 Mopidy 相关包:

    pip3 install --user mopidy-mpd mopidy-musicbox-webclient
  4. 配置你的 mopidy.conf 文件,该文件位于 $HOME/.config/mopidy/mopidy.conf 参见配置文件

  5. 如果系统中尚未安装,可能需要额外安装 gstreamer 编解码器,具体取决于硬件和发行版

  6. 在终端运行 mopidy 启动程序

  7. 参见使用指南

树莓派(远程控制音箱)​

利用树莓派(或其他小型计算机),可通过 Mopidy 构建连接至 Jellyfin 服务器的独立智能音箱系统。

  1. 获取最新版 raspbian 镜像。若无 GUI 需求,'Lite' 版本足以满足本项目

  2. 将镜像写入 SD 卡(参考官方文档)

  3. 从其 apt 仓库安装 Mopidy 以确保获取最新版本

  4. 安装必要的系统包:

    sudo apt install mopidy mopidy-mpd gstreamer1.0-plugins-bad python3-pip
  5. 安装 Jellyfin 扩展及其他所需 Mopidy 相关包:

    sudo pip3 install mopidy-jellyfin mopidy-musicbox-webclient
  6. 配置位于 /etc/mopidy/mopidy.conf 的 mopidy.conf 文件: 参见配置文件

  7. 启用并启动 mopidy 服务:

    sudo systemctl enable --now mopidy
  8. 参见使用指南

配置文件​

Mopidy 配置文件采用 INI 格式分区。以下展示 Jellyfin 的配置示例。

[jellyfin]
hostname = Jellyfin server hostname
username = username
password = password
libraries = Library1, Library2 (Optional: will default to "Music" if left undefined)
albumartistsort = False (Optional: will default to True if left undefined)
album_format = {ProductionYear} - {Name} (Optional: will default to "{Name}" if left undefined)
  • libraries 决定填充到 Mopidy 内部库(按艺术家/专辑等查看)的内容。使用文件浏览器将显示 Jellyfin 服务器中的所有音乐或书籍库

  • albumartistsort 控制媒体库按"艺术家"还是"专辑艺术家"元数据填充

  • album_format 用于更改文件浏览器视图中音乐专辑的显示格式。当前实际可用的字段仅为 ProductionYear 和 Name

其他可能有用的选项包括:

[mpd]
enabled = true
# Useful if you want to control this instance from a remote MPD client
hostname = 0.0.0.0
port = 6600
# This will help avoid timeout errors for artists or folders with large amounts of files
connection_timeout = 300

# Used in the event you want to control this system from a web browser
[http]
hostname = 0.0.0.0
port = 6680

请注意,Mopidy 对开放端口不提供任何安全措施,因此如果您在公共场所运行此服务,可能需要将 0.0.0.0 改为 127.0.0.1,以防止他人劫持您的收听会话。

使用方法​

Mopidy 运行后,您可以使用选择的客户端连接并控制它。MPD 客户端默认使用端口 6600 进行连接。经过测试的 MPD 客户端包括 ncmpcpp 和 M.A.L.P。Web 客户端可以通过 http://localhost:6680 访问,如果是远程系统,则使用 http://$IP_ADDRESS:6680。

升级​

当新版本的 Mopidy Jellyfin 发布时,您可以通过 pip 使用 --upgrade 标志进行升级。

pip3 install --user --upgrade mopidy-jellyfin