Solved

Read tag information from mp3 without downloading entire file C# .Net

Posted on 2014-11-26
5
326 Views
Last Modified: 2015-01-05
I want to read mp3 tag info without downloading entire file e.g. author, title etc.

I know how to download mp3 from URLs

I know how to read mp3 tags - there are a number of libraries

However, I only want to download part of file, enough to get the tag information (author, title etc. etc.)

Thanks
0
Comment
Question by:rwallacej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40467667
Is the server one you control?
0
 

Author Comment

by:rwallacej
ID: 40467688
no
0
 
LVL 62

Expert Comment

by:☠ MASQ ☠
ID: 40467731
in theory it's possible but because there are two separate ID3 formats you can only get this to work with ID3v2.

ID3v1 Tag format places the metadata at the end of the file so you have to control the whole file before you can extract the details.  Because ID3v2 is designed for streaming audio it puts the data upfront and so is in the first part of the file so you can stop capturing data once you have the whole of the tag.

The downside is there's no fixed size for ID3v2 tags so by design you'll always need to download more than you need to be sure of always capturing all the metadata.

Possible but not a reliable way of getting the information off the files because it depends on the tagging system used and you're generally going to have no idea which you're dealing with.
0
 

Author Comment

by:rwallacej
ID: 40467772
Ok, so assume its ID3v2
And try downloading xxx bytes
Then parsing this

The example libraries also seem to load whole files, using the FileStream, but if I'm only downloading xxx bytes using StreamReader Read line then I don't have FileStream
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40467784
You cannot (reliably) use ReadLine for anything other than the HTTP headers. The content body of the response is going to be binary data, which may or may not have newline characters in it. You'll need to use the Read method instead; and you should probably use the Read method of the FileStream, not a StreamReader. You can safely use the StreamReader for the headers, but the response body should be read as raw bytes.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Invest in your employees with these five simple steps to improve employee engagement and retention.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question