TrimTunes 0.1.0 - Trình phát Spotify Connect cho TrimUI Smart Pro S
                 Spotify Connect player for TrimUI Smart Pro S
Live Drift Studio - 2026-10-13 - bản thử (beta), cần cài đặt thủ công

================================ TIENG VIET ================================

TrimTunes biến TrimUI Smart Pro S thành một loa Spotify Connect có màn hình:
chọn máy từ app Spotify trên điện thoại, rồi điều khiển ngay trên máy. Nhạc vẫn
chạy khi thoát về menu, tự dừng khi vào game và phát tiếp khi thoát game. Có thẻ
"Đang phát" trong bảng HOME của máy, chọn loa / tai nghe / DAC USB, hẹn giờ tắt,
giao diện tiếng Việt và tiếng Anh.

YÊU CẦU
- Máy TrimUI Smart Pro S chạy hệ điều hành gốc (StockOS / Trimui UI), có WiFi.
- Tài khoản Spotify Premium.
- Spotify Soloist (trình phát chính thức không giao diện của Spotify). Spotify
  KHÔNG cho phép phát hành lại Soloist nên gói này không kèm; bạn tự tải và
  tự tạo API key (miễn phí) bằng tài khoản Spotify của mình. Mỗi bản Soloist
  hết hạn sau 90 ngày, khi đó tải lại bản mới.

CÀI ĐẶT
1. Giải nén, chép cả thư mục "TrimTunes" vào thẻ nhớ: /mnt/SDCARD/Apps/
   (thành /mnt/SDCARD/Apps/TrimTunes/).
2. Cài Soloist vào thư mục TrimTunes/soloist/:
   a. Tải https://soloist-builds.spotifycdn.com/soloist_release_arm64.tar.gz,
      giải nén, chép file "soloist" vào TrimTunes/soloist/soloist.
   b. Soloist cần glibc >= 2.38 (máy chỉ có 2.33): lấy các file .so trong gói
      Debian 13 (trixie) arm64 libc6, libgcc-s1, libatomic1 (packages.debian.org)
      chép vào TrimTunes/soloist/lib/ (phải có lib/ld-linux-aarch64.so.1).
   c. Tải https://curl.se/ca/cacert.pem vào TrimTunes/soloist/cacert.pem.
3. Tạo API key Soloist ở https://developer.spotify.com/dashboard (mục Soloist),
   ghi vào file TrimTunes/cache/soloist_key.txt (chỉ một dòng là key).
   Key là bí mật: đừng chia sẻ thư mục cache/ cho ai.
4. Mở Ứng dụng (Apps) > TrimTunes. Trên điện thoại (cùng WiFi) mở Spotify,
   chọn thiết bị "TrimUI Smart Pro S".
5. Thẻ "Đang phát" trên bảng HOME: lần mở app đầu tiên, TrimTunes thay thẻ
   Music của máy bằng thẻ của mình; có hiệu lực sau khi khởi động lại máy.
   Nếu máy không có bảng HOME này hoặc là bản firmware khác, app tự bỏ qua
   thẻ và vẫn chạy bình thường (ghi một dòng trong daemon.log).
Tab Thư viện / Tìm kiếm cần thêm token Spotify Web API (nâng cao, chưa có
hướng dẫn trong gói này); phát nhạc qua Spotify Connect không cần.

GỠ CÀI ĐẶT
1. Mở TrimTunes > MENU > "Tắt nhạc và thoát" (trả lại nhạc nền menu của máy).
2. Xoá thư mục /mnt/SDCARD/Apps/TrimTunes.
3. Khởi động lại máy: lúc khởi động, TrimTunes tự trả thẻ Music gốc về bảng
   HOME, xoá thẻ của mình và xoá file /mnt/SDCARD/System/starts/trimtunes_widget.sh.
   (Bản sao bảng HOME gốc vẫn còn ở /usr/trimui/osd/osdlayout.json.trimtunes.orig.)
4. Nếu muốn xoá cả phiên đăng nhập Spotify: xoá /mnt/UDISK/trimtunes
   (cần ADB/SSH), hoặc gỡ thiết bị trong tài khoản Spotify.

LƯU Ý
- Ứng dụng KHÔNG chính thức, không liên kết, không được Spotify bảo trợ hay
  chứng nhận. Spotify là nhãn hiệu của Spotify AB. Nội dung nhạc từ Spotify.
