def main(): path = "/Users/anaelle/Desktop/Films/" print path movienames = find_movies(path) print movienames movies_list = clean_movienames(movienames, path) print movies_list #imdb_list = ["http://www.imdb.com/title/tt1758692/","http://www.imdb.com/title/tt2194499/","http://www.imdb.com/title/tt0780504/","http://www.imdb.com/title/tt0111161/"] #print '\n'.join(movienames) #links = googlesearch('savages','http://www.imdb.com/') #for link in links: #print link #movies_list = test(imdb_list) count = 0 db = database_manager.DatabaseManager() db.connect() for movie in movies_list: #print repr(movie) link = googlesearch(movie.movie_name, IMDB) print link movie.imdb_link = link get_info(movie) #attention voir si ca modifie sans retourner quch #print movie.movie_name #print movie.summary #print movie.imdb_rating #print movie.seen print str(movie) insert_values = (count, movie.movie_name, movie.movie_path, movie.imdb_link, movie.cover, movie.summary, movie.imdb_rating, movie.anaelle_rating, movie.seen) db.insert(insert_values) count = count + 1 db.close()
def getImage(id_): db = database_manager.DatabaseManager() db.connect() m = db.find_movie(id_) print m.cover[0:20] open('/tmp/x.jpg', 'w').write(m.cover) #response = make_response(m.cover) #response.headers['Content-Type'] = 'image/jpeg' #return response return Response(m.cover, content_type='image/jpeg')
def my_rating(id_): form = AnaelleRateForm() db = database_manager.DatabaseManager() db.connect() m = db.find_movie(id_) if form.validate_on_submit(): flash('thanks') db.update_rating(id_, form.rate.data) return redirect('/index') return render_template('rate_form.html', title='rating', form=form, i=m)
def __init__(self, user_name: str, thread_manager: object, device: str): self.user_name = user_name self.session_id = None self.ner_class = None self.database_manager = database_manager.DatabaseManager() self.al_manager = None self.device = device self.thread_manager = thread_manager self.start_time = None self.end_time = None
def update_s(id_): db = database_manager.DatabaseManager() db.connect() m = db.find_movie(id_) if (m.seen == 0): m.seen = 1 else: m.seen = 0 db.update_seen(id_, m.seen) db.close return render_template('movie.html', i=m)
def x(): if request.method == 'GET': #return 'this is GET\n' db = database_manager.DatabaseManager() db.connect() titles = db.select_title() movies_list = db.import_db() db.close() return render_template('index.html', to_print=movies_list) if request.method == 'POST': print 'POST keys: ', request.form.keys() return 'this is a POST\n'
def first_access_setup(): # Setup initial configuration print("DomoRoom - Initial configurations...\n\n") print("\nInsert the database encryption key") while True: key = getpass.getpass("Key: ") key2 = getpass.getpass("Repeat Key: ") if key == key2: print("Encryption key saved\n") break else: print("Keys are not matching") print("Insert the telegram bot api token") token = getpass.getpass( "Token: ") # TODO check if the token is working database_manager.DatabaseManager(key).write("telegram", token)
def __init__(self, verbose): logfile = "../resources/files/logfile" if verbose: logfile = "" self.init_logging(logfile) self.logger = logging.getLogger("DomoRoom-kernel") # Default logger if not database_manager.DatabaseManager.file_exist("telegram"): self.logger.warning( "Resources not found, initializing 'first access setup'") control_panel.ControlPanel.first_access_setup() key = raw_input("Insert the key: ") # TODO verify & hide the key self.database_manager = database_manager.DatabaseManager(key) self.camera_manager = camera_manager.CameraManager(self) self.telegram_manager = telegram_manager.TelegramManager(self) self.control_panel = control_panel.ControlPanel(self) self.remote_devices = remote_devices.RemoteDevices(self) self.data_mining = None self.integrity_system = None self.routines = routines.RoutinesManager(self) self.remote_controller = None
import database_manager import active_learning_manager import survey_utils from thread_manager import start_thread_manager, ThreadManager from firebase_manager import setup_firebase from server_args import get_args from server_manager import ( ServerManager, ) thread_manager, thread_manager_thread = start_thread_manager() firebase_manager, fb_manager_thread = setup_firebase() SERVER_STATE = { "session_id": None, "ner_class": None, "database_manager": database_manager.DatabaseManager(), "al_manager": None, "thread_manager": thread_manager, "thread_manager_thread": thread_manager_thread, "firebase_manager": firebase_manager, "fb_manager_thread": fb_manager_thread, } def get_key_from_data(data, key): if key in data: return data[key] return None def get_keys_from_data(data, *args):
def index(): db = database_manager.DatabaseManager() db.connect() movies_list = db.import_db() db.close return render_template('index.html', to_print=movies_list)
def movie(id_): db = database_manager.DatabaseManager() db.connect() m = db.find_movie(id_) return render_template('movie.html', i=m)
# -*- coding: utf-8 -*- """ Created on Sun Aug 16 19:43:02 2020 @author: ASUS """ import pandas as pd import matplotlib as plt import database_manager databaseManager = database_manager.DatabaseManager() print(databaseManager.details_read_all()) a = databaseManager.details_read_all() print({b[0]: b[1] for b in a}) del databaseManager