def get_html(self, position): mod = self.get_module() if mod == "PER": p = people.People(self.tags, self.description) return p.get_html(False) elif mod == "GEO": return rome_rio.get_rome_rio(position, self.tags) elif mod == "BUY": return amazon_search.get_amazon_items(self.tags, False) elif mod == "MOV": f = film.Film(self.tags, self.description) f.get_info() return f.get_html()
def main(): IS_CHECK_LENGTH = False IS_TEST_CAMERA = False IS_DEBUG = False # camera_nums = [1, 2] mike_nums = [0, 1, 2, 3] Film = film.Film(camera_count=2, mike_count=4, recording_second=300.0, mike_device_nums=mike_nums) Film.setting_sound(channels=2) # make dir of experimental data path = '../data/' if IS_DEBUG == True: path = path + 'test/' else: path = path + '{0:%y%m%d%H%M}'.format(datetime.datetime.now()) if os.path.exists(path): i = 1 while os.path.exists(path + '_' + str(i)): i = i + 1 path = path + str(i) path = path + '/' os.mkdir(path) if IS_CHECK_LENGTH == True: check_length() elif IS_TEST_CAMERA == True: Film.capture_test() elif Film.start_filming() == True: print('now writing sound') Film.write_sound(path, devide_stereo=True) Film.pause(120) print('now encoding videos') Film.write_video(path, path + '_sight') print('complete') return
import film film_library = film.FilmLibrary() film_1 = film.Film('abc', 1) film_2 = film.Film("dfg", 9) film_library.set_film(film_1) film_library.set_film(film_2) film_library.del_film(film_1.name) film_library.read_films_from_file() film_list = film_library.get_films_info() for film in film_list: print(film)
# try: # f = film.Film(s) # print f.stats() # except IndexError: # print 'Bad script error: ' + s with open('script_data.csv', 'w') as datafile: fieldnames = [ 'Title', 'Dialogue Ratio', 'Parenthetical Ratio', 'Words per Line', 'Dialogue Sentiment', 'Number of Scenes' ] writer = csv.DictWriter(datafile, fieldnames=fieldnames) tracker = 0 failures = 0 print 'Starting processing...' writer.writeheader() for s in script_files(): try: f = film.Film(s) writer.writerow(f.stats()) tracker += 1 except: 'Failed to write ' + s failures += 1 print str(tracker) + ' successes and ' + str(failures) + ' failures...' print 'Processing complete!' # for s in script_files(): # print s
def test_title(): f = film.Film(SAMPLES[0]) assert f.title == 'SAMPLE MOVIE'
def test_characters(): f = film.Film(SAMPLES[0]) assert len(f.characters) == 3
def test_number_of_scenes(): f = film.Film(SAMPLES[0]) assert f.number_of_scenes() == 1
dbpool = adbapi.ConnectionPool("MySQLdb", host="localhost", user="******", passwd="user123", db="db_baf") class Home(resource.Resource): isLeaf = True def getChild(self, name, request): if name == '': return self return Resource.getChild(self, name, request) def render_GET(self, request): return '<html><body>Hello This is Home</body></html>' root = resource.Resource() root.putChild("", Home()) root.putChild("User", user.User()) root.putChild("Film", film.Film()) root.putChild("Jadwal", jadwal.Jadwal()) root.putChild("Booking", booking.Booking()) factory = server.Site(root) reactor.listenTCP(8001, factory) reactor.run()
def __init__(self, fenetre, **kwargs): Tk.__init__(self) self.title("Thot") # changer le titre de la fenêtre self.geometry("1080x900") # changer les dimension de la fenêtre self.minsize(480, 360) # fixer la taille min de la fenêtre self.iconbitmap("thot.ico") # donner l'url du l'icone self.config(background='#000000') # Donner la couleur de fond self.main = Frame(fenetre, padding="4 4 4 4", background='#E2BC74') # On déclare la frame principale self.main.pack(fill=BOTH) fenetre.columnconfigure(0, weight=1) fenetre.rowconfigure(0, weight=1) self.Titre = Label(self.main, text="Bienvenue dans Thot", font=("Times New Roman", 32), bg='#FEFEFE', fg='#850606') self.Titre.pack(side=TOP) self.fenIntro = Label(self.main, text="Un logiciel de traitement de text indépendant et surtout libre.", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.fenIntro.pack(side=TOP) self.cadreDoc = Frame(self.main, bg='#E0CDA9') self.cadreDoc.pack(expand=YES) self.cadreDocTitre = Label(self.cadreDoc, text="Document", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreDocTitre.pack(side=TOP) self.docs = ["Brouillon", "Compte-rendu, résumé, synthèse", "Devoirs de maths ou une autre science", "Devoirs littéraire ou d'histoire", "Lettre", "Rapports, thèse"] self.docsB = list() for i, doc in enumerate(self.docs): self.docsB.append(Button(self.cadreDoc, text=doc, font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.docsB[i].pack() self.cadreMuse = Frame(self.main, bg='#E1CE9A') self.cadreMuse.pack(expand=YES) self.cadreMuseTitre = Label(self.cadreMuse, text="Muse", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreMuseTitre.pack(side=TOP) self.muses = ["Film", "Court-métrage", "Vidéo", "Pub", "Livre", "Roman", "Nouvelle", "Pièce de théâtre", "Jeu"] self.musesF = [lambda: film.Film(self), lambda: cm.CM(self), lambda: video.Video(self), lambda: pub.Pub(self), lambda: livre.Livre(self), lambda: roman.Roman(self), lambda: nouvelle.Nouvelle(self), lambda: theatre.Theatre(self), lambda: jeu.Jeu(self)] self.musesB = list() for i, muse in enumerate(self.muses): self.musesB.append(Button(self.cadreMuse, text=muse, command=self.musesF[i], font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.musesB[i].pack() self.cadreMuseTitre2 = Label(self.cadreMuse, text="Élément histoire", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreMuseTitre2.pack() self.muses2 = ["Personnage"] self.muses2B = list() for i, muse in enumerate(self.muses2): self.muses2B.append(Button(self.cadreMuse, text=muse, font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.muses2B[i].pack()