473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Album Art, Track Duration, And An Error?

Tyler Wiebe
Okay, I'm using the following to get information from mp3 files
Expand|Select|Wrap|Line Numbers
  1.         public Track(string Location)
  2.         {
  3.             if (System.IO.File.Exists(Location))
  4.             {
  5.                 System.IO.FileStream FileStream = System.IO.File.OpenRead(Location);
  6.                 System.IO.BinaryReader ByteStream = new System.IO.BinaryReader(FileStream);
  7.  
  8.                 FileStream.Seek(-128, System.IO.SeekOrigin.End);
  9.                 if (System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(3)) == "TAG")
  10.                 {
  11.                     this.Title = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
  12.                     this.Artist = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
  13.                     this.Album = System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(30)).Trim();
  14.                     this.Year = int.Parse(System.Text.Encoding.Default.GetString(ByteStream.ReadBytes(4)).Trim());
  15.  
  16.                     ByteStream.BaseStream.Position = 126;
  17.                     byte[] TrackNumber = ByteStream.ReadBytes(2);
  18.                     if (TrackNumber[0] == 0 && TrackNumber[1] != 0) this.TrackNumber = TrackNumber[1];
  19.  
  20.                     this.Location = Location;
  21.                 }
  22.  
  23.                 FileStream.Close();
  24.             }
  25.         }
  26.  
First off, as you can see, this doesn't get the files album artwork, or the duration of the song, so I'm wondering how I can do that.

Secondly, the function I found for finding the track number doesn't seem to be working at all, and I'd like to know why.

And lastly, out of all of my mp3 files, only 1002 out of 1093 contain the "TAG" ID, so I'm wondering, why is that, and does anyone know a way to get the missing ones?
Mar 18 '12 #1
0 1227

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: stanley j Mroczek | last post by:
Every thing is on one machine, Programs and sql. Sql is up and running(can test with query analyzer). No changes where made! This was working fine. How do you track this error? What network...
1
by: a | last post by:
I have the following problem, where the Song is a class created by me. The first add is ok. The second caused this error. Exception in thread "main" java.lang.ClassCastException: library.Song...
2
by: Guadala Harry | last post by:
I created a simple "photo album" page; it has a bunch of ImageButton controls that display the thumbnails - and then an Image control that displays the full-sized image when the corresponding...
1
by: Jon | last post by:
Morning all. We have an ASP.net (1.1) app that is causing an error that sends us an email. However, due to the fact that the user is not aware that the error is happening we're having some...
2
by: maansi.creations | last post by:
Service unavailable error comes randomly while accessing our website and gets alright in matter of seconds....Could some one tell the possible reasons for these to happen: i got a earlier...
3
by: caveman | last post by:
Hi i am using PHP to upload picture files to a file in my server, but for some reason it will not create thumbnails of the upload, all that happens is that where the thumbnail is meant to be...
2
by: scorpion53061 | last post by:
Error in my sql statement please help SELECT PRODDTA.F5549110.BLITM, PRODDTA.F41002.UMITM, PRODDTA.F5549110.BLUOM, PRODDTA.F41002.UMUM FROM PRODDTA.F5549110, PRODDTA.F41002 WHERE ...
1
by: Oscar | last post by:
Hi, Is there a way to extact the album cover image that is shown in WMP 11. I Would like to have a cover.jpg file in each album folder so I'm able to make a backup of all mp3's as well as all...
1
by: RYKLOU | last post by:
I am kinda new to php, but i do know what i am doing kinda, but i came across this error when i am trying to upload a file to my website. Fatal error: Allowed memory size of 8388608 bytes...
15
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.