Index: configure
===================================================================
--- configure	(revision 11310)
+++ configure	(working copy)
@@ -22,6 +22,7 @@
 controls="yes"
 flix="yes"
 archive="yes"
+movies="yes"
 
 cc="gcc"
 
@@ -104,6 +105,9 @@
 
 MythWeather related options:
   --enable-mythweather     build the mythweather plugin [$weather]
+
+MythMovies related options:
+  --enable-mythmovies      build the mythmovies plugin [$movies]
 EOF
 exit 1
 fi
@@ -198,6 +202,10 @@
   ;;
   --disable-mythflix) flix="no"
   ;;
+  --enable-mythmovies) movies="yes"
+  ;;
+  --disable-mythmovies) movies="no"
+  ;;
   --enable-opengl) opengl="yes"
   ;;
   --disable-opengl) opengl="no"
@@ -238,6 +246,7 @@
                  browser="yes";
                  controls="yes";
                  flix="yes";
+                 movies="yes";
                  sdl="yes";
                  opengl="yes";
                  fftw_lib="yes";
@@ -260,6 +269,7 @@
                  browser="no";
                  controls="no";
                  flix="no";
+                 movies="no";
                  sdl="no";  
                  opengl="no"; 
                  fftw_lib="no"; 
@@ -618,6 +628,12 @@
   echo "        MythWeather    plugin will not be built"
 fi
 
+if test "$movies" = "yes" ; then
+  echo "        MythMovies     plugin will be built"
+  echo "SUBDIRS += mythmovies" >> ./config.pro
+else
+    echo "      MythMovies     plugin will not be built"
+fi
 ###########################################################
 #                                                         #
 #   MythArchive related configuration options             #
