diff options
author | Arne Morten Kvarving <spiff@kodi.tv> | 2017-12-11 16:08:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 16:08:33 +0100 |
commit | c8de175756398b3fb7ccf696d77b4cdf2e90f6f3 (patch) | |
tree | 66ffd26841d9006cd2b2a5fe9e0a9c7f55fb19e8 | |
parent | ce256f17631f8851b9dd02f66953444a2a942c51 (diff) | |
parent | d71874f2918c64faecf167833a67fe3df9f88637 (diff) |
Merge pull request #13124 from notspiff/update_info_tags
added: ability to update info tag for currently playing item from python
-rw-r--r-- | xbmc/interfaces/legacy/Player.cpp | 12 | ||||
-rw-r--r-- | xbmc/interfaces/legacy/Player.h | 32 |
2 files changed, 44 insertions, 0 deletions
diff --git a/xbmc/interfaces/legacy/Player.cpp b/xbmc/interfaces/legacy/Player.cpp index 8e5a3a1cfe..364492967c 100644 --- a/xbmc/interfaces/legacy/Player.cpp +++ b/xbmc/interfaces/legacy/Player.cpp @@ -26,6 +26,8 @@ #include "Application.h" #include "messaging/ApplicationMessenger.h" #include "GUIInfoManager.h" +#include "GUIUserMessages.h" +#include "guilib/GUIWindowManager.h" #include "AddonUtils.h" #include "utils/log.h" #include "cores/IPlayer.h" @@ -353,6 +355,16 @@ namespace XBMCAddon return new InfoTagMusic(); } + void Player::updateInfoTag(const XBMCAddon::xbmcgui::ListItem* item) + { + XBMC_TRACE; + if (!g_application.m_pPlayer->IsPlaying()) + throw PlayerException("Kodi is not playing any file"); + + CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE_ITEM, 0, item->item); + g_windowManager.SendMessage(msg); + } + InfoTagRadioRDS* Player::getRadioRDSInfoTag() throw (PlayerException) { XBMC_TRACE; diff --git a/xbmc/interfaces/legacy/Player.h b/xbmc/interfaces/legacy/Player.h index 6d67f150bc..2858487e7b 100644 --- a/xbmc/interfaces/legacy/Player.h +++ b/xbmc/interfaces/legacy/Player.h @@ -575,6 +575,38 @@ namespace XBMCAddon void setSubtitleStream(int iStream); #endif + // Player_UpdateInfoTag +#ifdef DOXYGEN_SHOULD_USE_THIS + /// + /// \ingroup python_Player + /// @brief \python_func{ updateInfoTag(item) } + ///----------------------------------------------------------------------- + /// Update info labels for currently playing item. + /// + /// @param item ListItem with new info + /// + /// @throws Exception If player is not playing a file + /// + ///----------------------------------------------------------------------- + /// @python_v18 New function added. + ///----------------------------------------------------------------------- + /// + /// **Example:** + /// ~~~~~~~~~~~~~{.py} + /// ... + /// item = xbmcgui.ListItem() + /// item.setPath(xbmc.Player().getPlayingFile()) + /// item.setInfo('music', {'title' : 'foo', 'artist' : 'bar'}) + /// xbmc.Player().updateInfoTag(item) + /// ... + /// ~~~~~~~~~~~~~ + /// + updateInfoTag(); +#else + void updateInfoTag(const XBMCAddon::xbmcgui::ListItem* item); +#endif + + #ifdef DOXYGEN_SHOULD_USE_THIS /// /// \ingroup python_Player |