def post(self, pessoa_id: int): args = self.req.parse_args() descricao = args['descricao'] titulo = args['titulo'] pessoa_id = args['pessoa_id'] album = Album(descricao, titulo, pessoa_id) return self.dao.create(album), 201
def matched(widget, model, iter): item = model[iter] data_a = item[4] data_b = item[5] self.aview.matched = [data_a, data_b] self.albumfilter.refilter() if data_b == 'blm.!ARTIST!': # Matched an artist: show albums return False elif exists(data_b): # Matched a song: queue to playlist sng = Song(filename=item[5]) self.aview.queue(sng) # Go back to empty search self.aview.matched = False searchentry = widget.get_entry() searchentry.set_text('') return True #elif len(self.albumfilter) == 1: else: # Matched an album: load it in a panel album = Album(data_b, data_a, self.songs_tree) if hasattr(album, 'name'): self.aview.on_album_matched(album) # Go back to empty search self.aview.matched = False searchentry = widget.get_entry() searchentry.set_text('') return True
def list_albums(): albums = [] sql = "SELECT * FROM albums" results = run_sql(sql) for row in results: album = Album(row['title'], row['genre'], row['id'], row['artist_id']) albums.append(album) return albums
def select(id): album = None sql = "SELECT * FROM albums WHERE id = %s" values = [id] result = run_sql(sql, values)[0] if result is not None: album = Album(result['name'], result['genre'], result['id']) return album
def select(self, id): album = None sql = "SELECT * FROM albums WHERE id = %s" results = SqlRunner.run(sql,(id,)) row = results[0] artist = artist_repository.select(row['artist_id']) album = Album(row['title'], artist, row['quantity'], row['id']) return album
def update_album(id): artist_id = request.form["artist_id"] artist = artist_repository.select(artist_id) title = request.form["title"] quantity = request.form["quantity"] album = Album(title, artist, quantity, id) album_repository.update(album) return redirect("/albums")
def update_album(id): title = request.form['title'] artist_id = request.form['artist_id'] quantity = request.form['quantity'] artist = artist_repository.select(artist_id) album = Album(title, artist, quantity, id) album_repository.update(album) return redirect('/albums')
def list_albums_by_artist(artist): list_a_b_a = [] sql = "SELECT * FROM albums WHERE artist_id = %s" values = [artist.id] results = run_sql(sql, values) for row in results: album = Album(row['title'], row['genre'], row['id'], artist) list_a_b_a.append(album) return list_a_b_a
def select(id): album = None sql = "SELECT * FROM album where id = %s" values = [id] result = run_sql(sql, values)[0] if result is not None: artist = artist_repository.select(result['artist_id']) album = Album(result['title'], artist, result['genre'], result['id']) return album
def albums(artist): albums = [] sql = "SELECT * FROM albums WHERE artist_id=%s" values = [artist.id] results = run_sql(sql, values) for row in results: album = Album(row["name"], row["genre"], artist, row["id"]) albums.append(album) return albums
def select_all(): albums = [] sql = "SELECT * FROM albums" results = run_sql(sql) for row in results: artist = artist_repo.select(row['artist_id']) album = Album(row['name'], row['genre'], row['id'], artist) albums.append(album) return albums
def select_all(artist): albums = [] sql = "SELECT * FROM artists WHEN artist = artist" results = run_sql(sql) for row in results: album = Album(result['title'], result['genre'], result['artist'], result['id']) albums.append(album) return albums
def find_album(id): album = None sql = "SELECT * FROM albums WHERE id = %s" values = [id] result = run_sql(sql, values)[0] if result is not None: album = Album(result['title'], result['genre'], result['artist'], result['id']) return album
def select_all(self): albums = [] sql = "SELECT * FROM albums" results = SqlRunner.run(sql) for row in results: artist = artist_repository.select(row['artist_id']) album = Album(row['title'], artist, row['quantity'], row['id']) albums.append(album) return albums
def select_for_artist(self, id): artist = artist_repository.select(id) albums = [] sql = "SELECT * FROM albums where artist_id = %s" results = SqlRunner.run(sql,(id,)) for row in results: album = Album(row['title'], artist, row['quantity'], row['id']) albums.append(album) return albums
def select(id): album = None sql = "SELECT * FROM albums WHERE id = %s" values = [id] result = run_sql(sql, values)[0] if result is not None: artist = artist_repo.select(result['artist_id']) album = Album(result["name"], result["genre"], artist, result["id"]) return album
def find_artist_by_album(album): artist = None sql = "SELECT * FROM album WHERE album_title = %s" values = [album.title] results = run_sql(sql, values) if results != None: artist = artist_repository.select(result['artist_id']) album = Album(result['title'], result['genre'], result['id'], artist) return artist
def select_all(): albums = [] sql = 'SELECT * FROM albums' results = run_sql(sql) for row in results: artist = artist_repository.select(row['artist_id']) album = Album(row['title'], artist, row['genre'], row['id']) albums.append(album) return albums
def setUp(self): self.artist = Artist("Frightened Rabbit") self.label = Label("Fat Cat Records") self.album = Album( "Midnight Organ Fight", self.artist, "Indie Rock", 22.99, 13.79, "2008", "https://is2-ssl.mzstatic.com/image/thumb/Music123/v4/53/79/37/53793762-eeef-8cce-96b2-6de1c18740e2/source/600x600bb.jpg", 6, self.label, 15)
def select_by_artist_id(artist_id): albums = [] sql = "SELECT * FROM albums WHERE artist_id = %s" values = [artist_id] results = run_sql(sql, values) for row in results: artist = artist_repository.select(row['artist_id']) album = Album(row['title'], row['genre'], artist, row['id']) albums.append(album) return albums
def get_albums(artist): albums = [] sql = "SELECT * FROM albums WHERE artist_id = %s" values = [artist.id] result = run_sql(sql, values) for row in result: album = Album(row['name'], row['artist'], row['genre'], row['id']) albums.append(album) return albums
def select_all(): albums = [] sql = "SELECT * FROM albums" results = run_sql(sql) for row in results: artist = artist_repository.select(row["artist_id"]) album = Album(row["title"], row["genre"], artist, row["id"]) albums.append(album) return albums
def select(id): album = None sql = "SELECT * FROM albums WHERE id = %s" results = run_sql(sql, (id,)) row = results[0] artist = artist_repository.select(row["artist_id"]) title = row["title"] quantity = row["quantity"] id = row["id"] album = Album(title, artist, quantity, id) return album
def albums(artist): albums = [] sql = "SELECT * FROM albums WHERE artist_id = %s" values = [artist.id] results = run_sql(sql, values) for row in results: album = Album(row['album_title'], row['genre'], artist) albums.append(album) return albums
def select(id): album = None sql = "SELECT * FROM albums WHERE id = %s" values = [id] results = run_sql(sql, values)[0] if results is not None: artist = artist_repository.select(results["artist_id"]) album = Album(results["title"], results["genre"], artist, results["id"]) return album
def select_for_artist(artist_id): artist = artist_repository.select(artist_id) albums = [] sql = "SELECT * FROM albums where artist_id = %s" results = run_sql(sql, (artist_id,)) for row in results: title = row["title"] quantity = row["quantity"] id = row["id"] album = Album(title, artist, quantity, id) albums.append(album) return albums
def update_photo_metadata(): values = {} for k in request.forms.keys(): values[k] = request.forms[k] image_path = values['image_path'] del values['image_path'] path_parts = image_path.split('/') reader.update_exif('/'.join(path_parts[2:]), values) Album(path=os.path.dirname(image_path)).delete_metadata_cache()
def albums_by_artist(artist): albums = [] sql = "SELECT * FROM albums WHERE artist_id = %s" values = [artist.id] results = run_sql(sql, values) for row in results: label = label_repository.select(row['label_id']) genre = genre_repository.select(row['genre_id']) album = Album(row['title'], artist, genre, row['price'], row['cost_price'], row['release_year'], row['cover_art'], row['stock'], label, row['sales_count'], row['id']) albums.append(album) return albums
def select_all(): albums = [] sql = "SELECT * FROM albums" results = run_sql(sql) for row in results: artist_id = row["artist_id"] artist = artist_repository.select(artist_id) title = row["title"] quantity = row["quantity"] id = row["id"] album = Album(title, artist, quantity, id) albums.append(album) return albums
def select(id): album = None sql = "SELECT * FROM albums WHERE id = %s" values = [id] result = run_sql(sql, values) if result is not None: result = result[0] album = Album(result['title'], result['artist_id'], result['genre'], result['id']) return album