In [1]:
from scrapediscogs import MusicDatabase
music_db = MusicDatabase('test.db', 85)

In [2]:
music_db.add_data('albumsinput.txt')


2016-12-04 15:55:37,809 - scrapediscogs - INFO - add_data: 1/59 - The Paul Butterfield Blues Band - The Resurrection Of Pigboy Crabshaw
2016-12-04 15:55:38,650 - scrapediscogs - INFO - add_data: 2/59 - James Carter (3) - In Carterian Fashion
2016-12-04 15:55:39,256 - scrapediscogs - INFO - add_data: 3/59 - James Carter (3) - Heaven On Earth
2016-12-04 15:55:39,822 - scrapediscogs - INFO - add_data: 4/59 - Benny Green - Bluebird
2016-12-04 15:55:40,367 - scrapediscogs - INFO - add_data: 5/59 - Benny Green - Jazz At The Bistro
2016-12-04 15:55:41,279 - scrapediscogs - INFO - add_data: 6/59 - David Sanborn - Inside
2016-12-04 15:55:42,124 - scrapediscogs - INFO - add_data: 7/59 - David Sanborn - Upfront
2016-12-04 15:55:42,669 - scrapediscogs - INFO - add_data: 8/59 - David Sanborn - Hearsay
2016-12-04 15:55:43,223 - scrapediscogs - INFO - add_data: 9/59 - David Sanborn - Pearls
2016-12-04 15:55:44,039 - scrapediscogs - INFO - add_data: 10/59 - David Sanborn - Hideaway
2016-12-04 15:55:44,584 - scrapediscogs - INFO - add_data: 11/59 - David Sanborn - Timeagain
2016-12-04 15:55:45,118 - scrapediscogs - INFO - add_data: 12/59 - David Sanborn - Double Vision
2016-12-04 15:55:45,651 - scrapediscogs - INFO - add_data: 13/59 - Seamus Blake - The Call
2016-12-04 15:55:46,226 - scrapediscogs - INFO - add_data: 14/59 - Brad Mehldau - 10 Years Solo Live
2016-12-04 15:55:46,781 - scrapediscogs - INFO - add_data: 15/59 - Bert Wilson & Rebirth - Endless Fingers
2016-12-04 15:55:47,325 - scrapediscogs - INFO - add_data: 16/59 - Hardcoretet - Do It Live
2016-12-04 15:55:48,152 - scrapediscogs - INFO - add_data: 17/59 - Dirty Loops - Loopified
2016-12-04 15:55:48,995 - scrapediscogs - INFO - add_data: 18/59 - Brad Mehldau - Mehliana (Taming The Dragon)
2016-12-04 15:55:49,524 - scrapediscogs - INFO - add_data: 19/59 - Brad Mehldau Trio - Progression: Art Of The Trio, Volume 5
2016-12-04 15:55:50,355 - scrapediscogs - INFO - add_data: 20/59 - Béla Fleck & The Flecktones - UFO TOFU
2016-12-04 15:55:50,908 - scrapediscogs - INFO - add_data: 21/59 - Spyro Gyra - Got The Magic
2016-12-04 15:55:51,735 - scrapediscogs - INFO - add_data: 22/59 - Euge Groove - Livin' Large
2016-12-04 15:55:52,643 - scrapediscogs - INFO - add_data: 23/59 - Euge Groove - Play Date
2016-12-04 15:56:00,918 - scrapediscogs - INFO - no album found for artist = Tim Green, album = Songs From This Season. skipping...
2016-12-04 15:56:01,451 - scrapediscogs - INFO - add_data: 25/59 - Spyro Gyra - The Very Best Of Spyro Gyra
2016-12-04 15:56:02,269 - scrapediscogs - INFO - add_data: 26/59 - The Benny Green Trio - Testifyin'!
2016-12-04 15:56:03,075 - scrapediscogs - INFO - add_data: 27/59 - Benny Green - Kaleidoscope
2016-12-04 15:56:03,617 - scrapediscogs - INFO - add_data: 28/59 - Benny Green - These Are Soulful Days 
2016-12-04 15:56:08,642 - scrapediscogs - INFO - no album found for artist = Gravity, album = Grimy. skipping...
2016-12-04 15:56:09,188 - scrapediscogs - INFO - add_data: 30/59 - Sax Gordon - You Knock Me Out
2016-12-04 15:56:13,108 - scrapediscogs - INFO - no album found for artist = Sax Gordon & Doug James, album = Jolly Jump Jive. skipping...
2016-12-04 15:56:18,247 - scrapediscogs - INFO - no album found for artist = Doug James & Sax Gordon, album = Swing Jump Jive. skipping...
2016-12-04 15:56:18,805 - scrapediscogs - INFO - add_data: 33/59 - Sax Gordon - Have Horn Will Travel
2016-12-04 15:56:19,622 - scrapediscogs - INFO - add_data: 34/59 - Herbie Hancock - Round Midnight - Original Motion Picture Soundtrack
2016-12-04 15:56:20,157 - scrapediscogs - INFO - add_data: 35/59 - Dexter Gordon - Go!
2016-12-04 15:56:24,807 - scrapediscogs - INFO - no album found for artist = Dave Glenn Little Big Band, album = Journeys. skipping...
2016-12-04 15:56:25,345 - scrapediscogs - INFO - add_data: 37/59 - Robert Glasper - In My Element
2016-12-04 15:56:26,196 - scrapediscogs - INFO - add_data: 38/59 - Robert Glasper - Double Booked
2016-12-04 15:56:26,729 - scrapediscogs - INFO - add_data: 39/59 - Stan Getz - People Time
2016-12-04 15:56:27,273 - scrapediscogs - INFO - add_data: 40/59 - James Carter (3) - Live At Baker's Keyboard Lounge
2016-12-04 15:56:27,826 - scrapediscogs - INFO - add_data: 41/59 - James Carter (3) - Chasin' The Gypsy
2016-12-04 15:56:28,365 - scrapediscogs - INFO - add_data: 42/59 - Benny Carter - New Jazz Sounds: The Urbane Sessions
2016-12-04 15:56:28,908 - scrapediscogs - INFO - add_data: 43/59 - Tim Carey (2) - Room 114
2016-12-04 15:56:29,450 - scrapediscogs - INFO - add_data: 44/59 - BWB (2) - Groovin'
2016-12-04 15:56:30,285 - scrapediscogs - INFO - add_data: 45/59 - The Paul Butterfield Blues Band - The Resurrection Of Pigboy Crabshaw
2016-12-04 15:56:31,120 - scrapediscogs - INFO - add_data: 46/59 - Kenny Burrell - Midnight Blue
2016-12-04 15:56:35,844 - scrapediscogs - INFO - no album found for artist = The Bumblebees, album = Bees of the Invisible. skipping...
2016-12-04 15:56:36,404 - scrapediscogs - INFO - add_data: 48/59 - Hiram Bullock - From All Sides
2016-12-04 15:56:37,639 - scrapediscogs - INFO - add_data: 49/59 - Hiram Bullock - Carrasco
2016-12-04 15:56:38,194 - scrapediscogs - INFO - add_data: 50/59 - Hiram Bullock - Way Kool
2016-12-04 15:56:38,725 - scrapediscogs - INFO - add_data: 51/59 - Hiram Bullock - Give It What U Got
2016-12-04 15:56:39,545 - scrapediscogs - INFO - add_data: 52/59 - Hiram Bullock - Try Livin' It
2016-12-04 15:56:40,095 - scrapediscogs - INFO - add_data: 53/59 - Everette Harp - Common Ground
2016-12-04 15:56:40,904 - scrapediscogs - INFO - add_data: 54/59 - Roy Hargrove Quintet - With The Tenors Of Our Time
2016-12-04 15:56:41,506 - scrapediscogs - INFO - add_data: 55/59 - The Dave Brubeck Quartet - Time Out
2016-12-04 15:56:42,058 - scrapediscogs - INFO - add_data: 56/59 - Norman Brown - Celebration
2016-12-04 15:56:42,593 - scrapediscogs - INFO - add_data: 57/59 - The Brecker Brothers - Pricelss Jazz Collection Brecker Brothers
2016-12-04 15:56:43,122 - scrapediscogs - INFO - add_data: 58/59 - Randy Brecker - 34th N Lex
2016-12-04 15:56:43,930 - scrapediscogs - INFO - add_data: 59/59 - Michael Brecker - Two Blocks From The Edge

