Jump to content

WMP song and artist


Recommended Posts

So how can i get artist and song name, from .wma file. Example: i have file 27960.wma, and inside it there is song artist and title. How can i get them?

I need something like MediaGetTitle() or MediaGetArtist()

Edited by poisonkiller
Link to comment
Share on other sites

Arrrrrr i cant understand this Object things. B) Oh someone help me. :o Is there any programs that i can use FileInstall?

So..I looked around and i found, that i need to get into WMP, open song, then go into song properties and then get song contents. How can i do it?

Edited by poisonkiller
Link to comment
Share on other sites

OK, here is a solution that works with both mp3 and wma files. It allows both reading and writing of id3 tags.

To use this solution, you need a special DLL called CDDBControl.dll -- I have not investigated the licensing issues with this file, but it is apparently distributed with some SoundBlaster products and is also used by other vendors, and is available for download at several places on the internet. There appear to be more than one version of this file out there and not all of them work. The one available here does:

Download CDDBControl.dll from here: http://www.helpy.com.ar/cen-dll/c.htm

Unzip the file and drop the dll anywhere that makes sense to you on your disk. You'll then need to register it by creating a DOS cmd window, navigating to the file location and issuing the following command:

C:\> regsvr32 CDDBControl.dll

You can find information on how to use the methods and properties of this dll in these locations:

http://ericmcconkey.com/index.php?cmd=newsdetail&extras=17

http://www.pstruh.cz/tips/detpg_list-id3-tags-script/

http://www.pstruh.cz/tips/detpg_change-id3-tags-script/

Once the dll is registered you can use the following code (with the latest AutoIt beta):

$file = "your mp3 or wma filename here"; e.g. "C:\Music\27960.wma"

; Instantiate a COM instance with your new dll
$oId3 = ObjCreate("CDDBControl.CddbID3Tag")

; Load the tags from your specified file - they are now available in the form $oId3.TagName
$oId3.LoadFromFile ($file, True); True means open for read-only

; Copy tag information into variables
$sTitle = $oId3.Title
$sLeadArtist = $oId3.LeadArtist
$sAlbum = $oId3.Album

; Write the selected values to the SciTe console
ConsoleWrite("Title: " & $sTitle & @CR)
ConsoleWrite("LeadArtist: " & $sLeadArtist & @CR)
ConsoleWrite("Album: " & $sAlbum & @CR)

Exit

If you issue the LoadFromFile command with a second parameter of False, it is opend for read-write. You can then use the $oId3.SaveToFile ($file) to update tag information. For example:

$file = "your mp3 or wma filename here"; e.g. "C:\Music\27960.wma"
$oId3 = ObjCreate("CDDBControl.CddbID3Tag")
$oId3.LoadFromFile ($file, False); False means open for read-write

$oId3.Title = "This is a new title tag"

$oId3.SaveToFile ($file); write tag information back to the file

Exit

Here are the id3 tags you can read and write:

Album

Movie

Title

CopyrightYear

CopyrightHolder

Comments

Label

BeatsPerMinute

LeadArtist

PartOfSet

TrackPosition

Year

Genre

FileId

ISRC

Hope this helps,

Dale

Edit: Note that there are also ways to get this information without this special DLL using COM with the Windows Media Player objects - but it requires you scan your media into the Windows Media Catalog, which I choose not to do. There are also ways to do this by reading from the files natively by knowing the information offsets -- a task for someone else with the time and motivation.

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thank you very much for this code! I was so excited, because i needed this code and i asked another question so fast... :">

But is there any way to FileInstall this .dll and use _runDOS() to send this code?

EDIT: Okay, i tried register this .dll, but First: "cmd" is not working, "command" works...I have Win98SE

Second: My computer is little broken i think :/,because it says after typing "C:\> regsvr32 CDDBControl.dll": "Too many arguments" AND if i type only "regsvr32 CDDBControl.dll" then it says:"Not reading drive A:\.Abort, Retry, Fail?".What i should to do??

