This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Amarok 2 script to get path to file

Tags: None
(comma "," separated)
knicefire
Registered Member
Posts
5
Karma
0

Amarok 2 script to get path to file

Fri Sep 19, 2008 10:24 am
Hi!

Old version of Amarok use DCOP and

dcop amarok player path 


give a path to file now played

how I can get it for Amarok 2 with d-bus

Sorry for my english

Last edited by knicefire on Fri Sep 19, 2008 11:56 am, edited 1 time in total.
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS
Amarok 2 implements the MPRIS D-Bus standard. See here:

http://mpris.org/


--
Mark Kretschmann - Amarok Developer
knicefire
Registered Member
Posts
5
Karma
0
Thanks for answer but I can't get it.
I can't find any function for use in my script.
Mabe imposible use one line command to get path to file now played.

Can you help me please?

:rolleyes:
kk7
Registered Member
Posts
6
Karma
0
Code: Select all
var currentSongPath = Amarok.Engine.currentTrack().path;


...yeah its late. but there will be other guys (like me) who will spend some hours to figure this out.  :biggrin:
knicefire
Registered Member
Posts
5
Karma
0
Thanks, but I no get solution on your answer.
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS


--
Mark Kretschmann - Amarok Developer
knicefire
Registered Member
Posts
5
Karma
0
Thank you all,
But I'm not programer. I no need learn some programing language to get some simple do.

XMMS2 - it's better solution for me.

P.S. I need one string solution for simpe script on bash.
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
In bash  qdbus org.mpris.amarok /Player org.freedesktop.MediaPlayer.GetMetadata will give you informations on the track playing including the location
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
Admittedly MPRIS is a pretty bare API. :)


Amarok Developer
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
As far as I'm concerned I think it should be a good idea to provide a method that return the location in a format that could be used directly in bash without having to convert filenames by replacing special chars (like %20 for a space, etc).
I mean if i want to retrieve filename for track at position "$i" in the Tracklist I have to do :
Code: Select all
 qdbus org.kde.amarok  /TrackList org.freedesktop.MediaPlayer.GetMetadata $i|grep location|cut -d " " -f2-|cut -d "/" -f3-| ruby -ruri -p -e '$_=URI.decode$_'


It's a little bit long for a filename :D
User avatar
Alanceil
Registered Member
Posts
160
Karma
0
OS
Yes, this problem was in Amarok 1, until a non-urlencoded path was added to the dcop calls. So it would be nice if a 'qdbus org.kde.amarok /TrackList GetCurrentPath' call could be added, which would return a non-urlencoded path. Grepping for 'location:' doesn't seem like a good solution :|
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS
Alanceil wrote:Yes, this problem was in Amarok 1, until a non-urlencoded path was added to the dcop calls. So it would be nice if a 'qdbus org.kde.amarok /TrackList GetCurrentPath' call could be added, which would return a non-urlencoded path. Grepping for 'location:' doesn't seem like a good solution :|


Sounds like a sane idea to me. We should probably add it then (hopefully we won't forget).


--
Mark Kretschmann - Amarok Developer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
Maybe we could just bundle a mpris CLI client for people who want to do some basic stuff in bash. MPRIS is pretty bare if you use qdbus, but really it has all the information that you'd need for playlist and player operations.


Amarok Developer
knicefire
Registered Member
Posts
5
Karma
0
gaillou wrote:As far as I'm concerned I think it should be a good idea to provide a method that return the location in a format that could be used directly in bash without having to convert filenames by replacing special chars (like %20 for a space, etc).
I mean if i want to retrieve filename for track at position "$i" in the Tracklist I have to do :
Code: Select all
 qdbus org.kde.amarok  /TrackList org.freedesktop.MediaPlayer.GetMetadata $i|grep location|cut -d " " -f2-|cut -d "/" -f3-| ruby -ruri -p -e '$_=URI.decode$_'


It's a little bit long for a filename :D

Thank you!!! It works!!


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]