在 Home Assistant 的 Music Assistant 中播放 Google Drive 里的 MP3 文件
MP3s from Google Drive in Music Assistant on Home Assistant

原始链接: https://blog.tomayac.com/2026/05/30/your-mp3s-from-google-drive-in-music-assistant-on-home-assistant/

本指南说明了如何将存储在 Google Drive 上的旧版 MP3 合集整合到 Home Assistant 的 Music Assistant 应用中。 该过程包含三个主要步骤: 1. **配置 rclone**:在电脑上使用 rclone 完成 Google Drive 的身份验证,然后将生成的 `rclone.conf` 文件复制到 Home Assistant 的 `/config/rclone/` 目录下。 2. **启用 WebDAV**:在 Home Assistant 中安装“Advanced SSH & Web Terminal”插件。将 rclone 添加到软件包列表,并配置 `init_commands` 以运行 `rclone serve webdav`。这将创建一个端口为 8080 的本地服务器,使您的 Google Drive 文件可以通过 WebDAV 协议访问。 3. **连接至 Music Assistant**:打开 Music Assistant 应用,选择“WebDAV Provider”作为音乐来源,并将其连接到 `http://127.0.0.1:8080/google_music`。 配置完成后,您整个云端 MP3 合集将直接显示在 Music Assistant 中,让您可以轻松地将怀旧音乐库与现代流媒体服务一同欣赏。

最近 Hacker News 上的一篇关于通过 Home Assistant 的 Music Assistant 播放存储在 Google Drive 中 MP3 文件的指南,引发了社区的广泛关注。 尽管该指南提供了一种利用云存储进行本地音乐流媒体播放的方法,但评论者警告称,在 Google Drive 上托管 MP3 文件如果被标记为侵犯版权,可能会导致账户被封禁。用户强烈建议不要这样做,并认为使用 NAS 或专用媒体服务器等本地存储方案会更安全、更可靠。 部分参与者讨论了 Google 大容量存储层在合法创作工作中的用途,而另一些人则讨论了云备份加密的必要性。最终,舆论一致认为,相比依赖公共云服务商来存放个人音乐收藏,自建托管方案或诸如 “copyparty” 之类的专用媒体服务器更为理想。此外,还有人指出该指南的作者本人就是 Google 员工,这让关于 Google 严苛内容政策的讨论平添了一丝讽刺意味。
相关文章

原文

Like most millennials, I grew up with Napster, then Kazaa, then eDonkey2000, obviously CD rips, and of course LAN parties. Over the years, this has led to a large collection of completely legal MP3 files that I have backed up on two large external USB spinning disks that haven't spun for a long time now, but the files also exist on Google Drive.

I'm also heavily invested in the Home Assistant ecosystem, which lets you install a full-featured music player app called Music Assistant.

My Home Assistant dashboard.

These days, of course I pay for my music (we have the YouTube Music family plan), but I recently thought it'd be fun to revive my old MP3 collection. This blog post describes how to connect Google Drive to Music Assistant on Home Assistant.

Create a rclone configuration for Google Drive

The first step is running rclone, a command-line program to manage files on cloud storage. Among many other providers, it supports Google Drive. Download rclone to your regular computer (that is, very likely, not your Home Assistant), and then follow the instructions to configure rclone for Google Drive. This requires you to go through the hell that is Google's Cloud Console, but it's a one-time setup. All you need in the end is a configuration file that you then have to copy over to your Home Assistant. Essentially, you run the configuration wizard, show the configuration file, and then copy its contents.

rclone config
rclone config show

It should look something like the following snippet, but of course with your own client ID, client secret, and token:

[drive]
type = drive
client_id = *.apps.googleusercontent.com
client_secret = *-*
scope = drive
token = {"access_token":"*","token_type":"Bearer","refresh_token":"*","expiry":"*","expires_in":3599}
team_drive = 

In Home Assistant, use the File editor addon (app) and create a file called rclone.conf in the config/rclone directory. Paste the contents of your rclone configuration file into it and save it.

The rclone configuration file in the Home Assistant File editor.

Set up rclone in Home Assistant

Now that you have the rclone configuration file in place, you need to set up rclone to serve your Google Drive as a WebDAV server. Install the Advanced SSH & Web Terminal app in Home Assistant. Open its Configuration tab and where it says Options, click the three dot menu and select Edit in YAML. Add the following configuration to it, which will install rclone and then start a WebDAV server on port 8080 that serves your Google Drive. This will be run automatically each time you start Home Assistant.

ssh:
  username: hassio
  password: passw0rd 
  authorized_keys: []
  sftp: false
  compatibility_mode: false
  allow_agent_forwarding: false
  allow_remote_port_forwarding: true
  allow_tcp_forwarding: false
zsh: true
share_sessions: false
packages:
  - rclone
init_commands:
  - >-
    rclone serve webdav drive: --addr :8080 --baseurl /google_music --config
    /config/rclone/rclone.conf --vfs-cache-mode full &

The Advanced SSH & Web Terminal configuration in Home Assistant.

Connect Music Assistant to the rclone WebDAV server

Finally, all you need to do is install Music Assistant and connect it to the WebDAV server that rclone is running. In Home Assistant, open the Music Assistant app and go to the Settings section. Click the Music sources button to add a new integration, and select WebDAV Provider from the list. Add http://127.0.0.1:8080/google_music as the WebDAV URL, and enter your username and password.

Adding a WebDAV music source in Music Assistant

Press play

If all went well, you should now see your Google Drive music collection in Music Assistant and can browse it. Some will be embarrassing, some will have aged poorly, and some will bring back fond memories and be timeless. Enjoy the nostalgia!

A song playing in Music Assistant.

A personal note

If you like this blog post, please consider sharing it. Let's keep personal blogging alive! This post was hand-written by me with love and a cup of coffee, weird non-native English and all, hitting Esc a thousand times to keep the AI assistance away. If the post helped you, I always appreciate it if you let me know.

联系我们 contact @ memedata.com