ChandimaPrabath commited on
Commit
78ec209
1 Parent(s): ccd0237
Files changed (1) hide show
  1. Instance.py +4 -5
Instance.py CHANGED
@@ -144,13 +144,12 @@ class Instance:
144
  return json.load(file)
145
 
146
  def find_music_path(self, title):
 
147
  for directory in self.file_structure:
148
- if directory['type'] == 'directory' and directory['path']:
149
  for sub_directory in directory['contents']:
150
- if sub_directory['type'] == 'directory':
151
- for item in sub_directory['contents']:
152
- if item['type'] == 'file' and title.lower() in item['path'].lower():
153
- return item['path']
154
  return None
155
 
156
  def get_music_id(self, title):
 
144
  return json.load(file)
145
 
146
  def find_music_path(self, title):
147
+ """Find the path of the music in the indexed data based on the title."""
148
  for directory in self.file_structure:
149
+ if directory['type'] == 'directory':
150
  for sub_directory in directory['contents']:
151
+ if sub_directory['type'] == 'file' and title.lower() in sub_directory['path'].lower():
152
+ return sub_directory['path']
 
 
153
  return None
154
 
155
  def get_music_id(self, title):