Пример #1
0
def main():
    parser = argparse.ArgumentParser(description='PyRfK Interface for liquidsoap',
                                     epilog='Anyways, this should normally not be called manually')
    parser.add_argument('--debug', action='store_true')
    subparsers = parser.add_subparsers(dest='command', help='sub-command help')

    authparser = subparsers.add_parser('auth', help='a help')
    authparser.add_argument('username')
    authparser.add_argument('password')

    metadataparser = subparsers.add_parser('meta', help='a help')
    metadataparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    connectparser = subparsers.add_parser('connect', help='a help')
    connectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    disconnectparser = subparsers.add_parser('disconnect', help='a help')
    disconnectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    playlistparser = subparsers.add_parser('playlist', help='a help')
    listenerparser = subparsers.add_parser('listenercount', help='prints total listenercount')

    args = parser.parse_args()

    rfk.init()
    rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                               rfk.CONFIG.get('database', 'username'),
                                               rfk.CONFIG.get('database', 'password'),
                                               rfk.CONFIG.get('database', 'host'),
                                               rfk.CONFIG.get('database', 'database')))
    try:
        global logger
        logger = init_db_logging('liquidsoaphandler')

        logger.info(args.command)
        rfk.database.session.commit()
        if args.command == 'auth':
            doAuth(args.username, args.password)
        elif args.command == 'meta':
            data = decode_json(args.data)
            doMetaData(data)
        elif args.command == 'connect':
            data = decode_json(args.data)
            doConnect(data)
        elif args.command == 'disconnect':
            data = decode_json(args.data)
            doDisconnect(data)
        elif args.command == 'playlist':
            doPlaylist()
        elif args.command == 'listenercount':
            doListenerCount()

    except Exception as e:
        rfk.database.session.rollback()
        exc_type, exc_value, exc_tb = sys.exc_info()
        import traceback

        logger.error(''.join(traceback.format_exception(exc_type, exc_value, exc_tb)))
        rfk.database.session.commit()

    finally:
        rfk.database.session.rollback()
        rfk.database.session.remove()
Пример #2
0
def main(foreground):
    if not foreground:
        rfk.helper.daemonize.createDaemon(get_path())

    rfk.init()
    rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                               rfk.CONFIG.get('database', 'username'),
                                               rfk.CONFIG.get('database', 'password'),
                                               rfk.CONFIG.get('database', 'host'),
                                               rfk.CONFIG.get('database', 'database')))

    global redis_client
    redis_client = redis.StrictRedis(host='127.0.0.1', port=6379, decode_responses=True)
    pubsub = redis_client.pubsub(ignore_subscribe_messages=True)
    pubsub.subscribe('rfk-event')

    try:
        for message in pubsub.listen():
            if message and message['type'] == 'message':
                data = ast.literal_eval(message['data'])
                try:
                    if data['event'] == 'show_change':
                        handle_show_change(data['show_id'])
                    elif data['event'] == 'track_change':
                        handle_track_change(data['track_id'])
                except (KeyError, TypeError):
                    pass
    except KeyboardInterrupt:
        return False
Пример #3
0
def main():
    parser = argparse.ArgumentParser(description='PyRfK Daemon for running Liquidsoap',
                                     epilog='Anyways this should normally not called manually')
    parser.add_argument('--foreground', action='store_true')
    parser.add_argument('--debug', action='store_true')
    args = parser.parse_args()
    if not args.foreground:
        rfk.helper.daemonize.createDaemon(get_path())
    
    rfk.init()
    
    rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                                            rfk.CONFIG.get('database', 'username'),
                                                            rfk.CONFIG.get('database', 'password'),
                                                            rfk.CONFIG.get('database', 'host'),
                                                            rfk.CONFIG.get('database', 'database')))
    try:
        daemon = LiquidsoapDaemon(rfk.CONFIG.get('liquidsoap-daemon','socket'))
        if args.debug:
            daemon.set_debug(args.debug)
        if args.foreground:
            daemon.enable_stdout()
        daemon.run()

    except SocketExists:
        print 'Socket is already there, maybe another instance running?'
        return 1
