Jump to content
CFire

UDF : Media Controls

Recommended Posts

How do you get the SharedUserRating value (according to the MSDN docs this is the user specified rating)? I tried creating a function to pull "wm/SharedUserRating" but it's always empty.

Func WMGetSharedUserRating($sObj)

Return $sObj.GetItemInfo("WM/SharedUserRating")

EndFunc

TIA


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

I may be wrong, but I think all of the "WM/" attributes only apply to WMA and other Windows Media filetypes. You might be able to use "Rating" instead.

Tried that earlier...returns nothing.

The ratings apply to all media formats Granted most of these are stored within the WM database however, if you have the 'global'/'retain my rating' option enabled in WMP, it will create a ID3 tag in the MP3 file. I just haven't figured out how to extract/write to this tag.


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

How about this instead of individual property functions:

Func WMGet($sObj, $sAttrib)
    Return $sObj.GetItemInfo($sAttrib)
EndFunc

You can call it this way:

Func _RetrieveMeta($sObj)
    ConsoleWrite("(_RetrieveMeta) Retrieving WMP tags")
    Dim $aMeta[2][$aWMPTags[0]+1]
    $aMeta[0][0] = 1
;~  $sMsg = ""
    for $i = 1 to $aWMPTags[0]
        ConsoleWrite(".")
        $aMeta[1][$i] = WMGet($sObj, $aWMPTags[$i])
;~      $sMsg &= $i & " - " & $aWMPTags[$i] & ": " & $aMeta[1][$i] & @CRLF
    Next
;~  msgbox(0,$sAppTitle,$sMsg)
    ConsoleWrite("done" & @CRLF)
    return $aMeta
EndFunc

Main script will look like this:

$aWMPTags = StringSplit("AcquisitionTime,AlbumID,AlbumIDAlbumArtist,Author,AverageLevel,Bitrate,BuyNow,BuyTickets,Copyrig
ht,CurrentBitrate,Duration,FileSize,FileType,Is_Protected,IsVBR,MediaType,MoreInfo,PeakValue,Provide
rLogoURL,ProviderURL,RecordingTime,ReleaseDate,RequestState,SourceURL,SyncState,Title,TrackingID,Use
rCustom1,UserCustom2,UserEffectiveRating,UserLastPlayedTime,UserPlayCount,UserPlaycountAfternoon,Use
rPlaycountEvening,UserPlaycountMorning,UserPlaycountNight,UserPlaycountWeekday,UserPlaycountWeekend,
UserRating,UserServiceRating,WM/AlbumArtist,WM/AlbumTitle,WM/Category,WM/Composer,WM/Conductor,WM/ContentDistributor,WM/ContentGroupDescription,WM/EncodingTime,WM/Genre,WM/GenreID,WM/InitialKey,WM/Language,WM/Lyrics,WM/MCDI,WM/MediaClassPrimaryID,WM/MediaClassSecondaryID,WM/Mood,WM/ParentalRating,WM/Period,WM/ProtectionType,WM/Provider,WM/ProviderRating,WM/ProviderStyle,WM/Publisher,WM/SubscriptionContentID,WM/SubTitle,WM/TrackNumber,WM/UniqueFileIdentifier,WM/WMCollectionGroupID,WM/WMCollectionID,WM/WMContentID,WM/Writer,WM/Year", ",")

$sObj = WMOpenFile($sFilename)
$aMeta = _RetrieveMeta($sObj)

Works for me. :)

Edited by sshrum

Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

How about a WMSet...so we can adjust the values in the files! Something like this (I already know it doesn't work...but you get the idea):

Func WMSet($sObj, $sAttrib, $sValue)
    if wmget($sObj, "Is_Protected") = "false" then $sObj.SetItemInfo($sAttrib, $sValue)
EndFunc

I just don't know how to get the setiteminfo to work. :)


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

@sshrum

According to:

http://msdn2.microsoft.com/en-us/library/bb262748.aspx

SetItemInfo: "If you embed the Windows Media Player control in your application, file attributes that you change will not be written to the digital media file until the user runs Windows Media Player."

Perhaps if Windows Media Player (the program, not the object) is also running, perhaps minimized, the info can be set/read in real time? Just a theory. Good luck with your project, it sounds interesting.

Share this post


Link to post
Share on other sites

If I want to get the current playing item info in WMP. But not the script ask to open a specific file(just like the Active WinAMP UDF). how can i do?

And can I get the current play time and seek time to play?

Thanks

Share this post


Link to post
Share on other sites

Like, attach to a Media Player application window, and query to find out what's currently playing? I don't think you can do that no. It would be nice though. You can do that with an IE window using _IEAttach, but that uses some dark magic which I don't think can be applied here. (at least, not casually...)

Share this post


Link to post
Share on other sites

Like, attach to a Media Player application window, and query to find out what's currently playing? I don't think you can do that no. It would be nice though. You can do that with an IE window using _IEAttach, but that uses some dark magic which I don't think can be applied here. (at least, not casually...)

Thanks for your reply.

I'm interested how to use _IEAttach, to do something like that can you tell me more about this?

Share this post


Link to post
Share on other sites

Using this approach (BTW very nice UDF there CFire) is there a way to build a dynamic "spectrum analyzer" ...equalizer?

Are the hooks accessible in the Windows Media Player Com Object to do such?

Thanks,

gsb


"Did you ever stop to think? ...and forget to restart!"

Share this post


Link to post
Share on other sites

Nice UDFs although it is limited in that only one sound file may be opened at once.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

I get an error when i play the media for the first time. This is what i get : "Exception Processing Message 0xc000007b Parameters 0x762E023C 0x762E023C 0x762E023C". Personally, i dunno why i get this error. I checked the functions again and agian and nothing. Anyway, i would greatly apreciate some help. I also specify that i Use Windows Vista, so WMP 11 :)


[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

Share this post


Link to post
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

×
×
  • Create New...