def db_reset():
    """ Resets database. """

    confirm_target('Are you sure you want to reset the database?')

    # backup database before resetting
    backup_db()
    with cd(env.server_root_dir):
        with prefix('. .env/bin/activate'):
            run('./reset.sh')
Пример #2
0
def db_reset():
    """ Resets database. """

    confirm_target('Are you sure you want to reset the database?')

    # backup database before resetting
    backup_db()
    with cd(env.server_root_dir):
        with prefix('. .env/bin/activate'):
            run('./reset.sh')
Пример #3
0
def db_reset():
    """ Resets database. """
    print('Are you sure you want to reset the database?')
    host = prompt('Type in the host to confirm: ')
    branch = prompt('Type in the branch to confirm: ')
    if host == env.host and branch == env.branch:
        # backup database before resetting
        backup_db()
        with cd(env.server_root_dir):
            with prefix('. .env/bin/activate'):
                run('./reset.sh')
    else:
        print('Invalid host or branch.')
Пример #4
0
def update_server():
    """ Updates server repository. """
    # backup database before updating
    backup_db()

    update_helper(env.server_root_dir)

    bower.update()

    with cd(env.server_root_dir):
        with prefix('. .env/bin/activate'):
            run('pip install --requirement install/requirements.pip')
            run('yes yes | python manage.py collectstatic')
Пример #5
0
def main():
    #Make a backup!
    db.backup_db()
    conn = sqlite3.connect(db.get_songs_db_path())
    conn.text_factory = str
    c = conn.cursor()

    c.execute("SELECT lyrics from songs")

    xmllist = c.fetchall()

    for xmlindex in xrange(len(xmllist)):
        try:
            song_xml = objectify.fromstring(
                xmllist[xmlindex][0]
                [38:])  # Cut the first 38 characters (xml preamble) off.
        except etree.XMLSyntaxError:
            exit("error")

        verses = song_xml.lyrics.verse
        newverses = []
        for i in xrange(len(verses)):

            attribs = verses[i].attrib
            text = verses[i].text
            if attribs["type"] == "c":
                if italics == "add":
                    text = tags.add_italic_tags(text)
                elif italics == "remove":
                    text = tags.trim_italic_tags(text)
            verse = etree.Element('verse', **attribs)
            verse.text = etree.CDATA(text)
            newverses.append(verse)

        song_xml.lyrics.verse = newverses

        generatedxml = etree.tostring(song_xml,
                                      encoding='UTF-8',
                                      xml_declaration=True)

        c.execute("UPDATE songs SET lyrics=? WHERE id=?;",
                  [generatedxml, xmlindex + 1])
        conn.commit()

    conn.close()
Пример #6
0
def main():
	#Make a backup!
	db.backup_db()
	conn = sqlite3.connect(db.get_songs_db_path())
	conn.text_factory = str
	c = conn.cursor()

	c.execute("SELECT lyrics from songs")


	xmllist = c.fetchall()

	for xmlindex in xrange(len(xmllist)):
		try:
			song_xml = objectify.fromstring(xmllist[xmlindex][0][38:]) # Cut the first 38 characters (xml preamble) off.
		except etree.XMLSyntaxError:
			exit("error")

		verses = song_xml.lyrics.verse
		newverses = []
		for i in xrange(len(verses)):

			attribs = verses[i].attrib
			text = verses[i].text
			if attribs["type"]=="c":
				if italics == "add":
					text = tags.add_italic_tags(text)
				elif italics == "remove":
					text = tags.trim_italic_tags(text)
			verse = etree.Element('verse', **attribs)
			verse.text = etree.CDATA(text)
			newverses.append(verse)
			
		song_xml.lyrics.verse = newverses


		generatedxml = etree.tostring(song_xml, encoding='UTF-8', xml_declaration=True)

		c.execute("UPDATE songs SET lyrics=? WHERE id=?;", [generatedxml, xmlindex+1])
		conn.commit()



	conn.close()
Пример #7
0
def update_server():
    """ Updates server repository. """
    # backup database before updating
    backup_db()

    update_helper(env.server_root_dir)

    with cd(env.server_root_dir):
        with prefix('. .env/bin/activate'):

            print(green('installing pip requirements'))
            run('pip install --requirement requirements.txt')

            print(green('collecting static files'))
            run('yes yes | python manage.py collectstatic')

            print(green('compiling translations'))
            run('./translate.sh -c')

    print(green('Migrate database'))
    migrate()
Пример #8
0
def update_server():
    """ Updates server repository. """
    # backup database before updating
    backup_db()

    update_helper(env.server_root_dir)

    bower.update()

    with cd(env.server_root_dir):
        with prefix('. .env/bin/activate'):

            print(green('installing pip requirements'))
            run('pip install --requirement install/requirements.pip')

            print(green('collecting static files'))
            run('yes yes | python manage.py collectstatic')

            print(green('compiling translations'))
            run('./translate.sh -c')

    print(green('Migrate database'))
    migrate()