Posts: 81
Joined: Dec 2009
Reputation:
0
2010-01-13, 14:18
Hello,
XBMC's Music views offers several choices, List, Big List, etc. I would like to add a new View that automatically displays Lyrics whenever a song is played.
It appears that this cannot be achieved by modifying the skins, so I presume it can only be done in the code. What I would like to see is (displaying the path would be nice, too):
Music > Singer English > Leonard Cohen > Greatest Hits :
-------------------------------------------------------------------------------------
01. Song 1...xx:yy | Song 3 (playing)
02. Song 2...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
03. Song 3...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
04. Song 4...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
05. Song 5...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
06. Song 6...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
07. Song 7...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
08. Song 8...xx:yy | lyrics lyrics lyrics lyrics lyrics lyrics lyrics
My Music is in /data/Music, and I would like to keep the lyrics in something like /data/Lyrics/$ARTIST/$SONG.txt .
How can I achieve that and where do I have to add code?
Any help is very much appreciated so I can start working on it.
Kind regards,
peter
Posts: 81
Joined: Dec 2009
Reputation:
0
Following up on my own post, would it work if I created a GUIMusicLyrics.h/cpp and MusicLyrics.h/cpp similar to the karaoke stuff? Here I would implement the logics of obtaining the lyrics and displaying it. Would this allow me to add an additional control in the ViewsMusicLibrary.xml?
I still not sure how all that works, with GUIWindows and XML configuration/skin files and launching stuff. Anybody here to give me a short intoduction?
peter
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
we already load embedded lyrics. which is done in CMusicInfoLoader::LoadAdditionalInfo - i suggest you hook it in there.
Posts: 81
Joined: Dec 2009
Reputation:
0
2010-01-13, 20:48
(This post was last modified: 2010-01-14, 00:44 by PeterW.)
Hello and thanks for the replies,
I'll have a look into the code where the lyrics are loaded. I guess I can add (at least for my own version) add some code that loads the lyrics from a file, either with the same filename and different extension, or from a separate Lyrics tree, configurable, such as //Lyrics/$ARTIST/$SONG.txt
Provided that the lyrics are loaded properly, I'll still need a GUI element or window to display the lyrics in, and then so I presume, make use of this window in ViewsMusicLibrary.xml, similar to all other Info, display in its own pane. Who or what program entity would be responsible for instantiating Lyrics View. Is there already some kind of Lyrics View?
Who instantiates GUI windows. From the code in Application.cpp I understand that most GUI windows are instantiated at startup, and only configured by the xml files for a given skin. This would mean that in different views, the XML file only configures the graphical layout. Or are windows instantiated every time they are displayed?
Still a bit confused,
peter
Posts: 81
Joined: Dec 2009
Reputation:
0
Hello,
Having looked through the code, in particular in MusicInfoLoader.cpp, the Loader Factory, the specific Loaders, and specific tag Read() methods, I trust that the lyrics are properly read if they are contained in the song files. I tried it out with an mp3 and printed the contents in the log file, and it works.
If the lyrics were to be stored outside the Music hierarchy, it does not appear to be too daunting to add some code that looks in a different place and loads a file if the lyrics from the tag is empty. However, this is not my major concern at the time, as there is a means to get the lyrics into XBMC.
What I still do not understand is how I can add a control that displays the lyrics. It does not have to be in the MusicView, I would be happy using a keypress in the Music View such as 'l' and then a Window appears containing the lyrics. Being in the MusicListView, and, and a song is playing, how can I make a TextControl appear that displays the lyrics?
I would appreciate some help with that, it cannot be so difficult, and perhaps it's already somewhere and I could find it.
Kind regards,
peter
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
the cu lyrics script for instance uses either embedded thumbs or grabs them from lyricswiki. you may want to check that out, cause it sounds like it's close to what you are after. note that this only shows the lyrics for the currently playing file.
if you want to extend it to the media windows, the main thing you have to change is that you have to load the lyrics for *all* songs there (which will slow it down considerably). then it's just skin work to have it show up (using info labels and possibly a custom dialog).
Posts: 81
Joined: Dec 2009
Reputation:
0
Hello,
as a matter of fact, I had CU lyrics installed, but did not like the way it works. I have to navigate my music hierarchy down to the song I want to play, press play, then all the way up, then down the scripts and select CU Lyrics. It's tedious and not the way I would like to use a lyrics facility.
I added a button to the Music view that calls the CU script, but then I did not succeed to press it without mouse. I did not succeed to add such a button to the MusicOSD either.
I presume, once one enters a directory, xbmc reads all meta information of all files in that directory. Then of course you are right, reading the lyrics would slow down things. So I won't incorporate the lyrics in the media files.
Imagine, you select a song to play, then you press a 'l' key and some code is invoked that will look for song.txt or somewhere else, then pop up a Dialog, say GUILyricsDialog. How difficult is it to add GUILyricsDialog that pops up from the Music View upon pressing a certain key? Where in the code can I catch the keypress, where do I have to instantiate the dialog (every time or at startup)?
peter
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
you can set a shortcut to cu lyrics from the fullscreen osd through skin settings which makes it behave really well.
that being said. yes, you can do such a dialog. you would instance it in Application.cpp as all the others are done. you would then need to define an action for popping up the dialog in Key.h, and a human name mapping to the action in ButtonTranslator.cpp. you would handle the action in the OnAction of the relevant window (GUIWindowMusicNav.cpp). finally you would map the key to the action in keyboard.xml
Posts: 81
Joined: Dec 2009
Reputation:
0
Hello,
Thanks for the guidance; looking through the code, this is what I thought I have to do, or roughly. I thought that I have to add an action in GUIWindowMusicSongs.cpp, though, assuming that this is the one that displays the list of songs from which one selects a song to be played, and that this is the one that has the focus.
I'll have a look at all that tomorrow. i see it is a long chain of events. from a key press through the ButtonTranslator to an Action to ...
Thanks,
peter
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
GUIWindowMusicSongs.cpp is (the confusingly named) file mode.
Posts: 81
Joined: Dec 2009
Reputation:
0
Hmm, the file mode, that's the mode I usually use.
The library mode, driven by the Album/Artist/Song paradigm does not suit me, unless I could have a domain/genre/artist(=composer)/[workgroup/][performer/]/work/part/ type of hierarchy, where domain would be classical, jazz, popular, opera, etc.
I'll try to add the Action handling in both GUIWindowMusicSongs.cpp and GUIWindowMusicNav.cpp and see what happens.
peter
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
1) is skin - not my turf
2) you may want to inherit GUIDialogBoxBase to make all this much easier on you. from the brief look i had no i cannot see anything obviously wrong.
last question; intercept the GUI_MSG_PLAYLISTPLAYER_CHANGED in ::OnMessage() - just grep and you will find examples.