Hello There, Guest!
View New Posts  |  View Today's Posts
Open for programming request

  • 0 Vote(s) - 0 Average


07-30-2012, 11:01 PM #21
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Open for programming request
Yeah sure, suggest away.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

07-30-2012, 11:09 PM #22
BreShiE
Knowledge Is Power
*****
Posts: 1,130 Threads:158 Joined: Sep 2011 Reputation: 12

RE: Open for programming request
Well, I was thinking about a program which you could select a folder, and it'll find all music/video files and calculate the total play time using the file information. Include all subfolders in that folder. :D

What'cha think?
This post was last modified: 07-30-2012, 11:10 PM by BreShiE.


"It was pretty impressive to watch a missile fly down an air vent, but couldn't we feasibly use that same technology to shoot food at hungry people?"

07-30-2012, 11:54 PM #23
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Open for programming request
(07-30-2012, 11:09 PM)BreShiE Wrote:  Well, I was thinking about a program which you could select a folder, and it'll find all music/video files and calculate the total play time using the file information. Include all subfolders in that folder. :D

What'cha think?


I think that would be a 1-2 minute project for me with simple LINQ... lol


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

08-02-2012, 12:27 AM #24
BreShiE
Knowledge Is Power
*****
Posts: 1,130 Threads:158 Joined: Sep 2011 Reputation: 12

RE: Open for programming request
Try it out then! :D

With my music, it's all kept in one folder so I can just use the default feature with Windows 7 to calculate it for me, but my movies... That's a whole different story, each movie has it's own folder. xD


"It was pretty impressive to watch a missile fly down an air vent, but couldn't we feasibly use that same technology to shoot food at hungry people?"

08-02-2012, 01:30 AM #25
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: Open for programming request
[code=csharp]private void button1_Click(object sender, EventArgs e)
{
string folderObj = @"D:\Music";
//string[] exts = { ".mp3", ".wav" };
string[] exts = { ".wav" };

string[] musicFiles = Directory.GetFiles(folderObj, "*.*", System.IO.SearchOption.AllDirectories)
.Where(f => exts.Contains(Path.GetExtension(f).ToLower())).ToArray();

foreach (string s in musicFiles)
{
TimeSpan TS = TimeSpan.FromMilliseconds((double)GetTrackLength(s));
Console.WriteLine("{0}:{1} Mins", TS.Minutes, TS.Seconds);
}
}

[DllImport("winmm.dll")]
private static extern uint mciSendString(string command, StringBuilder returnValue, int returnLength, IntPtr winHandle);

public static int GetTrackLength(string fileName)
{
StringBuilder buffer = new StringBuilder(32);

mciSendString(string.Format("open \"{0}\" type waveaudio alias wave", fileName), null, 0, IntPtr.Zero);
mciSendString("status wave length", buffer, buffer.Capacity, IntPtr.Zero);
mciSendString("close wave", null, 0, IntPtr.Zero);

int length = 0;
int.TryParse(buffer.ToString(), out length);
return length;
}[/code]

Just need to see how to read ID2/ID3 tags for MP3's in order to calculate their track length, and we're set. I'd put a switch statement into the GetTrackLength function and a second param for the switch to check the file extension as a param.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲




Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
  Open Projects - Request Download or Partnering Up To Complete AceInfinity 3 2,671 06-23-2012, 08:14 PM
Last Post: BreShiE
   Pool Of Programming Ideas AceInfinity 10 11,173 05-14-2012, 03:21 AM
Last Post: Shintaro


Users browsing this thread: 1 Guest(s)