Edited by poisonkiller
Link to comment
Share on other sites

But is there any way to FileInstall this .dll and use _runDOS() to send this code?

Your gratitude is overwhelming.

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

If i tested this Obj thing, then Artist was "" and sond name "" and i doesn want to work with this thing, because this is too hard B) . Please someone lock this topic if is possible to lock.

Lock this topic? Yeah right... you sound like a 10-year-old trying to hide behind mother's apron when dad is comming to give you a butt whoopin' you know you deserve. Revising your previous replies will not hide from me that you are asking for a handout and show no appreciation for the work of others.

You sent me the following PM after I let you know that I had a solution:

Please type this code, i need it Very Very much.

Thanks!

For the record, your "need" had nothing to do with my posting the solution. I spent about an hour researching, testing and documenting this because I thought it was an interesting problem. You say this is too hard? No, you're just being lazy.

I broke one of my cardinal rules here by putting far more energy into my reply than you put into asking the question or considering how you could solve it yourself. Rest assured, I won't make that mistake with you again.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • Moderators

If i tested this Obj thing, then Artist was "" and sond name "" and i doesn want to work with this thing, because this is too hard B) . Please someone lock this topic if is possible to lock.

LOL Dale... all but this one was edited...

Don't be fooled, some of us truly do appreciate your efforts and contributions!!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • 2 weeks later...

What i should to do? I cant register it. I cant do nothing with this if i cant register it. I found VBScirpt what gives me ID tags, but i dont know how to put .vbs into my script, does i have to download VBS and i dont know how to use AutoitX. So... Maybe there is some way to use DllOpen for using CDDBControl.dll. Im searching solution now.

Link to comment
Share on other sites

I spent about an hour researching, testing and documenting this because I thought it was an interesting problem.

Dale- Thank you for your hard work. I spent a half hour on this a month ago and got nowhere (since I don't have the dll knowledge that you have), so I was happy to see that someone had solved this.

I started with your code, stole a few lines from the help files and now have a pretty decent solution to edit MP3 tags. I plan to post it after we see what the original poster comes up with... B)

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

Can you give me some inspiration B) ? I tried DllCall(), DllOpen(), i searched a lot of wma ID3 tags, I've found some VBScripts, but i dont know how to include then into my script. And i even opened this .dll file with WordPad and i get ~15 000 lines of somekind of code.

Link to comment
Share on other sites

Can you give me some inspiration B) ? I tried DllCall(), DllOpen(), i searched a lot of wma ID3 tags, I've found some VBScripts, but i dont know how to include then into my script. And i even opened this .dll file with WordPad and i get ~15 000 lines of somekind of code.

I suggest others read the previous replies in this post before investing time here.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Then say, what i should to do if your code is not working and im noob in Obj and Dll??

Every time, if i want to use ObjCreate() then i get this error:

C:\WINDOWS\Desktop\Song and Artist (9) : ==> Variable must be of type "Object".:

$oId3.LoadFromFile ($file, True)

$oId3^ ERROR

Edited by poisonkiller
Link to comment
Share on other sites

found this dll

http://www.r1ch.net/stuff/r1dll/

works with dllcall()

function in the readme file

donno what else in the dll (not mine) B)

Features (exported functions)

GetCurrentApplication - Returns the title of the currently active window.

GetCurrentWinampSong - Returns the title of the currently playing song.

GetCurrentWinampSongChannels - Returns the number of channels of the current song (eg 2 = stero, 1 = mono).

GetCurrentWinampSongElapsedTime - Returns the number of seconds the current song has been playing.

GetCurrentWinampSongFileName - Return the full path to the currently playing file.

GetCurrentWinampSongKHz - Return the sample rate of the current song.

GetCurrentWinampSongKbps - Return the current bitrate of the song.

GetCurrentWinampSongTotalTime - Returns the total number of seconds of the current song.

IsWorkstationLocked - Returns 1 if the workstation is currently locked (NT/2k/XP only).

Edited by DiskAI

i think

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...