Permalink
Browse files

Support recording artwork in the OSD.

Themers can now use fanart, banner, coverart, and screenshot imagetypes in the OSD and expect them to behave identically in both recordings and videos (as opposed to only working for videos).

This looks like a LOT larger change than it actually is.  In reality, it's a number of changes to the media plugin registration, a header move, and just a couple dozen lines to add support for the imagery to the OSD.
  • Loading branch information...
Robert McNamara
Robert McNamara committed Jul 23, 2011
1 parent bdb7e79 commit 6216029d222c620ce078fb9c00a453ba3d1e6db3
@@ -20,7 +20,7 @@
using namespace std;
static int handleMedia(const QString &url, const QString &directory, const QString &filename,
- const QString &, const QString &, int, int, int, const QString &)
+ const QString &, const QString &, int, int, const QString &, int, const QString &)
{
if (url.isEmpty())
{
@@ -764,6 +764,7 @@ ProgramInfo::ProgramInfo(const QString &_pathname,
const QString &_subtitle,
const QString &_director,
int _season, int _episode,
+ const QString &_inetref,
uint _length_in_minutes,
uint _year) :
positionMapDBReplacement(NULL)
@@ -805,7 +806,7 @@ ProgramInfo::ProgramInfo(const QString &_pathname,
season = _season;
episode = _episode;
-
+ inetref = _inetref;
title = _title;
}
@@ -223,13 +223,14 @@ class MPUBLIC ProgramInfo
const QString &inetref);
/// Constructs a ProgramInfo for a pathname.
ProgramInfo(const QString &pathname);
- /// Constructs a ProgramInfo for a pathname.
+ /// Constructs a ProgramInfo for a video.
ProgramInfo(const QString &pathname,
const QString &plot,
const QString &title,
const QString &subtitle,
const QString &director,
int season, int episode,
+ const QString &inetref,
uint length_in_minutes,
uint year);
/// Constructs a manual record ProgramInfo.
@@ -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.20110721-1"
+#define MYTH_BINARY_VERSION "0.25.20110722-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -16,14 +16,14 @@ HEADERS += cleanup.h dbaccess.h dirscan.h globals.h parentalcontrols.h
HEADERS += videoscan.h videoutils.h videometadata.h videometadatalistmanager.h
HEADERS += quicksp.h metadatacommon.h metadatadownload.h metadataimagedownload.h
HEADERS += bluraymetadata.h mythmetaexp.h metadatafactory.h mythuimetadataresults.h
-HEADERS += mythuiimageresults.h metadataimagehelper.h
+HEADERS += mythuiimageresults.h
SOURCES += cleanup.cpp dbaccess.cpp dirscan.cpp globals.cpp
SOURCES += parentalcontrols.cpp videoscan.cpp videoutils.cpp
SOURCES += videometadata.cpp videometadatalistmanager.cpp
SOURCES += metadatacommon.cpp metadatadownload.cpp metadataimagedownload.cpp
SOURCES += bluraymetadata.cpp metadatafactory.cpp mythuimetadataresults.cpp
-SOURCES += mythuiimageresults.cpp metadataimagehelper.cpp
+SOURCES += mythuiimageresults.cpp
INCLUDEPATH += ../libmythbase ../libmythtv
INCLUDEPATH += ../.. ../ ./ ../libmythupnp ../libmythui
@@ -12,6 +12,7 @@
#include <QEvent>
#include "mythmetaexp.h"
+#include "metadataimagehelper.h"
class ProgramInfo;
@@ -20,18 +21,6 @@ enum LookupStep {
kLookupData = 1
};
-enum VideoArtworkType {
- kArtworkCoverart = 0,
- kArtworkFanart = 1,
- kArtworkBanner = 2,
- kArtworkScreenshot = 3,
- kArtworkPoster = 4,
- kArtworkBackCover = 5,
- kArtworkInsideCover = 6,
- kArtworkCDImage = 7
-};
-Q_DECLARE_METATYPE(VideoArtworkType)
-
struct PersonInfo
{
QString name;
@@ -40,16 +29,6 @@ struct PersonInfo
QString url;
};
-struct ArtworkInfo
-{
- QString label;
- QString thumbnail;
- QString url;
- uint width;
- uint height;
-};
-Q_DECLARE_METATYPE(ArtworkInfo)
-
enum MetadataType {
kMetadataVideo = 0,
kMetadataRecording = 1,
@@ -81,10 +60,6 @@ enum PeopleType {
kPersonGuestStar = 11
};
-typedef QList< ArtworkInfo > ArtworkList;
-
-typedef QMultiMap< VideoArtworkType, ArtworkInfo > ArtworkMap;
-
typedef QMap< VideoArtworkType, ArtworkInfo > DownloadMap;
typedef QMultiMap< PeopleType, PersonInfo > PeopleMap;
@@ -1,18 +0,0 @@
-#include <QObject>
-
-#include "metadatacommon.h"
-#include "mythmetaexp.h"
-
-META_PUBLIC ArtworkMap GetArtwork(QString inetref,
- uint season,
- bool strict = false);
-META_PUBLIC bool SetArtwork(const QString &inetref,
- uint season,
- const QString &host,
- const QString &coverart,
- const QString &fanart,
- const QString &banner);
-META_PUBLIC bool SetArtwork(const QString &inetref,
- uint season,
- const QString &host,
- const ArtworkMap map);
@@ -164,7 +164,7 @@ HEADERS += mythsystemevent.h
HEADERS += avfringbuffer.h ThreadedFileWriter.h
HEADERS += ringbuffer.h fileringbuffer.h
HEADERS += dvdringbuffer.h bdringbuffer.h
-HEADERS += streamingringbuffer.h
+HEADERS += streamingringbuffer.h metadataimagehelper.h
SOURCES += recordinginfo.cpp
SOURCES += dbcheck.cpp
@@ -192,7 +192,7 @@ SOURCES += mythsystemevent.cpp
SOURCES += avfringbuffer.cpp ThreadedFileWriter.cpp
SOURCES += ringbuffer.cpp fileringBuffer.cpp
SOURCES += dvdringbuffer.cpp bdringbuffer.cpp
-SOURCES += streamingringbuffer.cpp
+SOURCES += streamingringbuffer.cpp metadataimagehelper.cpp
# DiSEqC
HEADERS += diseqc.h diseqcsettings.h
@@ -251,7 +251,7 @@ SOURCES += channelscan/scaninfo.cpp channelscan/channelimporter.cpp
inc.path = $${PREFIX}/include/mythtv/
inc.files = playgroup.h
-inc.files += mythtvexp.h
+inc.files += mythtvexp.h metadataimagehelper.h
INSTALLS += inc
@@ -3,7 +3,6 @@
#include "mythdirs.h"
#include "mythdbcon.h"
-#include "videoutils.h"
#include "metadataimagehelper.h"
ArtworkMap GetArtwork(QString inetref,
@@ -43,21 +42,21 @@ ArtworkMap GetArtwork(QString inetref,
if (!coverart.isEmpty())
{
ArtworkInfo coverartinfo;
- coverartinfo.url = generate_file_url("Coverart", host, coverart);
+ coverartinfo.url = generate_myth_url("Coverart", host, coverart);
map.insert(kArtworkCoverart, coverartinfo);
}
if (!fanart.isEmpty())
{
ArtworkInfo fanartinfo;
- fanartinfo.url = generate_file_url("Fanart", host, fanart);
+ fanartinfo.url = generate_myth_url("Fanart", host, fanart);
map.insert(kArtworkFanart, fanartinfo);
}
if (!banner.isEmpty())
{
ArtworkInfo bannerinfo;
- bannerinfo.url = generate_file_url("Banners", host, banner);
+ bannerinfo.url = generate_myth_url("Banners", host, banner);
map.insert(kArtworkBanner, bannerinfo);
}
}
@@ -78,21 +77,21 @@ bool SetArtwork(const QString &inetref,
if (!coverart.isEmpty())
{
ArtworkInfo coverartinfo;
- coverartinfo.url = generate_file_url("Coverart", host, coverart);
+ coverartinfo.url = generate_myth_url("Coverart", host, coverart);
map.insert(kArtworkCoverart, coverartinfo);
}
if (!fanart.isEmpty())
{
ArtworkInfo fanartinfo;
- fanartinfo.url = generate_file_url("Fanart", host, fanart);
+ fanartinfo.url = generate_myth_url("Fanart", host, fanart);
map.insert(kArtworkFanart, fanartinfo);
}
if (!banner.isEmpty())
{
ArtworkInfo bannerinfo;
- bannerinfo.url = generate_file_url("Banners", host, banner);
+ bannerinfo.url = generate_myth_url("Banners", host, banner);
map.insert(kArtworkBanner, bannerinfo);
}
@@ -0,0 +1,62 @@
+#ifndef _METADATAIMAGEHELPER_H_
+#define _METADATAIMAGEHELPER_H_
+
+#include <QObject>
+
+#include "mythtvexp.h"
+
+enum VideoArtworkType {
+ kArtworkCoverart = 0,
+ kArtworkFanart = 1,
+ kArtworkBanner = 2,
+ kArtworkScreenshot = 3,
+ kArtworkPoster = 4,
+ kArtworkBackCover = 5,
+ kArtworkInsideCover = 6,
+ kArtworkCDImage = 7
+};
+Q_DECLARE_METATYPE(VideoArtworkType)
+
+struct ArtworkInfo
+{
+ QString label;
+ QString thumbnail;
+ QString url;
+ uint width;
+ uint height;
+};
+Q_DECLARE_METATYPE(ArtworkInfo)
+
+typedef QList< ArtworkInfo > ArtworkList;
+
+typedef QMultiMap< VideoArtworkType, ArtworkInfo > ArtworkMap;
+
+MTV_PUBLIC ArtworkMap GetArtwork(QString inetref,
+ uint season,
+ bool strict = false);
+MTV_PUBLIC bool SetArtwork(const QString &inetref,
+ uint season,
+ const QString &host,
+ const QString &coverart,
+ const QString &fanart,
+ const QString &banner);
+MTV_PUBLIC bool SetArtwork(const QString &inetref,
+ uint season,
+ const QString &host,
+ const ArtworkMap map);
+
+#include "storagegroup.h"
+#include "mythcorecontext.h"
+inline QString generate_myth_url(
+ const QString &storage_group, const QString &host, const QString &path)
+{
+ QString ip = gCoreContext->GetSettingOnHost("BackendServerIP", host);
+ uint port = gCoreContext->GetSettingOnHost("BackendServerPort",
+ host).toUInt();
+
+ return gCoreContext->GenMythURL(ip,port,path,
+ StorageGroup::GetGroupToUse(host, storage_group));
+
+}
+
+#endif
@@ -422,6 +422,9 @@ void OSD::SetText(const QString &window, QHash<QString,QString> &map,
icon->SetFilename(iconpath);
icon->Load(false);
}
+ }
+ if (map.contains("inetref"))
+ {
MythUIImage *cover = dynamic_cast<MythUIImage *> (win->GetChild("coverart"));
if (cover && map.contains("coverartpath"))
{
@@ -16,6 +16,7 @@
#include "storagegroup.h"
#include "mythcorecontext.h"
#include "videometadatautil.h"
+#include "metadataimagehelper.h"
#include "mythlogging.h"
#define LOC QString("playCtx: ")
@@ -693,6 +694,19 @@ bool PlayerContext::GetPlayingInfoMap(InfoMap &infoMap) const
infoMap["screenshotpath"] = VideoMetaDataUtil::GetArtPath(
playingInfo->GetPathname(), "Screenshots");
}
+ else
+ {
+ ArtworkMap artmap = GetArtwork(playingInfo->GetInetRef(),
+ playingInfo->GetSeason());
+ infoMap["coverartpath"] =
+ artmap.value(kArtworkCoverart).url;
+ infoMap["fanartpath"] =
+ artmap.value(kArtworkFanart).url;
+ infoMap["bannerpath"] =
+ artmap.value(kArtworkBanner).url;
+ infoMap["screenshotpath"] =
+ artmap.value(kArtworkScreenshot).url;
+ }
if (player)
player->GetCodecDescription(infoMap);
@@ -1804,8 +1804,8 @@ bool MythMainWindow::HandleMedia(const QString &handler, const QString &mrl,
const QString &plot, const QString &title,
const QString &subtitle,
const QString &director, int season,
- int episode, int lenMins,
- const QString &year)
+ int episode, const QString &inetref,
+ int lenMins, const QString &year)
{
QString lhandler(handler);
if (lhandler.isEmpty())
@@ -1815,8 +1815,8 @@ bool MythMainWindow::HandleMedia(const QString &handler, const QString &mrl,
if (d->mediaPluginMap.count(lhandler))
{
d->mediaPluginMap[lhandler].playFn(mrl, plot, title, subtitle,
- director, season, episode, lenMins,
- year);
+ director, season, episode,
+ inetref, lenMins, year);
return true;
}
@@ -18,7 +18,7 @@ class MythMediaDevice;
#define REG_JUMPEX(a, b, c, d, e) GetMythMainWindow()->RegisterJump(a, b, c, d, e)
#define REG_MEDIAPLAYER(a,b,c) GetMythMainWindow()->RegisterMediaPlugin(a, b, c)
-typedef int (*MediaPlayCallback)(const QString &, const QString &, const QString &, const QString &, const QString &, int, int, int, const QString &);
+typedef int (*MediaPlayCallback)(const QString &, const QString &, const QString &, const QString &, const QString &, int, int, const QString &, int, const QString &);
class MythMainWindowPrivate;
@@ -76,8 +76,8 @@ class MUI_PUBLIC MythMainWindow : public QWidget
bool HandleMedia(const QString& handler, const QString& mrl,
const QString& plot="", const QString& title="",
const QString& subtitle="", const QString& director="",
- int season=0, int episode=0, int lenMins=120,
- const QString& year="1895");
+ int season=0, int episode=0, const QString& inetref="",
+ int lenMins=120, const QString& year="1895");
void JumpTo(const QString &destination, bool pop = true);
bool DestinationExists(const QString &destination) const;
@@ -1086,7 +1086,7 @@ static void WriteDefaults()
static int internal_play_media(const QString &mrl, const QString &plot,
const QString &title, const QString &subtitle,
const QString &director, int season, int episode,
- int lenMins, const QString &year)
+ const QString &inetref, int lenMins, const QString &year)
{
int res = -1;
@@ -1106,7 +1106,7 @@ static int internal_play_media(const QString &mrl, const QString &plot,
ProgramInfo *pginfo = new ProgramInfo(
mrl, plot, title, subtitle, director, season, episode,
- lenMins, (year.toUInt()) ? year.toUInt() : 1900);
+ inetref, lenMins, (year.toUInt()) ? year.toUInt() : 1900);
pginfo->SetProgramInfoType(pginfo->DiscoverProgramInfoType());
@@ -33,7 +33,6 @@
#include "videoutils.h"
#include "mythuiutils.h"
-// libmythmetadata
#include "metadataimagehelper.h"
// Mythfrontend
Oops, something went wrong.

0 comments on commit 6216029

Please sign in to comment.