locked
Most Efficent way to List Artitst and Songs

    Question

  • I am working on an application that retrieves available song files from available media servers. The media server I am testing with is a NetGear Router with a USB drive connected.

    GetMediaServers(

    KnownFolders.MediaServerDevices);

    Finds the sever no problem. There are about 300 artists on this server. Also I have the same collection available on a HomeGroup share.

    //IReadOnlyList<StorageFolder> artists = await artistFolder.GetFoldersAsync(CommonFolderQuery.DefaultQuery, 10, 10);


               

    //QueryOptions qo = new QueryOptions();


               

    //qo.IndexerOption = IndexerOption.UseIndexerWhenAvailable;


               

    //qo.FolderDepth = FolderDepth.Shallow;


               

    //qo.SetPropertyPrefetch(PropertyPrefetchOptions.BasicProperties, new string[] { "System.ItemName" });


               

    DateTimestartTime = DateTime.Now;

               

    //StorageFolderQueryResult results = artistFolder.CreateFolderQueryWithOptions(qo);


               

    //IReadOnlyList<StorageFolder> artists = await results.GetFoldersAsync(0, 10);


               

    IReadOnlyList<StorageFolder> artists = awaitartistFolder.GetFoldersAsync(CommonFolderQuery.DefaultQuery, 0, 10);

                lstMedia.DisplayMemberPath =

    "DisplayName";

               

    inti = 1;

               

    foreach(StorageFolderfolder inartists)

                {

                   

    Debug.WriteLine(string.Format("{0} - Folder: {1}", i, folder.DisplayName));

                    lstMedia.Items.Add(folder);

                    i++;

                }

               

    DateTimeendTime = DateTime.Now;

               

    TimeSpants = (endTime - startTime);

               

    Debug.WriteLine(string.Format("Hr {0} Min {1} Sec {2} Ms {3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds));

    I am using the above code to retrieve the lists of artists from the Artists Folder. This is way too slow. From the NetGear server this takes about 30 seconds. From the HomeGroup it takes 2min 8 sec. Why is this so slow? If I use mediaplayer it retrieves these lists instantly.

    Is there another approach I should be using?

    Thanks for your help!

    Sunday, February 15, 2015 9:58 PM

Answers

  • I figured this out. I was using my NetGear router's DNLA capabilities to test with. GetFolderAsync does not work. It does not find the folder even if it exists.

    There are 2 capabilities on the router. You can share folders and you can activate a DNLA media server. I had both the media server on and a file share to a folder called "music" where all the music is. The music share had only read rights. If I remove the music share or add full rights to the share then I get sub second response time when retrieving the artists and songs.

    Sunday, February 22, 2015 6:41 PM

All replies

  • Hi jsullyboy2,

    Here in your code you log the start time also the end time, but have you ever tried to log the time that spent in each step? Hardly to give some suggestion without knowing which step cost too much time. Probably the network connection is not that Efficent I guess, but I may need your detail test result for a better analysis.

    And another question is do you have the correct capability set in your app?

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, February 16, 2015 2:36 AM
    Moderator
  • Hi James

    It is the line:

    IReadOnlyList<StorageFolder> artists = awaitartistFolder.GetFoldersAsync(CommonFolderQuery.DefaultQuery, 0, 10);

    That takes all the time. The other lines account for maybe 8 milliseconds total.

    I believe that I do have the right capabilities enabled. I have "music library" and "private networks" enabled for Windows and "Music Library" and "Internet (client & server)" set for phone. There is no "private network" equivalent for phone.

    Tuesday, February 17, 2015 1:00 AM
  • Hi jsullyboy2,

    Sounds like the network location is the key issue, could you give a try with StorageFolder.GetFolderAsync | getFolderAsync method to see if you visit a specific folder, will the same issue happens.

    IReadOnlyList<StorageFolder> artists = awaitartistFolder.GetFolderAsync("FOLDER_NAME_HERE");

    Probably executing the query on the network location spend too much time.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, February 18, 2015 3:34 AM
    Moderator
  • I figured this out. I was using my NetGear router's DNLA capabilities to test with. GetFolderAsync does not work. It does not find the folder even if it exists.

    There are 2 capabilities on the router. You can share folders and you can activate a DNLA media server. I had both the media server on and a file share to a folder called "music" where all the music is. The music share had only read rights. If I remove the music share or add full rights to the share then I get sub second response time when retrieving the artists and songs.

    Sunday, February 22, 2015 6:41 PM
  • Good to know that :)

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 23, 2015 1:06 AM
    Moderator