|
-
Dec 15th, 2012, 12:35 PM
#1
Thread Starter
Addicted Member
Audio and RTB
Hi
I'm looking for a way to be able to import audio information into a rich text box.
Whether this is by drag and drop, or by an "import" menu/ button doesn't matter.
I'd like the name of the file to be inserted into the rich text box, along with the duration of the file. But I'd like it to be formatted like this:
[NAME:
DURATION: ]
Obviously, with the correct info inserted after the colons.
Is anyone able to advise?
-
Dec 15th, 2012, 08:02 PM
#2
Re: Audio and RTB
What are you actually asking for? Do you have a method for obtaining the duration already? Where do these files come from - a directory, a playlist, a media player? It's pointless trying to advise you with such limited information to work with!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Dec 18th, 2012, 07:22 AM
#3
Thread Starter
Addicted Member
Re: Audio and RTB
Don't have a method, but since with files like mp3s the duration is a property I imagine there is one somewhere?
The files will be coming from a directory, eg the desktop.
let me know if you need any more info
-
Dec 18th, 2012, 10:42 AM
#4
Re: Audio and RTB
This snippet provides what you need to garner the metadata from just one file so you can see the potential problems with this. It returns a lot of information and you'll have to find a way to filter it for the specific info you want and apply that to a multi file scenario.
vb.net Code:
Sub Main() Dim FileName As String FileName = "C:\somefiles\somefile.mp3" Dim Properties As Dictionary(Of Integer, KeyValuePair(Of String, String)) = GetFileProperties(FileName) For Each FileProperty As KeyValuePair(Of Integer, KeyValuePair(Of String, String)) In Properties ListBox1.Items.Add(FileProperty.Value.Key & ": " & FileProperty.Value.Value) Next End Sub Public Function GetFileProperties(ByVal FileName As String) As Dictionary(Of Integer, KeyValuePair(Of String, String)) Dim Shell As New Shell Dim Folder As Folder = Shell.[NameSpace](Path.GetDirectoryName(FileName)) Dim File As FolderItem = Folder.ParseName(Path.GetFileName(FileName)) Dim Properties As New Dictionary(Of Integer, KeyValuePair(Of String, String))() Dim Index As Integer Dim Keys As Integer = Folder.GetDetailsOf(File, 0).Count For Index = 0 To Keys - 1 Dim CurrentKey As String = Folder.GetDetailsOf(Nothing, Index) Dim CurrentValue As String = Folder.GetDetailsOf(File, Index) If CurrentValue <> "" Then Properties.Add(Index, New KeyValuePair(Of String, String)(CurrentKey, CurrentValue)) End If Next Return Properties End Function
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|