~ubuntu-branches/ubuntu/natty/mythtv/natty

« back to all changes in this revision

Viewing changes to programs/mythcommflag/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello, Mario Limonciello, Thomas Mashos
  • Date: 2010-06-20 00:11:00 UTC
  • mfrom: (1.1.53 upstream)
  • Revision ID: james.westby@ubuntu.com-20100620001100-yulpns6qg4ksmay6
Tags: 0.23.0+fixes25138-0ubuntu1
[ Mario Limonciello ]
* new upstream checkout (25138)

[ Thomas Mashos ]
* Added missingok for mirobridge log in logrotate (LP: #581283)
* Backend now waits for udev to finish (LP: #556204)
* Added patch to properly detect dbus during compile (LP: #574877)

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#define LOC_WARN QString("MythCommFlag, Warning: ")
48
48
#define LOC_ERR  QString("MythCommFlag, Error: ")
49
49
 
 
50
namespace
 
51
{
 
52
    void cleanup()
 
53
    {
 
54
        delete gContext;
 
55
        gContext = NULL;
 
56
 
 
57
    }
 
58
 
 
59
    class CleanupGuard
 
60
    {
 
61
      public:
 
62
        typedef void (*CleanupFunc)();
 
63
 
 
64
      public:
 
65
        CleanupGuard(CleanupFunc cleanFunction) :
 
66
            m_cleanFunction(cleanFunction) {}
 
67
 
 
68
        ~CleanupGuard()
 
69
        {
 
70
            m_cleanFunction();
 
71
        }
 
72
 
 
73
      private:
 
74
        CleanupFunc m_cleanFunction;
 
75
    };
 
76
}
 
77
 
50
78
bool quiet = false;
51
79
bool force = false;
52
80
 
1196
1224
        ++argpos;
1197
1225
    }
1198
1226
 
1199
 
    gContext = NULL;
 
1227
    CleanupGuard callCleanup(cleanup);
 
1228
 
1200
1229
    gContext = new MythContext(MYTH_BINARY_VERSION);
1201
1230
    if (!gContext->Init(
1202
1231
            false/*use gui*/, NULL/*upnp*/, false/*prompt for backend*/,
1297
1326
        int breaksFound = FlagCommercials(
1298
1327
            chanid, starttime, outputfilename, useDB);
1299
1328
 
1300
 
        delete gContext;
1301
 
 
1302
1329
        return breaksFound; // exit(breaksFound);
1303
1330
    }
1304
1331
 
1512
1539
        }
1513
1540
    }
1514
1541
 
1515
 
    delete gContext;
1516
 
 
1517
1542
    time_now = time(NULL);
1518
1543
 
1519
1544
    if (!quiet)