Skip to content

Commit

Permalink
Update BlurayMetadata class to split parsing and opening of disc.
Browse files Browse the repository at this point in the history
Also update those functions to return bool rather than void.

For some stuff I'm working on it's nice to have a convenient function to determine if the disc in the drive is a usable Blu-ray, but it might not necessarily contain Disc Library metadata.  So break it out such that I can behave one way if there's a bluray, and another if there's a bluray with metadata.
  • Loading branch information
Robert McNamara committed Jan 25, 2011
1 parent 53b8199 commit 1f8d11e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythdb/mythversion.h
Expand Up @@ -11,7 +11,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythdb, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20110125-2"
#define MYTH_BINARY_VERSION "0.25.20110125-3"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
16 changes: 13 additions & 3 deletions mythtv/libs/libmythmetadata/bluraymetadata.cpp
Expand Up @@ -19,7 +19,7 @@ BlurayMetadata::~BlurayMetadata()
bd_close(m_bdnav);
}

void BlurayMetadata::Parse(void)
bool BlurayMetadata::OpenDisc(void)
{
QString keyfile = QString("%1/KEYDB.cfg").arg(GetConfDir());
QByteArray keyarray = keyfile.toAscii();
Expand All @@ -28,12 +28,20 @@ void BlurayMetadata::Parse(void)
m_bdnav = bd_open(m_path.toLatin1().data(), keyfilepath);

if (!m_bdnav)
return;
return false;

return true;
}

bool BlurayMetadata::ParseDisc(void)
{
if (!m_bdnav && !OpenDisc())
return false;

m_metadata = bd_get_meta(m_bdnav);

if (!m_metadata)
return;
return false;

m_title = QString(m_metadata->di_name);
m_alttitle = QString(m_metadata->di_alternative);
Expand All @@ -56,6 +64,8 @@ void BlurayMetadata::Parse(void)
.arg(m_metadata->thumbnails[i].path);
m_images.append(filepath);
}

return true;
}

void BlurayMetadata::toMap(MetadataMap &metadataMap)
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythmetadata/bluraymetadata.h
Expand Up @@ -22,7 +22,8 @@ class MPUBLIC BlurayMetadata : public QObject

void toMap(MetadataMap &metadataMap);

void Parse(void);
bool OpenDisc(void);
bool ParseDisc(void);

QString GetTitle(void) { return m_title; };
QString GetAlternateTitle(void) { return m_alttitle; };
Expand Down

0 comments on commit 1f8d11e

Please sign in to comment.