Пример #4
0
def main():
    parser = argparse.ArgumentParser(
        description='PyRfK Daemon for running Liquidsoap',
        epilog='Anyways this should normally not called manually')
    parser.add_argument('--foreground', action='store_true')
    parser.add_argument('--debug', action='store_true')
    args = parser.parse_args()
    if not args.foreground:
        rfk.helper.daemonize.createDaemon(get_path())

    rfk.init()

    rfk.database.init_db(
        "%s://%s:%s@%s/%s" % (rfk.CONFIG.get(
            'database', 'engine'), rfk.CONFIG.get('database', 'username'),
                              rfk.CONFIG.get('database', 'password'),
                              rfk.CONFIG.get('database', 'host'),
                              rfk.CONFIG.get('database', 'database')))
    try:
        daemon = LiquidsoapDaemon(rfk.CONFIG.get('liquidsoap-daemon',
                                                 'socket'))
        if args.debug:
            daemon.set_debug(args.debug)
        if args.foreground:
            daemon.enable_stdout()
        daemon.run()

    except SocketExists:
        print 'Socket is already there, maybe another instance running?'
    finally:
        rfk.database.session.rollback()
        rfk.database.session.remove()
Пример #5
0
def main():
    try:
        rfk.init()
        if rfk.CONFIG.has_option('database', 'url'):
            init_db(rfk.CONFIG.get('database', 'url'))
        else:
            init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                          rfk.CONFIG.get('database', 'username'),
                                          rfk.CONFIG.get('database', 'password'),
                                          rfk.CONFIG.get('database', 'host'),
                                          rfk.CONFIG.get('database', 'database')))
        for relay in Relay.query.all():
            try:
                relay.usage = get_stats_direct(relay)
                rs = RelayStatistic.get_relaystatistic(relay, RelayStatistic.TYPE.TRAFFIC)
                if relay.usage is not None:
                    rs.statistic.set(now(), relay.usage)
                relay.status = Relay.STATUS.ONLINE
                rfk.database.session.commit()
            except urllib2.URLError as e:
                rfk.database.session.rollback()
                relay.status = Relay.STATUS.UNKNOWN
                rfk.database.session.commit()
                print "Could not reach server: {}:{} - ".format(relay.address, relay.port, str(e))
            except socket.timeout as e:
                rfk.database.session.rollback()
                relay.status = Relay.STATUS.UNKNOWN
                rfk.database.session.commit()
                print "Could not reach server: {}:{} - ".format(relay.address, relay.port, str(e))
    except Exception as e:
        print e
    finally:
        rfk.database.session.rollback()
        rfk.database.session.remove()
Пример #6
0
def main():
    parser = argparse.ArgumentParser(description='PyRfK Interface for liquidsoap',
                                     epilog='Anyways, this should normally not be called manually')
    parser.add_argument('--debug', action='store_true')
    subparsers = parser.add_subparsers(dest='command', help='sub-command help')

    authparser = subparsers.add_parser('auth', help='a help')
    authparser.add_argument('username')
    authparser.add_argument('password')

    metadataparser = subparsers.add_parser('meta', help='a help')
    metadataparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    connectparser = subparsers.add_parser('connect', help='a help')
    connectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    disconnectparser = subparsers.add_parser('disconnect', help='a help')
    disconnectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    playlistparser = subparsers.add_parser('playlist', help='a help')
    listenerparser = subparsers.add_parser('listenercount', help='prints total listenercount')

    args = parser.parse_args()

    rfk.init()
    rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                               rfk.CONFIG.get('database', 'username'),
                                               rfk.CONFIG.get('database', 'password'),
                                               rfk.CONFIG.get('database', 'host'),
                                               rfk.CONFIG.get('database', 'database')))
    try:
        global logger
        logger = init_db_logging('liquidsoaphandler')

        logger.info(args.command)
        rfk.database.session.commit()
        if args.command == 'auth':
            doAuth(args.username, args.password)
        elif args.command == 'meta':
            data = decode_json(args.data);
            doMetaData(data)
        elif args.command == 'connect':
            data = decode_json(args.data);
            doConnect(data)
        elif args.command == 'disconnect':
            data = decode_json(args.data);
            doDisconnect(data)
        elif args.command == 'playlist':
            doPlaylist()
        elif args.command == 'listenercount':
            doListenerCount()
    except Exception as e:
        rfk.database.session.rollback()
        exc_type, exc_value, exc_tb = sys.exc_info()
        import traceback

        logger.error(''.join(traceback.format_exception(exc_type, exc_value, exc_tb)))
        rfk.database.session.commit()
    finally:
        rfk.database.session.rollback()
        rfk.database.session.remove()
