Dev query : To get the path of the current track playing from ratingValueChanged()

Matěj Laitl matej at laitl.cz
Sun Mar 4 16:44:42 UTC 2012


On 4. 3. 2012 Phalgun Guduthur wrote:
> Hello 
> 
> I'm trying to write a patch along my GSoC proposal ( I have already mailed
> in the first rough draft, please review it if possible, any feedback is
> welcome! ).
> 
> What I'm trying to do is, when a user changes the rating of a song, the song
> resource's nao:rating should be updated along with the normal id3 tag
> updation carried out by Amarok.
> 
> The slot for this is in src/playlist/view/listview/InlineEditorWidget.cpp
> which calls the function ratingValueChanged. (line 159 and 270)
> 
> But I'm stuck on getting the path of the current track whose rating is being
> modified.  I tried using Playlist::Item::track()
> But it didn't work. The ratingWidget disappeared after this.

I suggest you hook in a completely different place. Tracks from what collection 
do you want to watch? If it is SqlCollection, I suggest you hook in 
SqlTrack::setRating(). For tracks not in any collection there is 
MetaFile::Track.

If you need to watch tracks from various collections, you could become their 
observer by implementing Meta::Observer, but that would be inefficient to watch 
entire collections etc. Also, some tracks are not file-based (MTP collection), 
some could be remote..

Regards,
			Matěj


More information about the Amarok-devel mailing list