Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Recording Metadata: Allow picking artwork for individual seasons on r…

…ecordings.


http://www.fecitfacta.com/recimages.ogv

If you really want to see a simple summary of what I'm about to say, just watch the video above.

In the Recording Rules Editor, under the Metadata Options section, you can now select your fanart, coverart, and banners for recording rules by season.  These values now persist and don't require an expensive hunt through the filesystem to look for.

Simply, each season + inetref (or in the case of a movie, just an inetref) has a row in the new recordedartwork table.  So, as you change the season values in the screen, the artwork being modified changes.  If you want to control what artwork appears for Season 4 of True Blood, edit the "True Blood" recording rule and set the season number to 4.  Now, start browsing local and online file sources and set the artwork you like for that season.  These changes take place immediately upon selection.

This is obviously a more interactive and time consuming process than the old "run a script that does its best in the background" method, but it's also 100% *your* choice what artwork you get, it supports different artwork for multiple seasons, etc.  Well worth it IMO.

If a given season doesn't have new artwork assigned to it yet, it will fall back to the latest seasons artwork.

I have *not* yet removed the image hunt from the Watch Recordings screen.  This is the last element that remains in the transition to the new recording metadata code.  Almost there!

As ever, version of Arclight to match is found here:

http://www.fecitfacta.com/Arclight.tar.gz
  • Loading branch information...
commit a1be7d4daec162923f43fd3fb98a132d7c0ca192 1 parent 1c34d57
Robert McNamara authored
View
151 mythtv/libs/libmythmetadata/metadataimagehelper.cpp
@@ -0,0 +1,151 @@
+#include <QUrl>
+
+#include "mythdirs.h"
+#include "mythdbcon.h"
+
+#include "videoutils.h"
+#include "metadataimagehelper.h"
+
+ArtworkMap GetArtwork(QString inetref,
+ uint season)
+{
+ ArtworkMap map;
+
+ MSqlQuery query(MSqlQuery::InitCon());
+ query.prepare("SELECT host, coverart, fanart, banner "
+ "FROM recordedartwork WHERE inetref = :INETREF "
+ "ORDER BY season = :SEASON DESC, season DESC;");
+
+ query.bindValue(":INETREF", inetref);
+ query.bindValue(":SEASON", season);
+
+ if (!query.exec())
+ {
+ MythDB::DBError("GetArtwork SELECT", query);
+ return map;
+ }
+
+ if (query.next())
+ {
+ QString host = query.value(0).toString();
+ QString coverart = query.value(1).toString();
+ QString fanart = query.value(2).toString();
+ QString banner = query.value(3).toString();
+
+ if (!coverart.isEmpty())
+ {
+ ArtworkInfo coverartinfo;
+ coverartinfo.url = generate_file_url("Coverart", host, coverart);
+ map.insert(COVERART, coverartinfo);
+ }
+
+ if (!fanart.isEmpty())
+ {
+ ArtworkInfo fanartinfo;
+ fanartinfo.url = generate_file_url("Fanart", host, fanart);
+ map.insert(FANART, fanartinfo);
+ }
+
+ if (!banner.isEmpty())
+ {
+ ArtworkInfo bannerinfo;
+ bannerinfo.url = generate_file_url("Banners", host, banner);
+ map.insert(BANNER, bannerinfo);
+ }
+ }
+
+ return map;
+}
+
+bool SetArtwork(const QString &inetref,
+ uint season,
+ const QString &host,
+ const QString &coverart,
+ const QString &fanart,
+ const QString &banner)
+{
+ bool ret = false;
+ ArtworkMap map;
+
+ if (!coverart.isEmpty())
+ {
+ ArtworkInfo coverartinfo;
+ coverartinfo.url = generate_file_url("Coverart", host, coverart);
+ map.insert(COVERART, coverartinfo);
+ }
+
+ if (!fanart.isEmpty())
+ {
+ ArtworkInfo fanartinfo;
+ fanartinfo.url = generate_file_url("Fanart", host, fanart);
+ map.insert(FANART, fanartinfo);
+ }
+
+ if (!banner.isEmpty())
+ {
+ ArtworkInfo bannerinfo;
+ bannerinfo.url = generate_file_url("Banners", host, banner);
+ map.insert(BANNER, bannerinfo);
+ }
+
+ ret = SetArtwork(inetref, season, host, map);
+
+ return ret;
+}
+
+bool SetArtwork(const QString &inetref,
+ uint season,
+ const QString &host,
+ const ArtworkMap map)
+{
+ QString coverart, fanart, banner;
+
+ QUrl coverurl(map.value(COVERART).url);
+ if (!coverurl.path().isEmpty())
+ coverart = coverurl.path();
+
+ QUrl fanarturl(map.value(FANART).url);
+ if (!fanarturl.path().isEmpty())
+ fanart = fanarturl.path();
+
+ QUrl bannerurl(map.value(BANNER).url);
+ if (!bannerurl.path().isEmpty())
+ banner = bannerurl.path();
+
+ // Have to delete the old row for this item
+
+ MSqlQuery prequery(MSqlQuery::InitCon());
+ prequery.prepare("DELETE FROM recordedartwork WHERE "
+ "inetref = :INETREF AND season = :SEASON;");
+
+ prequery.bindValue(":INETREF", inetref);
+ prequery.bindValue(":SEASON", season);
+
+ if (!prequery.exec())
+ {
+ MythDB::DBError("SetArtwork DELETE FROM", prequery);
+ return false;
+ }
+
+ // Now we can insert the new
+ MSqlQuery query(MSqlQuery::InitCon());
+ query.prepare("INSERT INTO recordedartwork(inetref,"
+ "season,host,coverart,fanart,banner) VALUES( "
+ ":INETREF, :SEASON, :HOST, :COVERART, "
+ ":FANART, :BANNER);");
+
+ query.bindValue(":INETREF", inetref);
+ query.bindValue(":SEASON", season);
+ query.bindValue(":HOST", host);
+ query.bindValue(":COVERART", coverart);
+ query.bindValue(":FANART", fanart);
+ query.bindValue(":BANNER", banner);
+
+ if (!query.exec())
+ {
+ MythDB::DBError("SetArtwork INSERT INTO", query);
+ return false;
+ }
+
+ return true;
+}
View
17 mythtv/libs/libmythmetadata/metadataimagehelper.h
@@ -0,0 +1,17 @@
+#include <QObject>
+
+#include "metadatacommon.h"
+#include "mythmetaexp.h"
+
+META_PUBLIC ArtworkMap GetArtwork(QString inetref,
+ uint season);
+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);
Please sign in to comment.
Something went wrong with that request. Please try again.