▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/MprisCustomHud
MprisCustomHud

MprisCustomHud

(Linux only) Mpris music info addon for CustomHud and Hudder

Оцените первым
1.4K
4

MprisCustomHud

Important

Description

Variables for CustomHud and Hudder to show currently playing music using the Mpris DBus Spec.
Available for all versions CustomHud v4 is available for!
Works with Hudder 8.x, 9.x on version 1.21.9/10 and 10.x for version 1.21.11/26.1.x
It is heavily inspired by Hudify, so thank you for your work Lightningtow ig :)

Note

  • Not all variables have to be/will be populated by the player/music application

General Variables

NameTypeDescription
mpris_busnameStringbusname
mpris_trackStringtrack name
mpris_trackidStringthe unique mpris track id (mostly for debugging)
mpris_albumStringname of the album the track is from
mpris_repeatStringrepeat status - "None", "Track" or "Playlist"
mpris_artistStringname of the first artist coming from mpris
mpris_nameStringthe pretty player name from the Identity attribute of org.mpris.MediaPlayer2
mpris_lyricsStringxesam:asText
mpris_created_atStringxesam:contentCreated
mpris_first_playedStringxesam:firstUsed
mpris_last_playedStringxesam:lastUsed
mpris_art_urlStringxesam:artUrl
mpris_urlStringxesam:url
mpris_shuffleBooleanwether shuffle is on
mpris_playingBooleanwether the song is playing or paused/stopped
mpris_existsBooleanwether the song is playing or paused/stopped
mpris_has_album_artBooleanwether the track has an album art/it is loaded
mpris_data_ageNumberthe age of the metadata information (track, trackid, album, artist, artists, duration, ...) in milliseconds
mpris_progressNumberprogress in milliseconds
mpris_durationNumberduration of the track in milliseconds
mpris_rateNumberthe rate/speed the music is playing as floating point number
mpris_volumeNumberthe volume the music is playing at as a floating point number (usually between 0 and 1)
mpris_bpmNumberxesam:audioBPM
mpris_discNumberxesam:discNumber
mpris_numberNumberxesam:trackNumber
mpris_times_playedNumberxesam:useCount
mpris_auto_ratingNumberxesam:autoRating
mpris_user_ratingNumberxesam:userRating
mpris_album_widthNumberthe absolute pixel width of the album art
mpris_album_heightNumberthe absolute pixel height of the album art
mpris_album_colorNumberthe rgb value of the dominant color of the album art
mpris_artistsList of Stringlist of artists for the current player
mpris_album_artistsList of Stringxesam:albumArtist for the current player
mpris_commentsList of Stringxesam:comment for the current player
mpris_composersList of Stringxesam:composer for the current player
mpris_genresList of Stringxesam:genre for the current player
mpris_lyricistsList of Stringxesam:lyricist for the current player

CustomHud specific things

  • From what I can tell, it is not easily possible to have a list as a field/attribte so here are only the lists for the current player
  • All String variables are either not empty or null
  • Lists have the the first four letters of the variable name after mpris_ as the default prefix (for iteration)
  • PlayerInfo objects have all general variables + mpris_album_art with the mpris_ prefix removed as fields
NameType/UsageDescription
mpris_player{mpris_player:<field>} or {mpris_player:<player>:<field>}exposes the fields of a PlayerInfo Object; player can be the full busname or only the last part
mpris_playersList of PlayerInfo like Objectsjust a list of currently active PlayerInfo Objects (same <fields> as above)
mpris_album_artIcondraws the album art image of the current player to the screen

See https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata for details on the xesam:<name> and mpris:<name> variables.

Hudder specific things

Variables

NameTypeDescription
has_mprisBooleanalways true
mpris_playerObject/PlayerInfothe PlayerInfo object of the currently selected player or null
mpris_playersList<PlayerInfo>a list of currently tracked players

Functions/Methods

NameArgumentsEffect
mpris_playerString namereturns the PlayerInfo object with the bus name org.mpris.MediaPlayer2.<name> or null
mpris_album_artString name or AlbumArt albumArt, int x, int y, int width, int heightdraws the album art image; if the track has no album art, it draws a fallback; if width or height is 0 it will retain the original aspect ratio; if both are 0, it will use the pixel dimensions (way too big lol)

Objects

PlayerInfo:

  • String busname - the busname
  • String name - player name
  • String repeat - repeat status - see mpris_repeat
  • boolean shuffle - shuffle status
  • boolean playing - wether music is playing
  • double rate - the rate the music is playing at
  • double volume - the volume the music is playing at (usually between 0 and 1)
  • Metadata metadata - metadata
  • long progress() - returns the current progress (in ms)

Metadata:

  • String track - current track - xesam:title
  • String trackid - current track id - mpris:trackid
  • String album - current album - xesam:album
  • String artist - first artist
  • String art_url - mpris:artUrl
  • String lyrics - xesam:asText
  • String created_at - xesam:contentCreated
  • String first_played - xesam:firstUsed
  • String last_played - xesam:lastUsed
  • String url - xesam:url
  • List<String> artists - all artists - xesam:artist
  • List<String> album_artists - xesam:albumArtist
  • List<String> comments - xesam:comment
  • List<String> composers - xesam:composer
  • List<String> genres - xesam:genre
  • List<String> lyricists - xesam:lyricist
  • int bpm - xesam:audioBPM
  • int disc - xesam:discNumber
  • int number - xesam:trackNumber
  • int times_played - xesam:useCount
  • float auto_rating - xesam:autoRating
  • float user_rating - xesam:userRating
  • long duration - duration of current track (in ms)
  • AlbumArt album_art - information on the album art
  • long data_age() - returns the age of the object (in ms)

AlbumArt

  • int width - width in pixels
  • int height - height in pixels
  • int color - the rgb value of the dominant color of the album art
  • boolean exists() - wether the object for the real image or the fallback one

Controls

There are keybindings for play/pause, next, previous, refresh and cycle through active players that all have correcsponding commands.

Configuration

By default a player is selected from the active ones. To cycle through the currently active ones, use the mpriscustomhud cycle command (only works onlyPreferred is disabled (default)).
You can choose a player to prefer over others by using mpriscustomhud preferred <player> so that one will always be shown if it's active.
If you don't want to see other players (only the preferred one), you can use mpriscustomhud onlyPreferred true. This will result in no player being selected if you didn't set a preferred one.
With mpriscustomhud player, you get the currently active player, with mpriscustomhud onlyPreferred and mpriscustomhud preferred the values for that and with mpriscustomhud refresh, you can refresh the variables.

Flatpak notice

  • when you're running Minecraft in a Flatpak sandbox, you have to add org.mpris.MediaPlayer2.* to the list of well known session bus names your launcher can talk to e.g. with Flatseal

Problems/Todo

  • currently there is no album art variable; maybe I will try to add it at some point done

Libraries used

  • dbus-java
    • Improved version of java DBus library provided by freedesktop.org https://dbus.freedesktop.org/doc/dbus-java

License

This Mod is licensed under the MIT License

Часто задаваемые вопросы

Совместимость

Minecraft: Java Edition

26.2.x26.1.x1.21.x1.20.x

Платформы

Поддерживаемые окружения

Клиент

Зависимости

Ссылки

Создатели

Детали

Лицензия:
Опубликован:8 месяцев назад
Обновлён:1 месяц назад
Главная