2009-01-01 11:18:16 +00:00
|
|
|
#!/usr/bin/env python
|
2009-07-08 06:55:08 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
|
|
"""
|
|
|
|
OpenLP - Open Source Lyrics Projection
|
|
|
|
Copyright (c) 2008 Raoul Snyman
|
|
|
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
|
|
|
|
|
|
|
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; version 2 of the License.
|
|
|
|
|
|
|
|
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., 59 Temple
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
"""
|
2009-01-01 11:18:16 +00:00
|
|
|
|
2009-06-23 16:25:40 +00:00
|
|
|
import os
|
2009-01-01 11:18:16 +00:00
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
import time
|
|
|
|
import datetime
|
|
|
|
|
|
|
|
from openlp.migration.display import *
|
|
|
|
from openlp.migration.migratefiles import *
|
|
|
|
from openlp.migration.migratebibles import *
|
|
|
|
from openlp.migration.migratesongs import *
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
|
|
|
|
datefmt='%m-%d %H:%M',
|
|
|
|
filename='openlp-migration.log',
|
|
|
|
filemode='w')
|
|
|
|
|
2009-07-08 06:55:08 +00:00
|
|
|
class Migration(object):
|
|
|
|
"""
|
|
|
|
A class to take care of the migration process.
|
|
|
|
"""
|
2009-01-01 11:18:16 +00:00
|
|
|
def __init__(self):
|
|
|
|
"""
|
2009-07-08 06:55:08 +00:00
|
|
|
Initialise the process.
|
2009-01-01 11:18:16 +00:00
|
|
|
"""
|
2009-06-23 16:25:40 +00:00
|
|
|
self.display = Display()
|
|
|
|
self.stime = time.strftime(u'%Y-%m-%d-%H%M%S', time.localtime())
|
|
|
|
self.display.output(u'OpenLp v1.9.0 Migration Utility Started')
|
|
|
|
|
2009-01-01 11:18:16 +00:00
|
|
|
def process(self):
|
2009-07-08 06:55:08 +00:00
|
|
|
"""
|
|
|
|
Perform the conversion.
|
|
|
|
"""
|
2009-06-23 16:25:40 +00:00
|
|
|
#MigrateFiles(self.display).process()
|
2009-01-01 11:18:16 +00:00
|
|
|
MigrateSongs(self.display).process()
|
2009-06-23 16:25:40 +00:00
|
|
|
#MigrateBibles(self.display).process()
|
|
|
|
|
2009-01-01 11:18:16 +00:00
|
|
|
def move_log_file(self):
|
2009-07-08 06:55:08 +00:00
|
|
|
"""
|
|
|
|
Move the log file to a new location.
|
|
|
|
"""
|
2009-01-01 11:18:16 +00:00
|
|
|
fname = 'openlp-migration.log'
|
|
|
|
c = os.path.splitext(fname)
|
2009-06-16 18:21:24 +00:00
|
|
|
b = (c[0]+'-'+ unicode(self.stime) + c[1])
|
2009-06-23 16:25:40 +00:00
|
|
|
self.display.output(u'Logfile " +b + " generated')
|
2009-06-16 18:21:24 +00:00
|
|
|
self.display.output(u'Migration Utility Finished ')
|
2009-06-23 16:25:40 +00:00
|
|
|
os.rename(fname, b)
|
|
|
|
|
2009-01-01 11:18:16 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
mig = Migration()
|
|
|
|
mig.process()
|
2009-06-23 16:25:40 +00:00
|
|
|
#mig.move_log_file()
|