Skip to content

Commit

Permalink
Metadata: Add some more convenience methods to create Metadata XML si…
Browse files Browse the repository at this point in the history
…mply.

Creating exportable .mxml content is now as simple as (after including metadatacommon.h):

QDomDocument doc = CreateMetadataXML(pginfo);

You can do what you like with the result, but the metadata download classes search for a file in the same dir as the file being worked on (as defined in lookup->Set/GetFilename) with the same filename and a suffix of .mxml.

So, still missing:

* Decide where/when to create .mxml files for recordings (at which point it would work to drop the result in your video dir the mythvideo scanner will pick up the file + mxml and parse the metadata)
* Add some code to dynamically reimport files from offline/portable storage groups into recordings (Chris P'm has mentioned he's written such code)
* Add a MetadataFactory to the theoretical recording import class and tell it to do a lookup on the newly imported file (easy peasy: MetadataFactory *factory(this); factory->AddLookup(pginfo);) and listen for the result event that provides you the fully looked up info which you can assign to your programinfo as you see fit.
  • Loading branch information
Robert McNamara committed Jul 17, 2011
1 parent e198674 commit 158b6e5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Expand Up @@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
#define MYTH_BINARY_VERSION "0.25.20110715-1"
#define MYTH_BINARY_VERSION "0.25.20110716-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
23 changes: 23 additions & 0 deletions mythtv/libs/libmythmetadata/metadatacommon.cpp
Expand Up @@ -460,6 +460,29 @@ QDomDocument CreateMetadataXML(MetadataLookupList list)
return doc;
}

QDomDocument CreateMetadataXML(MetadataLookup *lookup)
{
QDomDocument doc("MythMetadataXML");

QDomElement root = doc.createElement("metadata");
doc.appendChild(root);

CreateMetadataXMLItem(lookup, root, doc);

return doc;
}

QDomDocument CreateMetadataXML(ProgramInfo *pginfo)
{
QDomDocument doc("MythMetadataXML");

MetadataLookup *lookup = LookupFromProgramInfo(pginfo);
if (lookup)
doc = CreateMetadataXML(lookup);

return doc;
}

void CreateMetadataXMLItem(MetadataLookup *lookup,
QDomElement placetoadd,
QDomDocument docroot)
Expand Down
2 changes: 2 additions & 0 deletions mythtv/libs/libmythmetadata/metadatacommon.h
Expand Up @@ -439,6 +439,8 @@ Q_DECLARE_METATYPE(MetadataLookup*)
typedef QList<MetadataLookup*> MetadataLookupList;

META_PUBLIC QDomDocument CreateMetadataXML(MetadataLookupList list);
META_PUBLIC QDomDocument CreateMetadataXML(MetadataLookup *lookup);
META_PUBLIC QDomDocument CreateMetadataXML(ProgramInfo *pginfo);

META_PUBLIC void CreateMetadataXMLItem(MetadataLookup *lookup,
QDomElement placetoadd,
Expand Down

0 comments on commit 158b6e5

Please sign in to comment.