Skip to content

Commit

Permalink
adds routine to classify art into poster or banner based on aspect ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Oct 31, 2012
1 parent 061f786 commit 70638e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xbmc/video/VideoInfoScanner.cpp
Expand Up @@ -1162,6 +1162,16 @@ namespace VIDEO
}
}

std::string CVideoInfoScanner::GetArtTypeFromSize(unsigned int width, unsigned int height)
{
std::string type = "thumb";
if (width*5 < height*4)
type = "poster";
else if (width*1 > height*4)
type = "banner";
return type;
}

void CVideoInfoScanner::GetArtwork(CFileItem *pItem, const CONTENT_TYPE &content, bool bApplyToDir, bool useLocal, const std::string &actorArtPath)
{
CVideoInfoTag &movieDetails = *pItem->GetVideoInfoTag();
Expand Down
8 changes: 8 additions & 0 deletions xbmc/video/VideoInfoScanner.h
Expand Up @@ -102,6 +102,14 @@ namespace VIDEO
*/
void GetArtwork(CFileItem *pItem, const CONTENT_TYPE &content, bool bApplyToDir=false, bool useLocal=true, const std::string &actorArtPath = "");

/*! \brief Retrieve the art type for an image from the given size.
\param width the width of the image.
\param height the height of the image.
\return "poster" if the aspect ratio is at most 4:5, "banner" if the aspect ratio
is at least 1:4, "thumb" otherwise.
*/
static std::string GetArtTypeFromSize(unsigned int width, unsigned int height);

/*! \brief Get season thumbs for a tvshow.
All seasons (regardless of whether the user has episodes) are added to the art map.
\param show tvshow info tag
Expand Down

0 comments on commit 70638e4

Please sign in to comment.