Ticket #10250: mythgame-multi.patch

File mythgame-multi.patch, 87.4 KB (added by Chris Lack <psycho_driver@…>, 14 years ago)
  • mythplugins/mythgame/mythgame/dbcheck.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/dbcheck.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/dbcheck.cpp
    old new  
    1010#include "dbcheck.h"
    1111#include "gamesettings.h"
    1212
    13 const QString currentDatabaseVersion = "1018";
     13const QString currentDatabaseVersion = "1019";
    1414
    1515static bool UpdateDBVersionNumber(const QString &newnumber)
    1616{
     
    437437            return false;
    438438    }
    439439
     440    if (dbver == "1018")
     441    {
     442        const QString updates[] = {
     443"ALTER TABLE gamemetadata "
     444"ADD developer varchar(128) NOT NULL AFTER publisher,"
     445"ADD esrb tinyint(1) NOT NULL default -1 AFTER developer,"
     446"ADD metarating tinyint(1) NOT NULL default 0 AFTER esrb,"
     447"ADD rating tinyint(1) NOT NULL default 0 AFTER metarating;",
     448"ADD players tinyint(1) NOT NULL default 1 AFTER rating;",
     449""
     450};
     451        if (!performActualUpdate(updates, "1019", dbver))
     452          return false;
     453    }
     454
    440455    return true;
    441456}
  • mythplugins/mythgame/mythgame/gamedetails.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gamedetails.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/gamedetails.cpp
    old new  
    8181    handleText("year", m_romInfo->Year());
    8282    handleText("country", m_romInfo->Country());
    8383    handleText("publisher", m_romInfo->Publisher());
     84    handleText("developer", m_romInfo->Developer());
     85    handleText("esrb", m_romInfo->ESRB_str());
     86    handleText("metarating", m_romInfo->Metarating_str());
     87    handleText("rating", m_romInfo->Rating_str());
     88    handleText("players", QString::number(m_romInfo->Players()));
    8489    handleText("description", m_romInfo->Plot());
    8590    handleText("allsystems", m_romInfo->AllSystems());
    8691    handleImage("fanart", m_romInfo->Fanart());
  • mythplugins/mythgame/mythgame/gamedetails.h

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gamedetails.h mythtv-build-010912/mythplugins/mythgame/mythgame/gamedetails.h
    old new  
    3838    MythUIText  *m_country;
    3939    MythUIText  *m_plot;
    4040    MythUIText  *m_publisher;
     41    MythUIText  *m_developer;
     42    MythUIText  *m_esrb;
     43    MythUIText  *m_metarating;
     44    MythUIText  *m_rating;
     45    MythUIText  *m_players;
    4146    MythUIText  *m_allSystems;
    4247    MythUIImage *m_fanartImage;
    4348    MythUIImage *m_boxImage;
  • mythplugins/mythgame/mythgame/gamehandler.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gamehandler.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/gamehandler.cpp
    old new  
    155155    *Year = QObject::tr("19xx");
    156156    *Country = QObject::tr("Unknown");
    157157    *GameName = QObject::tr("Unknown");
    158     *Genre = QObject::tr("Unknown");
     158    *Genre = QString("Unknown%1").arg( handler->GameType() );
    159159    *Plot = QObject::tr("Unknown");
    160160    *Publisher = QObject::tr("Unknown");
    161161    *Version = QObject::tr("0");
     
    168168        {
    169169            LOG(VB_GENERAL, LOG_INFO, LOC + QString("ROMDB FOUND for %1 - %2")
    170170                     .arg(romDB[key].GameName()).arg(key));
    171             *Year = romDB[key].Year();
    172             *Country = romDB[key].Country();
    173             *Genre = romDB[key].Genre();
    174             *Publisher = romDB[key].Publisher();
    175             *GameName = romDB[key].GameName();
    176             *Version = romDB[key].Version();
     171            if (!romDB[key].Year().trimmed().isEmpty())
     172                *Year = romDB[key].Year();
     173            if (!romDB[key].Country().trimmed().isEmpty())
     174                *Country = romDB[key].Country();
     175            if (!romDB[key].Genre().trimmed().isEmpty())
     176                *Genre = romDB[key].Genre();
     177            if (!romDB[key].Publisher().trimmed().isEmpty())
     178                *Publisher = romDB[key].Publisher();
     179            if (!romDB[key].GameName().trimmed().isEmpty())
     180                *GameName = romDB[key].GameName();
     181            if (!romDB[key].Version().trimmed().isEmpty())
     182                *Version = romDB[key].Version();
    177183        }
    178184        else
    179185        {
    180186            LOG(VB_GENERAL, LOG_ERR, LOC + QString("NO ROMDB FOUND for %1 (%2)")
    181187                    .arg(rom).arg(*CRC32));
    182188        }
    183 
    184     };
    185 
    186     if ((*Genre == "Unknown") || (*Genre).isEmpty())
    187         *Genre = QString("Unknown%1").arg( handler->GameType() );
    188 
     189    }
    189190}
    190191
    191192static void purgeGameDB(QString filename, QString RomPath)
     
    390391
    391392    GameScanMap::Iterator iter;
    392393
    393     QString GameName, Genre, Country, CRC32, Year, Plot;
    394     QString Publisher, Version, Fanart, Boxart, ScreenShot;
     394    QString GameName, Genre, Country, CRC32, Year, Plot, Publisher;
     395    QString Developer, Version, Fanart, Boxart, ScreenShot;
    395396    QString thequery, queryvalues;
     397    int ESRB = -1, Metarating = 0, Rating = 0, Players = 1;
    396398
    397399    int removalprompt = gCoreContext->GetSetting("GameRemovalPrompt").toInt();
    398400    int indepth = gCoreContext->GetSetting("GameDeepScan").toInt();
    399401    QString screenShotPath = gCoreContext->GetSetting("mythgame.screenshotdir");
     402    Developer = QObject::tr("Unknown");
    400403
    401404    for (iter = m_GameMap.begin(); iter != m_GameMap.end(); ++iter)
    402405    {
     
    451454            query.prepare("INSERT INTO gamemetadata "
    452455                          "(system, romname, gamename, genre, year, gametype, "
    453456                          "rompath, country, crc_value, diskcount, display, plot, "
    454                           "publisher, version, fanart, boxart, screenshot) "
     457                          "publisher, developer, esrb, metarating, rating, "
     458                          "players, version, fanart, boxart, screenshot) "
    455459                          "VALUES (:SYSTEM, :ROMNAME, :GAMENAME, :GENRE, :YEAR, "
    456                           ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', '1', :PLOT, :PUBLISHER, :VERSION, "
    457                           ":FANART, :BOXART, :SCREENSHOT)");
     460                          ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', '1', :PLOT, "
     461                          ":PUBLISHER, :DEVELOPER, :ESRB, :METARATING, :RATING, "
     462                          ":PLAYERS, :VERSION, :FANART, :BOXART, :SCREENSHOT)");
    458463
    459464            query.bindValue(":SYSTEM",handler->SystemName());
    460465            query.bindValue(":ROMNAME",iter.value().Rom());
     
    467472            query.bindValue(":CRC32", CRC32);
    468473            query.bindValue(":PLOT", Plot);
    469474            query.bindValue(":PUBLISHER", Publisher);
     475            query.bindValue(":DEVELOPER", Developer);
     476            query.bindValue(":ESRB", QString::number(ESRB));
     477            query.bindValue(":METARATING", QString::number(Metarating));
     478            query.bindValue(":RATING", QString::number(Rating));
     479            query.bindValue(":PLAYERS", QString::number(Players));
    470480            query.bindValue(":VERSION", Version);
    471481            query.bindValue(":FANART", Fanart);
    472482            query.bindValue(":BOXART", Boxart);
  • mythplugins/mythgame/mythgame/gamescan.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gamescan.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/gamescan.cpp
    old new  
    117117            RomInfo *add = new RomInfo(0, (*p).romfile, (*p).system,
    118118                               (*p).romname, "", "", "", (*p).rompath,
    119119                               "", "", 0, (*p).gametype, 0, "", "", "",
    120                                "", "", "", "", "");
     120                               "", -1, 0, 0, 1, "", "", "", "", "");
    121121            add->SaveToDatabase();
    122122            m_DBDataChanged = true;
    123123        }
     
    125125            SendProgressEvent(++counter);
    126126    }
    127127
    128     for (QList<uint>::iterator p = m_remove.begin();
    129                                  p != m_remove.end(); ++p)
     128    // Do not remove if user has requested a prompt
     129    // Very annoying to accidentally hit the menu scan option when a large database
     130    // has been defined for games on a removable device
     131    if (!gCoreContext->GetSetting("GameRemovalPrompt").toInt())
    130132    {
    131         removeOrphan(*p);
    132         m_DBDataChanged = true;
     133        for (QList<uint>::iterator p = m_remove.begin(); p != m_remove.end(); ++p)
     134        {
     135            removeOrphan(*p);
     136            m_DBDataChanged = true;
     137        }
    133138    }
    134139}
    135140
  • mythplugins/mythgame/mythgame/gamesettings.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gamesettings.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/gamesettings.cpp
    old new  
    2424    HostLineEdit *gc = new HostLineEdit("GameAllTreeLevels");
    2525    gc->setLabel(QObject::tr("Game display order"));
    2626    gc->setValue("system gamename");
    27     gc->setHelpText(QObject::tr("Order in which to sort the games "
    28                     "- this is for all systems. Available choices: "
    29                     "system, year, genre and gamename"));
     27    gc->setHelpText(QObject::tr("Metadata values used to build dynamic game "
     28                    "tree. Available choices: system, year, genre, players, "
     29                    "esrb, rating, developer, publisher, and country"));
    3030    return gc;
    3131}
    3232
     
    3535    HostLineEdit *gc = new HostLineEdit("GameFavTreeLevels");
    3636    gc->setLabel(QObject::tr("Favourite display order"));
    3737    gc->setValue("gamename");
    38     gc->setHelpText(QObject::tr("Order in which to sort the games "
    39                     "marked as favourites "
    40                     "- this is for all systems. Available choices: "
    41                     "system, year, genre and gamename"));
     38    gc->setHelpText(QObject::tr("Order in which to sort the games marked "
     39                    "as favourites. Available choices: system, year, genre, "
     40                    "esrb, rating, developer, publisher, and country"));
    4241    return gc;
    4342}
    4443
  • mythplugins/mythgame/mythgame/gameui.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gameui.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/gameui.cpp
    old new  
    55#include <mythcontext.h>
    66#include <mythuibuttontree.h>
    77#include <metadata/mythuimetadataresults.h>
     8#include <metadata/mythuiimageresults.h>
    89#include <mythuiimage.h>
    910#include <mythuitext.h>
    1011#include <mythuistatetype.h>
     
    2425class GameTreeInfo
    2526{
    2627  public:
    27     GameTreeInfo(const QString& levels, const QString& filter)
    28       : m_levels(levels.split(" "))
     28    GameTreeInfo(const QString& sortby, const QString& si, const QString& filter)
     29      : m_sortby(sortby.split(" "))
     30      , m_sorted(si.toLower())
    2931      , m_filter(filter)
    3032    {
    3133    }
    3234
    33     int getDepth() const                        { return m_levels.size(); }
    34     const QString& getLevel(unsigned i) const   { return m_levels[i]; }
     35    int getDepth() const                        { return m_sortby.size(); }
     36    const QString& getLevel(unsigned i) const   { return m_sortby[i]; }
    3537    const QString& getFilter() const            { return m_filter; }
     38    const QString& getSorted(unsigned i) const { return m_sorted[i]; }
     39    void setSorted(const QString &lsorted, int i)
     40    {
     41        if (i > 0)
     42            m_sorted.insert(i, lsorted.toLower());
     43        while ((m_sorted.size() - 1) > i)
     44            m_sorted.removeLast();
     45    }
     46    const QStringList getToSort(int i)
     47    {
     48        QStringList to_sort = QStringList(m_sortby);
     49
     50        for (int k = 0; k < i; k++)
     51        {
     52            if (to_sort.contains(m_sorted[k]))
     53                to_sort.removeOne(m_sorted[k]);
     54        }
     55
     56        return to_sort;
     57    }
    3658
    3759  private:
    38     QStringList m_levels;
     60    QStringList m_sortby;
     61    QStringList m_sorted;
    3962    QString m_filter;
    4063};
    4164
     
    4467GameUI::GameUI(MythScreenStack *parent)
    4568       : MythScreenType(parent, "GameUI"),
    4669            m_showHashed(false), m_gameShowFileName(0),
    47             m_gameTree(NULL), m_favouriteNode(NULL),
    48             m_busyPopup(0),
     70            m_showHidden(false), m_gameTree(NULL),
     71            m_favouriteNode(NULL), m_busyPopup(0),
    4972            m_gameUITree(NULL), m_gameTitleText(NULL),
    5073            m_gameSystemText(NULL), m_gameYearText(NULL),
    5174            m_gameGenreText(NULL), m_gamePlotText(NULL),
     75            m_gamePublisherText(NULL), m_gameDeveloperText(NULL),
     76            m_gameESRBText(NULL), m_gameMetaratingText(NULL),
     77            m_gameRatingText(NULL), m_gamePlayersText(NULL),
    5278            m_gameFavouriteState(NULL), m_gameImage(NULL),
    5379            m_fanartImage(NULL), m_boxImage(NULL),
    5480            m_scanner(NULL)
     
    74100    UIUtilW::Assign(this, m_gameSystemText, "system");
    75101    UIUtilW::Assign(this, m_gameYearText, "year");
    76102    UIUtilW::Assign(this, m_gameGenreText, "genre");
     103    UIUtilW::Assign(this, m_gamePublisherText, "publisher");
     104    UIUtilW::Assign(this, m_gameDeveloperText, "developer");
     105    UIUtilW::Assign(this, m_gameESRBText, "esrb");
     106    UIUtilW::Assign(this, m_gameMetaratingText, "metarating");
     107    UIUtilW::Assign(this, m_gameRatingText, "rating");
     108    UIUtilW::Assign(this, m_gamePlayersText, "players");
    77109    UIUtilW::Assign(this, m_gameFavouriteState, "favorite");
    78110    UIUtilW::Assign(this, m_gamePlotText, "description");
    79111    UIUtilW::Assign(this, m_gameImage, "screenshot");
     
    134166    //  approach with multiple roots if/when someone has the time to create
    135167    //  the relevant dialog screens
    136168
    137     QString levels = gCoreContext->GetSetting("GameFavTreeLevels");
     169    QString sortby = gCoreContext->GetSetting("GameFavTreeLevels");
    138170
    139171    MythGenericTree *new_node = new MythGenericTree(tr("Favorites"), 1, true);
    140172    new_node->SetData(qVariantFromValue(
    141                 new GameTreeInfo(levels, systemFilter + " and favorite=1")));
     173                new GameTreeInfo(sortby, sortby.section(' ', 0, 0), systemFilter + " and favorite=1")));
    142174    m_favouriteNode = m_gameTree->addNode(new_node);
     175    if (m_gameTitleText)
     176        m_gameTitleText->SetText(QString("Sort by Favorites"));
    143177
    144     levels = gCoreContext->GetSetting("GameAllTreeLevels");
     178    sortby = gCoreContext->GetSetting("GameAllTreeLevels");
    145179
    146180    if (m_showHashed)
    147181    {
    148         int pos = levels.indexOf("gamename");
     182        int pos = sortby.indexOf("gamename");
    149183        if (pos >= 0)
    150             levels.insert(pos, " hash ");
     184            sortby.insert(pos, " hash ");
    151185    }
    152186
    153     new_node = new MythGenericTree(tr("All Games"), 1, true);
    154     new_node->SetData(qVariantFromValue(
    155                 new GameTreeInfo(levels, systemFilter)));
    156     m_gameTree->addNode(new_node);
     187    if (sortby.trimmed().isEmpty())
     188    {
     189        new_node = new MythGenericTree(tr("Games"), 1, true);
     190        new_node->SetData(qVariantFromValue(
     191                          new GameTreeInfo(m_showHashed ? "hash" : "gamename",
     192                                           m_showHashed ? "hash" : "gamename",
     193                                           systemFilter)));
     194        m_gameTree->addNode(new_node);
     195    }
    157196
    158     new_node = new MythGenericTree(tr("-   By Genre"), 1, true);
    159     new_node->SetData(qVariantFromValue(
    160                 new GameTreeInfo("genre gamename", systemFilter)));
    161     m_gameTree->addNode(new_node);
     197    QString sort_item;
     198    for (unsigned i = 0; !(sort_item = sortby.section(' ', i, i).trimmed()).isEmpty(); i++)
     199    {
     200        QString new_sort = sortby;
    162201
    163     new_node = new MythGenericTree(tr("-   By Year"), 1, true);
    164     new_node->SetData(qVariantFromValue(
    165                 new GameTreeInfo("year gamename", systemFilter)));
    166     m_gameTree->addNode(new_node);
     202        new_sort.remove(sort_item + " ");
     203        new_sort.insert(0, sort_item + " ");
    167204
    168     new_node = new MythGenericTree(tr("-   By Name"), 1, true);
    169     new_node->SetData(qVariantFromValue(
    170                 new GameTreeInfo("gamename", systemFilter)));
    171     m_gameTree->addNode(new_node);
    172 
    173     new_node = new MythGenericTree(tr("-   By Publisher"), 1, true);
    174     new_node->SetData(qVariantFromValue(
    175                 new GameTreeInfo("publisher gamename", systemFilter)));
    176     m_gameTree->addNode(new_node);
     205        sort_item[0] = sort_item[0].toUpper();
     206        new_node = new MythGenericTree(sort_item, 1, true);
     207        new_node->SetData(qVariantFromValue(
     208                          new GameTreeInfo(new_sort.trimmed(), sort_item, systemFilter)));
     209        m_gameTree->addNode(new_node);
     210    }
    177211
     212    fillNode(m_gameTree->getSelectedChild());
    178213    m_gameUITree->AssignTree(m_gameTree);
    179214}
    180215
     
    221256    if (!node)
    222257        return;
    223258
     259    int sortLevel = (node->getInt() / 2);
     260    bool sortTree = (node->getInt() % 2);
     261
    224262    if (!isLeaf(node))
    225263    {
     264        if (sortLevel && !sortTree)
     265        {
     266            QString si = node->getParent()->getString().toLower();
     267            setSortedString(node, si, sortLevel - 1);
     268        }
     269
    226270        if (node->childCount() == 0 || node == m_favouriteNode)
    227271        {
    228272            node->deleteAllChildren();
    229273            fillNode(node);
    230274        }
    231275        clearRomInfo();
     276
     277        if (m_gameTitleText && sortTree)
     278            m_gameTitleText->SetText(QString("Sort by " + node->getString()));
     279
     280        if (sortLevel)
     281        {
     282            if (!sortTree)
     283            {
     284                QString tmptitle = getSortedString(node, sortLevel - 1);
     285
     286                if (m_gameTitleText)
     287                {
     288                    if (tmptitle == "esrb")
     289                        tmptitle = tmptitle.toUpper();
     290                    else
     291                        tmptitle[0] = tmptitle[0].toUpper();
     292
     293                    m_gameTitleText->SetText("Select " + tmptitle);
     294                }
     295            }
     296        }
    232297    }
    233298    else
    234299    {
     
    329394        m_gameGenreText->SetText(rom->Genre());
    330395    if (m_gamePlotText)
    331396        m_gamePlotText->SetText(rom->Plot());
     397    if (m_gamePublisherText)
     398        m_gamePublisherText->SetText(rom->Publisher());
     399    if (m_gameDeveloperText)
     400        m_gameDeveloperText->SetText(rom->Developer());
     401    if (m_gameESRBText)
     402        m_gameESRBText->SetText(rom->ESRB_str());
     403    if (m_gameMetaratingText)
     404        m_gameMetaratingText->SetText(rom->Metarating_str());
     405    if (m_gameRatingText)
     406        m_gameRatingText->SetText(rom->Rating_str());
     407    if (m_gamePlayersText)
     408        m_gamePlayersText->SetText(QString::number(rom->Players()));
    332409
    333410    if (m_gameFavouriteState)
    334411    {
     
    367444        m_gameGenreText->Reset();
    368445    if (m_gamePlotText)
    369446        m_gamePlotText->Reset();
     447    if (m_gamePublisherText)
     448        m_gamePublisherText->Reset();
     449    if (m_gameDeveloperText)
     450        m_gameDeveloperText->Reset();
     451    if (m_gameESRBText)
     452        m_gameESRBText->Reset();
     453    if (m_gameMetaratingText)
     454        m_gameMetaratingText->Reset();
     455    if (m_gameRatingText)
     456        m_gameRatingText->Reset();
     457    if (m_gamePlayersText)
     458        m_gamePlayersText->Reset();
    370459    if (m_gameFavouriteState)
    371460        m_gameFavouriteState->Reset();
    372461
     
    438527        showMenuPopup->SetReturnEvent(this, "showMenuPopup");
    439528
    440529        showMenuPopup->AddButton(tr("Scan For Changes"));
     530
     531        if (showHidden())
     532            showMenuPopup->AddButton(tr("Hide Hidden"));
     533        else
     534            showMenuPopup->AddButton(tr("Show Hidden"));
     535
    441536        if (isLeaf(node))
    442537        {
    443538            RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
     
    521616            {
    522617                doScan();
    523618            }
     619            else if (resulttext == tr("Show Hidden") ||
     620                     resulttext == tr("Hide Hidden"))
     621            {
     622                toggleHidden();
     623            }
    524624            else if (resulttext == tr("Show Information"))
    525625            {
    526626                showInfo();
     
    637737
    638738QString GameUI::getFillSql(MythGenericTree *node) const
    639739{
    640     QString layer = node->getString();
    641     int childDepth = node->getInt() + 1;
    642     QString childLevel = getChildLevelString(node);
     740    int sortLevel = (node->getInt() / 2);
     741    bool sortTree = (node->getInt() % 2);
     742    QString layer = sortTree ? node->getString() : node->getParent()->getString();
     743    QString childLevel = layer.toLower();
    643744    QString filter = getFilter(node);
    644     bool childIsLeaf = childDepth == getLevelsOnThisBranch(node) + 1;
     745    bool childIsLeaf = ((layer == "Games") || (sortLevel == getLevelsOnThisBranch(node)));
    645746    RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
    646747
    647748    QString columns;
    648749    QString conj = "where ";
    649750
     751    if (childIsLeaf)
     752    {
     753        childLevel = m_showHashed ? "hash" : "gamename";
     754    }
     755    else if (layer == "Favorites")
     756    {
     757        childLevel = getChildLevelString(node);
     758    }
     759
    650760    if (!filter.isEmpty())
    651761    {
    652762        filter = conj + filter;
     
    713823            filter += conj + "publisher=:PUBLISHER";
    714824            conj = " and ";
    715825        }
     826        if (!romInfo->Developer().isEmpty())
     827        {
     828            filter += conj + "developer=:DEVELOPER";
     829            conj = " and ";
     830        }
     831        if (!romInfo->Country().isEmpty())
     832        {
     833            filter += conj + "trim(country)=:COUNTRY";
     834        }
    716835        if (!romInfo->Gamename().isEmpty())
    717836        {
    718837            filter += conj + "trim(gamename)=:GAMENAME";
    719838        }
    720839
     840        for (int i = 0; i < sortLevel; i++)
     841        {
     842            QString si = getSortedString(node, i);
     843
     844            if (si == "esrb")
     845                filter += conj + "esrb=:ESRB";
     846            else if (si == "metarating")
     847                filter += conj + "metarating=:METARATING";
     848            else if (si == "rating")
     849                filter += conj + "rating=:RATING";
     850            else if (si == "players")
     851                filter += conj + "players=:PLAYERS";
     852        }
    721853    }
    722854
    723     filter += conj + " display = 1 ";
     855    if (!showHidden())
     856        filter += conj + " display = 1 ";
    724857
    725858    QString sql;
    726859
     
    758891
    759892QString GameUI::getChildLevelString(MythGenericTree *node) const
    760893{
    761     unsigned this_level = node->getInt();
     894    unsigned this_level = node->getInt() / 2;
    762895    while (node->getInt() != 1)
    763896        node = node->getParent();
    764897
    765898    GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData());
    766     return gi->getLevel(this_level - 1);
     899    return gi->getLevel(this_level);
     900}
     901
     902QString GameUI::getSortedString(MythGenericTree *node, unsigned index) const
     903{
     904    unsigned this_index = (index == 0xffff) ? (node->getInt() / 2): index;
     905    while (node->getInt() != 1)
     906        node = node->getParent();
     907
     908    GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData());
     909    return gi->getSorted(this_index);
    767910}
    768911
    769912QString GameUI::getFilter(MythGenericTree *node) const
     
    774917    return gi->getFilter();
    775918}
    776919
     920void GameUI::setSortedString(MythGenericTree *node, QString si, unsigned index)
     921{
     922    while (node->getInt() != 1)
     923        node = node->getParent();
     924    GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData());
     925    gi->setSorted(si, index);
     926}
     927
     928QStringList GameUI::getToSortList(MythGenericTree *node, int index)
     929{
     930    while (node->getInt() != 1)
     931        node = node->getParent();
     932    GameTreeInfo *gi = qVariantValue<GameTreeInfo *>(node->GetData());
     933    return gi->getToSort(index);
     934}
     935
    777936int GameUI::getLevelsOnThisBranch(MythGenericTree *node) const
    778937{
    779938    while (node->getInt() != 1)
     
    785944
    786945bool GameUI::isLeaf(MythGenericTree *node) const
    787946{
    788   return (node->getInt() - 1) == getLevelsOnThisBranch(node);
     947    return (((node->getInt() - 1) / 2) == getLevelsOnThisBranch(node)) || node->getParent()->getString() == "Games";
    789948}
    790949
    791950void GameUI::fillNode(MythGenericTree *node)
    792951{
    793952    QString layername = node->getString();
    794953    RomInfo *romInfo = qVariantValue<RomInfo *>(node->GetData());
     954    int sortLevel = (node->getInt() / 2);
     955    bool sortTree = (node->getInt() % 2);
     956
     957    bool childIsLeaf = (layername == "Games") ||
     958                  (!sortTree && (sortLevel == getLevelsOnThisBranch(node)));
     959
     960    if (!childIsLeaf && sortLevel && !sortTree)
     961    {
     962        QStringList ts = getToSortList(node, sortLevel);
     963        int ns = getLevelsOnThisBranch(node);
     964
     965        MythGenericTree *new_node = new MythGenericTree(tr("Games"),
     966                                                        node->getInt() + 1,
     967                                                        false);
     968        new_node->SetData(qVariantFromValue(romInfo));
     969        node->addNode(new_node);
     970
     971        for (int i = 0; i < (ns - sortLevel); i++)
     972        {
     973            QString ni = ts[i];
     974
     975            if (ni == "esrb")
     976                ni = ni.toUpper();
     977            else
     978                ni[0] = ni[0].toUpper();
     979
     980            MythGenericTree *new_node = new MythGenericTree(ni,
     981                                                            node->getInt() + 1,
     982                                                            false);
     983            new_node->SetData(qVariantFromValue(romInfo));
     984            node->addNode(new_node);
     985        }
     986
     987        return;
     988    }
    795989
    796990    MSqlQuery query(MSqlQuery::InitCon());
    797991
     
    8091003            query.bindValue(":PLOT", romInfo->Plot());
    8101004        if (!romInfo->Publisher().isEmpty())
    8111005            query.bindValue(":PUBLISHER", romInfo->Publisher());
     1006        if (!romInfo->Developer().isEmpty())
     1007            query.bindValue(":DEVELOPER", romInfo->Developer());
     1008
     1009        for (int i = 0; i < sortLevel; i++)
     1010        {
     1011            QString si = getSortedString(node, i);
     1012
     1013            if (si == "esrb")
     1014                query.bindValue(":ESRB", QString::number(romInfo->ESRB()));
     1015            else if (si == "metarating")
     1016                query.bindValue(":METARATING", QString::number(romInfo->Metarating()));
     1017            else if (si == "rating")
     1018                query.bindValue(":RATING", QString::number(romInfo->Rating()));
     1019            else if (si == "players")
     1020                query.bindValue(":PLAYERS", QString::number(romInfo->Players()));
     1021        }
     1022
     1023        if (!romInfo->Country().isEmpty())
     1024            query.bindValue(":COUNTRY", romInfo->Country());
    8121025        if (!romInfo->Gamename().isEmpty())
    8131026            query.bindValue(":GAMENAME", romInfo->Gamename());
    8141027    }
    8151028
    816     bool IsLeaf = node->getInt() == getLevelsOnThisBranch(node);
    8171029    if (query.exec() && query.size() > 0)
    8181030    {
    8191031        while (query.next())
     
    8211033            QString current = query.value(0).toString().trimmed();
    8221034            MythGenericTree *new_node =
    8231035                new MythGenericTree(current, node->getInt() + 1, false);
    824             if (IsLeaf)
     1036            if (childIsLeaf)
    8251037            {
    8261038                RomInfo *temp = new RomInfo();
    8271039                temp->setSystem(query.value(1).toString().trimmed());
     
    8341046            else
    8351047            {
    8361048                RomInfo *newRomInfo;
    837                 if (node->getInt() > 1)
     1049                if (sortLevel > 0)
    8381050                {
    8391051                    RomInfo *currentRomInfo;
    8401052                    currentRomInfo = qVariantValue<RomInfo *>(node->GetData());
     
    8461058                }
    8471059                new_node->SetData(qVariantFromValue(newRomInfo));
    8481060                node->addNode(new_node);
    849                 if (getChildLevelString(node) != "hash")
    850                     newRomInfo->setField(getChildLevelString(node), current);
     1061                QString ci = node->getString().toLower();
     1062
     1063                if (ci != "hash")
     1064                {
     1065                    if (ci == "favorites")
     1066                        ci = getChildLevelString(node);
     1067
     1068                    newRomInfo->setField(ci, current);
     1069                    if (ci == "rating")
     1070                        new_node->SetText(newRomInfo->Rating_str());
     1071                    else if (ci == "esrb")
     1072                        new_node->SetText(newRomInfo->ESRB_str());
     1073                }
    8511074            }
    8521075        }
    8531076    }
     
    9701193        return;
    9711194
    9721195    metadata->setGamename(lookup->GetTitle());
    973     metadata->setYear(QString::number(lookup->GetYear()));
    9741196    metadata->setPlot(lookup->GetDescription());
    975     metadata->setSystem(lookup->GetSystem());
     1197    if (metadata->Genre().trimmed().isEmpty() || metadata->Genre().contains("Unknown"))
     1198        metadata->setGenre(lookup->GetCategories().join("/"));
     1199    if (metadata->Country().trimmed().isEmpty())
     1200        metadata->setCountry(lookup->GetCountries().join("/"));
     1201    if (metadata->Publisher().trimmed().isEmpty() || metadata->Publisher().contains("Unknown"))
     1202        metadata->setPublisher(lookup->GetPublishers().join("/"));
     1203    if (metadata->Developer().trimmed().isEmpty() || metadata->Developer().contains("Unknown"))
     1204        metadata->setDeveloper(lookup->GetStudios().join("/"));
     1205    if ((metadata->Year().trimmed().isEmpty() || !metadata->Year().compare("0") ||
     1206        !metadata->Year().compare("19xx")) && (lookup->GetYear() > 1950))
     1207        metadata->setYear(QString::number(lookup->GetYear()));
     1208    if (lookup->GetPopularity() > 0)
     1209        metadata->setMetarating(lookup->GetPopularity());
    9761210
    977     QStringList coverart, fanart, screenshot;
     1211    m_metadataNode = node;
    9781212
    9791213    // Imagery
    9801214    ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
    981     for (ArtworkList::const_iterator p = coverartlist.begin();
    982         p != coverartlist.end(); ++p)
     1215    if (coverartlist.count() > 0)
    9831216    {
    984         coverart.prepend((*p).url);
     1217        ImageSearchResultsDialog *resultsdialog =
     1218              new ImageSearchResultsDialog(m_popupStack, coverartlist, kArtworkCoverart);
     1219
     1220        connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)),
     1221                SLOT(OnImageSearchListSelection(ArtworkInfo, VideoArtworkType)));
     1222
     1223        if (resultsdialog->Create())
     1224            m_popupStack->AddScreen(resultsdialog);
    9851225    }
     1226
    9861227    ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
    987     for (ArtworkList::const_iterator p = fanartlist.begin();
    988         p != fanartlist.end(); ++p)
     1228    if (fanartlist.count() > 0)
    9891229    {
    990         fanart.prepend((*p).url);
     1230        ImageSearchResultsDialog *resultsdialog =
     1231              new ImageSearchResultsDialog(m_popupStack, fanartlist, kArtworkFanart);
     1232
     1233        connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)),
     1234                SLOT(OnImageSearchListSelection(ArtworkInfo, VideoArtworkType)));
     1235
     1236        if (resultsdialog->Create())
     1237            m_popupStack->AddScreen(resultsdialog);
    9911238    }
     1239
    9921240    ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
    993     for (ArtworkList::const_iterator p = screenshotlist.begin();
    994         p != screenshotlist.end(); ++p)
     1241    if (screenshotlist.count() > 0)
    9951242    {
    996         screenshot.prepend((*p).url);
    997     }
     1243        ImageSearchResultsDialog *resultsdialog =
     1244              new ImageSearchResultsDialog(m_popupStack, screenshotlist, kArtworkScreenshot);
    9981245
    999     StartGameImageSet(node, coverart, fanart, screenshot);
     1246        connect(resultsdialog, SIGNAL(haveResult(ArtworkInfo, VideoArtworkType)),
     1247                SLOT(OnImageSearchListSelection(ArtworkInfo, VideoArtworkType)));
     1248
     1249        if (resultsdialog->Create())
     1250            m_popupStack->AddScreen(resultsdialog);
     1251    }
    10001252
    10011253    metadata->SaveToDatabase();
    10021254    updateChangedNode(node, metadata);
    10031255}
    10041256
    1005 void GameUI::StartGameImageSet(MythGenericTree *node, QStringList coverart,
    1006                                      QStringList fanart, QStringList screenshot)
     1257void GameUI::OnImageSearchListSelection(ArtworkInfo info, VideoArtworkType type)
    10071258{
    1008     if (!node)
    1009         return;
    1010 
    1011     RomInfo *metadata = qVariantValue<RomInfo *>(node->GetData());
     1259    RomInfo *metadata = qVariantValue<RomInfo *>(m_metadataNode->GetData());
    10121260
    10131261    if (!metadata)
    10141262        return;
    10151263
    1016     ArtworkMap map;
    1017 
    1018     QString inetref = metadata->Inetref();
    1019     QString system = metadata->System();
    1020     QString title = metadata->Gamename();
    1021 
    1022     if (metadata->Boxart().isEmpty() && coverart.size())
    1023     {
    1024         ArtworkInfo info;
    1025         info.url = coverart.takeAt(0).trimmed();
    1026         map.insert(kArtworkCoverart, info);
    1027     }
    1028 
    1029     if (metadata->Fanart().isEmpty() && fanart.size())
    1030     {
    1031         ArtworkInfo info;
    1032         info.url = fanart.takeAt(0).trimmed();
    1033         map.insert(kArtworkFanart, info);
    1034     }
    1035 
    1036     if (metadata->Screenshot().isEmpty() && screenshot.size())
    1037     {
    1038         ArtworkInfo info;
    1039         info.url = screenshot.takeAt(0).trimmed();
    1040         map.insert(kArtworkScreenshot, info);
    1041     }
    1042 
    1043     MetadataLookup *lookup = new MetadataLookup();
    1044     lookup->SetTitle(metadata->Gamename());
    1045     lookup->SetSystem(metadata->System());
    1046     lookup->SetInetref(metadata->Inetref());
    1047     lookup->SetType(kMetadataGame);
    1048     lookup->SetDownloads(map);
    1049     lookup->SetData(qVariantFromValue(node));
    1050 
    1051     m_imageDownload->addDownloads(lookup);
     1264    MetadataLookup *m_lookup = new MetadataLookup();
     1265    m_lookup->SetType(kMetadataGame);
     1266    m_lookup->SetHost(gCoreContext->GetMasterHostName());
     1267    m_lookup->SetAutomatic(true);
     1268
     1269    ArtworkMap downloads;
     1270    downloads.insert(type, info);
     1271    m_lookup->SetDownloads(downloads);
     1272    m_lookup->SetAllowOverwrites(true);
     1273    m_lookup->SetTitle(metadata->Gamename());
     1274    m_lookup->SetSystem(metadata->System());
     1275    m_lookup->SetInetref(metadata->Inetref());
     1276    m_lookup->SetData(qVariantFromValue(m_metadataNode));
     1277    m_imageDownload->addDownloads(m_lookup);
    10521278}
    10531279
    10541280void GameUI::handleDownloadedImages(MetadataLookup *lookup)
  • mythplugins/mythgame/mythgame/gameui.h

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/gameui.h mythtv-build-010912/mythplugins/mythgame/mythgame/gameui.h
    old new  
    4444    void OnGameSearchDone(MetadataLookup *lookup);
    4545    void StartGameImageSet(MythGenericTree *node, QStringList coverart,
    4646                           QStringList fanart, QStringList screenshot);
     47    void OnImageSearchListSelection(ArtworkInfo info, VideoArtworkType type);
    4748    void doScan(void);
    4849    void reloadAllData(bool dbchanged);
    4950
     
    5556    void showMenu(void);
    5657    void searchStart(void);
    5758    void toggleFavorite(void);
     59    void toggleHidden(void) { m_showHidden = 1 - m_showHidden; }
     60    int  showHidden() const { return m_showHidden; }
    5861    void customEvent(QEvent *event);
    5962    void createBusyDialog(QString title);
    6063
    6164    QString getFillSql(MythGenericTree* node) const;
    6265    QString getChildLevelString(MythGenericTree *node) const;
     66    QString getSortedString(MythGenericTree *node, unsigned level=0xffff) const;
    6367    QString getFilter(MythGenericTree *node) const;
     68    void    setSortedString(MythGenericTree *node, QString si, unsigned index);
     69    QStringList getToSortList(MythGenericTree *node, int index);
    6470    int     getLevelsOnThisBranch(MythGenericTree *node) const;
    6571    bool    isLeaf(MythGenericTree *node) const;
    6672    void    fillNode(MythGenericTree *node);
     
    7177  private:
    7278    bool m_showHashed;
    7379    int m_gameShowFileName;
     80    bool m_showHidden;
    7481
    7582    MythGenericTree  *m_gameTree;
    7683    MythGenericTree  *m_favouriteNode;
     84    MythGenericTree  *m_metadataNode;
    7785
    7886    MythUIBusyDialog *m_busyPopup;
    7987    MythScreenStack  *m_popupStack;
     
    8492    MythUIText       *m_gameYearText;
    8593    MythUIText       *m_gameGenreText;
    8694    MythUIText       *m_gamePlotText;
     95    MythUIText       *m_gamePublisherText;
     96    MythUIText       *m_gameDeveloperText;
     97    MythUIText       *m_gameESRBText;
     98    MythUIText       *m_gameMetaratingText;
     99    MythUIText       *m_gameRatingText;
     100    MythUIText       *m_gamePlayersText;
    87101    MythUIStateType  *m_gameFavouriteState;
    88102    MythUIImage      *m_gameImage;
    89103    MythUIImage      *m_fanartImage;
  • mythplugins/mythgame/mythgame/romedit.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/romedit.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/romedit.cpp
    old new  
    2020        QString name, RomInfo *romInfo) : MythScreenType(parent, name),
    2121    m_id(""), m_retObject(NULL), m_gamenameEdit(NULL), m_genreEdit(NULL),
    2222    m_yearEdit(NULL), m_countryEdit(NULL), m_plotEdit(NULL),
    23     m_publisherEdit(NULL), m_favoriteCheck(NULL), m_screenshotButton(NULL),
    24     m_screenshotText(NULL), m_fanartButton(NULL), m_fanartText(NULL),
    25     m_boxartButton(NULL), m_boxartText(NULL), m_doneButton(NULL)
     23    m_publisherEdit(NULL), m_developerEdit(NULL), m_esrbList(NULL),
     24    m_ratingList(NULL), m_playersEdit(NULL), m_favoriteCheck(NULL),
     25    m_displayCheck(NULL), m_screenshotButton(NULL), m_screenshotText(NULL),
     26    m_fanartButton(NULL), m_fanartText(NULL), m_boxartButton(NULL),
     27    m_boxartText(NULL), m_doneButton(NULL)
    2628{
    2729    m_workingRomInfo = new RomInfo(*romInfo);
    2830}
     
    4446    UIUtilE::Assign(this, m_countryEdit, "country_edit", &err);
    4547    UIUtilE::Assign(this, m_plotEdit, "description_edit", &err);
    4648    UIUtilE::Assign(this, m_publisherEdit, "publisher_edit", &err);
     49    UIUtilE::Assign(this, m_developerEdit, "developer_edit", &err);
     50    UIUtilE::Assign(this, m_esrbList, "esrb_list", &err);
     51    UIUtilE::Assign(this, m_ratingList, "rating_list", &err);
     52    UIUtilE::Assign(this, m_playersEdit, "players_edit", &err);
    4753
    4854    UIUtilE::Assign(this, m_favoriteCheck, "favorite_check", &err);
     55    UIUtilE::Assign(this, m_displayCheck, "display_check", &err);
    4956
    5057    UIUtilE::Assign(this, m_screenshotButton, "screenshot_button", &err);
    5158    UIUtilE::Assign(this, m_screenshotText, "screenshot_text", &err);
     
    7279    connect(m_countryEdit, SIGNAL(valueChanged()), SLOT(SetCountry()));
    7380    connect(m_plotEdit, SIGNAL(valueChanged()), SLOT(SetPlot()));
    7481    connect(m_publisherEdit, SIGNAL(valueChanged()), SLOT(SetPublisher()));
     82    connect(m_developerEdit, SIGNAL(valueChanged()), SLOT(SetDeveloper()));
     83    connect(m_esrbList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(SetESRB()));
     84    connect(m_ratingList, SIGNAL(itemSelected(MythUIButtonListItem *)), SLOT(SetRating()));
     85    connect(m_playersEdit, SIGNAL(valueChanged()), SLOT(SetPlayers()));
    7586
    7687    connect(m_favoriteCheck, SIGNAL(valueChanged()), SLOT(ToggleFavorite()));
    77 
     88    connect(m_displayCheck, SIGNAL(valueChanged()), SLOT(ToggleDisplay()));
    7889    connect(m_screenshotButton, SIGNAL(Clicked()), SLOT(FindScreenshot()));
    7990    connect(m_fanartButton, SIGNAL(Clicked()), SLOT(FindFanart()));
    8091    connect(m_boxartButton, SIGNAL(Clicked()), SLOT(FindBoxart()));
     
    147158    m_countryEdit->SetText(m_workingRomInfo->Country());
    148159    m_plotEdit->SetText(m_workingRomInfo->Plot());
    149160    m_publisherEdit->SetText(m_workingRomInfo->Publisher());
    150 
     161    m_developerEdit->SetText(m_workingRomInfo->Developer());
     162    new MythUIButtonListItem(m_esrbList, "RP");
     163    new MythUIButtonListItem(m_esrbList, "C");
     164    new MythUIButtonListItem(m_esrbList, "E");
     165    new MythUIButtonListItem(m_esrbList, "E10");
     166    new MythUIButtonListItem(m_esrbList, "T");
     167    new MythUIButtonListItem(m_esrbList, "M");
     168    new MythUIButtonListItem(m_esrbList, "AO");
     169    m_esrbList->SetItemCurrent(m_workingRomInfo->ESRB() + 1);
     170    new MythUIButtonListItem(m_ratingList, "Unrated");
     171    new MythUIButtonListItem(m_ratingList, "1");
     172    new MythUIButtonListItem(m_ratingList, "2");
     173    new MythUIButtonListItem(m_ratingList, "3");
     174    new MythUIButtonListItem(m_ratingList, "4");
     175    new MythUIButtonListItem(m_ratingList, "5");
     176    new MythUIButtonListItem(m_ratingList, "6");
     177    new MythUIButtonListItem(m_ratingList, "7");
     178    new MythUIButtonListItem(m_ratingList, "8");
     179    new MythUIButtonListItem(m_ratingList, "9");
     180    new MythUIButtonListItem(m_ratingList, "10");
     181    m_ratingList->SetItemCurrent(m_workingRomInfo->Rating());
     182    m_playersEdit->SetText(QString::number(m_workingRomInfo->Players()));   
    151183    if (m_workingRomInfo->Favorite())
    152184        m_favoriteCheck->SetCheckState(MythUIStateType::Full);
     185    if (m_workingRomInfo->Display())
     186        m_displayCheck->SetCheckState(MythUIStateType::Full);
    153187
    154188    m_screenshotText->SetText(m_workingRomInfo->Screenshot());
    155189    m_fanartText->SetText(m_workingRomInfo->Fanart());
     
    207241    m_workingRomInfo->setPublisher(m_publisherEdit->GetText());
    208242}
    209243
     244void EditRomInfoDialog::SetDeveloper()
     245{
     246    m_workingRomInfo->setDeveloper(m_developerEdit->GetText());
     247}
     248
     249void EditRomInfoDialog::SetESRB()
     250{
     251    m_workingRomInfo->setESRB(m_esrbList->GetCurrentPos() - 1);
     252}
     253
     254void EditRomInfoDialog::SetRating()
     255{
     256    m_workingRomInfo->setRating(m_ratingList->GetCurrentPos());
     257}
     258
     259void EditRomInfoDialog::SetPlayers()
     260{
     261    m_workingRomInfo->setPlayers(m_playersEdit->GetText().toInt());
     262}
     263
    210264void EditRomInfoDialog::ToggleFavorite()
    211265{
    212266    m_workingRomInfo->setFavorite();
    213267}
    214268
     269void EditRomInfoDialog::ToggleDisplay()
     270{
     271    m_workingRomInfo->setDisplay();
     272}
     273
    215274void EditRomInfoDialog::FindScreenshot()
    216275{
    217276    FindImagePopup(gCoreContext->GetSetting("mythgame.screenshotDir"),
     
    238297    if (file.isEmpty())
    239298        return;
    240299
    241     m_workingRomInfo->setScreenshot(file);
    242     m_screenshotText->SetText(file);
     300    if (file.size() == 1)
     301    {
     302        m_workingRomInfo->setScreenshot(NULL);
     303        m_screenshotText->SetText(NULL);
     304    }
     305    else
     306    {
     307        m_workingRomInfo->setScreenshot(file);
     308        m_screenshotText->SetText(file);
     309    }
    243310}
    244311
    245312void EditRomInfoDialog::SetFanart(QString file)
     
    247314    if (file.isEmpty())
    248315        return;
    249316
    250     m_workingRomInfo->setFanart(file);
    251     m_fanartText->SetText(file);
     317    if (file.size() == 1)
     318    {
     319        m_workingRomInfo->setFanart(NULL);
     320        m_fanartText->SetText(NULL);
     321    }
     322    else
     323    {
     324        m_workingRomInfo->setFanart(file);
     325        m_fanartText->SetText(file);
     326    }
    252327}
    253328
    254329void EditRomInfoDialog::SetBoxart(QString file)
     
    256331    if (file.isEmpty())
    257332        return;
    258333
    259     m_workingRomInfo->setBoxart(file);
    260     m_boxartText->SetText(file);
     334    if (file.size() == 1)
     335    {
     336        m_workingRomInfo->setBoxart(NULL);
     337        m_boxartText->SetText(NULL);
     338    }
     339    else
     340    {
     341        m_workingRomInfo->setBoxart(file);
     342        m_boxartText->SetText(file);
     343    }
    261344}
  • mythplugins/mythgame/mythgame/romedit.h

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/romedit.h mythtv-build-010912/mythplugins/mythgame/mythgame/romedit.h
    old new  
    2727    void SetCountry();
    2828    void SetPlot();
    2929    void SetPublisher();
     30    void SetDeveloper();
     31    void SetESRB();
     32    void SetMetarating();
     33    void SetRating();
     34    void SetPlayers();
    3035    void ToggleFavorite();
     36    void ToggleDisplay();
    3137    void FindScreenshot();
    3238    void FindFanart();
    3339    void FindBoxart();
     
    5056    MythUITextEdit      *m_countryEdit;
    5157    MythUITextEdit      *m_plotEdit;
    5258    MythUITextEdit      *m_publisherEdit;
     59    MythUITextEdit      *m_developerEdit;
     60    MythUIButtonList    *m_esrbList;
     61    MythUIButtonList    *m_ratingList;
     62    MythUITextEdit      *m_playersEdit;
    5363    MythUICheckBox      *m_favoriteCheck;
     64    MythUICheckBox      *m_displayCheck;
    5465    MythUIButton        *m_screenshotButton;
    5566    MythUIText          *m_screenshotText;
    5667    MythUIButton        *m_fanartButton;
  • mythplugins/mythgame/mythgame/rominfo.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/rominfo.cpp mythtv-build-010912/mythplugins/mythgame/mythgame/rominfo.cpp
    old new  
    3333        query.prepare("INSERT INTO gamemetadata "
    3434                      "(system, romname, gamename, genre, year, gametype, "
    3535                      "rompath, country, crc_value, diskcount, display, plot, "
    36                       "publisher, version, fanart, boxart, screenshot) "
     36                      "publisher, developer, esrb, metarating, rating, players, "
     37                      "version, fanart, boxart, screenshot) "
    3738                      "VALUES (:SYSTEM, :ROMNAME, :GAMENAME, :GENRE, :YEAR, "
    38                       ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', '1', :PLOT, "
    39                       ":PUBLISHER, :VERSION, :FANART, :BOXART, :SCREENSHOT)");
     39                      ":GAMETYPE, :ROMPATH, :COUNTRY, :CRC32, '1', :DISPLAY, "
     40                      ":PLOT, :PUBLISHER, :DEVELOPER, :ESRB, :METARATING, "
     41                      ":RATING, :PLAYERS, :VERSION, :FANART, :BOXART, "
     42                      ":SCREENSHOT)");
    4043
    4144        query.bindValue(":SYSTEM",System());
    4245        query.bindValue(":ROMNAME",Romname());
     
    4750        query.bindValue(":ROMPATH",Rompath());
    4851        query.bindValue(":COUNTRY",Country());
    4952        query.bindValue(":CRC32", QString());
     53        query.bindValue(":DISPLAY", Display());
    5054        query.bindValue(":PLOT", Plot());
    5155        query.bindValue(":PUBLISHER", Publisher());
     56        query.bindValue(":DEVELOPER", Developer());
     57        query.bindValue(":ESRB", QString::number(ESRB()));
     58        query.bindValue(":METARATING", QString::number(Metarating()));
     59        query.bindValue(":RATING", QString::number(Rating()));
     60        query.bindValue(":PLAYERS", QString::number(Players()));
    5261        query.bindValue(":VERSION", Version());
    5362        query.bindValue(":FANART", Fanart());
    5463        query.bindValue(":BOXART", Boxart());
     
    6271                      "    genre = :GENRE,"
    6372                      "    year = :YEAR,"
    6473                      "    country = :COUNTRY,"
     74                      "    display = :DISPLAY,"
    6575                      "    plot = :PLOT,"
    6676                      "    publisher = :PUBLISHER,"
     77                      "    developer = :DEVELOPER,"
     78                      "    esrb = :ESRB,"
     79                      "    metarating = :METARATING,"
     80                      "    rating = :RATING,"
     81                      "    players = :PLAYERS,"
    6782                      "    favorite = :FAVORITE,"
    6883                      "    screenshot = :SCREENSHOT,"
    6984                      "    fanart = :FANART,"
    7085                      "    boxart = :BOXART, "
    71                       "    inetref = :INETREF "
     86                      "    inetref = :INETREF, "
     87                      "    display = :DISPLAY "
    7288                      "WHERE gametype = :GAMETYPE AND "
    7389                      "      romname  = :ROMNAME");
    7490        query.bindValue(":GAMENAME", Gamename());
    7591        query.bindValue(":GENRE", Genre());
    7692        query.bindValue(":YEAR", Year());
    7793        query.bindValue(":COUNTRY", Country());
    7894        query.bindValue(":PLOT", Plot());
    7995        query.bindValue(":PUBLISHER", Publisher());
     96        query.bindValue(":DEVELOPER", Developer());
     97        query.bindValue(":ESRB", QString::number(ESRB()));
     98        query.bindValue(":METARATING", QString::number(Metarating()));
     99        query.bindValue(":RATING", QString::number(Rating()));
     100        query.bindValue(":PLAYERS", QString::number(Players()));
    80101        query.bindValue(":FAVORITE", Favorite());
    81102        query.bindValue(":SCREENSHOT", Screenshot());
    82103        query.bindValue(":FANART", Fanart());
    83104        query.bindValue(":BOXART", Boxart());
    84105        query.bindValue(":INETREF", Inetref());
     106        query.bindValue(":DISPLAY", Display());
    85107        query.bindValue(":GAMETYPE", GameType());
    86108        query.bindValue(":ROMNAME", Romname());
    87109    }
     
    197219        plot = data;
    198220    else if (field == "publisher")
    199221        publisher = data;
     222    else if (field == "developer")
     223        developer = data;
     224    else if (field == "esrb")
     225        esrb = data.toInt();
     226    else if (field == "metarating")
     227        metarating = data.toInt();
     228    else if (field == "rating")
     229        rating = data.toInt();
     230    else if (field == "players")
     231        players = data.toInt();
    200232    else if (field == "crc_value")
    201233        crc_value = data;
    202234    else if (field == "inetref")
    203235        inetref = data;
     236    else if (field == "display")
     237        display = data.toInt();
    204238    else if (field == "diskcount")
    205239        diskcount = data.toInt();
    206240    else if (field == "gametype")
     
    262296
    263297    QString thequery = "SELECT system,gamename,genre,year,romname,favorite,"
    264298                       "rompath,country,crc_value,diskcount,gametype,plot,publisher,"
    265                        "version,screenshot,fanart,boxart,inetref,intid FROM gamemetadata "
    266                        "WHERE gamename = :GAMENAME "
    267                        + systemtype + " ORDER BY diskcount DESC";
     299                       "developer,esrb,metarating,rating,players,version,screenshot,"
     300                       "fanart,boxart,inetref,display,intid "
     301                       "FROM gamemetadata WHERE gamename = :GAMENAME " + systemtype +
     302                       " ORDER BY diskcount DESC";
    268303
    269304    query.prepare(thequery);
    270305    query.bindValue(":SYSTEM", system);
     
    285320        setGameType(query.value(10).toString());
    286321        setPlot(query.value(11).toString());
    287322        setPublisher(query.value(12).toString());
    288         setVersion(query.value(13).toString());
    289         setScreenshot(query.value(14).toString());
    290         setFanart(query.value(15).toString());
    291         setBoxart(query.value(16).toString());
    292         setInetref(query.value(17).toString());
    293         setId(query.value(18).toInt());
     323        setDeveloper(query.value(13).toString());
     324        setESRB(query.value(14).toInt());
     325        setMetarating(query.value(15).toInt());
     326        setRating(query.value(16).toInt());
     327        setPlayers(query.value(17).toInt());
     328        setVersion(query.value(18).toString());
     329        setScreenshot(query.value(19).toString());
     330        setFanart(query.value(20).toString());
     331        setBoxart(query.value(21).toString());
     332        setInetref(query.value(22).toString());
     333        setField("display",query.value(23).toString());
     334        setId(query.value(24).toInt());
    294335    }
    295336
    296337    setRomCount(romInDB(romname,gametype));
     
    325366
    326367    MSqlQuery query(MSqlQuery::InitCon());
    327368
    328     QString querystr = "SELECT intid,system,romname,gamename,genre,year,publisher,"
     369    QString querystr = "SELECT intid,system,romname,gamename,genre,year,"
     370                       "publisher,developer,esrb,metarating,rating,players,"
    329371                       "favorite,rompath,screenshot,fanart,plot,boxart,"
    330372                       "gametype,diskcount,country,crc_value,inetref,display,"
    331373                       "version FROM gamemetadata ORDER BY diskcount DESC";
     
    347389                           query.value(3).toString(),
    348390                           query.value(4).toString(),
    349391                           query.value(5).toString(),
    350                            query.value(7).toBool(),
    351                            query.value(8).toString(),
    352                            query.value(15).toString(),
    353                            query.value(16).toString(),
    354                            query.value(14).toInt(),
     392                           query.value(12).toBool(),
    355393                           query.value(13).toString(),
     394                           query.value(20).toString(),
     395                           query.value(21).toString(),
     396                           query.value(19).toInt(),
     397                           query.value(18).toString(),
    356398                           0, QString(),
    357                            query.value(11).toString(),
     399                           query.value(16).toString(),
    358400                           query.value(6).toString(),
    359                            query.value(19).toString(),
    360                            query.value(9).toString(),
    361                            query.value(10).toString(),
    362                            query.value(12).toString(),
    363                            query.value(17).toString());
     401                           query.value(7).toString(),
     402                           query.value(8).toInt(),
     403                           query.value(9).toInt(),
     404                           query.value(10).toInt(),
     405                           query.value(11).toInt(),
     406                           query.value(24).toString(),
     407                           query.value(14).toString(),
     408                           query.value(15).toString(),
     409                           query.value(17).toString(),
     410                           query.value(22).toString());
    364411        ret.append(add);
    365412    }
    366413
     
    373420
    374421    MSqlQuery query(MSqlQuery::InitCon());
    375422
    376     QString querystr = "SELECT intid,system,romname,gamename,genre,year,publisher,"
     423    QString querystr = "SELECT intid,system,romname,gamename,genre,year,"
     424                       "publisher,developer,esrb,metarating,rating,players,"
    377425                       "favorite,rompath,screenshot,fanart,plot,boxart,"
    378426                       "gametype,diskcount,country,crc_value,inetref,display,"
    379427                       "version FROM gamemetadata WHERE intid = :INTID";
     
    396444                           query.value(3).toString(),
    397445                           query.value(4).toString(),
    398446                           query.value(5).toString(),
    399                            query.value(7).toBool(),
    400                            query.value(8).toString(),
    401                            query.value(15).toString(),
    402                            query.value(16).toString(),
    403                            query.value(14).toInt(),
     447                           query.value(12).toBool(),
    404448                           query.value(13).toString(),
     449                           query.value(20).toString(),
     450                           query.value(21).toString(),
     451                           query.value(19).toInt(),
     452                           query.value(18).toString(),
    405453                           0, QString(),
    406                            query.value(11).toString(),
     454                           query.value(16).toString(),
    407455                           query.value(6).toString(),
    408                            query.value(19).toString(),
    409                            query.value(9).toString(),
    410                            query.value(10).toString(),
    411                            query.value(12).toString(),
    412                            query.value(17).toString());
     456                           query.value(7).toString(),
     457                           query.value(8).toInt(),
     458                           query.value(9).toInt(),
     459                           query.value(10).toInt(),
     460                           query.value(11).toInt(),
     461                           query.value(24).toString(),
     462                           query.value(14).toString(),
     463                           query.value(15).toString(),
     464                           query.value(17).toString(),
     465                           query.value(22).toString(),
     466                           query.value(23).toBool());
    413467    }
    414468
    415469    return ret;
  • mythplugins/mythgame/mythgame/rominfo.h

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/rominfo.h mythtv-build-010912/mythplugins/mythgame/mythgame/rominfo.h
    old new  
    1818            QString lrompath = "", QString lcountry ="", QString lcrc_value = "",
    1919            int ldiskcount = 0, QString lgametype = "", int lromcount = 0,
    2020            QString lallsystems = "", QString lplot = "", QString lpublisher = "",
    21             QString lversion = "", QString lscreenshot = "", QString lfanart = "",
    22             QString lboxart = "", QString linetref = "")
     21            QString ldeveloper = "", int lesrb = -1, int lmetarating = 0,
     22            int lrating = 0, int lplayers = 1, QString lversion = "",
     23            QString lscreenshot = "", QString lfanart = "", QString lboxart = "",
     24            QString linetref = "", bool ldisplay = true)
    2325            {
    2426                id = lid;
    2527                romname = lromname;
     
    4042                allsystems = lallsystems;
    4143                plot = lplot;
    4244                publisher = lpublisher;
     45                developer = ldeveloper;
     46                esrb = lesrb;
     47                metarating = lmetarating;
     48                rating = lrating;
     49                players = lplayers;
    4350                version = lversion;
    4451                inetref = linetref;
     52                display = ldisplay;
    4553            }
    4654
    4755    RomInfo(const RomInfo &lhs)
     
    6573                allsystems = lhs.allsystems;
    6674                plot = lhs.plot;
    6775                publisher = lhs.publisher;
     76                developer = lhs.developer;
     77                esrb = lhs.esrb;
     78                metarating = lhs.metarating;
     79                rating = lhs.rating;
     80                players = lhs.players;
    6881                version = lhs.version;
    6982                inetref = lhs.inetref;
     83                display = lhs.display;
    7084            }
    7185
    7286    ~RomInfo() {}
     
    124138    QString Publisher() const { return publisher; }
    125139    void setPublisher(const QString &lpublisher) { publisher = lpublisher; }
    126140
     141    QString Developer() const { return developer; }
     142    void setDeveloper(const QString &ldeveloper) { developer = ldeveloper; }
     143
     144    int ESRB() const { return esrb; }
     145    QString ESRB_str() const
     146    {
     147        switch (esrb)
     148        {
     149            case 0:
     150                return "C";
     151            case 1:
     152                return "E";
     153            case 2:
     154                return "E10";
     155            case 3:
     156                return "T";
     157            case 4:
     158                return "M";
     159            case 5:
     160                return "AO";
     161            default:
     162                return "RP";
     163        }
     164    }
     165    void setESRB(const int &lesrb) { esrb = lesrb; }
     166
     167    int Metarating() const { return metarating; }
     168    QString Metarating_str() const
     169    {
     170        if (metarating == 0)
     171            return "Unrated";
     172
     173        return QString::number(metarating);
     174    }
     175    void setMetarating(const int &lmetarating) { metarating = lmetarating; }
     176
     177    int Rating() const { return rating; }
     178    QString Rating_str() const
     179    {
     180        if (rating == 0)
     181            return "Unrated";
     182
     183        return QString::number(rating);
     184    }
     185    void setRating(const int &lrating) { rating = lrating; }
     186
     187    int Players() const { return players; }
     188    void setPlayers(const int &lplayers) { players = lplayers; }
     189
    127190    QString Version() const { return version; }
    128191    void setVersion(const QString &lversion) { version = lversion; }
    129192
     
    136199    int Favorite() const { return favorite; }
    137200    void setFavorite(bool updateDatabase = false);
    138201
     202    int Display() const { return display; }
     203    void setDisplay() { display = 1 - display; }
     204
    139205    QString getExtension();
    140206    QString toString();
    141207
     
    157223    QString allsystems;
    158224    QString plot;
    159225    QString publisher;
     226    QString developer;
     227    int esrb;
     228    int metarating;
     229    int rating;
     230    int players;
    160231    QString version;
    161232    int romcount;
    162233    int diskcount;
     
    167238    QString fanart;
    168239    QString boxart;
    169240    QString inetref;
     241    bool display;
    170242};
    171243
    172244bool operator==(const RomInfo& a, const RomInfo& b);
  • mythplugins/mythgame/mythgame/scripts/giantbomb/XSLT/giantbombGame.xsl

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/scripts/giantbomb/XSLT/giantbombGame.xsl mythtv-build-010912/mythplugins/mythgame/mythgame/scripts/giantbomb/XSLT/giantbombGame.xsl
    old new  
    6363                        </xsl:for-each>
    6464                    </systems>
    6565                </xsl:if>
    66                 <xsl:if test=".//company">
     66                <xsl:if test=".//publishers">
     67                    <publishers>
     68                        <xsl:for-each select=".//publishers/company">
     69                            <xsl:element name="publisher">
     70                                <xsl:attribute name="name"><xsl:value-of select="normalize-space(./name)"/></xsl:attribute>
     71                            </xsl:element>
     72                        </xsl:for-each>
     73                    </publishers>
     74                </xsl:if>
     75                <xsl:if test=".//developers">
    6776                    <studios>
    68                         <xsl:for-each select=".//company">
     77                        <xsl:for-each select=".//developers/company">
    6978                            <xsl:element name="studio">
    7079                                <xsl:attribute name="name"><xsl:value-of select="normalize-space(./name)"/></xsl:attribute>
    7180                            </xsl:element>
    7281                        </xsl:for-each>
    7382                    </studios>
    7483                </xsl:if>
     84                <xsl:if test="./expected_release_year/text() != ''">
     85                    <year><xsl:value-of select="normalize-space(./expected_release_year)"/></year>
     86                </xsl:if>
    7587                <!-- Input format: 2001-10-23 00:00:00 -->
    7688                <xsl:if test="./original_release_date/text() != ''">
    77                     <releasedate><xsl:value-of select="gamebombXpath:pubDate(string(./original_release_date), '%Y-%m-%d %H:%M:%S', '%Y-%m-%d')"/></releasedate>
    78                 </xsl:if>
    79                 <xsl:if test="./original_release_date/text() = ''">
    80                     <xsl:if test="gamebombXpath:futureReleaseDate(.) != ''">
    81                         <releasedate><xsl:value-of select="gamebombXpath:futureReleaseDate(.)"/></releasedate>
    82                     </xsl:if>
     89                    <year><xsl:value-of select="gamebombXpath:pubDate(string(./original_release_date), '%Y-%m-%d %H:%M:%S', '%Y')"/></year>
    8390                </xsl:if>
    8491                <!--Input format: 2010-05-10 16:59:49.972923 -->
    8592                <xsl:if test="./date_last_updated/text() != ''">
  • mythplugins/mythgame/mythgame/scripts/giantbomb/giantbomb_api.py

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/mythgame/scripts/giantbomb/giantbomb_api.py mythtv-build-010912/mythplugins/mythgame/mythgame/scripts/giantbomb/giantbomb_api.py
    old new  
    103103        self.config['debug'] = debug
    104104
    105105        self.config['searchURL'] = u'http://api.giantbomb.com/search/?api_key=%s&offset=0&query=%%s&resources=game&format=xml' % self.config['apikey']
     106        self.config['platformsURL'] = u'http://api.giantbomb.com/game/%%s/?api_key=%s&format=xml&field_list=platforms' % self.config['apikey']
    106107        self.config['dataURL'] = u'http://api.giantbomb.com/game/%%s/?api_key=%s&format=xml' % self.config['apikey']
    107108
    108109        self.error_messages = {'GiantBombHttpError': u"! Error: A connection error to api.giantbomb.com was raised (%s)\n", 'GiantBombXmlError': u"! Error: Invalid XML was received from api.giantbomb.com (%s)\n", 'GiantBombBaseError': u"! Error: An error was raised (%s)\n", }
     
    262263        return args[0]
    263264    # end pubDate()
    264265
    265     def futureReleaseDate(self, context, gameElement):
    266         '''Convert the "expected" release date into the default MNV item format.
    267         return the formatted pubDate string
    268         return If there is not enough information to make a date then return an empty string
    269         '''
    270         try:
    271             if gameElement.find('expected_release_year').text != None:
    272                 year = gameElement.find('expected_release_year').text
    273             else:
    274                 year = None
    275             if gameElement.find('expected_release_quarter').text != None:
    276                 quarter = gameElement.find('expected_release_quarter').text
    277             else:
    278                 quarter = None
    279             if gameElement.find('expected_release_month').text != None:
    280                 month = gameElement.find('expected_release_month').text
    281             else:
    282                 month = None
    283         except:
    284             return u''
    285         if not year:
    286             return u''
    287         if month and not quarter:
    288             pubdate = time.strptime((u'%s-%s-01' % (year, month)), '%Y-%m-%d')
    289         elif not month and quarter:
    290             month = str((int(quarter)*3))
    291             pubdate = time.strptime((u'%s-%s-01' % (year, month)), '%Y-%m-%d')
    292         else:
    293             pubdate = time.strptime((u'%s-12-01' % (year, )), '%Y-%m-%d')
    294 
    295         return time.strftime('%Y-%m-%d', pubdate)
    296     # end futureReleaseDate()
    297 
    298266    def findImages(self, context, *args):
    299267        '''Parse the "image" and "description" elements for images and put in a persistant array
    300268        return True when there are images available
     
    382350            'htmlToString': self.htmlToString,
    383351            'getHtmlData': self.getHtmlData,
    384352            'pubDate': self.pubDate,
    385             'futureReleaseDate': self.futureReleaseDate,
    386353            'findImages': self.findImages,
    387354            'getImages': self.getImages,
    388355            'supportedJobs': self.supportedJobs,
     
    416383
    417384        items = queryXslt(queryResult)
    418385
     386        games = items.xpath('//item')
     387        for x in range(0, len(games)):
     388            inrtag = games[x].find("inetref")
     389            nametag = games[x].find("title")
     390            url = self.config['platformsURL'] % inrtag.text
     391            res = etree.parse(url, parser=self.xmlParser)
     392            ptag = res.xpath('//name')
     393            display = nametag.text
     394            display += ' for '
     395            for i in range(0, len(ptag)):
     396                display += '%s/' % ptag[i].text
     397            display = display[:-1]
     398            nametag.text = display
     399
    419400        if items.getroot() != None:
    420401            if len(items.xpath('//item')):
    421402                sys.stdout.write(etree.tostring(items, encoding='UTF-8', method="xml", xml_declaration=True, pretty_print=True, ))
  • mythplugins/mythgame/theme/default/game-ui.xml

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/theme/default/game-ui.xml mythtv-build-010912/mythplugins/mythgame/theme/default/game-ui.xml
    old new  
    8484  <window name="edit_metadata">
    8585
    8686    <textarea name="title" from="basetextarea">
    87         <area>10,50,1260,50</area>
     87        <area>10,10,780,50</area>
    8888        <value>Edit Game Information</value>
    8989        <align>hcenter,vcenter</align>
    9090        <font>baselarge</font>
     
    9393    <!-- Labels -->
    9494
    9595    <textarea name="gamename_label" from="basetextarea">
    96         <area>25,110,250,40</area>
     96        <area>0,62,190,40</area>
    9797        <value>Game Name:</value>
    9898        <align>right,top</align>
    9999    </textarea>
    100100
     101    <textarea name="favorite_label" from="basetextarea">
     102        <area>480,62,250,40</area>
     103        <value>Favorite:</value>
     104        <align>right,top</align>
     105    </textarea>
     106
    101107    <textarea name="genre_label" from="basetextarea">
    102         <area>25,155,250,40</area>
     108        <area>0,107,190,40</area>
    103109        <value>Genre:</value>
    104110        <align>right,top</align>
    105111    </textarea>
    106112
     113    <textarea name="display_label" from="basetextarea">
     114        <area>480,107,250,40</area>
     115        <value>Display:</value>
     116        <align>right,top</align>
     117    </textarea>
     118
    107119    <textarea name="year_label" from="basetextarea">
    108         <area>25,200,250,40</area>
     120        <area>0,152,190,40</area>
    109121        <value>Year:</value>
    110122        <align>right,top</align>
    111123    </textarea>
    112124
     125    <textarea name="esrb_label" from="basetextarea">
     126        <area>460,147,340,40</area>
     127        <value>ESRB</value>
     128        <align>center</align>
     129    </textarea>
     130
    113131    <textarea name="country_label" from="basetextarea">
    114         <area>25,245,250,40</area>
     132        <area>0,197,190,40</area>
    115133        <value>Country:</value>
    116134        <align>right,top</align>
    117135    </textarea>
    118136
    119137    <textarea name="publisher_label" from="basetextarea">
    120         <area>25,290,250,40</area>
     138        <area>0,242,190,40</area>
    121139        <value>Publisher:</value>
    122140        <align>right,top</align>
    123141    </textarea>
    124142
    125     <textarea name="plot_label" from="basetextarea">
    126         <area>25,335,250,40</area>
    127         <value>Plot:</value>
     143    <textarea name="rating_label" from="basetextarea">
     144        <area>460,237,340,40</area>
     145        <value>Rating</value>
     146        <align>center</align>
     147    </textarea>
     148
     149    <textarea name="developer_label" from="basetextarea">
     150        <area>0,287,190,40</area>
     151        <value>Developer:</value>
    128152        <align>right,top</align>
    129153    </textarea>
    130154
    131     <textarea name="favorite_label" from="basetextarea">
    132         <area>25,385,250,40</area>
    133         <value>Favorite:</value>
     155    <textarea name="players_label" from="basetextarea">
     156        <area>0,332,190,40</area>
     157        <value>Players:</value>
     158        <align>right,top</align>
     159    </textarea>
     160
     161    <textarea name="plot_label" from="basetextarea">
     162        <area>0,377,190,40</area>
     163        <value>Plot:</value>
    134164        <align>right,top</align>
    135165    </textarea>
    136166
    137167    <textarea name="screenshot_label" from="basetextarea">
    138         <area>25,430,250,40</area>
     168        <area>0,430,190,40</area>
    139169        <value>Screenshot:</value>
    140170        <align>right,top</align>
    141171    </textarea>
    142172
    143173    <textarea name="fanart_label" from="basetextarea">
    144         <area>25,475,250,40</area>
     174        <area>0,475,190,40</area>
    145175        <value>Fanart:</value>
    146176        <align>right,top</align>
    147177    </textarea>
    148178
    149179    <textarea name="coverart_label" from="basetextarea">
    150         <area>25,520,250,40</area>
     180        <area>0,520,190,40</area>
    151181        <value>Boxart:</value>
    152182        <align>right,top</align>
    153183    </textarea>
     
    155185    <!-- Widgets -->
    156186
    157187    <textedit name="title_edit" from="basetextedit">
    158         <position>285,100</position>
     188        <position>200,60</position>
    159189    </textedit>
    160190
     191    <checkbox name="favorite_check" from="basecheckbox">
     192        <position>740,60</position>
     193    </checkbox>
     194
    161195    <textedit name="genre_edit" from="basetextedit">
    162         <position>285,145</position>
     196        <position>200,105</position>
    163197    </textedit>
    164198
     199    <checkbox name="display_check" from="basecheckbox">
     200        <position>740,105</position>
     201    </checkbox>
     202
    165203    <textedit name="year_edit" from="basetextedit">
    166         <position>285,190</position>
     204        <position>200,150</position>
    167205    </textedit>
    168206
    169207    <textedit name="country_edit" from="basetextedit">
    170         <position>285,235</position>
     208        <position>200,195</position>
    171209    </textedit>
    172210
     211    <buttonlist name="esrb_list" from="baseselector">
     212        <position>535,185</position>
     213    </buttonlist>
     214
    173215    <textedit name="publisher_edit" from="basetextedit">
    174         <position>285,280</position>
     216        <position>200,240</position>
    175217    </textedit>
    176218
    177     <textedit name="description_edit" from="basetextedit">
    178         <position>285,325</position>
     219    <textedit name="developer_edit" from="basetextedit">
     220        <position>200,285</position>
    179221    </textedit>
    180222
    181     <checkbox name="favorite_check" from="basecheckbox">
    182         <position>285,380</position>
    183     </checkbox>
     223    <buttonlist name="rating_list" from="baseselector">
     224        <position>535,275</position>
     225    </buttonlist>
     226
     227    <textedit name="players_edit" from="basetextedit">
     228        <position>200,330</position>
     229    </textedit>
     230
     231    <textedit name="description_edit">
     232        <area>200,365,590,60</area>
     233        <statetype name="background">
     234            <state name="active">
     235                <area>0,0,590,60</area>
     236                <shape name="background" from="basewidgetshape" />
     237                <shape name="textbackground">
     238                    <area>0,0,590,60</area>
     239                    <type>roundbox</type>
     240                    <cornerradius>4</cornerradius>
     241                    <fill color="#FFFFFF" alpha="200" />
     242                </shape>
     243            </state>
     244            <state name="selected" from="active">
     245                <shape name="background">
     246                    <shape name="background" from="baseselectedwidgetshape" />
     247                </shape>
     248                <shape name="textbackground">
     249                    <fill color="#FFFFFF" alpha="255" />
     250                </shape>
     251            </state>
     252            <state name="inactive" from="active" />
     253        </statetype>
     254        <imagetype name="cursor">
     255        </imagetype>
     256        <textarea name="text">
     257            <area>3,1,557,57</area>
     258            <font>basesmallblack</font>
     259            <multiline>yes</multiline>
     260        </textarea>
     261    </textedit>
    184262
    185263    <button name="screenshot_button" from="basesearchbutton">
    186         <position>285,420</position>
     264        <position>200,430</position>
    187265    </button>
    188266
    189267    <textarea name="screenshot_text" from="basetextarea">
    190         <area>325,425,250,40</area>
     268        <area>240,430,550,40</area>
    191269        <value>/path/to/the/thing.jpg</value>
    192270    </textarea>
    193271
    194272    <button name="fanart_button" from="basesearchbutton">
    195         <position>285,465</position>
     273        <position>200,475</position>
    196274    </button>
    197275
    198276    <textarea name="fanart_text" from="basetextarea">
    199         <area>325,470,250,40</area>
     277        <area>240,475,550,40</area>
    200278        <value>/path/to/the/thing.jpg</value>
    201279    </textarea>
    202280
    203281    <button name="coverart_button" from="basesearchbutton">
    204         <position>285,510</position>
     282        <position>200,520</position>
    205283    </button>
    206284
    207285    <textarea name="coverart_text" from="basetextarea">
    208         <area>325,515,250,40</area>
     286        <area>240,520,550,40</area>
    209287        <value>/path/to/the/thing.jpg</value>
    210288    </textarea>
    211289
  • mythplugins/mythgame/theme/default-wide/game-ui.xml

    diff -ur /raidz/dev/htpc/mythtv-git/mythplugins/mythgame/theme/default-wide/game-ui.xml mythtv-build-010912/mythplugins/mythgame/theme/default-wide/game-ui.xml
    old new  
    227227        <!-- Labels -->
    228228
    229229        <textarea name="gamename_label" from="basetextarea">
    230             <area>250,110,250,40</area>
     230            <area>0,102,250,40</area>
    231231            <value>Game Name:</value>
    232232            <align>right,top</align>
    233233        </textarea>
    234234
    235235        <textarea name="genre_label" from="basetextarea">
    236             <area>250,155,250,40</area>
     236            <area>550,102,250,40</area>
    237237            <value>Genre:</value>
    238238            <align>right,top</align>
    239239        </textarea>
    240240
    241241        <textarea name="year_label" from="basetextarea">
    242             <area>250,200,250,40</area>
     242            <area>0,147,250,40</area>
    243243            <value>Year:</value>
    244244            <align>right,top</align>
    245245        </textarea>
    246246
    247247        <textarea name="country_label" from="basetextarea">
    248             <area>250,245,250,40</area>
     248            <area>550,147,250,40</area>
    249249            <value>Country:</value>
    250250            <align>right,top</align>
    251251        </textarea>
    252252
    253253        <textarea name="publisher_label" from="basetextarea">
    254             <area>250,290,250,40</area>
     254            <area>0,192,250,40</area>
    255255            <value>Publisher:</value>
    256256            <align>right,top</align>
    257257        </textarea>
    258258
    259         <textarea name="plot_label" from="basetextarea">
    260             <area>250,335,250,40</area>
    261             <value>Plot:</value>
     259        <textarea name="developer_label" from="basetextarea">
     260            <area>550,192,250,40</area>
     261            <value>Developer:</value>
     262            <align>right,top</align>
     263        </textarea>
     264
     265        <textarea name="players_label" from="basetextarea">
     266            <area>0,237,250,40</area>
     267            <value>Players:</value>
    262268            <align>right,top</align>
    263269        </textarea>
    264270
    265271        <textarea name="fav_label" from="basetextarea">
    266             <area>250,400,250,40</area>
     272            <area>520,237,250,40</area>
    267273            <value>Favorite:</value>
    268274            <align>right,top</align>
    269275        </textarea>
    270276
     277        <textarea name="display_label" from="basetextarea">
     278            <area>800,237,250,40</area>
     279            <value>Display:</value>
     280            <align>right,top</align>
     281        </textarea>
     282
     283        <textarea name="plot_label" from="basetextarea">
     284            <area>0,305,250,40</area>
     285            <value>Plot:</value>
     286            <align>right,top</align>
     287        </textarea>
     288
     289        <textarea name="esrb_label" from="basetextarea">
     290            <area>0,382,290,40</area>
     291            <value>ESRB:</value>
     292            <align>right,top</align>
     293        </textarea>
     294
     295        <textarea name="rating_label" from="basetextarea">
     296            <area>550,382,290,40</area>
     297            <value>Rating:</value>
     298            <align>right,top</align>
     299        </textarea>
     300
    271301        <textarea name="screenshot_label" from="basetextarea">
    272             <area>250,445,250,40</area>
     302            <area>0,425,250,40</area>
    273303            <value>Screenshot:</value>
    274304            <align>right,top</align>
    275305        </textarea>
    276306
    277307        <textarea name="fanart_label" from="basetextarea">
    278             <area>250,490,250,40</area>
     308            <area>0,470,250,40</area>
    279309            <value>Fanart:</value>
    280310            <align>right,top</align>
    281311        </textarea>
    282312
    283313        <textarea name="coverart_label" from="basetextarea">
    284             <area>250,535,250,40</area>
     314            <area>0,515,250,40</area>
    285315            <value>Boxart:</value>
    286316            <align>right,top</align>
    287317        </textarea>
     
    289319        <!-- Widgets -->
    290320
    291321        <textedit name="title_edit" from="basetextedit">
    292             <position>510,100</position>
     322            <position>260,100</position>
    293323        </textedit>
    294324
    295325        <textedit name="genre_edit" from="basetextedit">
    296             <position>510,145</position>
     326            <position>810,100</position>
    297327        </textedit>
    298328
    299329        <textedit name="year_edit" from="basetextedit">
    300             <position>510,190</position>
     330            <position>260,145</position>
    301331        </textedit>
    302332
    303333        <textedit name="country_edit" from="basetextedit">
    304             <position>510,235</position>
     334            <position>810,145</position>
    305335        </textedit>
    306336
    307337        <textedit name="publisher_edit" from="basetextedit">
    308             <position>510,280</position>
     338            <position>260,190</position>
     339        </textedit>
     340
     341        <textedit name="developer_edit" from="basetextedit">
     342            <position>810,190</position>
    309343        </textedit>
    310344
    311         <textedit name="description_edit" from="basetextedit">
    312             <position>510,325</position>
     345        <textedit name="players_edit" from="basetextedit">
     346            <position>260,235</position>
    313347        </textedit>
    314348
    315349        <checkbox name="favorite_check" from="basecheckbox">
    316             <position>510,400</position>
     350            <position>780,235</position>
    317351        </checkbox>
    318352
     353        <checkbox name="display_check" from="basecheckbox">
     354            <position>1060,235</position>
     355        </checkbox>
     356
     357        <textedit name="description_edit">
     358            <area>260,280,830,85</area>
     359            <statetype name="background">
     360                <state name="active">
     361                    <area>0,0,830,85</area>
     362                    <shape name="background" from="basewidgetshape" />
     363                    <shape name="textbackground">
     364                        <area>0,0,830,85</area>
     365                        <type>roundbox</type>
     366                        <cornerradius>4</cornerradius>
     367                        <fill color="#FFFFFF" alpha="200" />
     368                    </shape>
     369                </state>
     370                <state name="selected" from="active">
     371                    <shape name="background">
     372                        <shape name="background" from="baseselectedwidgetshape" />
     373                    </shape>
     374                    <shape name="textbackground">
     375                        <fill color="#FFFFFF" alpha="255" />
     376                    </shape>
     377                </state>
     378                <state name="inactive" from="active" />
     379            </statetype>
     380            <imagetype name="cursor">
     381                <filename>cursor.png</filename>
     382            </imagetype>
     383            <textarea name="text">
     384                <area>3,1,797,82</area>
     385                <font>basesmallblack</font>
     386                <multiline>yes</multiline>
     387            </textarea>
     388        </textedit>
     389
     390        <buttonlist name="esrb_list" from="baseselector">
     391            <position>300,375</position>
     392        </buttonlist>
     393
     394        <buttonlist name="rating_list" from="baseselector">
     395            <position>850,375</position>
     396        </buttonlist>
     397
    319398        <button name="screenshot_button" from="basesearchbutton">
    320             <position>510,445</position>
     399            <position>260,425</position>
    321400        </button>
    322401
    323402        <textarea name="screenshot_text" from="basetextarea">
    324             <area>550,440,750,40</area>
     403            <area>300,425,950,40</area>
    325404            <value>/path/to/the/thing.jpg</value>
    326405        </textarea>
    327406
    328407        <button name="fanart_button" from="basesearchbutton">
    329             <position>510,480</position>
     408            <position>260,470</position>
    330409        </button>
    331410
    332411        <textarea name="fanart_text" from="basetextarea">
    333             <area>550,485,750,40</area>
     412            <area>300,470,950,40</area>
    334413            <value>/path/to/the/thing.jpg</value>
    335414        </textarea>
    336415
    337416        <button name="coverart_button" from="basesearchbutton">
    338             <position>510,525</position>
     417            <position>260,515</position>
    339418        </button>
    340419
    341420        <textarea name="coverart_text" from="basetextarea">
    342             <area>550,530,750,40</area>
     421            <area>300,515,950,40</area>
    343422            <value>/path/to/the/thing.jpg</value>
    344423        </textarea>
    345424
  • mythtv/libs/libmythmetadata/metadatacommon.cpp

    diff -ur /raidz/dev/htpc/mythtv-git/mythtv/libs/libmythmetadata/metadatacommon.cpp mythtv-build-010912/mythtv/libs/libmythmetadata/metadatacommon.cpp
    old new  
    5555    m_album(),
    5656    m_tracknum(0),
    5757    m_system(),
     58    m_publishers(),
    5859    m_year(0),
    5960    m_releasedate(),
    6061    m_lastupdated(),
     
    119120    QString album,
    120121    uint tracknum,
    121122    const QString system,
     123    const QStringList publishers,
    122124    const uint year,
    123125    const QDate releasedate,
    124126    const QDateTime lastupdated,
     
    179181    m_album(album),
    180182    m_tracknum(tracknum),
    181183    m_system(system),
     184    m_publishers(publishers),
    182185    m_year(year),
    183186    m_releasedate(releasedate),
    184187    m_lastupdated(lastupdated),
     
    396399    metadataMap["album"] = m_album;
    397400    metadataMap["tracknum"] = QString::number(m_tracknum);
    398401    metadataMap["system"] = m_system;
     402    metadataMap["publishers"] = m_publishers.join(", ");
    399403    metadataMap["year"] = QString::number(m_year);
    400404
    401405    metadataMap["releasedate"] = MythDateToString(m_releasedate, kDateFull);
     
    799803        AddCertifications(lookup, item, docroot);
    800804    if (lookup->GetCategories().size())
    801805        AddCategories(lookup, item, docroot);
     806    if (lookup->GetPublishers().size())
     807        AddPublishers(lookup, item, docroot);
    802808    if (lookup->GetStudios().size())
    803809        AddStudios(lookup, item, docroot);
    804810    if (lookup->GetCountries().size())
     
    837843    }
    838844}
    839845
     846void AddPublishers(MetadataLookup *lookup,
     847                   QDomElement placetoadd,
     848                   QDomDocument docroot)
     849{
     850    QStringList pubs = lookup->GetPublishers();
     851    QDomElement publishers = docroot.createElement("publishers");
     852    placetoadd.appendChild(publishers);
     853
     854    for (QStringList::const_iterator i = pubs.begin();
     855            i != pubs.end(); ++i)
     856    {
     857        QDomElement pub = docroot.createElement("publisher");
     858        publishers.appendChild(pub);
     859        pub.setAttribute("name", *i);
     860    }
     861}
     862
    840863void AddStudios(MetadataLookup *lookup,
    841864                   QDomElement placetoadd,
    842865                   QDomDocument docroot)
     
    886909        channum, chansign, channame, chanplaybackfilters, recgroup,
    887910        playgroup, seriesid, programid, storagegroup, album, system,
    888911        inetref, tmsref, imdb, homepage, trailerURL, language;
    889     QStringList categories, countries, studios;
     912    QStringList categories, countries, publishers, studios;
    890913    float userrating = 0;
    891914    QDate releasedate;
    892915    QDateTime lastupdated, startts, endts, recstartts, recendts;
     
    10121035        }
    10131036    }
    10141037
     1038    // Publishers
     1039    QDomElement publishersxml = item.firstChildElement("publishers");
     1040    if (!publishersxml.isNull())
     1041    {
     1042        QDomElement publisher = publishersxml.firstChildElement("publisher");
     1043        if (!publisher.isNull())
     1044        {
     1045            while (!publisher.isNull())
     1046            {
     1047                if (publisher.hasAttribute("name"))
     1048                    publishers.append(publisher.attribute("name"));
     1049                publisher = publisher.nextSiblingElement("publisher");
     1050            }
     1051        }
     1052    }
     1053
    10151054    // Studios
    10161055    QDomElement studiosxml = item.firstChildElement("studios");
    10171056    if (!studiosxml.isNull())
     
    10781117        chanplaybackfilters, recgroup, playgroup, seriesid, programid,
    10791118        storagegroup, startts, endts, recstartts, recendts, programflags,
    10801119        audioproperties, videoproperties, subtitletype, certification,
    1081         countries, popularity, budget, revenue, album, tracknum, system, year,
    1082         releasedate, lastupdated, runtime, runtimesecs, inetref, tmsref,
    1083         imdb, people, studios, homepage, trailerURL, artwork, DownloadMap());
     1120        countries, popularity, budget, revenue, album, tracknum, system,
     1121        publishers, year, releasedate, lastupdated, runtime, runtimesecs,
     1122        inetref, tmsref, imdb, people, studios, homepage, trailerURL, artwork,
     1123        DownloadMap());
    10841124}
    10851125
    10861126MetadataLookup* ParseMetadataMovieNFO(const QDomElement& item,
  • mythtv/libs/libmythmetadata/metadatacommon.h

    diff -ur /raidz/dev/htpc/mythtv-git/mythtv/libs/libmythmetadata/metadatacommon.h mythtv-build-010912/mythtv/libs/libmythmetadata/metadatacommon.h
    old new  
    118118        QString album,
    119119        uint tracknum,
    120120        QString system,
     121        const QStringList publishers,
    121122        const uint year,
    122123        const QDate releasedate,
    123124        const QDateTime lastupdated,
     
    304305
    305306    // General - Game
    306307    QString GetSystem() const { return m_system; };
     308    QStringList GetPublishers() const { return m_publishers; };
    307309
    308310    // Times
    309311    uint GetYear() const { return m_year; };
     
    384386
    385387    // General - Game
    386388    QString m_system;
     389    QStringList m_publishers;
    387390
    388391    // Times
    389392    uint m_year;
     
    427430META_PUBLIC void AddCategories(MetadataLookup *lookup,
    428431                               QDomElement placetoadd,
    429432                               QDomDocument docroot);
     433META_PUBLIC void AddPublishers(MetadataLookup *lookup,
     434                               QDomElement placetoadd,
     435                               QDomDocument docroot);
    430436META_PUBLIC void AddStudios(MetadataLookup *lookup,
    431437                            QDomElement placetoadd,
    432438                            QDomDocument docroot);