Skip to content

Commit

Permalink
If available use videoInfoTags in IsSamePath
Browse files Browse the repository at this point in the history
If VideoInfoTags are available, then comparing the DBId and the Type is
good enough for testing the samePath.
  • Loading branch information
cg110 committed Mar 9, 2014
1 parent f47b6be commit 763a702
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xbmc/FileItem.cpp
Expand Up @@ -1430,6 +1430,11 @@ bool CFileItem::IsSamePath(const CFileItem *item) const
return (item->GetProperty("item_start") == GetProperty("item_start"));
return true;
}
if (HasVideoInfoTag() && item->HasVideoInfoTag())
{
return ((m_videoInfoTag->m_iDbId == item->m_videoInfoTag->m_iDbId) &&
(m_videoInfoTag->m_type == item->m_videoInfoTag->m_type));
}

This comment has been minimized.

Copy link
@jmarshallnz

jmarshallnz Mar 9, 2014

I think you also need check that m_iDbId != -1. So something like:

if (HasVideoInfoTag() && item->HasVideoInfoTag())
{
  if (m_videoInfoTag->m_iDbId != -1 && item->m_videoInfoTag->m_iDbId != -1)
    return m_videoInfoTag->m_iDbId == item->m_videoInfoTag->m_iDbId &&
              m_videoInfoTag->m_type == item->m_videoInfoTag->m_type;
}

This comment has been minimized.

Copy link
@cg110

cg110 Mar 10, 2014

Author Owner

That probably make sense to protect against Info Tags that aren't populated from the DB.
See commit: c8e36b2b4596cd1f28b943713e97639e7fea724c

if (IsMusicDb() && HasMusicInfoTag())
{
CFileItem dbItem(m_musicInfoTag->GetURL(), false);
Expand Down

1 comment on commit 763a702

@cg110
Copy link
Owner Author

@cg110 cg110 commented on 763a702 Mar 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a timing data point, the above change, and the -1 commit, remove the time it takes to compare 346 films with FileItemList::UpdateItem from 10ms, to <1ms. That's on an i7-920.

Please sign in to comment.