Пример #7
0
def main():
    rfk.init(enable_geoip=False)

    db_url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'
    (file_name, headers) = urllib.urlretrieve(db_url)
    ret_val = subprocess.call(['gunzip', file_name])

    if ret_val == 0:
        shutil.move(file_name[:-3], rfk.CONFIG.get('site', 'geoipdb'))
Пример #8
0
def fetch_database_url():
    import rfk
    rfk.init(enable_geoip=False)
    if rfk.CONFIG.has_option('database', 'url'):
        return rfk.CONFIG.get('database', 'url')
    else:
        return "%s://%s:%s@%s/%s" % (rfk.CONFIG.get(
            'database', 'engine'), rfk.CONFIG.get('database', 'username'),
                                     rfk.CONFIG.get('database', 'password'),
                                     rfk.CONFIG.get('database', 'host'),
                                     rfk.CONFIG.get('database', 'database'))
Пример #9
0
def fetch_database_url():
    import rfk
    rfk.init(enable_geoip=False)
    if rfk.CONFIG.has_option('database', 'url'):
        return rfk.CONFIG.get('database', 'url')
    else:
        return "%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                  rfk.CONFIG.get('database', 'username'),
                                  rfk.CONFIG.get('database', 'password'),
                                  rfk.CONFIG.get('database', 'host'),
                                  rfk.CONFIG.get('database', 'database'))
Пример #10
0
def main():
    rfk.init(enable_geoip=False)

    def download_progress(blocks_read, block_size, total_size):
        if blocks_read == 0:
            widgets = [progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA(), ' ', progressbar.FileTransferSpeed()]
            download_progress.progress_bar = progressbar.ProgressBar(widgets=widgets, maxval=(total_size/block_size) + 1).start()
        download_progress.progress_bar.update(blocks_read)

    db_url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'
    (file_name, headers) = urllib.urlretrieve(db_url, reporthook=download_progress)

    ret_val = subprocess.call(['gunzip', file_name])
    if ret_val == 0:
        shutil.move(file_name[:-3], rfk.CONFIG.get('site', 'geoipdb'))
    else:
        raise IOError
Пример #11
0
def main():
    parser = argparse.ArgumentParser(description='PyRfK Interface for liquidsoap',
                                     epilog='Anyways this should normally not called manually')
    parser.add_argument('--debug', action='store_true')
    subparsers = parser.add_subparsers(dest='command', help='sub-command help')
    
    authparser = subparsers.add_parser('auth', help='a help')
    authparser.add_argument('username')
    authparser.add_argument('password')
    
    metadataparser = subparsers.add_parser('meta', help='a help')
    metadataparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    connectparser = subparsers.add_parser('connect', help='a help')
    connectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    disconnectparser = subparsers.add_parser('disconnect', help='a help')
    disconnectparser.add_argument('data', metavar='data', help='mostly some json encoded string from liquidsoap')
    playlistparser = subparsers.add_parser('playlist', help='a help')
    listenerparser = subparsers.add_parser('listenercount', help='prints total listenercount')
    
    args = parser.parse_args()
    
    rfk.init()
    rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                                              rfk.CONFIG.get('database', 'username'),
                                                              rfk.CONFIG.get('database', 'password'),
                                                              rfk.CONFIG.get('database', 'host'),
                                                              rfk.CONFIG.get('database', 'database')))
    logger.info(args.command)
    rfk.database.session.commit()
    if args.command == 'auth':
        doAuth(args.username, args.password)
    elif args.command == 'meta':
        data = json.loads(args.data);
        doMetaData(data)
    elif args.command == 'connect':
        data = json.loads(args.data);
        doConnect(data)
    elif args.command == 'disconnect':
        data = json.loads(args.data);
        doDisconnect(data)
    elif args.command == 'playlist':
        doPlaylist()
    elif args.command == 'listenercount':
        doListenerCount()
    rfk.database.session.remove()
