Page 1 of 2

Tutorial to MediaMonkey, anyone?

Posted: Thu Aug 31, 2006 8:46 am
by almo9004
Hi!

I have been using MediaMonkey for almost a year now and i think its the best musicplayer out there.
Recently I started getting interested in VB and I saw that MM uses VB scripts!
So I tried to transfer my knowledge from Visual Studio but failed right away. I found out that MM uses a 'master' object, SDBApplication or alike, and all commands are called via its underlaying classes and so on.

I find it very frustrating that noone has really tried to show how common operations are performed in MM. Sure, you can observe scripts from the pros, but

Is it too much to ask for a simple tutorial?!!

I'm convinced that many other intermediate MM users feel that same and would join me in my opinion.

Thanks!
almo9004

Posted: Thu Aug 31, 2006 9:17 am
by trixmoto
How do you define "common operations"?

Just under a year ago I had never used MediaMonkey, nor VBScript. In that time (whilst having a full time job and a fiance to keep happy!) I've taught myself how to use both and written many scripts which people find useful.

I taught myself using the scripting helpfile and sample scripts which can be found here: http://www.mediamonkey.com/developers.htm

I also used W3Schools and DevGuru to help with VBScript, plus searching this forum and Google for examples.

If you have any questions, feel free to ask! :)

Posted: Thu Aug 31, 2006 9:28 am
by Lowlander
Not that a tutorial wouldn't be helpful. But there are plenty of tutorials for VBScript on the internet. And for the MediaMonkey specifics you can find more on the MediaMonkey Developers page and this forum.

One should remember that writing scripts is not for anyone. Some affinity with computers and preferrably knowledge of some programming language are bare minimums when it comes to starting coding. That doesn't mean that without programming experience you can't do it (I started programming without experience) but it's really helpful in order to understand how programming works.

Posted: Thu Aug 31, 2006 12:14 pm
by almo9004
@ trixmoto:
Well, to mention a few examples of 'common operations': modifing tags, composing playlists, showing now playing-stats/information.

I would like to create a Album Art-orientated album browser, create playlists consisting of, let's say, 30% rock, 40% techno and 30% classical or more complex criterias not covered by the features in AutoPlaylists etc.

As probably indicated above, I am a stats-junkie... 8) :D

@ Lowlander:
I have visited the MM Developer's site and had a look at the sample snippets. But, call me picky, it would be a great improvement if someone sat down and explained the code and commands like they are supposed to be taught, so that new users don't have to stare at thousands of lines of code to figure out what to use where.
Not to mention that some users use one classmember and other use a completly different class.

I'm short-sighted standing in a dark room and asking 'Turn on the light!' :wink: :D

almo9004

Posted: Thu Aug 31, 2006 12:27 pm
by trixmoto
Well, for album art browsing you should check out my Browse By Art script - but I warn you the code is nasty! I should know, I wrote it! :)

There are many scripts which create playlists based on various specifications, but I've not really delved much in this area so can't help you.

Posted: Thu Aug 31, 2006 1:20 pm
by Peke
You could also look at few of my Scripts most recent ones show you how to manipulate Events combinating with Playlists and Now Playing (including rearanging the list).

I tried to make them as simple as possible, also I noted that lots of us scripters comment parts of code to help others in learning, understanding, changing and using our scripts.

At last you can allways ask us. As you already noticed not all functions in Scripting help have example.

Finally, welcome to the club.

Posted: Fri Sep 01, 2006 3:11 pm
by paulmt
I have been using MM for about a year and in the last couple of months have really started to get interested in customising my MM.
I am attempting to teach my self VBScript as well as skinning.
I avoid jumping into the forum and asking for help every time I hit "the wall" simply because I feel I learn better by working it through myself.

There is plenty of resource available on VBScript on the net, as well as there is a host of help within this forum.

The best way though, I find is to de-construct some of the great scripts already written and used in MM <gulp, sorry> pull them apart line by line and look at what has been done there. I then try different things to see if what I had thought works. By using the fine work already done here it is teaching me an enormous amount.

In time I know I will be contributing my own twists on how I think MM can be used. Honestly I really don't think you can be spoon fed this, via a tutorial, you have to do the hours sitting in front of the computer nutting the problems through.

So, although all help is appreciated, it is already very available if you look.

Posted: Sat Sep 02, 2006 1:13 pm
by rovingcowboy
i do the simple thing.

