Yianji
Yianji

Reputation: 1

Accessing music directories with eyed3 tool

I am creating a music application currently and i have saved my music in a separate folder called music. Now, I want to loop and get every music and get all music's information with eyed3. The main problem here is that it seems that eyed3 can only load music from parent directory. Is there a solution to this. Any help will be appreciated.

Code:

def load_songs(self):
        self.music_path = "D:\Music App\music"
        self.music_files = os.listdir(self.music_path)

        for i in range(len(self.music_files)):
            self.music = eyed3.load(self.music_files[i])

Error: line 436, in load raise IOError(f"file not found: {path}") OSError: file not found: Bieber_-_Yummy.mp3

Upvotes: 0

Views: 167

Answers (1)

Yianji
Yianji

Reputation: 1

I found the solution here, only a bit complex. You've to provide the full path of the song.

def load_songs(self):
        self.music_path = "D:\Music App\music"
        self.music_files = os.listdir(self.music_path)

        for i in range(len(self.music_files)):
            self.music = TinyTag.get(f"D:\Music App\music\{self.music_files[i]}")

Upvotes: 0

Related Questions