Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 45d51a2b928ee76de9f30a3aecce81effc3b8c5f Mon Sep 17 00:00:00 2001
- From: montellese <montellese@xbmc.org>
- Date: Sun, 8 Jan 2012 13:04:20 +0100
- Subject: [PATCH 4/4] fix invalid details in Player announcements by doing a
- manual database lookup by path
- ---
- xbmc/interfaces/AnnouncementManager.cpp | 46 +++++++++++++++++++++++++++++-
- 1 files changed, 44 insertions(+), 2 deletions(-)
- diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp
- index 3403ccd..166ad10 100644
- --- a/xbmc/interfaces/AnnouncementManager.cpp
- +++ b/xbmc/interfaces/AnnouncementManager.cpp
- @@ -26,8 +26,11 @@
- #include "utils/Variant.h"
- #include "FileItem.h"
- #include "music/tags/MusicInfoTag.h"
- +#include "music/MusicDatabase.h"
- #include "video/VideoDatabase.h"
- +#define LOOKUP_PROPERTY "database-lookup"
- +
- using namespace std;
- using namespace ANNOUNCEMENT;
- @@ -82,12 +85,29 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender,
- if (item->HasVideoInfoTag())
- {
- - CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);
- -
- id = item->GetVideoInfoTag()->m_iDbId;
- + // TODO: Can be removed once this is properly handled when starting playback of a file
- + if (id <= 0 && !item->GetPath().empty() &&
- + (!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
- + {
- + CVideoDatabase videodatabase;
- + if (videodatabase.Open())
- + {
- + if (videodatabase.LoadVideoInfo(item->GetPath(), *item->GetVideoInfoTag()))
- + id = item->GetVideoInfoTag()->m_iDbId;
- +
- + videodatabase.Close();
- + }
- + }
- +
- + CVideoDatabase::VideoContentTypeToString((VIDEODB_CONTENT_TYPE)item->GetVideoContentType(), type);
- +
- if (id <= 0)
- {
- + // TODO: Can be removed once this is properly handled when starting playback of a file
- + item->SetProperty(LOOKUP_PROPERTY, false);
- +
- object["title"] = item->GetVideoInfoTag()->m_strTitle;
- switch (item->GetVideoContentType())
- @@ -118,8 +138,30 @@ void CAnnouncementManager::Announce(EAnnouncementFlag flag, const char *sender,
- id = item->GetMusicInfoTag()->GetDatabaseId();
- type = "song";
- + // TODO: Can be removed once this is properly handled when starting playback of a file
- + if (id <= 0 && !item->GetPath().empty() &&
- + (!item->HasProperty(LOOKUP_PROPERTY) || item->GetProperty(LOOKUP_PROPERTY).asBoolean()))
- + {
- + CMusicDatabase musicdatabase;
- + if (musicdatabase.Open())
- + {
- + CSong song;
- + if (musicdatabase.GetSongByFileName(item->GetPath(), song))
- + {
- + item->GetMusicInfoTag()->SetSong(song);
- + item->SetMusicThumb();
- + id = item->GetMusicInfoTag()->GetDatabaseId();
- + }
- +
- + musicdatabase.Close();
- + }
- + }
- +
- if (id <= 0)
- {
- + // TODO: Can be removed once this is properly handled when starting playback of a file
- + item->SetProperty(LOOKUP_PROPERTY, false);
- +
- object["title"] = item->GetMusicInfoTag()->GetTitle();
- if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
- --
- 1.7.7.msysgit.0
Add Comment
Please, Sign In to add comment