Index: mythmovies/ignyte/main.cpp
===================================================================
--- mythmovies/ignyte/main.cpp	(revision 0)
+++ mythmovies/ignyte/main.cpp	(revision 0)
@@ -0,0 +1,28 @@
+#include <qapplication.h>
+#include "ignytegrabber.h"
+
+using namespace std;
+
+int main(int argc, char **argv)
+{
+    QString zip;
+    QString radius;
+    for(int i = 1; i + 1 < argc; ++i)
+    {
+        if (!strcmp(argv[i], "--zip"))
+        {
+            zip = argv[i + 1];
+        }
+        if (!strcmp(argv[i], "--radius"))
+        {
+            radius = argv[i + 1];
+        }
+    }
+
+    QApplication app(argc, argv, false);
+    IgnyteGrabber *grab;
+    grab = new IgnyteGrabber(zip, radius, &app);
+    return app.exec();
+}
+
+
Index: mythmovies/ignyte/ignytegrabber.cpp
===================================================================
--- mythmovies/ignyte/ignytegrabber.cpp	(revision 0)
+++ mythmovies/ignyte/ignytegrabber.cpp	(revision 0)
@@ -0,0 +1,56 @@
+
+#include "ignytegrabber.h"
+ 
+IgnyteGrabber::IgnyteGrabber(QString zip, QString radius, QApplication *callingApp)
+{
+    app = callingApp;
+    //this feels clumsy to me - should we store it in a file instead?
+    QString fields ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+            "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" "
+            "xmlns:tns=\"http://www.ignyte.com/whatsshowing\" xmlns:xs=\"http://www.w3.org"
+            "/2001/XMLSchema\">\n"
+            "<soap:Body>\n"
+            "<tns:GetTheatersAndMovies>\n"
+            "<tns:zipCode>"  + zip + "</tns:zipCode>\n"
+            "<tns:radius>" + radius + "</tns:radius>\n"
+            "</tns:GetTheatersAndMovies>\n"
+            "</soap:Body>\n"
+            "</soap:Envelope>\n");
+    QString server("www.ignyte.com");
+    QString path("/webservices/ignyte.whatsshowing.webservice/moviefunctions.asmx");
+    QString soapAction("http://www.ignyte.com/whatsshowing/GetTheatersAndMovies");
+    ms.doSoapRequest(server, path, soapAction, fields);
+
+    waitForSoap = new QTimer(this);
+    connect(waitForSoap, SIGNAL(timeout()), this, SLOT(checkHttp()));
+    waitForSoap->start(0, FALSE);
+}
+
+void IgnyteGrabber::checkHttp()
+{
+    if (ms.isDone())
+    {
+        if (ms.hasError())
+        {
+            cerr << "Data Source Error" << endl << flush;
+        }
+        else
+        {
+            outputData(ms.getResponseData().data());
+        }
+        waitForSoap->stop();
+        app->exit();
+    }
+}
+
+void IgnyteGrabber::outputData(QString data)
+{
+    int i =  data.find("<GetTheatersAndMoviesResult>");
+    data = data.mid(i + 28);
+    int x = data.find("</GetTheatersAndMoviesResult>");
+    data = data.left(x);
+    data = data.remove('\r');
+    data = data.remove('\n');
+    data = "<?xml version=\"1.0\" encoding=\"utf-8\"?><MovieTimes>" + data + "</MovieTimes>";
+    cout << data;
+}
Index: mythmovies/ignyte/mythsoap.cpp
===================================================================
--- mythmovies/ignyte/mythsoap.cpp	(revision 0)
+++ mythmovies/ignyte/mythsoap.cpp	(revision 0)
@@ -0,0 +1,54 @@
+#include <mythtv/mythcontext.h>
+
+#include "mythsoap.h"
+
+void MythSoap::doSoapRequest(QString host, QString path, QString soapAction,
+                             QString query)
+{
+    connect(&http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)));
+
+    QHttpRequestHeader header("POST", path);
+    header.setValue("Host", host);
+    header.setValue("SOAPAction",  soapAction);
+    header.setContentType("text/xml");
+
+    http.setHost(host);
+    QByteArray bArray(query.utf8());
+    bArray.resize(bArray.size() - 1);
+    http.request(header, bArray);
+}
+
+QByteArray MythSoap::getResponseData()
+{
+    return m_data;
+}
+
+bool MythSoap::isDone()
+{
+    return m_done;
+}
+
+bool MythSoap::hasError()
+{
+    return m_error;
+}
+
+void MythSoap::httpDone(bool error)
+{
+    if (error)
+    {
+        cerr << "Error in mythsoap.o retrieving data: " << http.errorString() << endl << flush;
+    }
+    else
+    {
+        m_data = http.readAll();
+        //cout << "Data: " << m_data.data() << endl << flush;
+    }
+    m_done = true;
+}
+
+MythSoap::MythSoap()
+{
+    m_done = false;
+    m_error = false;
+}
Index: mythmovies/ignyte/ignytegrabber.h
===================================================================
--- mythmovies/ignyte/ignytegrabber.h	(revision 0)
+++ mythmovies/ignyte/ignytegrabber.h	(revision 0)
@@ -0,0 +1,25 @@
+#include <qapplication.h>
+#include <qtimer.h>
+#include <qstring.h>
+#include <iostream>
+#include "mythsoap.h"
+
+using namespace std;
+
+class IgnyteGrabber : public QObject
+{
+    Q_OBJECT
+
+    public:
+        IgnyteGrabber(QString, QString, QApplication*);
+
+    private:
+        QTimer *waitForSoap;
+        MythSoap ms;
+        QApplication *app;
+        void outputData(QString);
+
+    public slots:
+        void checkHttp();
+};
+
Index: mythmovies/ignyte/mythsoap.h
===================================================================
--- mythmovies/ignyte/mythsoap.h	(revision 0)
+++ mythmovies/ignyte/mythsoap.h	(revision 0)
@@ -0,0 +1,27 @@
+#ifndef MYTHSOAP_H_
+#define MYTHSOAP_H_
+
+#include <qhttp.h>
+#include <qstring.h>
+
+class MythSoap : public QObject
+{
+    Q_OBJECT
+    public:
+        void doSoapRequest(QString, QString, QString, QString);
+        QByteArray getResponseData();
+        bool isDone();
+        bool hasError();
+        MythSoap();
+
+    private:
+        QHttp http;
+        bool  m_done;
+        bool m_error;
+        QByteArray m_data;
+
+    public slots:
+        void httpDone(bool);
+};
+
+#endif
Index: mythmovies/ignyte/ignyte.pro
===================================================================
--- mythmovies/ignyte/ignyte.pro	(revision 0)
+++ mythmovies/ignyte/ignyte.pro	(revision 0)
@@ -0,0 +1,12 @@
+include ( ../../mythconfig.mak )
+include ( ../../settings.pro )
+
+TEMPLATE = app
+CONFIG += thread
+TARGET = ignyte
+target.path = $${PREFIX}/bin
+INSTALLS += target
+
+# Input
+HEADERS += ignytegrabber.h mythsoap.h
+SOURCES += main.cpp ignytegrabber.cpp mythsoap.cpp
Index: mythmovies/mythmovies.pro
===================================================================
--- mythmovies/mythmovies.pro	(revision 0)
+++ mythmovies/mythmovies.pro	(revision 0)
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+# Directories
+SUBDIRS = mythmovies ignyte
+
Index: mythmovies/mythmovies/helperobjects.h
===================================================================
--- mythmovies/mythmovies/helperobjects.h	(revision 0)
+++ mythmovies/mythmovies/helperobjects.h	(revision 0)
@@ -0,0 +1,43 @@
+#ifndef HELPEROBJECTS_H_
+#define HELPEROBJECTS_H_
+
+#include <qvaluevector.h>
+
+class Theater;
+
+typedef QValueVector<Theater> TheaterVector;
+
+class Movie
+{
+  public:
+    QString rating;
+    QString name;
+    QString runningTime;
+    QString showTimes;
+    TheaterVector theaters;
+    Movie()
+    {
+        rating = "";
+        name = "";
+        runningTime = "";
+        showTimes = "";
+    }
+};
+
+typedef QValueVector<Movie> MovieVector;
+
+class Theater
+{
+  public:
+    QString name;
+    QString address;
+    MovieVector movies;
+    QString showTimes;
+    Theater()
+    {
+        name = "";
+        address = "";
+    }
+};
+
+#endif
Index: mythmovies/mythmovies/moviesui.cpp
===================================================================
--- mythmovies/mythmovies/moviesui.cpp	(revision 0)
+++ mythmovies/mythmovies/moviesui.cpp	(revision 0)
@@ -0,0 +1,688 @@
+#include <qtimer.h>
+#include <qapplication.h>
+
+#include <mythtv/mythcontext.h>
+#include <mythtv/uitypes.h>
+#include <qprocess.h>
+
+#include "moviesui.h"
+
+namespace
+{
+    struct sAscendingMovieOrder
+    {
+        bool operator()(const Movie& start,const Movie& end)
+        {
+            return start.name < end.name;
+        }
+    };
+    
+        //Taken from MythVideo
+    // Execute an external command and return results in string
+    // probably should make this routing async vs polling like this
+    // but it would require a lot more code restructuring
+    QString executeExternal(const QStringList &args, const QString &purpose)
+    {
+        QString ret = "";
+        QString err = "";
+
+        VERBOSE(VB_GENERAL, QString("%1: Executing '%2'").arg(purpose).
+                arg(args.join(" ")).local8Bit() );
+        QProcess proc(args);
+
+        QString cmd = args[0];
+        QFileInfo info(cmd);
+
+        if (!info.exists())
+        {
+            err = QString("\"%1\" failed: does not exist").arg(cmd.local8Bit());
+        }
+        else if (!info.isExecutable())
+        {
+            err = QString("\"%1\" failed: not executable").arg(cmd.local8Bit());
+        }
+        else if (proc.start())
+        {
+            while (true)
+            {
+                while (proc.canReadLineStdout() || proc.canReadLineStderr())
+                {
+                    if (proc.canReadLineStdout())
+                    {
+                        ret +=
+                                QString::fromUtf8(proc.readLineStdout(), -1) + "\n";
+                    }
+
+                    if (proc.canReadLineStderr())
+                    {
+                        if (err == "")
+                        {
+                            err = cmd + ": ";
+                        }
+
+                        err +=
+                                QString::fromUtf8(proc.readLineStderr(), -1) + "\n";
+                    }
+                }
+
+                if (proc.isRunning())
+                {
+                    qApp->processEvents();
+                    usleep(10000);
+                }
+                else
+                {
+                    if (!proc.normalExit())
+                    {
+                        err = QString("\"%1\" failed: Process exited "
+                                "abnormally").arg(cmd.local8Bit());
+                    }
+
+                    break;
+                }
+            }
+        }
+        else
+        {
+            err = QString("\"%1\" failed: Could not start process")
+                    .arg(cmd.local8Bit());
+        }
+
+        while (proc.canReadLineStdout() || proc.canReadLineStderr())
+        {
+            if (proc.canReadLineStdout())
+            {
+                ret += QString::fromUtf8(proc.readLineStdout(),-1) + "\n";
+            }
+
+            if (proc.canReadLineStderr())
+            {
+                if (err == "")
+                {
+                    err = cmd + ": ";
+                }
+
+                err += QString::fromUtf8(proc.readLineStderr(), -1) + "\n";
+            }
+        }
+
+        if (err != "")
+        {
+            QString tempPurpose(purpose);
+
+            if (tempPurpose == "")
+                tempPurpose = "Command";
+
+            VERBOSE(VB_IMPORTANT, err);
+            MythPopupBox::showOkPopup(gContext->GetMainWindow(),
+                                      QObject::tr(tempPurpose + " failed"),
+                                      QObject::tr(err + "\n\nCheck MythMovies Settings"));
+            ret = "#ERROR";
+        }
+
+        //VERBOSE(VB_IMPORTANT, ret);
+        return ret;
+    }
+}
+
+MoviesUI::MoviesUI(MythMainWindow *parent, QString windowName,
+                   QString themeFilename, const char *name)
+    : MythThemedDialog(parent, windowName, themeFilename, name)
+{
+    query = new MSqlQuery(MSqlQuery::InitCon());
+    subQuery = new MSqlQuery(MSqlQuery::InitCon());
+    aboutPopup = NULL;
+    menuPopup = NULL;
+    //m_movieTree = new GenericTree("Theaters", 0, false);
+    m_currentMode = "Undefined";
+    setupTheme();
+}
+
+MoviesUI::~MoviesUI()
+{
+    //do nothing, yet
+}
+
+void MoviesUI::setupTheme(void)
+{
+    m_movieTreeUI = getUIManagedTreeListType("movietreelist");
+    m_currentNode = NULL;
+    m_movieTreeUI->showWholeTree(true);
+    m_movieTreeUI->colorSelectables(true);
+
+    connect(m_movieTreeUI, SIGNAL(nodeSelected(int, IntVector*)),
+            this, SLOT(handleTreeListSelection(int, IntVector*)));
+    connect(m_movieTreeUI, SIGNAL(nodeEntered(int, IntVector*)),
+            this, SLOT(handleTreeListEntry(int, IntVector*)));
+
+
+    m_movieTitle = getUITextType("movietitle");
+    if (!m_movieTitle)
+        VERBOSE(VB_IMPORTANT, "moviesui.o: Couldn't find text area movietitle");
+
+    m_movieRating = getUITextType("ratingvalue");
+    if (!m_movieRating)
+        VERBOSE(VB_IMPORTANT,
+                "moviesui.o: Couldn't find text area ratingvalue");
+
+    m_movieRunningTime = getUITextType("runningtimevalue");
+    if (!m_movieRunningTime)
+        VERBOSE(VB_IMPORTANT,
+                "moviesui.o: Couldn't find text area runningtimevalue");
+
+    m_movieShowTimes = getUITextType("showtimesvalue");
+    if (!m_movieShowTimes)
+        VERBOSE(VB_IMPORTANT,
+                "moviesui.o: Couldn't find text area showtimesvalue");
+
+    m_theaterName = getUITextType("theatername");
+    if (!m_theaterName)
+        VERBOSE(VB_IMPORTANT,
+                "moviesui.o: Couldn't find text area theatername");
+    gContext->ActivateSettingsCache(false);
+    QString currentDate = QDate::currentDate().toString();
+    QString lastDate = gContext->GetSetting("MythMovies.LastGrabDate");
+    if (currentDate != lastDate)
+    {
+        VERBOSE(VB_IMPORTANT, "Movie Data Has Expired. Refreshing.");
+        updateMovieTimes();
+    }
+
+    gContext->ActivateSettingsCache(true);
+
+    updateDataTrees();
+    drawDisplayTree();
+    updateForeground();
+}
+
+void MoviesUI::updateMovieTimes()
+{
+    gContext->ActivateSettingsCache(false);
+    QString currentDate = QDate::currentDate().toString();
+    query->exec("truncate table movies_showtimes");
+    query->exec("truncate table movies_movies");
+    query->exec("truncate table movies_theaters");
+    QString grabber = gContext->GetSetting("MythMovies.Grabber");
+    grabber.replace("%z", gContext->GetSetting("MythMovies.ZipCode"));
+    grabber.replace("%r", gContext->GetSetting("MythMovies.Radius"));
+    QStringList args = QStringList::split(' ', grabber);
+    QString ret = executeExternal(args, "MythMovies Data Grabber");
+    VERBOSE(VB_IMPORTANT, "Grabber Finished. Processing Data.");
+    populateDatabaseFromGrabber(ret);
+    gContext->SaveSetting("MythMovies.LastGrabDate", currentDate);
+    gContext->ActivateSettingsCache(true);
+}
+
+MovieVector MoviesUI::buildMovieDataTree()
+{
+    MovieVector ret;
+    if (query->exec("select id, moviename, rating, runningtime from movies_movies order by moviename asc"))
+    {
+        while (query->next())
+        {
+            Movie m;
+            m.name = query->value(1).toString();
+            m.rating = query->value(2).toString();
+            m.runningTime = query->value(3).toString();
+            subQuery->prepare("select theatername, theateraddress, showtimes "
+                    "from movies_showtimes left join movies_theaters "
+                    "on movies_showtimes.theaterid = movies_theaters.id "
+                    "where movies_showtimes.movieid = :MOVIEID");
+            subQuery->bindValue(":MOVIEID", query->value(0).toString());
+
+            if (subQuery->exec())
+            {
+                while (subQuery->next())
+                {
+                    Theater t;
+                    t.name = subQuery->value(0).toString();
+                    t.address = subQuery->value(1).toString();
+                    t.showTimes = subQuery->value(2).toString();
+                    m.theaters.push_back(t);
+                }
+            }
+            ret.push_back(m);
+        }
+    }
+    return ret;
+}
+
+TheaterVector MoviesUI::buildTheaterDataTree()
+{
+    TheaterVector ret;
+    if (query->exec("select id, theatername, theateraddress from movies_theaters order by theatername asc"))
+    {
+        while (query->next())
+        {
+            Theater t;
+            t.name = query->value(1).toString();
+            t.address = query->value(2).toString();
+            subQuery->prepare("select moviename, rating, runningtime, showtimes "
+                    "from movies_showtimes left join movies_movies "
+                    "on movies_showtimes.movieid = movies_movies.id "
+                    "where movies_showtimes.theaterid = :THEATERID");
+            subQuery->bindValue(":THEATERID", query->value(0).toString());
+
+            if (subQuery->exec())
+            {
+                while (subQuery->next())
+                {
+                    Movie m;
+                    m.name = subQuery->value(0).toString();
+                    m.rating = subQuery->value(1).toString();
+                    m.runningTime = subQuery->value(2).toString();
+                    m.showTimes = subQuery->value(3).toString();
+                    t.movies.push_back(m);
+                }
+            }
+
+            ret.push_back(t);
+        }
+    }
+    return ret;
+}
+
+void MoviesUI::keyPressEvent(QKeyEvent *e)
+{
+    bool handled = false;
+    QStringList actions;
+    gContext->GetMainWindow()->TranslateKeyPress("Movies", e, actions);
+
+    for (unsigned int i = 0; i < actions.size() && !handled; i++)
+    {
+        QString action = actions[i];
+        //cout << "Action: " << action << endl << flush;
+        handled = true;
+        if (action == "SELECT")
+            m_movieTreeUI->select();
+        else if (action == "MENU")
+            showMenu();
+        else if (action == "INFO")
+            //todo: redirect info to an info screen via imdb.pl
+            showAbout();
+        else if (action == "UP")
+            m_movieTreeUI->moveUp();
+        else if (action == "DOWN")
+            m_movieTreeUI->moveDown();
+        else if (action == "LEFT")
+            m_movieTreeUI->popUp();
+        else if (action == "RIGHT")
+            m_movieTreeUI->pushDown();
+        else if (action == "PAGEUP")
+            m_movieTreeUI->pageUp();
+        else if (action == "PAGEDOWN")
+            m_movieTreeUI->pageDown();
+        else if (action == "INCSEARCH")
+            m_movieTreeUI->incSearchStart();
+        else if (action == "INCSEARCHNEXT")
+            m_movieTreeUI->incSearchNext();
+        else
+            handled = false;
+    }
+
+    if (!handled)
+        MythThemedDialog::keyPressEvent(e);
+}
+
+void MoviesUI::showMenu()
+{
+    if (menuPopup)
+        return;
+    menuPopup = new MythPopupBox(gContext->GetMainWindow(), "menuPopup");
+    menuPopup->addLabel("MythMovies Menu");
+    updateButton = menuPopup->addButton("Update Movie Times", this, SLOT(slotUpdateMovieTimes()));
+    OKButton = menuPopup->addButton("Close Menu", this, SLOT(closeMenu()));
+    OKButton->setFocus();
+    menuPopup->ShowPopup(this, SLOT(closeMenu()));
+}
+
+void MoviesUI::slotUpdateMovieTimes()
+{
+    VERBOSE(VB_IMPORTANT, "Doing Manual Movie Times Update");
+    updateMovieTimes();
+    updateDataTrees();
+    drawDisplayTree();
+    menuPopup->hide();
+    delete menuPopup;
+    menuPopup = NULL;
+}
+
+void MoviesUI::closeMenu()
+{
+    if (!menuPopup)
+        return;
+    menuPopup->hide();
+    delete menuPopup;
+    menuPopup = NULL;
+}
+
+void MoviesUI::showAbout()
+{
+    if (aboutPopup)
+        return;
+
+    aboutPopup = new MythPopupBox(gContext->GetMainWindow(), "aboutPopup");
+    aboutPopup->addLabel("MythMovies");
+    aboutPopup->addLabel("Copyright (c) 2006 Josh Lefler.");
+    aboutPopup->addLabel("Released under GNU GPL v2");
+    aboutPopup->addLabel("Special Thanks to Ignyte.com for\nproviding the "
+                         "listings data.\n and the #mythtv IRC channel for "
+                         "assistance.");
+    OKButton = aboutPopup->addButton(QString("Close"), this,
+                                     SLOT(closeAboutPopup()));
+    OKButton->setFocus();
+    aboutPopup->ShowPopup(this,SLOT(closeAboutPopup()));
+}
+
+void MoviesUI::closeAboutPopup(void)
+{
+    if (!aboutPopup)
+        return;
+
+    aboutPopup->hide();
+    delete aboutPopup;
+    aboutPopup = NULL;
+}
+
+void MoviesUI::handleTreeListEntry(int nodeInt, IntVector *)
+{
+    m_currentNode = m_movieTreeUI->getCurrentNode();
+    if (nodeInt == 0)
+    {
+        m_currentMode = m_currentNode->getString();
+        m_theaterName->SetText("");
+        m_movieTitle->SetText("");
+        m_movieRunningTime->SetText("");
+    }
+    else
+    {
+        if (m_currentMode == "By Theater")
+        {
+            if (nodeInt < 0)
+            {
+                int theaterInt = -nodeInt;
+                m_currentTheater = &m_dataTreeByTheater.at(theaterInt - 1);
+                m_theaterName->SetText(m_currentTheater->name + " - " +
+                                       m_currentTheater->address);
+                m_movieTitle->SetText("");
+                m_movieRating->SetText("");
+                m_movieShowTimes->SetText("");
+                m_movieRunningTime->SetText("");
+            }
+            else
+            {
+                int theaterInt = nodeInt / 100;
+                int movieInt = nodeInt - (theaterInt * 100);
+                Theater t = m_dataTreeByTheater.at(theaterInt - 1);
+                Movie m = t.movies.at(movieInt - 1);
+                m_movieTitle->SetText(m.name);
+                m_movieRating->SetText(m.rating);
+                m_movieRunningTime->SetText(m.runningTime);
+                QStringList st = QStringList::split("|", m.showTimes);
+                QString buf;
+                int i = 0;
+                for (QStringList::Iterator it = st.begin(); it != st.end();
+                     ++it)
+                {
+                    if (i % 4 == 0 && i != 0)
+                        buf+= "\n";
+                    buf += (*it).stripWhiteSpace() + " ";
+                    i++;
+                }
+                m_movieShowTimes->SetText(buf);
+            }
+        }
+        else if (m_currentMode == "By Movie")
+        {
+            if (nodeInt < 0)
+            {
+                int movieInt = -nodeInt;
+                m_currentMovie = &m_dataTreeByMovie.at(movieInt - 1);
+                m_movieTitle->SetText(m_currentMovie->name);
+                m_movieRating->SetText(m_currentMovie->rating);
+                m_movieRunningTime->SetText(m_currentMovie->runningTime);
+                m_movieShowTimes->SetText("");
+                m_theaterName->SetText("");
+            }
+            else
+            {
+                int movieInt =  nodeInt / 100;
+                int theaterInt = nodeInt - (movieInt * 100);
+                Movie m = m_dataTreeByMovie.at(movieInt - 1);
+                Theater t = m.theaters.at(theaterInt - 1);
+                QStringList st = QStringList::split("|", t.showTimes);
+                QString buf;
+                int i = 0;
+                for (QStringList::Iterator it = st.begin(); it != st.end();
+                     ++it)
+                {
+                    if (i % 4 == 0 && i != 0)
+                        buf+= "\n";
+                    buf += (*it).stripWhiteSpace() + " ";
+                    i++;
+                }
+                m_movieShowTimes->SetText(buf);
+                m_theaterName->SetText(t.name + " - " + t.address);
+            }
+        }
+        else
+        {
+            //cerr << "Entry was called with an undefined mode." << endl << flush;
+        }
+    }
+}
+
+void MoviesUI::handleTreeListSelection(int nodeInt, IntVector *)
+{
+    //perhaps the same as info?
+    //VERBOSE(VB_IMPORTANT, QString("In Selection with %1").arg(nodeInt));
+}
+
+GenericTree* MoviesUI::getDisplayTreeByTheater()
+{
+    TheaterVector *theaters;
+    theaters = &m_dataTreeByTheater;
+    int tbase = 0;
+    GenericTree *parent = new GenericTree("By Theater", 0, false);
+    for (unsigned int i = 0; i < theaters->size(); i++)
+    {
+        int mbase = 0;
+        Theater x = theaters->at(i);
+        GenericTree *node = new GenericTree(x.name, --tbase, false);
+        for (unsigned int m =0; m < x.movies.size(); m++)
+        {
+            Movie y = x.movies.at(m);
+            node->addNode(y.name, (tbase * -100) + ++mbase, true);
+        }
+        parent->addNode(node);
+    }
+    return parent;
+}
+
+GenericTree* MoviesUI::getDisplayTreeByMovie()
+{
+    MovieVector *movies;
+    movies = &m_dataTreeByMovie;
+    int mbase = 0;
+    GenericTree *parent = new GenericTree("By Movie", 0, false);
+    for (unsigned int i = 0; i < movies->size(); i++)
+    {
+        int tbase = 0;
+        Movie x = movies->at(i);
+        GenericTree *node = new GenericTree(x.name, --mbase, false);
+        for (unsigned int m = 0; m < x.theaters.size(); m++)
+        {
+            Theater y = x.theaters.at(m);
+            node->addNode(y.name, (mbase * -100) + ++tbase, true);
+        }
+        parent->addNode(node);
+    }
+    return parent;
+}
+void MoviesUI::updateDataTrees()
+{
+    m_dataTreeByTheater = buildTheaterDataTree();
+    m_dataTreeByMovie = buildMovieDataTree();
+}
+
+void MoviesUI::drawDisplayTree()
+{
+    m_movieTree = new GenericTree("Theaters", 0, false);
+    m_movieTree->addNode(getDisplayTreeByTheater());
+    m_movieTree->addNode(getDisplayTreeByMovie());
+    m_movieTreeUI->assignTreeData(m_movieTree);
+    m_movieTreeUI->popUp();
+    m_movieTreeUI->popUp();
+    m_movieTreeUI->popUp();
+    m_movieTreeUI->enter();
+    m_currentMode = m_movieTreeUI->getCurrentNode()->getString();
+}
+
+void MoviesUI::populateDatabaseFromGrabber(QString ret)
+{
+     //stores error returns
+    QString error;
+    int errorLine;
+    int errorColumn;
+    QDomDocument doc;
+    QDomNode n;
+    if (!doc.setContent(ret, false, &error, &errorLine, &errorColumn))
+    {
+        VERBOSE(VB_IMPORTANT, QString("Error parsing data from grabber: "
+                "Error: %1 Location Line: %2 Column %3")
+                .arg(error) .arg(errorLine) .arg(errorColumn));
+        exit(-1);
+    }
+    QDomElement root = doc.documentElement();
+    n = root.firstChild();
+    //loop through each theater
+    while (!n.isNull())
+    {
+        processTheatre(n);
+        //list.push_back(t);
+        n = n.nextSibling();
+    }
+}
+
+void MoviesUI::processTheatre(QDomNode &n)
+{
+    Theater t;
+    //Movie m;
+    QDomNode movieNode;
+    const QDomElement theater = n.toElement();
+    QDomNode child = theater.firstChild();
+    while (!child.isNull())
+    {
+        if (!child.isNull())
+        {
+            if (child.toElement().tagName() == "Name")
+            {
+                t.name = child.firstChild().toText().data();
+                if (t.name.isNull())
+                    t.name = "";
+            }
+
+            if (child.toElement().tagName() == "Address")
+            {
+                t.address = child.firstChild().toText().data();
+                if (t.address.isNull())
+                    t.address = "";
+            }
+            if (child.toElement().tagName() == "Movies")
+            {
+                query->prepare("INSERT INTO movies_theaters "
+                        "(theatername, theateraddress)" 
+                        "values (:NAME,:ADDRESS)");
+
+                query->bindValue(":NAME", t.name.utf8());
+                query->bindValue(":ADDRESS", t.address.utf8());
+                if (!query->exec())
+                {
+                    VERBOSE(VB_IMPORTANT, "Failure to Insert Theater");
+                }
+                int lastid = query->lastInsertId().toInt();
+                movieNode = child.firstChild();
+                while (!movieNode.isNull())
+                {
+                    processMovie(movieNode, lastid);
+                    //t.movies.push_back(m);
+                    movieNode = movieNode.nextSibling();
+                }
+            }
+
+            child = child.nextSibling();
+        }
+    }
+}
+
+void MoviesUI::processMovie(QDomNode &n, int theaterId)
+{
+    Movie m;
+    QDomNode mi = n.firstChild();
+    int movieId = 0;
+    while (!mi.isNull())
+    {
+        if (mi.toElement().tagName() == "Name")
+        {
+            m.name = mi.firstChild().toText().data();
+            if (m.name.isNull())
+                m.name = "";
+        }
+        if (mi.toElement().tagName() == "Rating")
+        {
+            m.rating = mi.firstChild().toText().data();
+            if (m.rating.isNull())
+                m.rating = "";
+        }
+        if (mi.toElement().tagName() == "ShowTimes")
+        {
+            m.showTimes = mi.firstChild().toText().data();
+            if (m.showTimes.isNull())
+                m.showTimes = "";
+        }
+        if (mi.toElement().tagName() == "RunningTime")
+        {
+            m.runningTime = mi.firstChild().toText().data();
+            if (m.runningTime.isNull())
+                m.runningTime = "";
+        }
+        mi = mi.nextSibling();
+    }
+    
+    query->prepare("SELECT id FROM movies_movies Where moviename = :NAME");
+    query->bindValue(":NAME", m.name.utf8());
+    if (query->exec() && query->next())
+    {
+        movieId = query->value(0).toInt();
+    }
+    else
+    {
+        query->prepare("INSERT INTO movies_movies ("
+                "moviename, rating, runningtime) values ("
+                ":NAME, :RATING, :RUNNINGTIME)");
+        query->bindValue(":NAME", m.name.utf8());
+        query->bindValue(":RATING", m.rating.utf8());
+        query->bindValue(":RUNNINGTIME", m.runningTime.utf8());
+        if (query->exec())
+        {
+            movieId = query->lastInsertId().toInt();
+        }
+        else
+        {
+            VERBOSE(VB_IMPORTANT, "Failure to Insert Movie");
+        }
+    }
+    query->prepare("INSERT INTO movies_showtimes ("
+            "theaterid, movieid, showtimes) values ("
+            ":THEATERID, :MOVIEID, :SHOWTIMES)");
+    query->bindValue(":THEATERID", theaterId);
+    query->bindValue(":MOVIEID", movieId);
+    query->bindValue(":SHOWTIMES", m.showTimes);
+
+    if (!query->exec())
+    {
+        VERBOSE(VB_IMPORTANT, "Failure to Link Movie to Theater");
+    }
+}
+
+