Пример #12
0
def main(jid, password, foreground):
    rfk.init(enable_geoip=False)
    if not jid:
        jid = rfk.CONFIG.get('xmpp', 'jid')
    if not password:
        password = rfk.CONFIG.get('xmpp', 'password')
    if not foreground:
        rfk.helper.daemonize.createDaemon(get_path())

    # Setup logging
    logging.basicConfig(level=logging.INFO,
                        format='%(levelname)-8s %(message)s')

    # Setup XMPP instance
    xmpp = RfKBot(jid, password)

    # Connect to the XMPP server and start processing XMPP stanzas
    if xmpp.connect():
        xmpp.process(block=False)

        def message_handler(message):
            if message and message['type'] == 'message':
                data = ast.literal_eval(message['data'])
                try:
                    if data['type'] == 'message':
                        xmpp.send_messages(data)
                    elif data['type'] == 'tune':
                        xmpp.update_tune(data)
                except (KeyError, TypeError) as err:
                    logging.error('message_handler error: {}'.format(err))

        try:
            redis_client = StrictRedis(host='localhost',
                                       port=6379,
                                       decode_responses=True)
            redis_pubsub = redis_client.pubsub(ignore_subscribe_messages=True)
            redis_pubsub.subscribe('rfk-xmpp')
            for message in redis_pubsub.listen():
                message_handler(message)
        except (ConnectionError, KeyboardInterrupt):
            xmpp.disconnect(wait=True)
            return False

    else:
        return False
Пример #13
0
def main():
    try:
        rfk.init()
        if rfk.CONFIG.has_option('database', 'url'):
            init_db(rfk.CONFIG.get('database', 'url'))
        else:
            init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                          rfk.CONFIG.get('database', 'username'),
                                          rfk.CONFIG.get('database', 'password'),
                                          rfk.CONFIG.get('database', 'host'),
                                          rfk.CONFIG.get('database', 'database')))
        for user in User.query.yield_per(50):
            for stat in stats:
                stat(user)
        rfk.database.session.commit()
    except Exception as e:
        rfk.database.session.rollback()
        raise
    finally:
        rfk.database.session.remove()
Пример #14
0
def main():
    try:
        rfk.init()
        if rfk.CONFIG.has_option('database', 'url'):
            init_db(rfk.CONFIG.get('database', 'url'))
        else:
            init_db("%s://%s:%s@%s/%s" %
                    (rfk.CONFIG.get('database', 'engine'),
                     rfk.CONFIG.get('database', 'username'),
                     rfk.CONFIG.get('database', 'password'),
                     rfk.CONFIG.get('database', 'host'),
                     rfk.CONFIG.get('database', 'database')))
        for user in User.query.yield_per(50):
            for stat in stats:
                stat(user)
        rfk.database.session.commit()
    except Exception as e:
        rfk.database.session.rollback()
        raise
    finally:
        rfk.database.session.remove()