- Chỉ dùng cho mục đích cá nhân, tuân thủ Điều khoản sử dụng của Spotify và
  của Soloist. Spotify có thể thay đổi bất cứ lúc nào khiến app ngừng chạy.
- Phần mềm cung cấp "nguyên trạng", không bảo hành; bạn tự chịu rủi ro khi dùng.
  App sửa bảng HOME của máy (/usr/trimui/osd/osdlayout.json) có sao lưu.
- Thông tin đăng nhập và API key chỉ lưu trên máy của bạn.
- Font Be Vietnam Pro theo giấy phép SIL OFL (res/fonts/OFL.txt).

================================= ENGLISH ==================================

TrimTunes turns the TrimUI Smart Pro S into a Spotify Connect speaker with a
screen: pick the device in the Spotify app on your phone, then control it on
the handheld. Music keeps playing after you leave the app, pauses when a game
starts and resumes when you quit the game. Includes a Now Playing card in the
HOME panel, speaker / headphones / USB DAC output, sleep timer, Vietnamese and
English UI.

REQUIREMENTS
- TrimUI Smart Pro S on the stock OS (StockOS / Trimui UI), with WiFi.
- A Spotify Premium account.
- Spotify Soloist (Spotify's official headless player). Spotify does NOT allow
  redistributing Soloist, so it is not included: you download it yourself and
  create a (free) API key with your own Spotify account. Each Soloist build
  expires after 90 days; download a new one then.

INSTALL
1. Unzip and copy the whole "TrimTunes" folder to the SD card at
   /mnt/SDCARD/Apps/ (giving /mnt/SDCARD/Apps/TrimTunes/).
2. Install Soloist into TrimTunes/soloist/:
   a. Download https://soloist-builds.spotifycdn.com/soloist_release_arm64.tar.gz,
      extract it and copy the "soloist" file to TrimTunes/soloist/soloist.
   b. Soloist needs glibc >= 2.38 (the device has 2.33): take the .so files
      from the Debian 13 (trixie) arm64 packages libc6, libgcc-s1, libatomic1
      (packages.debian.org) and copy them to TrimTunes/soloist/lib/
      (lib/ld-linux-aarch64.so.1 must be there).
   c. Download https://curl.se/ca/cacert.pem to TrimTunes/soloist/cacert.pem.
3. Create a Soloist API key at https://developer.spotify.com/dashboard
   (Soloist section) and put it in TrimTunes/cache/soloist_key.txt (one line).
   The key is a secret: never share your cache/ folder.
4. Open Apps > TrimTunes. On your phone (same WiFi) open Spotify and pick the
   device "TrimUI Smart Pro S".
5. HOME panel Now Playing card: on the first app start, TrimTunes replaces the
   device's Music card with its own; it shows after a reboot. If the device
   has no such HOME panel or runs different firmware, the app skips the card
   and works normally (one line in daemon.log).
The Library / Search tabs also need a Spotify Web API token (advanced, not
covered by this package); playback through Spotify Connect does not.

UNINSTALL
1. Open TrimTunes > MENU > "Stop music and exit" (gives the menu music back).
2. Delete /mnt/SDCARD/Apps/TrimTunes.
3. Reboot: at boot TrimTunes puts the stock Music card back in the HOME panel,
   removes its own card and deletes /mnt/SDCARD/System/starts/trimtunes_widget.sh.
   (A copy of the original HOME layout stays at
   /usr/trimui/osd/osdlayout.json.trimtunes.orig.)
4. To also delete the Spotify session: delete /mnt/UDISK/trimtunes (needs
   ADB/SSH), or remove the device from your Spotify account.

NOTES
- UNOFFICIAL app. Not affiliated with, endorsed by or certified by Spotify.
  Spotify is a trademark of Spotify AB. Content provided by Spotify.
- Personal use only; follow the Spotify and Soloist terms. Spotify may change
  at any time and break the app.
- Provided "as is", without warranty; use at your own risk. The app edits the
  device's HOME panel layout (/usr/trimui/osd/osdlayout.json), with a backup.
- Your login and API key stay on your device.
- Be Vietnam Pro font under the SIL OFL (res/fonts/OFL.txt).
