Reading ID3 tags of a remote mp3 file?

你说的曾经没有我的故事 提交于 2019-12-12 15:06:29

问题


Read MP3 Tags with Silverlight got me started with reading id3 tags, but i realize that taglib# online deals with local file paths ?

Is there a way of reading this info from a remote file ?


回答1:


I recently answered the same question for Ruby (see below) - I'm pretty sure you can do something similar.

The idea is:

  1. use HTTP 1.1 protocol or higher, and a Range HTTP-request.

  2. download the beginning section (100 bytes) of the ID3v2-tag

  3. from the first few bytes downloaded, you can determine the correct length of the complete ID3v2 tag, e.g. N

  4. download the first N bytes of the file (e.g. the complete ID3v2-tag)

  5. parse the ID3v2 tag for your purposes

See:

Read ID3 Tags of Remote MP3 File in Ruby/Rails?




回答2:


Tim Heuer has a good blog post on doing this. http://timheuer.com/blog/archive/2010/01/30/reading-mp3-id3-tags-with-silverlight-taglib.aspx

Like yourself, he also ran into the problem of TabLib# only using local paths.

One thing that TagLib# didn’t have was a stream input implementation. Most of the libraries, in fact, assumed a local file path. Luckily the library was written using a generic ‘File’ interface, so I just had to create my own StreamFileAbstraction. I chose to do this within my project rather than the base library. It was easy since the LocalFileAbstraction actually perfomed an Open on the file as it’s first task and set some public variables. My abstraction basically just hands the stream already and ready to go.

There is an example on the novell site that uses file abstraction. http:// developer.novell.com/wiki/index.php/TagLib_Sharp:_Examples



来源:https://stackoverflow.com/questions/2606081/reading-id3-tags-of-a-remote-mp3-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!