Skip to content

Commit

Permalink
Support recording artwork in the OSD.
Browse files Browse the repository at this point in the history
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 committed Jul 23, 2011
1 parent bdb7e79 commit 6216029
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 86 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythbrowser/mythbrowser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmyth/programinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -805,7 +806,7 @@ ProgramInfo::ProgramInfo(const QString &_pathname,

season = _season;
episode = _episode;

inetref = _inetref;
title = _title;
}

Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmyth/programinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h
Original file line number Diff line number Diff line change
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.20110721-1"
#define MYTH_BINARY_VERSION "0.25.20110722-1"

/** \brief Increment this whenever the MythTV network protocol changes.
*
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythmetadata/libmythmetadata.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 1 addition & 26 deletions mythtv/libs/libmythmetadata/metadatacommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QEvent>

#include "mythmetaexp.h"
#include "metadataimagehelper.h"

class ProgramInfo;

Expand All @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 0 additions & 18 deletions mythtv/libs/libmythmetadata/metadataimagehelper.h

This file was deleted.

6 changes: 3 additions & 3 deletions mythtv/libs/libmythtv/libmythtv.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "mythdirs.h"
#include "mythdbcon.h"

#include "videoutils.h"
#include "metadataimagehelper.h"

ArtworkMap GetArtwork(QString inetref,
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}

Expand Down
62 changes: 62 additions & 0 deletions mythtv/libs/libmythtv/metadataimagehelper.h
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/osd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand Down
14 changes: 14 additions & 0 deletions mythtv/libs/libmythtv/playercontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "storagegroup.h"
#include "mythcorecontext.h"
#include "videometadatautil.h"
#include "metadataimagehelper.h"
#include "mythlogging.h"

#define LOC QString("playCtx: ")
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions mythtv/libs/libmythui/mythmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythui/mythmainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions mythtv/programs/mythfrontend/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());

Expand Down
1 change: 0 additions & 1 deletion mythtv/programs/mythfrontend/scheduleeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "videoutils.h"
#include "mythuiutils.h"

// libmythmetadata
#include "metadataimagehelper.h"

// Mythfrontend
Expand Down
Loading

0 comments on commit 6216029

Please sign in to comment.