-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SetPosition, Position and other mpris properties #10
Open
antlarr
wants to merge
11
commits into
dodo:master
Choose a base branch
from
antlarr:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added support for callbacks when getting values so there's no need to keep a variable updated and so we can provide the current media position throught mpris' Position property Added support for SetPosition so mpris clients can seek freely. Fix media length reporting (which was always nil) by getting the mpris:length value from the duration property. Fill values for the following metadata: xesam:album xesam:albumArtist xesam:artist xesam:trackNumber xesam:genre xesam:lyricist xesam:discNumber mpris:trackid mpris:artUrl xesam:url Note that mpris:trackid has a fixed value (it needs to be a dbus object reference). This value is later provided by the mpris client as the first parameter of SetPosition. Also, in order to find out the full path of the url, we need to find out the current working directory, which requires to add lfs as a dependency. Maybe there's another way to find out the CWD but I don't know so much lua. Also, to show the artUrl, a 'cover.jpg' file has to be available in the same directory as the media. The ideal solution would be to extract the cover from the music file, but again, that's beyond my lua knowledge. This makes KDE Plasma mediacontroller completely usable to control mpv.
Added a MIT license as that's what the original author wanted to have according to the mpris-scm-0.rockspec file
Use mp.utils to get the CWD and to split/join paths instead of lfs and custom code that didn't work with absolute paths for filenames
Also, move static variables to the beginning of the file
This fixes the mpv.lua script to work when everything is installed on the system as it should be.
This way, if a file sets a value for artUrl and the next file in the playlist doesn't have a valid artUrl, it gets initialized to nil instead of keeping the old value
Fix a reference to nil by checking the table to be searched before using it.
When sending the metadata of the file through dbus, the dbus library was making mpv crash because it wasn't accepting invalid utf8 encoded strings. We now remove all invalid characters when setting the metadata that will be sent through dbus which should fix the issue.
The fix in 1281dcd didn't work for some characters, making the function remove valid utf-8 characters. This patch takes a different approach which works better by matching the bytes sequences against valid sequences patterns.
It seems I renamed a table/function and forgot to rename some occurrences.
…perties The media controller applet in Plasma 5.17 now requires those two properties to be set up correctly or otherwise it ignores the mpris client, so we now have to set those variables correctly in order to be useful in Plasma.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added support for callbacks when getting values so there's no need
to keep a variable updated and so we can provide the current media
position throught mpris' Position property
Added support for SetPosition so mpris clients can seek freely.
Fix media length reporting (which was always nil) by getting the
mpris:length value from the duration property.
Fill values for the following metadata:
xesam:album
xesam:albumArtist
xesam:artist
xesam:trackNumber
xesam:genre
xesam:lyricist
xesam:discNumber
mpris:trackid
mpris:artUrl
xesam:url
Note that mpris:trackid has a fixed value (it needs to be a dbus
object reference). This value is later provided by the mpris client
as the first parameter of SetPosition.
Also, in order to find out the full path of the url, we need to find
out the current working directory, which requires to add lfs as a
dependency. Maybe there's another way to find out the CWD but I
don't know so much lua. Also, to show the artUrl, a 'cover.jpg'
file has to be available in the same directory as the media. The ideal
solution would be to extract the cover from the music file, but again,
that's beyond my lua knowledge.
This makes KDE Plasma mediacontroller completely usable to control
mpv.