Пример #15
0
def main():
    try:
        rfk.init()
        if rfk.CONFIG.has_option('database', 'url'):
            init_db(rfk.CONFIG.get('database', 'url'))
        else:
            init_db("%s://%s:%s@%s/%s" %
                    (rfk.CONFIG.get('database', 'engine'),
                     rfk.CONFIG.get('database', 'username'),
                     rfk.CONFIG.get('database', 'password'),
                     rfk.CONFIG.get('database', 'host'),
                     rfk.CONFIG.get('database', 'database')))
        for relay in Relay.query.all():
            try:
                relay.usage = get_stats_direct(relay)
                rs = RelayStatistic.get_relaystatistic(
                    relay, RelayStatistic.TYPE.TRAFFIC)
                if relay.usage is not None:
                    rs.statistic.set(now(), relay.usage)
                relay.status = Relay.STATUS.ONLINE
                rfk.database.session.commit()
            except urllib2.URLError as e:
                rfk.database.session.rollback()
                relay.status = Relay.STATUS.UNKNOWN
                rfk.database.session.commit()
                print "Could not reach server: {}:{} - ".format(
                    relay.address, relay.port, str(e))
            except socket.timeout as e:
                rfk.database.session.rollback()
                relay.status = Relay.STATUS.UNKNOWN
                rfk.database.session.commit()
                print "Could not reach server: {}:{} - ".format(
                    relay.address, relay.port, str(e))
    except Exception as e:
        print e
    finally:
        rfk.database.session.rollback()
        rfk.database.session.remove()
Пример #16
0
def main():
    rfk.init(enable_geoip=False)

    def download_progress(blocks_read, block_size, total_size):
        if blocks_read == 0:
            widgets = [
                progressbar.Percentage(), ' ',
                progressbar.Bar(), ' ',
                progressbar.ETA(), ' ',
                progressbar.FileTransferSpeed()
            ]
            download_progress.progress_bar = progressbar.ProgressBar(
                widgets=widgets, maxval=(total_size / block_size) + 1).start()
        download_progress.progress_bar.update(blocks_read)

    db_url = 'http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz'
    (file_name, headers) = urllib.urlretrieve(db_url,
                                              reporthook=download_progress)

    ret_val = subprocess.call(['gunzip', file_name])
    if ret_val == 0:
        shutil.move(file_name[:-3], rfk.CONFIG.get('site', 'geoipdb'))
    else:
        raise IOError
Пример #17
0
from sqlalchemy.orm.exc import NoResultFound

import rfk
import rfk.database
from rfk.database.streaming import Listener
from rfk.database.stats import Statistic


def update_stats_at(stats, datetime):
    c = Listener.query.filter(datetime >= Listener.connect,
                              datetime < Listener.disconnect).count()
    stats.set(datetime, c)

if __name__ == '__main__':
    rfk.init(enable_geoip=False)
    if rfk.CONFIG.has_option('database', 'url'):
        rfk.database.init_db(rfk.CONFIG.get('database', 'url'))
    else:
        rfk.database.init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                                   rfk.CONFIG.get('database', 'username'),
                                                   rfk.CONFIG.get('database', 'password'),
                                                   rfk.CONFIG.get('database', 'host'),
                                                   rfk.CONFIG.get('database', 'database')))

    try:
        stat = Statistic.query.filter(Statistic.identifier == 'lst-total').one()
    except NoResultFound:
        stat = Statistic(name='Overall Listener', identifier='lst-total')
        rfk.database.session.add(stat)
        rfk.database.session.flush()
    for listener in Listener.query.order_by(Listener.listener.asc()).yield_per(50):
Пример #18
0
    useragent = Column(String)
    connected = Column(DateTime)
    disconnected = Column(DateTime)
    client = Column(Integer)
    
class News(Base):
    __tablename__ = 'news'
    news = Column(Integer, primary_key=True, autoincrement=True)
    streamer_id = Column('streamer', Integer(unsigned=True), ForeignKey('streamer.streamer', onupdate="CASCADE", ondelete="RESTRICT"))
    streamer = relationship('Streamer', backref='news')
    time = Column(DateTime)
    description = Column(String)
    text = Column(Text)
    
current_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
rfk.init(current_dir)

old_engine = create_engine("%s://%s:%s@%s/%s?charset=utf8" % (rfk.CONFIG.get('olddatabase', 'engine'),
                                                              rfk.CONFIG.get('olddatabase', 'username'),
                                                              rfk.CONFIG.get('olddatabase', 'password'),
                                                              rfk.CONFIG.get('olddatabase', 'host'),
                                                              rfk.CONFIG.get('olddatabase', 'database')))

