Skip to content
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...
1 parent bdb7e79 commit 6216029d222c620ce078fb9c00a453ba3d1e6db3 Robert McNamara committed Jul 22, 2011
View
2 mythplugins/mythbrowser/mythbrowser/main.cpp
@@ -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())
{
View
3 mythtv/libs/libmyth/programinfo.cpp
@@ -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;
}
View
3 mythtv/libs/libmyth/programinfo.h
@@ -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.
View
2 mythtv/libs/libmythbase/mythversion.h
@@ -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.
*
View
4 mythtv/libs/libmythmetadata/libmythmetadata.pro
@@ -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
View
27 mythtv/libs/libmythmetadata/metadatacommon.h
@@ -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;
View
18 mythtv/libs/libmythmetadata/metadataimagehelper.h
@@ -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);
View
6 mythtv/libs/libmythtv/libmythtv.pro
@@ -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
View
13 ...s/libmythmetadata/metadataimagehelper.cpp → ...tv/libs/libmythtv/metadataimagehelper.cpp
@@ -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);
}
View
62 mythtv/libs/libmythtv/metadataimagehelper.h
@@ -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
View
3 mythtv/libs/libmythtv/osd.cpp
@@ -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"))
{
View
14 mythtv/libs/libmythtv/playercontext.cpp
@@ -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);
View
8 mythtv/libs/libmythui/mythmainwindow.cpp
@@ -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;
}
View
6 mythtv/libs/libmythui/mythmainwindow.h
@@ -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;
View
4 mythtv/programs/mythfrontend/main.cpp
@@ -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());
View
1 mythtv/programs/mythfrontend/scheduleeditor.cpp
@@ -33,7 +33,6 @@
#include "videoutils.h"
#include "mythuiutils.h"
-// libmythmetadata
#include "metadataimagehelper.h"
// Mythfrontend
View
33 mythtv/programs/mythfrontend/videoplayercommand.cpp
@@ -79,30 +79,30 @@ class VideoPlayHandleMedia : public VideoPlayProc
private:
VideoPlayHandleMedia(const QString &handler, const QString &mrl,
const QString &plot, const QString &title, const QString &subtitle,
- const QString &director, int season, int episode,
+ const QString &director, int season, int episode, const QString &inetref,
int length, const QString &year) :
m_handler(handler), m_mrl(mrl), m_plot(plot), m_title(title),
m_subtitle(subtitle), m_director(director), m_season(season),
- m_episode(episode), m_length(length), m_year(year)
+ m_episode(episode), m_inetref(inetref), m_length(length), m_year(year)
{
}
public:
static VideoPlayHandleMedia *Create(const QString &handler,
const QString &mrl, const QString &plot, const QString &title,
const QString &subtitle, const QString &director,
- int season, int episode,
+ int season, int episode, const QString &inetref,
int length, const QString &year)
{
return new VideoPlayHandleMedia(handler, mrl, plot, title, subtitle,
- director, season, episode, length, year);
+ director, season, episode, inetref, length, year);
}
bool Play() const
{
return GetMythMainWindow()->HandleMedia(m_handler, m_mrl,
m_plot, m_title, m_subtitle, m_director, m_season,
- m_episode, m_length, m_year);
+ m_episode, m_inetref, m_length, m_year);
}
QString GetCommandDisplayName() const
@@ -124,6 +124,7 @@ class VideoPlayHandleMedia : public VideoPlayProc
QString m_director;
int m_season;
int m_episode;
+ QString m_inetref;
int m_length;
QString m_year;
};
@@ -214,8 +215,8 @@ class VideoPlayerCommandPrivate
AddPlayer(play_command, filename, item->GetPlot(),
item->GetTitle(), item->GetSubtitle(),
item->GetDirector(), item->GetSeason(),
- item->GetEpisode(), item->GetLength(),
- QString::number(item->GetYear()));
+ item->GetEpisode(), item->GetInetRef(),
+ item->GetLength(), QString::number(item->GetYear()));
}
else
{
@@ -242,8 +243,8 @@ class VideoPlayerCommandPrivate
AddPlayer(play_command, filename, item->GetPlot(),
item->GetTitle(), item->GetSubtitle(),
item->GetDirector(), item->GetSeason(),
- item->GetEpisode(), item->GetLength(),
- QString::number(item->GetYear()));
+ item->GetEpisode(), item->GetInetRef(),
+ item->GetLength(), QString::number(item->GetYear()));
}
else
{
@@ -286,6 +287,7 @@ class VideoPlayerCommandPrivate
QString director;
int season = 0;
int episode = 0;
+ QString inetref;
int length = 0;
QString year = QString::number(VIDEO_YEAR_DEFAULT);
@@ -297,12 +299,13 @@ class VideoPlayerCommandPrivate
director = extraData->GetDirector();
season = extraData->GetSeason();
episode = extraData->GetEpisode();
+ inetref = extraData->GetInetRef();
length = extraData->GetLength();
year = QString::number(extraData->GetYear());
}
- AddPlayer(play_command, filename, plot, title, subtitle, director,
- season, episode, length, year);
+ AddPlayer(play_command, filename, plot, title, subtitle, director,
+ season, episode, inetref, length, year);
}
void ClearPlayerList()
@@ -333,12 +336,12 @@ class VideoPlayerCommandPrivate
private:
void AddPlayer(const QString &player, const QString &filename,
- const QString &plot, const QString &title, const QString &subtitle,
- const QString &director, int season, int episode, int length,
- const QString &year)
+ const QString &plot, const QString &title, const QString &subtitle,
+ const QString &director, int season, int episode, const QString &inetref,
+ int length, const QString &year)
{
m_player_procs.push_back(VideoPlayHandleMedia::Create(player, filename,
- plot, title, subtitle, director, season, episode,
+ plot, title, subtitle, director, season, episode, inetref,
length, year));
m_player_procs.push_back(VideoPlayMythSystem::Create(player, filename));
}
View
2 mythtv/programs/mythpreviewgen/main.cpp
@@ -121,7 +121,7 @@ int preview_helper(uint chanid, QDateTime starttime,
}
pginfo = new ProgramInfo(
infile, ""/*plot*/, ""/*title*/, ""/*subtitle*/, ""/*director*/,
- 0/*season*/, 0/*episode*/, 120/*length_in_minutes*/,
+ 0/*season*/, 0/*episode*/, ""/*inetref*/, 120/*length_in_minutes*/,
1895/*year*/);
}
else

0 comments on commit 6216029

Please sign in to comment.
Something went wrong with that request. Please try again.