Search the populated database for albums by a given artist:


In [3]:
results = music_db.find_albums_by_artist('David Sanborn')
print results[0]


----------------------------------------------------------------------
[album ID]: 444360
[album title]: Inside
[artist ID]: 185751
[artist name]: David Sanborn
[year]: 1999
[genres]: Jazz
[notes]: 
[formats]: CD
[track list]: Corners (For Herbie), Day Dreaming, Trance, Brother Ray, Lisa, When I'm With You, Naked Moon, Cane, Ain't No Sunshine, Miss You
[track durations]: 4:50, 5:36, 5:02, 5:57, 4:33, 4:58, 5:41, 0:46, 4:12, 5:56
[companies]: 
----------------------------------------------------------------------

Search for album by name:


In [4]:
results = music_db.find_album(album_title = "The Call")
print results[0]


----------------------------------------------------------------------
[album ID]: 2414116
[album title]: The Call
[artist ID]: 438165
[artist name]: Seamus Blake
[year]: 1994
[genres]: Jazz
[notes]: Recorded December 24, 1993
[formats]: CD
[track list]: Vanguard Blues I, The Call, Nobody's Song But His Own, On Cue, Prelude To A Kiss, Mercy Days, Zydeco, Smoke Gets In Your Eyes, Vanguard Blues II
[track durations]: 7:15, 8:41, 9:29, 11:11, 5:22, 8:40, 9:05, 5:12, 10:33
[companies]: 
----------------------------------------------------------------------

