How do I get the 'AlbumArtist' property

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: How do I get the 'AlbumArtist' property

by Steegy » Sat May 27, 2006 6:06 am

Sorry for the long wait... I hadn't seen this post yet.
It seems that the OnStop event is called, but as the music resumes, the OnPlay event was not called
Yep, I can confirm this. In my eyes, it's an inconsistency with the MM event handling mechanism. I'll see what the devs say about it.

When tags have to be written to a playing song, the song "stops" and after the writing it "plays" again.
1) If the OnStop event is rissen, then the OnPlay event should be too.
2) If the OnStop event is not rissen, then the OnPlay event shouldn't be rissen either.
(just a matter of consistency).

The best would probably be case 1, but with the possibility to see if the stop/play is happening for file writing or not.
In that case, the script itself can choose whether to handle the stop/play events when a playing song file is been written to.

Cheers
Steegy

Event not called after property is changed

by pepoluan » Tue May 23, 2006 7:34 am

Okay, downloaded latest 2.5.3 beta (build 963)

Now if I edit the properties, no longer error as I said previously.

However, the script fails when editing properties:

It seems that the OnStop event is called, but as the music resumes, the OnPlay event was not called.

The result is that, after editing the properties, the signature file says that I'm not playing anything on MM, even though the song is still playing.

However, at the end of the edited song, when the next song plays, OnPlay is called again.

by pepoluan » Sat May 20, 2006 4:30 am

Ah, okay. It's not show-stopping, and I don't often edit properties. Only post this because I luuuurve MM and definitely wants to see it be the best. :)

Peace! 8)

by Steegy » Fri May 19, 2006 6:36 am

I think it is because of a problem with the MM event system. This problem has been discussed before and it will hopefully be fixed in the next version.

My case: I don't have this script (SignatureWriter.vbs) active right now, but I get the same errors as you (because other scripts also trigger the same event problem).

So, I'm affraid we'll have to wait a bit.

Cheers
Steegy

Error when changing properties

by pepoluan » Fri May 19, 2006 6:25 am

I experience error with this script installed:

When music is playing, I right-click and edit the property, click OK, an error pops up:
Error executing script event.

Click OK, and another error pops up:
Error executing script event.

But in the background, the music plays, but starts from the beginning.

Click OK, and the music resumes playing where it was before I edit the property.

Not fatal, but rather annoying.

FYI I am using MM 2.5.3.959 (beta)

by pepoluan » Sun May 14, 2006 11:19 pm

I *am* using the latest version :(
Or must I use the Gold (i.e. paid) version?

Edit: Whoa. On second check, I'm still using 2.5.1. I could've sworn I've installed 2.5.2 :-? Will try reinstalling 2.5.2

Edit2: Yup. That's the problem. Thanks for the wonderful script! Now I can wow my penpals *does a little dance of joy* :D

by Steegy » Sun May 14, 2006 2:58 pm

You'll need a newer version of MediaMonkey, to be able to run this script (and many other scripts on this site). I think you need at least version 2.5.2

Cheers
Steegy

Error #438?

by pepoluan » Sun May 14, 2006 12:25 pm

I got an error #438 - Microsoft VBScript runtime error
Object doesn't support this property or method: 'Script.RegisterEvent'

by kalex » Sun Apr 16, 2006 9:12 am

Yeeehaa! Send me a PM with your address. This deserves some beer sent to you - awesome, man.

One minor glitch: I'm working with a limited user account - no administrative rights, no write access to the SDB.ApplicationPath directory. I changed it to my user profile path & everything is just fine.

Thanks a million, Steegy!

by Steegy » Sun Apr 16, 2006 7:57 am

Happy easter too.

This is an improved version.

It has to be placed in MediaMonkey's Scripts\Auto folder, and you will have to remove the entry you previously made in the Scripts.ini file (you can remove the other script file in the Scripts folder too).

It will create a file NowPlayingSignature.txt in MediaMonkey's Scripts\Auto folder.
When playback stops, or you shut down MediaMonkey, the file will be deleted.

Code: Select all

Option Explicit

Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")

Dim sSignatureFileName
sSignatureFileName = SDB.ApplicationPath & "Scripts\Auto\NowPlayingSignature.txt"


Sub OnStartUp

  Script.RegisterEvent SDB, "OnPlay", "WriteSignatureFile"
  Script.RegisterEvent SDB, "OnStop", "DeleteSignatureFile"
  Script.RegisterEvent SDB, "OnShutDown", "DeleteSignatureFile"
  
End Sub



Sub WriteSignatureFile

  On Error Resume Next

  Dim oSignatureFile, oTrack, sAlbumArtist
	
  Set oSignatureFile = oFSO.CreateTextFile(sSignatureFileName, True)
  Set oTrack = SDB.Player.CurrentSong
	
  oSignatureFile.Write "NP: " & oTrack.ArtistName & " - " & oTrack.Title
  If (Instr(oTrack.AlbumName, "Best")=0 And Instr(oTrack.AlbumName, "Greatest")=0) _
      Or Instr(oTrack.AlbumArtistName, "Various")=0 Then
    oSignatureFile.Write " (from the album " & oTrack.AlbumName & ")"
  End If
	
  oSignatureFile.Close()
	
End Sub



Sub DeleteSignatureFile

  On Error Resume Next
  
  oFSO.DeleteFile(sSignatureFileName)
  
End Sub
Cheers
Steegy

by kalex » Sun Apr 16, 2006 6:12 am

Steegy wrote:Am I not good enough to answer your question??? :evil: :lol: :lol: :lol:
Hehe. Don't worry - I just didn't want to bother you too much.

The problem is not that that the script will be locked, or something. I have to explain the details a little more, I think.

I've added some simply "code" into the templates of my email program. It checks for the existence of the "now playing" file. If its there, it is added below my signature to the message. If its NOT there, a random tagline ("cookie") is added, instead.

As it is now the file stays there for all eternity. Even if I wouldn't play a song with MM the whole month (which is hardly going to happen, but anyway), my email program would still show that I'm listening to... Ozzy Osbourne, or whatever, in an infinite loop. :)

