如何快速搜索和比较巨大的mp3数据列表? [英] How to search and compare huge lists of mp3 data fast?

查看:57
本文介绍了如何快速搜索和比较巨大的mp3数据列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编程是流媒体播放器。在程序启动时,会下载一个文件,其中包含此时在线可用的曲目列表。目前此列表中有20.000.000项!



此文本文件被读取并转换为(mediadata)列表,其中mediadata是包含14个项目的自定义类每个曲目(例如艺术家作为字符串,标题作为字符串,专辑作为字符串,持续时间作为字符串......)

所以我有一个包含大约的列表(mediadata)。 20.000.000项目。



本地我同样有播放列表,每个播放列表包含大约1000个曲目,存在相同类型(mediadata)





我的问题:

因为并非所有在线歌曲都可用,我需要根据艺术家和标题比较这些播放列表(其他值可能与MusicLibrary不同!)如果找到匹配项,我会将MusicLibray中的数据加载到我的播放器中。





我当然可以为每个循环执行此操作,但这需要很长时间才能加载。



进行此比较的最快方法是什么?据我所知,二进制搜索是不可能的?





我是否以错误的方式处理这个问题?有什么令人耳目一新的想法吗?

My prog is a streaming mp3 player. At program start, a file is downloaded containing a list of tracks available online at the moment. Currently there are 20.000.000 items in this list!

This textfile is read and converted to a list(of mediadata), where mediadata is a custom class containg 14 items per track (e.g. artist as string, title as string, album as string, duration as string...)
So I have a list(of mediadata) containing approx. 20.000.000 items.

Locally I likewise have playlists containing roughly 1000 tracks each, existing of the same type (mediadata)


My problem:
Because not all songs online are always available I need to compare these playlists based on "artist" and "title" (the other values may be different!) against MusicLibrary, and if a match is found, I load the data from the MusicLibray into my player.


I can do this with a for each loop of course,but this takes ages to load.

What would be the fastest way to make this comparison? A binarysearch is not possible as far as I know?


Am I approaching this problem the wrong way? Any refreshing ideas?

推荐答案

试试这个。



Try this.

var MyListC = MyListA.Where(t2 => MyListB.Count(t1 => t2.Author == t1.Author && t2.Title == t1.Title) == 0);


在本地使用SQLite存储播放列表,并使用可用于本地SQLite和主网络数据库的常用SQL命令进行交换。

这应该避免重新发明轮子......
Use SQLite locally to store playlist and make exchanges using common SQL commands that can work for local SQLite and the main network database.
This should avoid to reinvent the wheel...


这篇关于如何快速搜索和比较巨大的mp3数据列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