Find all songs by a given artist


In [5]:
results = music_db.find_songs_by_album_artist("Seamus Blake")
for r in results:
        print r


----------------------------------------------------------------------
[track title]: Vanguard Blues I
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 7:15
[position]: 1
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: The Call
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 8:41
[position]: 2
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Nobody's Song But His Own
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 9:29
[position]: 3
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: On Cue
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 11:11
[position]: 4
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Prelude To A Kiss
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 145257 - Duke Ellington, 699212 - Irving Gordon, 307446 - Irving Mills
[duration]: 5:22
[position]: 5
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Mercy Days
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 8:40
[position]: 6
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Zydeco
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 9:05
[position]: 7
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Smoke Gets In Your Eyes
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 166685 - Jerome Kern
[duration]: 5:12
[position]: 8
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Vanguard Blues II
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 10:33
[position]: 9
----------------------------------------------------------------------

Find songs containing a given substring (uses the LIKE operator in SQL):


In [6]:
results = music_db.find_song('blues')
for r in results:
        print r


----------------------------------------------------------------------
[track title]: Reunion Blues
[artist ID]: 96442
[artist name]: Benny Green
[album ID]: 8542565
[album title]: Bluebird
[credits]: 149254 - Milt Jackson
[duration]: 6:16
[position]: 1
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: The Intimacy Of The Blues
[artist ID]: 96442
[artist name]: Benny Green
[album ID]: 1499442
[album title]: Jazz At The Bistro
[credits]: 
[duration]: 6:44
[position]: 8
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: The Intimacy Of The Blues (Alternate Take)
[artist ID]: 96442
[artist name]: Benny Green
[album ID]: 1499442
[album title]: Jazz At The Bistro
[credits]: 
[duration]: 6:08
[position]: 15
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Vanguard Blues I
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 7:15
[position]: 1
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Vanguard Blues II
[artist ID]: 438165
[artist name]: Seamus Blake
[album ID]: 2414116
[album title]: The Call
[credits]: 
[duration]: 10:33
[position]: 9
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Carl's Blues
[artist ID]: 3724842
[artist name]: The Benny Green Trio
[album ID]: 7027618
[album title]: Testifyin'!
[credits]: 
[duration]: 5:14
[position]: 7
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Polite Blues
[artist ID]: 258701
[artist name]: Benny Carter
[album ID]: 2813131
[album title]: New Jazz Sounds: The Urbane Sessions
[credits]: 
[duration]: 
[position]: 2-5
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: The Marriage Blues
[artist ID]: 258701
[artist name]: Benny Carter
[album ID]: 2813131
[album title]: New Jazz Sounds: The Urbane Sessions
[credits]: 
[duration]: 
[position]: 2-15
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Saturday Night Blues
[artist ID]: 30184
[artist name]: Kenny Burrell
[album ID]: 5504237
[album title]: Midnight Blue
[credits]: 30184 - Kenny Burrell
[duration]: 6:15
[position]: B3
----------------------------------------------------------------------
----------------------------------------------------------------------
[track title]: Delta City Blues
[artist ID]: 135847
[artist name]: Michael Brecker
[album ID]: 2518637
[album title]: Two Blocks From The Edge
[credits]: 135847 - Michael Brecker
[duration]: 5:37
[position]: 8
----------------------------------------------------------------------