Property changes on: mythmovies/mythmovies/moviesui.cpp
___________________________________________________________________
Name: svn:executable
   + *

Index: mythmovies/mythmovies/movies-ui-wide.xml
===================================================================
--- mythmovies/mythmovies/movies-ui-wide.xml	(revision 0)
+++ mythmovies/mythmovies/movies-ui-wide.xml	(revision 0)
@@ -0,0 +1,141 @@
+<mythuitheme>
+    <window name="moviesui">
+        <font name="active" face="Trebuchet MS">
+            <color>#ffffff</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="inactive" face="Trebuchet MS">
+            <color>#9999cc</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="selectable" face="Trebuchet MS">
+            <color>#8cdeff</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="largetitle" face="Trebuchet MS">
+            <color>#ffffff</color>
+            <dropcolor>#000000</dropcolor>
+            <size>32</size>
+            <shadow>3,3</shadow>
+            <bold>yes</bold>
+        </font>
+
+        <font name="infofont" face="Trebuchet MS">
+            <color>#ffffff</color>
+            <size>16</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="infofontunderline" face="Arial">
+            <color>#ffffff</color>
+            <size>16</size>
+            <bold>yes</bold>
+            <underline>yes</underline>
+        </font>
+
+        <container name="background">
+            <image name="filler" draworder="0" fleximage="yes">
+                <filename>background.png</filename> <!-- 1280x326 -->
+                <position>0,48</position>
+            </image>
+            <image name="titlelines" draworder="0" fleximage="no">
+                <filename>trans-titles.png</filename> <!-- 1280x326 -->
+                <position>0,48</position>
+            </image>
+            <image name="infofiller" draworder="0" fleximage="no">
+                <filename>pf-top.png</filename> <!-- 1152x260 -->
+                <position>64,412</position>
+            </image>
+        </container>
+
+        <container name="movieselector">
+            <area>8,52,1264,310</area>
+            <managedtreelist name="movietreelist" draworder="1" bins="2">
+                <area>32,0,1200,296</area>
+                <image function="selectionbar" filename="mv_selectionbar.png"></image>
+                <image function="uparrow" filename="mv_up_arrow.png"></image>
+                <image function="downarrow" filename="mv_down_arrow.png"></image>
+                <image function="leftarrow" filename="mv_left_arrow.png"></image>
+                <image function="rightarrow" filename="mv_right_arrow.png"></image>
+                <bin number="1">
+                    <area>56,28,288,250</area>
+                    <fcnfont name="active" function="active"></fcnfont>
+                    <fcnfont name="inactive" function="inactive"></fcnfont>
+                    <fcnfont name="active" function="selected"></fcnfont>
+                    <fcnfont name="selectable" function="selectable"></fcnfont>
+                </bin>
+                <bin number="2">
+                    <area>384,0,816,296</area>
+                    <fcnfont name="active" function="active"></fcnfont>
+                    <fcnfont name="active" function="selected"></fcnfont>
+                    <fcnfont name="inactive" function="inactive"></fcnfont>
+                    <fcnfont name="selectable" function="selectable"></fcnfont>
+                </bin>
+            </managedtreelist>
+
+	    <image name="showinglines" draworder="2" fleximage="yes">
+                <filename>showings.png</filename>
+                <position>0,0</position>
+            </image>
+        </container>
+
+        <container name="theater_info">
+            <area>25,363,750,55</area>
+            <textarea name="theatername" draworder="6">
+                <area>10,10,2000,55</area>
+                <font>infofont</font>
+            </textarea>
+        </container>
+
+        <container name="movie_info">
+            <area>64,412,1152,260</area>
+
+            <textarea name="movietitle" draworder="6">
+                <area>32,15,752,60</area>
+                <font>largetitle</font>
+            </textarea>
+
+            <textarea name="rating" draworder="6">
+                <area>32,100,140,35</area>
+                <font>infofont</font>
+                <value>Rating:</value>
+            </textarea>
+
+            <textarea name="ratingvalue" draworder="6">
+                <area>172,100,580,35</area>
+                <font>infofont</font>
+            </textarea>
+
+            <textarea name="runningtime" draworder="6">
+                <area>32,75,300,35</area>
+                <font>infofont</font>
+                <value>Running Time:</value>
+            </textarea>
+
+            <textarea name="runningtimevalue" draworder="6">
+                <area>270,75,500,35</area>
+                <font>infofont</font>
+            </textarea>
+
+            <textarea name="showtimes" draworder="6">
+                <area>32,130,140,35</area>
+                <font>infofontunderline</font>
+                <value>Showtimes</value>
+            </textarea>
+
+            <textarea name="showtimesvalue" draworder="6">
+                <area>32,160,10000,100</area><!--set absurdly large to prevent trimming-->
+                <font>infofont</font>
+            </textarea>  
+
+        </container>
+
+    </window>
+
+</mythuitheme>
Index: mythmovies/mythmovies/mythmovies.pro
===================================================================
--- mythmovies/mythmovies/mythmovies.pro	(revision 0)
+++ mythmovies/mythmovies/mythmovies.pro	(revision 0)
@@ -0,0 +1,24 @@
+include ( ../../mythconfig.mak )
+include ( ../../settings.pro )
+
+TEMPLATE = lib
+CONFIG += plugin thread
+TARGET = mythmovies
+target.path = $${LIBDIR}/mythtv/plugins
+INSTALLS += target
+
+installfiles.path = $${PREFIX}/share/mythtv
+installfiles.files = movie_settings.xml
+uifiles.path = $${PREFIX}/share/mythtv/themes/default
+uifiles.files = movies-ui.xml
+
+INSTALLS += uifiles installfiles
+
+# Input
+HEADERS += moviesui.h helperobjects.h moviessettings.h
+
+SOURCES += main.cpp moviesui.cpp moviessettings.cpp
+
+macx {
+    QMAKE_LFLAGS += -flat_namespace -undefined suppress
+}
Index: mythmovies/mythmovies/moviessettings.cpp
===================================================================
--- mythmovies/mythmovies/moviessettings.cpp	(revision 0)
+++ mythmovies/mythmovies/moviessettings.cpp	(revision 0)
@@ -0,0 +1,45 @@
+#include "moviessettings.h"
+
+static HostLineEdit *ZipCode()
+{
+    HostLineEdit *gc = new HostLineEdit("MythMovies.ZipCode");
+    gc->setLabel("Zip Code");
+    gc->setValue("00000");
+    gc->setHelpText("Enter your zip code here. "
+                    "MythMovies will use it to find local theaters.");
+    return gc;
+}
+
+static HostLineEdit *Radius()
+{
+    HostLineEdit *gc = new HostLineEdit("MythMovies.Radius");
+    gc->setLabel("Radius");
+    gc->setValue("20");
+    gc->setHelpText("Enter the radius (in miles) to search for theaters. "
+            "Numbers larger than 50 will be reduced to 50.");
+    return gc;
+}
+
+static HostLineEdit *Grabber()
+{
+    HostLineEdit *gc = new HostLineEdit("MythMovies.Grabber");
+    gc->setLabel("Grabber:");
+    gc->setValue(QString("%1/bin/ignyte --zip %z --radius %r").arg(gContext->GetInstallPrefix()));
+    gc->setHelpText("This is the path to the data grabber to use."
+                    "If you are in the United States, the default grabber "
+                    "should be fine. If you are elsewhere, you'll need a "
+                    "different grabber. %z will be replaced by the zip code"
+                    "setting. %r will be replaced by the radius setting."
+                   );
+    return gc;
+}
+MoviesSettings::MoviesSettings()
+{
+    VerticalConfigurationGroup *settings =
+            new VerticalConfigurationGroup(false);
+    settings->setLabel("MythMovies Settings");
+    settings->addChild(ZipCode());
+    settings->addChild(Radius());
+    settings->addChild(Grabber());
+    addChild(settings);
+}
Index: mythmovies/mythmovies/main.cpp
===================================================================
--- mythmovies/mythmovies/main.cpp	(revision 0)
+++ mythmovies/mythmovies/main.cpp	(revision 0)
@@ -0,0 +1,138 @@
+#include <mythtv/mythcontext.h>
+#include <mythtv/mythdbcon.h>
+
+#include "moviesui.h"
+#include "moviessettings.h"
+
+extern "C" {
+    int mythplugin_init(const char *libversion);
+    int mythplugin_run(void);
+    int mythplugin_config(void);
+}
+
+void runMovies(void);
+int setupDatabase();
+MythPopupBox *configPopup;
+const QString dbVersion = "4";
+
+void setupKeys(void)
+{
+    //REG_JUMP("MythMovies", "Movie Times Screen", "", runMovies);
+}
+
+int mythplugin_init(const char *libversion)
+{
+    if (!gContext->TestPopupVersion("mythmovies", libversion,
+                                    MYTH_BINARY_VERSION))
+    {
+        VERBOSE(VB_IMPORTANT,
+                QString("libmythmovies.so/main.o: binary version mismatch"));
+        return -1;
+    }
+    int dbSetup = setupDatabase();
+    if (dbSetup == -1)
+    {
+        VERBOSE(VB_IMPORTANT, "MythMovies cannot continue without"
+                "a proper database setup.");
+        return -1;
+    }
+    setupKeys();
+    return 0;
+}
+
+void runMovies(void)
+{
+    gContext->addCurrentLocation("mythmovies");
+    MoviesUI moviesui(gContext->GetMainWindow(), "moviesui", "movies-");
+    moviesui.exec();
+    gContext->removeCurrentLocation();
+}
+
+void runConfig()
+{
+    MoviesSettings settings;
+    settings.exec();
+}
+
+int mythplugin_run(void)
+{
+    gContext->ActivateSettingsCache(false);
+    if (gContext->GetSetting("MythMovies.ZipCode") == "" ||
+        gContext->GetSetting("MythMovies.Radius") == "" ||
+        gContext->GetSetting("MythMovies.Grabber") == "") 
+    {
+        runConfig();
+    }
+    if (gContext->GetSetting("MythMovies.ZipCode") == "" ||
+        gContext->GetSetting("MythMovies.Radius") == "" ||
+        gContext->GetSetting("MythMovies.Grabber") == "")
+    {
+        VERBOSE(VB_IMPORTANT,
+                QString("Invalid configuration options supplied."));
+        gContext->ActivateSettingsCache(true);
+        return 0;
+    }
+    gContext->ActivateSettingsCache(true);
+    runMovies();
+    return 0;
+}
+
+int mythplugin_config(void)
+{
+    runConfig();
+    return 0;
+}
+
+int setupDatabase()
+{
+    //we just throw away the old tables rather than worry about a database upgrade since movie times data
+    //is highly transient and losing it isn't harmful
+    if (dbVersion == gContext->GetSetting("MythMovies.DatabaseVersion"))
+        return 0;
+
+    gContext->SaveSetting("MythMovies.LastGrabDate", "");
+
+    VERBOSE(VB_GENERAL, "Setting Up MythMovies Database Tables");
+
+    MSqlQuery query(MSqlQuery::InitCon());
+    if (query.exec("DROP TABLE IF EXISTS movies_showtimes, movies_theaters, movies_movies"))
+    {
+        bool a = query.exec("CREATE TABLE movies_theaters ("
+                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"
+                "theatername VARCHAR(100),"
+                "theateraddress VARCHAR(100)"
+                ");");
+
+        bool b = query.exec("CREATE TABLE movies_movies ("
+                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"
+                "moviename VARCHAR(255),"
+                "rating VARCHAR(10),"
+                "runningtime VARCHAR(50)"
+                ");");
+
+        bool c = query.exec("CREATE TABLE movies_showtimes ("
+                "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,"
+                "theaterid INT NOT NULL,"
+                "movieid INT NOT NULL,"
+                "showtimes VARCHAR(255)"
+                ");");
+
+        if (!a || !b || !c)
+        {
+            VERBOSE(VB_IMPORTANT, "Failed to create MythMovies Tables");
+            return -1;
+        }
+        else
+        {
+            gContext->SaveSetting("MythMovies.DatabaseVersion", dbVersion);
+            VERBOSE(VB_GENERAL, "MythMovies Database Setup Complete");
+            return 0;
+        }
+    }
+    else
+    {
+        VERBOSE(VB_IMPORTANT, "Failed to delete old MythMovies Tables");
+        return -1;
+    }
+}
+
Index: mythmovies/mythmovies/moviesui.h
===================================================================
--- mythmovies/mythmovies/moviesui.h	(revision 0)
+++ mythmovies/mythmovies/moviesui.h	(revision 0)
@@ -0,0 +1,72 @@
+#ifndef MOVIESUI_H_
+#define MOVIESUI_H_
+
+#include <mythtv/mythdialogs.h>
+#include <mythtv/mythdbcon.h>
+
+#include "helperobjects.h"
+
+
+class QTimer;
+
+class MoviesUI : public MythThemedDialog
+{
+    Q_OBJECT
+  public:
+    typedef QValueVector<int> IntVector;
+
+    MoviesUI(MythMainWindow *parent, QString windowName,
+             QString themeFilename, const char *name = 0);
+    ~MoviesUI();
+
+  protected:
+    void keyPressEvent(QKeyEvent *e);
+    void showAbout();
+    void showMenu();
+  private:
+    void updateDataTrees();
+    void updateMovieTimes();
+    void setupTheme(void);
+    TheaterVector loadTrueTreeFromFile(QString);
+    void drawDisplayTree();
+    GenericTree* getDisplayTreeByMovie();
+    GenericTree* getDisplayTreeByTheater();
+    void populateDatabaseFromGrabber(QString ret);
+    void processTheatre(QDomNode &n);
+    void processMovie(QDomNode &n, int theaterId);
+    TheaterVector buildTheaterDataTree();
+    MovieVector buildMovieDataTree();
+    TheaterVector m_dataTreeByTheater;
+    Theater *m_currentTheater;
+    MovieVector m_dataTreeByMovie;
+    Movie *m_currentMovie;
+    GenericTree           *m_movieTree;
+    UIManagedTreeListType *m_movieTreeUI;
+    GenericTree *m_currentNode;
+    QString m_currentMode;
+    QTimer *waitForReady;
+    MSqlQuery *query;
+    MSqlQuery *subQuery;
+
+    UITextType  *m_movieTitle;
+    UITextType  *m_movieRating;
+    UITextType  *m_movieRunningTime;
+    UITextType  *m_movieShowTimes;
+    UITextType  *m_theaterName;
+    MythPopupBox *aboutPopup;
+    MythPopupBox *menuPopup;
+    QButton *OKButton;
+    QButton *updateButton;
+
+  public slots:
+    void handleTreeListSelection(int, IntVector*);
+    void handleTreeListEntry(int, IntVector*);
+    void checkDataReady();
+
+  protected slots:
+    void closeAboutPopup();
+    void closeMenu();
+    void slotUpdateMovieTimes();
+};
+
+#endif
Index: mythmovies/mythmovies/moviessettings.h
===================================================================
--- mythmovies/mythmovies/moviessettings.h	(revision 0)
+++ mythmovies/mythmovies/moviessettings.h	(revision 0)
@@ -0,0 +1,12 @@
+#ifndef MOVIESSETTINGS_H
+#define MOVIESSETTINGS_H
+
+#include <mythtv/settings.h>
+
+class MoviesSettings : virtual public ConfigurationWizard
+{
+  public:
+    MoviesSettings();
+};
+
+#endif
Index: mythmovies/mythmovies/movies-ui.xml
===================================================================
--- mythmovies/mythmovies/movies-ui.xml	(revision 0)
+++ mythmovies/mythmovies/movies-ui.xml	(revision 0)
@@ -0,0 +1,142 @@
+<mythuitheme>
+
+    <window name="moviesui">
+        <font name="active" face="Arial">
+            <color>#ffffff</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+    
+        <font name="inactive" face="Arial">
+            <color>#9999cc</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="selectable" face="Arial">
+            <color>#8cdeff</color>
+            <size>18</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="largetitle" face="Arial">
+            <color>#ffffff</color>
+            <dropcolor>#000000</dropcolor>
+            <size>20</size>
+            <shadow>3,3</shadow>
+        </font>
+
+        <font name="infofont" face="Arial">
+            <color>#ffffff</color>
+            <size>16</size>
+            <bold>yes</bold>
+        </font>
+
+        <font name="infofontunderline" face="Arial">
+            <color>#ffffff</color>
+            <size>16</size>
+            <bold>yes</bold>
+            <underline>yes</underline>
+        </font>
+    
+        <container name="background">
+            <image name="filler" draworder="0" fleximage="yes">
+                <filename>background.png</filename>
+                <position>0,10</position>
+            </image>
+            <image name="titlelines" draworder="0" fleximage="no">
+                <filename>trans-titles.png</filename>
+                <position>0,13</position>
+            </image>
+            <image name="infofiller" draworder="0" fleximage="no">
+                <filename>pf-top.png</filename>
+                <position>26,350</position>
+            </image>
+        </container>
+        <container name="movieselector">
+            <area>0,10,800,310</area>
+            <managedtreelist name="movietreelist" draworder="2" bins="2">
+                <area>40,10,720,270</area>
+                <image function="selectionbar" filename="mv_selectionbar.png"></image>
+                <image function="uparrow" filename="mv_up_arrow.png"></image>
+                <image function="downarrow" filename="mv_down_arrow.png"></image>
+                <image function="leftarrow" filename="mv_left_arrow.png"></image>
+                <image function="rightarrow" filename="mv_right_arrow.png"></image>
+                <bin number="1">
+                    <area>30,16,190,250</area>
+                    <fcnfont name="active" function="active"></fcnfont>
+                    <fcnfont name="inactive" function="inactive"></fcnfont>
+                    <fcnfont name="active" function="selected"></fcnfont>
+                    <fcnfont name="selectable" function="selectable"></fcnfont>
+                </bin>
+                <bin number="2">
+                    <area>235,10,535,270</area>
+                    <fcnfont name="active" function="active"></fcnfont>
+                    <fcnfont name="active" function="selected"></fcnfont>
+                    <fcnfont name="inactive" function="inactive"></fcnfont>
+                    <fcnfont name="selectable" function="selectable"></fcnfont>
+                </bin>
+            </managedtreelist>
+
+            <image name="showinglines" draworder="2" fleximage="yes">
+                <filename>showings.png</filename>
+                <position>0,0</position>
+            </image>
+        </container>
+    
+        <container name="theater_info">
+            <area>25,300,750,55</area>
+            <textarea name="theatername" draworder="6">
+                <area>10,10,750,55</area>
+                <font>infofont</font>
+                <value>Theater name</value>
+            </textarea>
+        </container>
+    
+    
+        <container name="movie_info">
+            <area>25,355,750,220</area>
+            <textarea name="movietitle" draworder="6">
+                <area>13,5,500,50</area>
+                <font>largetitle</font>
+            </textarea>
+
+            <textarea name="rating" draworder="6">
+                <area>13,50,150,35</area>
+                <font>infofont</font>
+                <value>Rating:</value>
+            </textarea>
+
+            <textarea name="ratingvalue" draworder="6">
+                <area>153,50,500,35</area>
+                <font>infofont</font>
+            </textarea>
+            
+            <textarea name="runningtime" draworder="6">
+                <area>13,80,300,35</area>
+                <font>infofont</font>
+                <value>Running Time:</value>
+            </textarea>
+
+            <textarea name="runningtimevalue" draworder="6">
+                <area>303,80,500,35</area>
+                <font>infofont</font>
+            </textarea>
+
+
+            <textarea name="showtimes" draworder="6">
+                <area>13,110,300,35</area>
+                <font>infofontunderline</font>
+                <value>Show Times</value>
+            </textarea>
+
+            <textarea name="showtimesvalue" draworder="6">
+                <area>13,140,10000,100</area><!--set absurdly large to prevent trimming-->
+                <font>infofont</font>
+            </textarea>         
+        
+        </container>
+    
+    </window>
+
+</mythuitheme>
Index: mythmovies/TODO
===================================================================
--- mythmovies/TODO	(revision 0)
+++ mythmovies/TODO	(revision 0)
@@ -0,0 +1,2 @@
+Rewrite the tree code once the new libmythui is ready
+
Index: mythmovies/COPYING
===================================================================
--- mythmovies/COPYING	(revision 0)
+++ mythmovies/COPYING	(revision 0)
@@ -0,0 +1,339 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
Index: mythmovies/README
===================================================================
--- mythmovies/README	(revision 0)
+++ mythmovies/README	(revision 0)
@@ -0,0 +1,18 @@
+MythMovies is Copyright (c) 2006, Josh Lefler.
+
+You may contact the original author at joshlefler@leflerinc.com.
+
+See the INSTALL file for installation instructions.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of tne GNU General Public License as public by
+the Free Software Foundation; version 2.
+
+This program is distributed in the hope that it will be useful, 
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software 
+Foundation, Inc. 51 Frankling St, Fifth Floor, Boston, MA, 02110-1201 USA