So, what I'm looking for would be an additional functionality that deletes the created textfile (or empties its contents, either way) as soon as I press stop, or before I exit MM.

You see, thats why I didn't want to bother you too much with it! :wink:

A happy easter & thanks for the help you already provided.

by Steegy » Sat Apr 15, 2006 12:07 pm

Am I not good enough to answer your question??? :evil: :lol: :lol: :lol:

Anyway, the author hasn't been here in a long time, so maybe I can give an answer:

The script runs when a song starts playing, does it's work, and ends. The whole process shouldn't take more than a second. (i.e. creating/overwriting the text file and storing the song info in it).

That means that you can edit/delete/rename/... the text file always. *Except* at the moment when a song starts playing (and so the script runs). Then you'll have to wait a second for the script to finish.


Does the script work correctly? I mean, does it always contain one (or two) line(s) of text from the last played song?
If it doesn't, then change

Code: Select all

Set oOutput = oFSO.CreateTextFile("CookieData.txt")
to

Code: Select all

Set oOutput = oFSO.CreateTextFile("CookieData.txt", True)
The "True" makes sure that the file gets overwritten by a new version and so always contains the last played song.

Cheers
Steegy

by kalex » Sat Apr 15, 2006 11:41 am

Thanks, it works now. I got the RTFM hint. :-)

However (this question goes to the original script author), when I stop the song, or exit MM (though I have the feeling that is seldomly gonna happen, I start to rrrrreally like the program), the textfile remains. Seeing that there is no "stop" action in the scripts type, I wonder if its possible to delete the file when the song is stopped and/or MM is quit?

by Steegy » Sat Apr 15, 2006 11:09 am

Hi

The script has to be in MediaMonkey's "Scripts" folder, and you have to add an entry to the "Scripts.ini" file. See the example below:

Code: Select all

[SignatureWriter]
FileName=SignatureWriter.vbs
ProcName=Main
Order=1
DisplayName=SignatureWriter
Description=SignatureWriter
Language=VBScript
ScriptType=2
This supposes that you named the script text file "SignatureWriter.vbs".

BTW: ScriptType=2 means that the script will be launched each time a song starts playing.

More information: http://faq.mediamonkey.com/index.php?ac ... artlang=en

Cheers
Steegy

by kalex » Sat Apr 15, 2006 7:35 am

Please excuse the newbie question, this is exactly what I was looking for, but where do I put the script so that it automatically does its work when I play a song? Into the auto folder? Do I have to edit the script.ini as well?

[about the email app - I'm using "The Bat!" from Ritlabs, it has a template system for messages with a macro language that allows to include text files very easily, %INCLUDE("D:\nowplaying.txt") for example]

Thanks...

Top