diff --git a/.cache.csv b/.cache.csv new file mode 100644 index 0000000..7789aae --- /dev/null +++ b/.cache.csv @@ -0,0 +1,127 @@ +,id,title,artist,album_artist,album,year,track,total_tracks +0,a2344e23-c1ce-452f-a90a-dc3781951f2c,Nedslåttheten,['Happy Days'],Happy Days,Drowning in Negativity,2007,1,4 +1,8597ab19-e81e-4426-8bad-955905cf5a5c,Jeg Er Ikke Noe...,['Happy Days'],Happy Days,Drowning in Negativity,2007,2,4 +2,66c4597e-11c5-4393-8806-91d044343e24,Tiggeren For Nei Barmhjertighet,['Happy Days'],Happy Days,Drowning in Negativity,2007,3,4 +3,c10f105e-5b0b-4b25-821c-f91cff864044,En Annen Dag... En Annen Død...,['Happy Days'],Happy Days,Drowning in Negativity,2007,4,4 +4,b965eee6-194e-4d08-87ff-f00e0e0c19d2,Alone and Cold,['Happy Days'],Happy Days,Alone and Cold,2007,1,3 +5,fc1ab878-1380-4838-91d8-d7b3c73bc06c,End All Happiness,['Happy Days'],Happy Days,Alone and Cold,2007,2,3 +6,20277b27-8ea4-4d17-8081-4743960ba434,Endless Suffering,['Happy Days'],Happy Days,Alone and Cold,2007,3,3 +7,9f504424-f0e4-4fe9-a6d2-83c65aeaae30,Introduksjon og Døende,['Happy Days'],Happy Days,A World of Pain,2007,1,5 +8,ab3f709c-ec37-42f0-92c4-446bddf7f7a6,Welcome (To a World of Pain),['Happy Days'],Happy Days,A World of Pain,2007,2,5 +9,2f4efdfa-19cb-46d3-8259-32fc4b06152c,Lidende,['Happy Days'],Happy Days,A World of Pain,2007,3,5 +10,e3aa59ed-4c1d-49bb-a83c-a09a1e75e830,No Point in Living...,['Happy Days'],Happy Days,A World of Pain,2007,4,5 +11,b0374bf2-13cc-42cf-aeb5-17297a9e25a4,Dens Nettop Begonia,['Happy Days'],Happy Days,A World of Pain,2007,5,5 +12,bcf68a7f-2302-4e08-ac7c-3eaeac7d0584,Emotionally Torn From Within,['Happy Days'],Happy Days,Defeated by Life,2008,1,7 +13,c21036c2-b66c-4f95-9cca-a0b05d69f761,The Painful Truth,['Happy Days'],Happy Days,Defeated by Life,2008,2,7 +14,eec8a8bf-bd94-471b-ab47-c07747d153f0,"Hurt, Destroyed and Torn... There's Nothing Left",['Happy Days'],Happy Days,Defeated by Life,2008,3,7 +15,64bef366-8780-4de4-aa82-19e96d02b39e,A World of Pain,['Happy Days'],Happy Days,Defeated by Life,2008,4,7 +16,e61a7dc0-e253-4a8f-80e0-5f1f52ff0512,Defeated by Life,['Happy Days'],Happy Days,Defeated by Life,2008,5,7 +17,e634db0c-69b7-47ee-9288-a3d2a150bf76,Hate Life,['Happy Days'],Happy Days,Defeated by Life,2008,6,7 +18,ff363518-3dd4-4798-9919-0b0e01b51ae4,Trnový Labyrint,['Happy Days'],Happy Days,Defeated by Life,2008,7,7 +19,6cc0019a-ec30-45dc-bc68-a952b8668f1f,Drowning in Razorblades,['Happy Days'],Happy Days,Melancholic Memories,2008,1,5 +20,912acfe1-24b3-4ac7-b485-29329d8b58ce,The Beginning,['Happy Days'],Happy Days,Melancholic Memories,2008,2,5 +21,fb4e9732-3bef-4ad2-a18b-8bb2ce1a4411,Neglect...,['Happy Days'],Happy Days,Melancholic Memories,2008,3,5 +22,9e3d5c2d-8e11-46a0-80f3-5c3a319a6424,Slowly and Painfully,['Happy Days'],Happy Days,Melancholic Memories,2008,4,5 +23,3382cdea-cf5a-4960-8b44-0ec1757d0f6e,Sneni,['Happy Days'],Happy Days,Melancholic Memories,2008,5,5 +24,3844c3bc-8a62-4265-b4b1-686f5555f9ef,Years of Angst,['Fornicatus'],Various Artists,Children of Failure,2009,1,7 +25,eab6c5fd-a1b3-4a49-aac8-bbdf205d906a,My Grave,['Fornicatus'],Various Artists,Children of Failure,2009,2,7 +26,9020fec7-2d18-4310-a344-e94441b1ea1f,Soledad,['Black Hate'],Various Artists,Children of Failure,2009,3,7 +27,590ddff0-26ee-4e02-b45d-97cf33fea7a6,Alone and Cold,['Black Hate'],Various Artists,Children of Failure,2009,4,7 +28,87133880-408e-4133-be9f-f15ae5affa4f,Dying Alone Done,['Happy Days'],Various Artists,Children of Failure,2009,5,7 +29,ef2f2e62-5a61-4b99-b24c-d96ba101958e,Coldly to Heart,['All the Cold'],Various Artists,Children of Failure,2009,6,7 +30,05919a55-e0b9-493a-abd4-2b98609c4ea3,New Day Without Me,['All the Cold'],Various Artists,Children of Failure,2009,7,7 +31,2c52dc46-edcf-41bc-aea7-101b777d4109,Don't Go,['Happy Days'],Happy Days,Happiness Stops Here...,2009,1,7 +32,c3229044-6041-4f1a-98ed-94f8a9bdb5f7,My Brutus,['Happy Days'],Happy Days,Happiness Stops Here...,2009,2,7 +33,d8710ed0-76c4-4849-936c-988e77cdf929,What It Feels to Be Unloved,['Happy Days'],Happy Days,Happiness Stops Here...,2009,3,7 +34,95e0d278-878f-4060-9b4c-5c90a1bf938e,Sovnlose Netter I Mitt Isolatrom,['Happy Days'],Happy Days,Happiness Stops Here...,2009,4,7 +35,0805c344-3747-4efe-9257-97e1a7d47674,Letting Go,['Happy Days'],Happy Days,Happiness Stops Here...,2009,5,7 +36,e6ce79f9-ef91-4846-8aa6-a0048173bc4c,No Tomorrow,['Happy Days'],Happy Days,Happiness Stops Here...,2009,6,7 +37,3f6105ae-2b7e-4e9c-9659-b769bdf328cf,Take Me Away,['Happy Days'],Happy Days,Happiness Stops Here...,2009,7,7 +38,cd9f4fdb-45ac-4316-b8ac-c440e274c865,Don't Go,['Happy Days'],Happy Days,Happiness Stops Here...,2009,1,7 +39,4f4448ed-c2cc-49f1-944a-26beb33e5282,My Brutus,['Happy Days'],Happy Days,Happiness Stops Here...,2009,2,7 +40,4fc2fc4c-302d-4517-b76b-3a63f5d0a496,What It Feels to Be Unloved,['Happy Days'],Happy Days,Happiness Stops Here...,2009,3,7 +41,cc12d2de-fe11-4f67-8fe2-1e41e14acc42,Sovnlose netter i mitt isolatrom,['Happy Days'],Happy Days,Happiness Stops Here...,2009,4,7 +42,bb722ad8-078c-4bf9-a23f-9903cef69d93,Letting Go,['Happy Days'],Happy Days,Happiness Stops Here...,2009,5,7 +43,1bd14431-944b-4291-bf69-c8e81915da87,No Tomorrow,['Happy Days'],Happy Days,Happiness Stops Here...,2009,6,7 +44,9a991f19-dcb7-4d7b-964a-0a4569403646,Take Me Away,['Happy Days'],Happy Days,Happiness Stops Here...,2009,7,7 +45,ad9fe821-e2c6-456f-afc4-403614f21cf9,Clinging onto a Chance of Happiness,['Happy Days'],Various Artists,The First Step Towards Suicide,2010,1,8 +46,e11db7dc-c727-400a-8a6f-31d7de9b0593,A Bleak Future that Awaits Us,['Happy Days'],Various Artists,The First Step Towards Suicide,2010,2,8 +47,7142c1bc-53c4-4821-9284-0ee2ae019afb,Too Sick to Speak,['Happy Days'],Various Artists,The First Step Towards Suicide,2010,3,8 +48,dd4bb467-d1de-4e95-976a-d733ba6b058a,Screams that Go Unheard (Test Subjects),['Happy Days'],Various Artists,The First Step Towards Suicide,2010,4,8 +49,314e116a-a467-4535-bdc6-cac06b1017e0,De Nacht,['Eindig'],Various Artists,The First Step Towards Suicide,2010,5,8 +50,c175cb20-e6e1-4d99-a82a-fe748c3999b9,Ter Aarde,['Eindig'],Various Artists,The First Step Towards Suicide,2010,6,8 +51,3761d054-538b-43f6-bd17-306aa8992274,"As tot Stof, Stof tot As",['Eindig'],Various Artists,The First Step Towards Suicide,2010,7,8 +52,86acee01-3569-462f-8b32-12dba166773d,Bloedspoor,['Eindig'],Various Artists,The First Step Towards Suicide,2010,8,8 +53,42a2b40d-d003-48f6-aa5c-55af636abd2c,Happy Days,['Happy Days'],Happy Days,Cause of Death: Life,2012,1,9 +54,14844448-cc60-4e14-a9f9-d7234b8286cc,Broken,['Happy Days'],Happy Days,Cause of Death: Life,2012,2,9 +55,3c176aed-741a-417a-a856-17d53bfc833a,Cold Aggression,['Happy Days'],Happy Days,Cause of Death: Life,2012,3,9 +56,d7b67a2d-5a02-489e-b9e3-e38bc14b78fc,For These Wounds Will Never Be as Deep as This Emptiness,['Happy Days'],Happy Days,Cause of Death: Life,2012,4,9 +57,f3c6a2b1-8e4e-47f3-8a2d-7116f00224e5,Industrial Melancholy,['Happy Days'],Happy Days,Cause of Death: Life,2012,5,9 +58,216303bf-d67c-4816-b153-29b39ec529c7,Alone and Cold,['Happy Days'],Happy Days,Cause of Death: Life,2012,6,9 +59,284134d7-8820-45d0-810f-701e3ffa420e,No Point in Living,['Happy Days'],Happy Days,Cause of Death: Life,2012,7,9 +60,5162ffc2-786c-490b-ae68-c5e07e9e44bc,Take Me Away,['Happy Days'],Happy Days,Cause of Death: Life,2012,8,9 +61,219e18b8-fc98-4a00-81ba-97152de2fc09,Abigail,['Happy Days'],Happy Days,Cause of Death: Life,2012,9,9 +62,42a2b40d-d003-48f6-aa5c-55af636abd2c,Happy Days,['Happy Days'],Happy Days,Cause of Death: Life,2012,1,10 +63,14844448-cc60-4e14-a9f9-d7234b8286cc,Broken,['Happy Days'],Happy Days,Cause of Death: Life,2012,2,10 +64,3c176aed-741a-417a-a856-17d53bfc833a,Cold Aggression,['Happy Days'],Happy Days,Cause of Death: Life,2012,3,10 +65,d7b67a2d-5a02-489e-b9e3-e38bc14b78fc,For These Wounds Will Never Be as Deep as This Emptiness,['Happy Days'],Happy Days,Cause of Death: Life,2012,4,10 +66,f3c6a2b1-8e4e-47f3-8a2d-7116f00224e5,Industrial Melancholy,['Happy Days'],Happy Days,Cause of Death: Life,2012,5,10 +67,216303bf-d67c-4816-b153-29b39ec529c7,Alone and Cold,['Happy Days'],Happy Days,Cause of Death: Life,2012,6,10 +68,284134d7-8820-45d0-810f-701e3ffa420e,No Point in Living,['Happy Days'],Happy Days,Cause of Death: Life,2012,7,10 +69,5162ffc2-786c-490b-ae68-c5e07e9e44bc,Take Me Away,['Happy Days'],Happy Days,Cause of Death: Life,2012,8,10 +70,219e18b8-fc98-4a00-81ba-97152de2fc09,Abigail,['Happy Days'],Happy Days,Cause of Death: Life,2012,9,10 +71,1c7b2859-1a73-42f7-94df-56783e353309,Abwärts,['Happy Days'],Happy Days,Cause of Death: Life,2012,10,10 +72,3844c3bc-8a62-4265-b4b1-686f5555f9ef,Years of Angst,['Fornicatus'],Various Artists,Children of Failure,2009,1,7 +73,eab6c5fd-a1b3-4a49-aac8-bbdf205d906a,My Grave,['Fornicatus'],Various Artists,Children of Failure,2009,2,7 +74,9020fec7-2d18-4310-a344-e94441b1ea1f,Soledad,['Black Hate'],Various Artists,Children of Failure,2009,3,7 +75,590ddff0-26ee-4e02-b45d-97cf33fea7a6,Alone and Cold,['Black Hate'],Various Artists,Children of Failure,2009,4,7 +76,87133880-408e-4133-be9f-f15ae5affa4f,Dying Alone Done,['Happy Days'],Various Artists,Children of Failure,2009,5,7 +77,ef2f2e62-5a61-4b99-b24c-d96ba101958e,Coldly to Heart,['All the Cold'],Various Artists,Children of Failure,2009,6,7 +78,05919a55-e0b9-493a-abd4-2b98609c4ea3,New Day Without Me,['All the Cold'],Various Artists,Children of Failure,2009,7,7 +79,e63b06c8-0ee6-4408-bcd7-c9c145d27047,Emotionally Torn from Within,['Happy Days'],Happy Days,Defeated by Life,2012,1,7 +80,8304d5d5-af1c-43bf-9c4d-b372f086c3cf,The Painful Truth,['Happy Days'],Happy Days,Defeated by Life,2012,2,7 +81,4069779d-0f2a-46c7-9df8-abc0ac0ef5d1,"Hurt, Destroyed and Torn... There's Nothing Left",['Happy Days'],Happy Days,Defeated by Life,2012,3,7 +82,33e16f84-127b-4029-9f28-503d3175c479,A World of Pain,['Happy Days'],Happy Days,Defeated by Life,2012,4,7 +83,5b2887c1-6479-4b1a-bb9d-487835554ba1,Defeated by Life,['Happy Days'],Happy Days,Defeated by Life,2012,5,7 +84,88a7dc55-33be-4fc8-b7fb-486abe5f403b,Hate Life,['Happy Days'],Happy Days,Defeated by Life,2012,6,7 +85,22a9ba28-550c-4ed9-a075-7b18aa6d3321,Trnový Labyrint,['Happy Days'],Happy Days,Defeated by Life,2012,7,7 +86,ea95d8e3-ba43-4e8d-86f4-db4b9f5748b2,My Despair Can't Be Explained,['Psychonaut 4'],Various Artists,The Great Depression I,2013,1,6 +87,1e4eb933-0cfa-4a39-b5a6-e0c852b21ef3,Wor(l)d of Pain and Hate,['Psychonaut 4'],Various Artists,The Great Depression I,2013,2,6 +88,88008b4b-41c6-44d4-a3b0-778a0668b805,Reaching Without Consequence,['Happy Days'],Various Artists,The Great Depression I,2013,3,6 +89,bc466270-ef45-444d-a9c7-d85b018b7b11,Serenity the Deceiver,['Happy Days'],Various Artists,The Great Depression I,2013,4,6 +90,565c11fd-77cf-46d1-88c2-3c272724beee,Death Has Always Been the God of Man,['Dødsferd'],Various Artists,The Great Depression I,2013,5,6 +91,6842ac46-723e-42b1-a02a-d06614a26680,Million Deaths Inside,['Dødsferd'],Various Artists,The Great Depression I,2013,6,6 +92,f08d565d-a0bd-4e70-a366-677acea8a0f5,Emotionally Torn from Within,['Happy Days'],Happy Days,Defeated by Life,2013,1,7 +93,c4a24384-ef9c-4c24-8fba-83402d9c6d13,The Painful Truth,['Happy Days'],Happy Days,Defeated by Life,2013,2,7 +94,d9af31d8-57c7-4e5b-ac84-34fd645e5bc2,"Hurt, Destroyed and Torn... There's Nothing Left",['Happy Days'],Happy Days,Defeated by Life,2013,3,7 +95,5ccf95cd-794b-48f3-b934-d9744a721eed,A World of Pain,['Happy Days'],Happy Days,Defeated by Life,2013,4,7 +96,29a56d69-8c7e-4651-bf81-ebf51f7936d3,Defeated by Life,['Happy Days'],Happy Days,Defeated by Life,2013,5,7 +97,ee942ef7-44fd-4fe4-9081-1a689317546b,Hate Life,['Happy Days'],Happy Days,Defeated by Life,2013,6,7 +98,742a5303-8f0e-4a3f-9d35-e7acefea8ae0,Trnový Labyrint,['Happy Days'],Happy Days,Defeated by Life,2013,7,7 +99,70621cfb-ec58-405c-94da-fc071c2a6d3e,Don't Go,['Happy Days'],Happy Days,Happiness Stops Here...,2013,1,7 +100,876258ce-6d7e-4c77-9c99-628e6b7c56f9,My Brutus,['Happy Days'],Happy Days,Happiness Stops Here...,2013,2,7 +101,6d03c688-6bb1-45ca-84c1-85b15cef6d10,What It Feels to Be Unloved,['Happy Days'],Happy Days,Happiness Stops Here...,2013,3,7 +102,65458a70-6fd0-45a6-b448-758bf50bdefe,Sovnlose netter i mitt isolatrom,['Happy Days'],Happy Days,Happiness Stops Here...,2013,4,7 +103,e174c667-dbfb-4685-a360-1cab31c73f03,Letting Go,['Happy Days'],Happy Days,Happiness Stops Here...,2013,5,7 +104,9f71e447-0ea1-429a-bd96-d9bc04652ca1,No Tomorrow,['Happy Days'],Happy Days,Happiness Stops Here...,2013,6,7 +105,a3a838a3-f447-451f-a24f-c5ac3e1031f1,Take Me Away,['Happy Days'],Happy Days,Happiness Stops Here...,2013,7,7 +106,0b25059e-6ea0-4b42-91b5-d5f8d2970103,Dwell in the Insanity,['Happy Days'],Happy Days,Save Yourself,2016,1,10 +107,d9da195a-2fa9-4172-9a70-728fc719f178,Die to Forget,['Happy Days'],Happy Days,Save Yourself,2016,2,10 +108,2099f938-4ac6-4626-b991-7a3df6b79333,Serenity Theft,['Happy Days'],Happy Days,Save Yourself,2016,3,10 +109,c63ad122-941c-4909-bbf1-cc86ba89e9bf,Will We Make It?,['Happy Days'],Happy Days,Save Yourself,2016,4,10 +110,dab795ee-a9dc-4e3a-b41d-76fb094a39f0,One Can Dream,['Happy Days'],Happy Days,Save Yourself,2016,5,10 +111,336a1898-6332-41db-b351-5560eb6f0808,Let Me In...,['Happy Days'],Happy Days,Save Yourself,2016,6,10 +112,b7c606f3-d7eb-4077-9e2f-750485d67791,Malicious Callous,['Happy Days'],Happy Days,Save Yourself,2016,7,10 +113,42dd3f8d-0ff6-4f02-9943-3fdc501ae297,Freedom of Silence,['Happy Days'],Happy Days,Save Yourself,2016,8,10 +114,700c3910-ad1f-4aa7-9f56-795246365018,Your Starchild,['Happy Days'],Happy Days,Save Yourself,2016,9,10 +115,9ea53857-1ae2-4757-87c2-080686a025ac,Save Yourself,['Happy Days'],Happy Days,Save Yourself,2016,10,10 +116,bf345f74-e51e-4b2b-b8a2-f3f05ff19108,Glass Houses,['Deadspace'],Various Artists,Reaching For Silence,2017,1,10 +117,410906b4-f514-49fd-9cba-afb78c62de5e,"Flesh To Chew, Teeth To Swallow",['Deadspace'],Various Artists,Reaching For Silence,2017,2,10 +118,93a1b113-4fe0-412a-903d-d69155e8edde,Phantom Limb,['Deadspace'],Various Artists,Reaching For Silence,2017,3,10 +119,28433a2c-8545-49f1-8e5c-8a6b10631725,Epilogue,['Deadspace'],Various Artists,Reaching For Silence,2017,4,10 +120,96379e19-45cf-4b3f-a920-5a8d1c0c6757,"Nostalgia, Like A Plague, She Rapes Me To Sleep",['Deadspace'],Various Artists,Reaching For Silence,2017,5,10 +121,18c0be14-0eea-478f-bd19-4dd24cee9dc1,Y cuando encuentren mi cuerpo...,['Happy Days'],Various Artists,Reaching for Silence,2017,6,10 +122,89b80a3a-b31d-4388-91b4-4132f0a53f4c,Soiled Flowers,['Happy Days'],Various Artists,Reaching for Silence,2017,7,10 +123,746d1ccd-7140-4572-aeba-be86e8de1aad,Death Knows Best,['Happy Days'],Various Artists,Reaching for Silence,2017,8,10 +124,ea729d1e-cafa-4948-aea7-152536b022a8,Drowning,['Happy Days'],Various Artists,Reaching for Silence,2017,9,10 +125,5c05ab58-15cd-4bbb-939a-d902df80c3fc,"Schrei Schrei, mein Heim",['Happy Days'],Various Artists,Reaching for Silence,2017,10,10 diff --git a/.~lock..cache.csv# b/.~lock..cache.csv# new file mode 100644 index 0000000..8f8e324 --- /dev/null +++ b/.~lock..cache.csv# @@ -0,0 +1 @@ +,lars,lars-school,17.10.2022 14:13,file:///home/lars/.config/libreoffice/4; \ No newline at end of file diff --git a/src/__pycache__/metadata.cpython-310.pyc b/src/__pycache__/metadata.cpython-310.pyc index 8b4487a..811ac59 100644 Binary files a/src/__pycache__/metadata.cpython-310.pyc and b/src/__pycache__/metadata.cpython-310.pyc differ diff --git a/src/main.py b/src/main.py index 710f7ad..bcd78bc 100644 --- a/src/main.py +++ b/src/main.py @@ -25,6 +25,7 @@ def search_for_metadata(query: str): def cli(): search = search_for_metadata(query=input("initial query: ")) + search.download() if __name__ == "__main__": diff --git a/src/metadata.py b/src/metadata.py index c57c63f..503a0b0 100644 --- a/src/metadata.py +++ b/src/metadata.py @@ -1,4 +1,6 @@ +import imp import musicbrainzngs +import pandas as pd musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader") @@ -22,18 +24,21 @@ class Search: self.set_options(self.Options([musicbrainzngs.search_artists(artist=artist)])) def download(self): - print("DOWNLOADING") - print(self.current_chosen_option) - kind = self.current_chosen_option['kind'] mb_id = self.current_chosen_option['id'] + metadata_list = [] if kind == "artist": - return self.download_artist(mb_id) - if kind == "release": - return self.download_release(mb_id) - if kind == "track": - return self.download_track(mb_id) + metadata_list = self.download_artist(mb_id) + elif kind == "release": + metadata_list = self.download_release(mb_id) + elif kind == "track": + metadata_list = self.download_track(mb_id) + + metadata_df = pd.DataFrame(metadata_list) + metadata_df.to_csv(".cache.csv") + + return metadata_df def download_artist(self, mb_id): """ @@ -42,9 +47,12 @@ class Search: release-rels, release-group-rels, series-rels, url-rels, work-rels, instrument-rels, tags, user-tags, ratings, user-ratings """ - print(mb_id) - result = musicbrainzngs.get_artist_by_id(mb_id, includes=[]) - print(result) + metadata_list = [] + result = musicbrainzngs.get_artist_by_id(mb_id, includes=["releases"]) + for release in result["artist"]["release-list"]: + metadata_list.extend(self.download_release(release["id"])) + + return metadata_list def download_release(self, mb_id): """ @@ -53,9 +61,21 @@ class Search: label-rels, place-rels, event-rels, recording-rels, release-rels, release-group-rels, series-rels, url-rels, work-rels, instrument-rels """ - print(mb_id) - result = musicbrainzngs.get_release_by_id(mb_id, includes=[]) - print(result) + result = musicbrainzngs.get_release_by_id(mb_id, includes=["artists", "recordings"]) + + tracklist_metadata = [] + + is_various_artist = len(result['release']['artist-credit']) > 1 + tracklist = result['release']['medium-list'][0]['track-list'] + track_count = len(tracklist) + this_track = 0 + for track in tracklist: + track_id = track["recording"]["id"] + this_track = track["position"] + + tracklist_metadata.extend(self.download_track(track_id, is_various_artist=is_various_artist, track=this_track, total_tracks=track_count)) + + return tracklist_metadata def download_track(self, mb_id, is_various_artist: bool = None, track: int = None, total_tracks: int = None): """ @@ -104,7 +124,8 @@ class Search: is_various_artist, track, total_tracks = get_additional_release_info(album_id) album_artist = "Various Artists" if is_various_artist else artist[0] - return { + return [{ + 'id': mb_id, 'title': title, 'artist': artist, 'album_artist': album_artist, @@ -112,7 +133,7 @@ class Search: 'year': year, 'track': track, 'total_tracks': total_tracks - } + }] def browse_artist(self, artist: dict, limit: int = 25): options_sets = [ @@ -279,7 +300,7 @@ def interactive_demo(): search = Search(query=input("initial query: ")) print(search.options) while True: - input_ = input("q to quit, .. for previous options, . for current options, int for this element: ").lower() + input_ = input("d to download, q to quit, .. for previous options, . for current options, int for this element: ").lower() input_.strip() if input_ == "q": break @@ -292,11 +313,16 @@ def interactive_demo(): if input_.isdigit(): print(search.choose(int(input_))) continue + if input_ == "d": + search.download() + break if __name__ == "__main__": + interactive_demo() # automated_demo() - search = Search(query="psychonaut 4") - # search.download_artist("c0c720b5-012f-4204-a472-981403f37b12") + # search = Search(query="psychonaut 4") # search.download_release("27f00fb8-983c-4d5c-950f-51418aac55dc") - search.download_track("83a30323-aee1-401a-b767-b3c1bdd026c0") + # for track_ in search.download_artist("c0c720b5-012f-4204-a472-981403f37b12"): + # print(track_) + # search.download_track("83a30323-aee1-401a-b767-b3c1bdd026c0")