如何在C#XAML应用程序中从音乐库中抓取所有媒体文件 [英] how to crawl all media files from music library in C# XAML application
问题描述
大家好,
我创建了 使用此查询的HTML javascript和已抓取的音乐文件中的应用程序
var query = Windows.Storage.KnownFolders.musicLibrary.createFolderQuery(
  ; Windows.Storage.Search.CommonFolderQuery.groupByAlbum);
& NBSP;      
var dataSourceOptions = {
mode:Windows.Storage.FileProperties.ThumbnailMode.musicView,
requestedThumbnailSize:250,
thumpnailOptions:Windows.Storage.FileProperties.ThumbnailOptions.resizeThumbnail,
waitForFileLoad:
true;
类似地如何从音乐库中抓取音乐文件 使用C#/ xaml
BharathiGurusheve.R
等效代码C#应该类似于:
//我添加了一个过滤器,以确保在查询中只返回.mp3和.wma文件
var MusicSearchQueryOptions = new QueryOptions(CommonFileQuery.OrderByMusicProperties,new List< string> {" .mp3"," .wma" });
MusicSearchQueryOptions.SetThumbnailPrefetch(Windows.Storage.FileProperties.ThumbnailMode.MusicView,250,Windows.Storage.FileProperties.ThumbnailOptions.ResizeThumbnail);
var query = Windows.Storage.KnownFolders.MusicLibrary.CreateFolderQueryWithOptions(MusicSearchQueryOptions);
&NBSP;&NBSP;
取决于您希望如何抓取所有音乐(将它们保存在文件夹中)或者只是抓取单个文件),你可以使用
等待query.Folder.GetFilesAsync API来获取你的所有音乐。
告诉我如果您在此处有任何其他问题或疑问。
hi to all,
I have created an application in HTML javascript and crawled music files by using this query
varquery = Windows.Storage.KnownFolders.musicLibrary.createFolderQuery(
Windows.Storage.Search.CommonFolderQuery.groupByAlbum);
vardataSourceOptions = {
mode: Windows.Storage.FileProperties.ThumbnailMode.musicView,
requestedThumbnailSize: 250,
thumpnailOptions: Windows.Storage.FileProperties.ThumbnailOptions.resizeThumbnail,
waitForFileLoad:
true;
Similarly how to crawl music files from music library using C#/ xaml
BharathiGurusheve.R
The equivalent code in C# should look something like:
//I've added a filter to ensure only .mp3 and .wma files are returned in your query
var MusicSearchQueryOptions = new QueryOptions(CommonFileQuery.OrderByMusicProperties, new List<string> { ".mp3", ".wma" });
MusicSearchQueryOptions.SetThumbnailPrefetch(Windows.Storage.FileProperties.ThumbnailMode.MusicView, 250, Windows.Storage.FileProperties.ThumbnailOptions.ResizeThumbnail);
var query = Windows.Storage.KnownFolders.MusicLibrary.CreateFolderQueryWithOptions(MusicSearchQueryOptions);
Depending on how you want to crawl all the music (keep them in folders or just grab single files), you can use the await query.Folder.GetFilesAsync API to get all your music.
Let me know if you have any more questions or issues here.
这篇关于如何在C#XAML应用程序中从音乐库中抓取所有媒体文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!