From 4b1bb045652287bf2a0d82ecc435e2eb082db768 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Wed, 3 Oct 2018 10:32:53 +0000 Subject: [PATCH] =?UTF-8?q?Bug=202453=20-=20simpatix50=20n'arrive=20pas=20?= =?UTF-8?q?=C3=A0=20r=C3=A9cuperer=20son=20adresse=20ip=20ipmi=20via=20dhc?= =?UTF-8?q?p?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit désactivation d'ipmi sur les r610 tant que l'on n'a pas trouvé la cause du problème. --- meltingnotes.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 meltingnotes.py diff --git a/meltingnotes.py b/meltingnotes.py new file mode 100644 index 0000000..c0a5ded --- /dev/null +++ b/meltingnotes.py @@ -0,0 +1,63 @@ +''' + The goal of this application is to convert a mno database into mno's web site compatible database (drupal) +''' + +import sqlite3 + + +import os +import re +import sys +from SimpaDbUtil import SqlFile, SqlDatabaseReader +from _sqlite3 import Row + +class OrchestraSqlDb( object ): + def __init__(self, sql_reader): + """ + :param SqlDatabaseReader sql_reader: the inventory database + """ + super(OrchestraSqlDb, self).__init__() + self._sql_reader = sql_reader + + def query(self, sql_query): + return self._sql_reader.query(sql_query) + + +class Concert(object): + pass + +class Recording(object): + pass + +class OrchestraDb(object): + + def __init__(self, mno_drupal_db_sql_file_path): + self.concerts = {} + + sql_source = SqlFile(mno_drupal_db_sql_file_path) + sql_reader = SqlDatabaseReader(sql_source) + orchestra_sql_db = OrchestraSqlDb(sql_reader) + + self._parse_from_orchestra_drupal_db(orchestra_sql_db) + + def _parse_from_orchestra_drupal_db(self, orchestra_sql_db): + """ + :param OrchestraSqlDb orchestra_sql_db: + """ + + concert_rows = orchestra_sql_db.query("SELECT nid,title FROM node WHERE type is 'concert'") + + for concert_row in concert_rows: + (nid, title)=concert_row + print(title) + nid = int(nid) + track_id_rows = orchestra_sql_db.query("SELECT field_tracks_target_id FROM field_revision_field_tracks WHERE entity_id=%d" % nid ) + for track_id_row in track_id_rows: + (field_tracks_target_id, ) = track_id_row + #print(field_tracks_target_id) + + track_rows = orchestra_sql_db.query("SELECT title FROM node WHERE nid=%d" % field_tracks_target_id) + (recording_title, ) = track_rows[0] + print("\t%s" % recording_title) + +mno_db = OrchestraDb('/Users/graffy/data/Perso/MeltingNotes_work.git/website/v2_drupal/melting_drupal.sql')