i just ask for scripts and let this other great scripters do them since i have not figured out vbs and am really unsure if i ever will.

so i let the best ones do the scripting.

8)

Posted: Sun Sep 03, 2006 4:27 am
by almo9004
:D :lol: :D roving cowboy, i guess that's a way to do it... :D

OK, I'm gonna have myself a good look at your scripts, guys, and hopefully I will get a few steps closer to realizing my ideas in my last post.

Undoubtedly, I will have lots of questions when I'm done studying your works, so stay tuned!

Thanks!

Posted: Sun Sep 10, 2006 4:57 am
by almo9004
Hi, I'm back.

My Internet connection has been offline for a few days, sorry for making you wait.

I've come to realize that if i'm gonna be able to accomplish a script that creates playlists with say, 30% rock, 40% techno and 30% classical (as mentioned), i will have to know SQL. So, i started searching and observing scipts with even the tiniest line of SQL and came up with that some people use QuerySongs() and some openSQL() or even execSQL. So now, my questions:

1. Which should I use, QuerySongs(), openSQL or execSQL()?

2. Why does the line QuerySongs("AND Artists.Artist = 'Beatles'") work and QuerySongs("AND Genres.Genre = 'Pop'") does not?!

3. Where can I learn EVERYTHING about SQL in MediaMonkey?

4. Can I accomplish my above mentioned script without SQL?

Hope I'm not too nooby... :P :)

Posted: Sun Sep 10, 2006 6:24 am
by Bex
I dont know VBScript but so I can't answer all questions.

2. There are no fieldname called Genre in table Genres. The correct syntax is:
QuerySongs("AND Genres.GenreName = 'Pop'")
Which would work just fine.

3. Well, to learn everything will take a while. Try to google "sql tutorial".
(This is pretty good: http://www.w3schools.com/sql/sql_intro.asp )
The SQL syntax differs between different databases. But is the same to 95%. MM uses MS Access as its database.
Tip!
Skip everything that has todo with altering data like Update, Delete, Insert into. Also skip everything that has todo with "SQL Data Definition Language (DDL)". At this stage you only want to query the database and "look" at the data.

4. I dont think so

/Bex

Posted: Sun Sep 10, 2006 7:59 am
by trixmoto
My knowledge is more VBScript and less SQL so I'll try to fill in the blanks!

1. The differences are...
- QuerySongs returns a SongIterator which is a list of songs for you to iterate through. The query is also only the WHERE part of the statement so should begin with "AND".
- OpenSQL returns a DBIterator which is a results set containing the information you have requested, which you can then iterate through. This should be the full SQL statement.
- ExecSQL doesn't return anything. It is used to perform UPDATE functions primarily and it's not something I've ever needed to use.

3. I use DevGuru for a lot of my SQL syntax, and also tend to ask people here as there are some real experts amongst us (of which I'm not one!)

4. It is possible, but would be extremely slow. The only feasible solution is with SQL.

Posted: Sun Sep 10, 2006 11:36 am
by DiddeLeeDoo
Just a quick non-script solution.
New Auto Playlist - Advanced - Genre=Rock, Max Tracks 30
New Auto Playlist - Advanced - Genre=Techno, Max Tracks 40
New Auto Playlist - Advanced - Genre=Classical, Max Tracks 30

Combine and stirr..

QuerySongs is good for things like this by the way.

Posted: Mon Sep 11, 2006 4:39 am
by almo9004
Hey, guys!

Thanks for your answers, they really cleared up the sky :lol: :P
Except for one thing, when I tried QuerySongs("AND Genres.GenreName = 'Pop'") I got an errormessage saying (translated into English)

Code: Select all

There was a problem querying the database:
07002:[Microsoft][Driver for ODBC Microsoft Access] Too few parameters given. 1 was expected.
The lines looks like:

Code: Select all

...
strSQL = "AND Genres.GenreName = 'Pop'"
set iter_songs = SDB.Database.QuerySongs(strSQL) '<- Error points here
...
PS. I will have a look at MagicNodes, see if there is any help. But that doesn't stop you from answering. :)

PPS. Remember to honor the victims of 9/11 today at 13:46 GMT.

Posted: Mon Sep 11, 2006 5:10 am
by trixmoto
Try

Code: Select all

AND Genres.GenreName LIKE 'Pop'