aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Marshall <jmarshall@xbmc.org>2013-11-30 18:53:22 +1300
committerJonathan Marshall <jmarshall@xbmc.org>2013-12-24 13:48:49 +1300
commit6e2baea75a685bcbb9bdcd6a19c5006e65d35d79 (patch)
tree86adbddb8522d62d94f00f7da4073d9e86e65167
parent69de842c4492924ebf6cea0ea54da6577fb12385 (diff)
[musicdb] cosmetic: adds an UpdateSong() wrapper for public use, and use it in JSON-RPC
-rw-r--r--xbmc/interfaces/json-rpc/AudioLibrary.cpp2
-rw-r--r--xbmc/music/MusicDatabase.cpp21
-rw-r--r--xbmc/music/MusicDatabase.h13
3 files changed, 35 insertions, 1 deletions
diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp
index bbc5c0daa4..cb78955ddf 100644
--- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp
+++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -510,7 +510,7 @@ JSONRPC_STATUS CAudioLibrary::SetSongDetails(const CStdString &method, ITranspor
if (ParameterNotNull(parameterObject, "musicbrainztrackid"))
song.strMusicBrainzTrackID = parameterObject["musicbrainztrackid"].asString();
- if (musicdatabase.UpdateSong(id, song.strTitle, song.strMusicBrainzTrackID, song.strFileName, song.strComment, song.strThumb, song.artist, song.genre, song.iTrack, song.iDuration, song.iYear, song.iTimesPlayed, song.iStartOffset, song.iEndOffset, song.lastPlayed, song.rating, song.iKaraokeNumber) <= 0)
+ if (musicdatabase.UpdateSong(id, song) <= 0)
return InternalError;
CJSONRPCUtils::NotifyItemUpdated();
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index 02a701bfba..d438094e33 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -475,6 +475,27 @@ bool CMusicDatabase::GetSong(int idSong, CSong& song)
return false;
}
+int CMusicDatabase::UpdateSong(int idSong, const CSong &song)
+{
+ return UpdateSong(idSong,
+ song.strTitle,
+ song.strMusicBrainzTrackID,
+ song.strFileName,
+ song.strComment,
+ song.strThumb,
+ song.artist,
+ song.genre,
+ song.iTrack,
+ song.iDuration,
+ song.iYear,
+ song.iTimesPlayed,
+ song.iStartOffset,
+ song.iEndOffset,
+ song.lastPlayed,
+ song.rating,
+ song.iKaraokeNumber);
+}
+
int CMusicDatabase::UpdateSong(int idSong,
const CStdString& strTitle, const CStdString& strMusicBrainzTrackID,
const CStdString& strPathAndFileName, const CStdString& strComment, const CStdString& strThumb,
diff --git a/xbmc/music/MusicDatabase.h b/xbmc/music/MusicDatabase.h
index 2f65370d1b..3cb649a561 100644
--- a/xbmc/music/MusicDatabase.h
+++ b/xbmc/music/MusicDatabase.h
@@ -137,6 +137,19 @@ public:
char rating, int iKaraokeNumber);
bool GetSong(int idSong, CSong& song);
+ /*! \brief Update a song in the database.
+
+ NOTE: This function assumes that song.artist contains the artist string to be concatenated.
+ Most internal functions should instead use the long-form function as the artist string
+ should be constructed from the artist credits.
+ This function will eventually be demised.
+
+ \param idSong the database ID of the song to update
+ \param song the song
+ \return the id of the song.
+ */
+ int UpdateSong(int idSong, const CSong &song);
+
/*! \brief Update a song in the database
\param idSong [in] the database ID of the song to update
\param strTitle [in] the title of the song (required to be non-empty)