Best way to find all mp3's on a device

staticmike

Member
Licensed User
Longtime User
Hi
I wonder if somebody would be kind enough to guide me. I am currently using the following code to index mp3 songs within the music folder on my kindle fire -

B4X:
Try
   root=File.DirRootExternal
     path1 = root & "/music"
   
   
    Dim fileList As List
     Dim n As Int
    tunepath=path1
   
   'Search for mp3's
   
   fileList = File.ListFiles(path1)
   temp=filelist.Size-1
   
    For n = 0 To fileList.Size-1

   file1 = fileList.Get(n)

   If (file1.EndsWith (".mp3")) OR (file1.EndsWith (".MP3"))Then
          progbar1.Visible=True
         
         If counter<1001 Then 'was 1500
         
            musiclibrary(counter,1)="/"& file1
            lblmikedent.Text="Indexing Song - " &counter
            LogMp3Tags(path1, musiclibrary(counter,1))
            counter=counter+1
            
         End If
                  
   End If
   
  Next


This works fine for me on songs in the root which is what I expected. I now however would like to find all songs in this folder under sub folders etc and wonder is there a better way to get the mp3 paths ?

Do I need to read every folder and then check for files in them or is there a simpler way to find all my music ?

Many thanks

Mike
 

staticmike

Member
Licensed User
Longtime User
No, I just want to log the paths and track names.
I am just looking at esaudiomediabrowser which works well but I don't think I can get the paths from this library.

Found mediabrowser which does seem to provide the location (Presume path?) but struggling to get the demo working as I only have version 1.7 of B4A and believe I need a later version !
Can you tell me if this is the case ?
If so then I will probably upgrade to ver 2.5 if required. I presume I just buy a new single developer licence ?

Thanks
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Found mediabrowser which does seem to provide the location (Presume path?) but struggling to get the demo working as I only have version 1.7 of B4A and believe I need a later version !
Can you tell me if this is the case ?
If so then I will probably upgrade to ver 2.5 if required. I presume I just buy a new single developer licence ?
Maybe the demo wont work, but the library should work.
 
Upvote 0

staticmike

Member
Licensed User
Longtime User
Fixed

Just tried esaudiomediabrowser with the "Data" field and it provides the path so now I am sorted.

Thanks for the suggestions. Brilliant.
 
Upvote 0
Top