rfk.database.init_db("%s://%s:%s@%s/%s?charset=utf8" % (rfk.CONFIG.get('database', 'engine'),
                                                              rfk.CONFIG.get('database', 'username'),
                                                              rfk.CONFIG.get('database', 'password'),
                                                              rfk.CONFIG.get('database', 'host'),
                                                              rfk.CONFIG.get('database', 'database')))


OldSession = sessionmaker(bind=old_engine)
Пример #19
0
from sqlalchemy.orm.exc import NoResultFound

import rfk
import rfk.database
from rfk.database.streaming import Listener
from rfk.database.stats import Statistic


def update_stats_at(stats, datetime):
    c = Listener.query.filter(datetime >= Listener.connect,
                              datetime < Listener.disconnect).count()
    stats.set(datetime, c)


if __name__ == '__main__':
    rfk.init(enable_geoip=False)
    if rfk.CONFIG.has_option('database', 'url'):
        rfk.database.init_db(rfk.CONFIG.get('database', 'url'))
    else:
        rfk.database.init_db(
            "%s://%s:%s@%s/%s" % (rfk.CONFIG.get(
                'database', 'engine'), rfk.CONFIG.get('database', 'username'),
                                  rfk.CONFIG.get('database', 'password'),
                                  rfk.CONFIG.get('database', 'host'),
                                  rfk.CONFIG.get('database', 'database')))

    try:
        stat = Statistic.query.filter(
            Statistic.identifier == 'lst-total').one()
    except NoResultFound:
        stat = Statistic(name='Overall Listener', identifier='lst-total')
Пример #20
0
def to_utc(datetime):
    """Convert a datetime object to UTC [s]and drop tzinfo[/s].  This is the
    opposite operation to :func:`to_user_timezone`.
    """
    if datetime.tzinfo is None:
        datetime = flask.ext.babel.get_timezone().localize(datetime)
    return datetime.astimezone(pytz.utc).replace(tzinfo=pytz.UTC)


flask.ext.babel.to_utc = to_utc

import rfk
from rfk.database import init_db


rfk.init()
if rfk.CONFIG.has_option('database', 'url'):
    init_db(rfk.CONFIG.get('database', 'url'))
else:
    init_db("%s://%s:%s@%s/%s" % (rfk.CONFIG.get('database', 'engine'),
                                  rfk.CONFIG.get('database', 'username'),
                                  rfk.CONFIG.get('database', 'password'),
                                  rfk.CONFIG.get('database', 'host'),
                                  rfk.CONFIG.get('database', 'database')))
from rfk.site import app

app.template_folder = '../templates/'
app.static_folder = '../static/'
app.static_url_path = '/static'

Пример #21
0
class News(Base):
    __tablename__ = 'news'
    news = Column(Integer, primary_key=True, autoincrement=True)
    streamer_id = Column(
        'streamer', Integer(unsigned=True),
        ForeignKey('streamer.streamer',
                   onupdate="CASCADE",
                   ondelete="RESTRICT"))
    streamer = relationship('Streamer', backref='news')
    time = Column(DateTime)
    description = Column(String)
    text = Column(Text)


current_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
rfk.init(current_dir)

old_engine = create_engine("%s://%s:%s@%s/%s?charset=utf8" %
                           (rfk.CONFIG.get('olddatabase', 'engine'),
                            rfk.CONFIG.get('olddatabase', 'username'),
                            rfk.CONFIG.get('olddatabase', 'password'),
                            rfk.CONFIG.get('olddatabase', 'host'),
                            rfk.CONFIG.get('olddatabase', 'database')))

rfk.database.init_db(
    "%s://%s:%s@%s/%s?charset=utf8" %
    (rfk.CONFIG.get('database',
                    'engine'), rfk.CONFIG.get('database', 'username'),
     rfk.CONFIG.get('database', 'password'), rfk.CONFIG.get(
         'database', 'host'), rfk.CONFIG.get('database', 'database')))