Tutorial to MediaMonkey, anyone?

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Would you like a tutorial on scripts in MediaMonkey?

You may select 1 option

 
 
View results

almo9004
Posts: 12
Joined: Wed May 03, 2006 6:29 am
Location: Sweden

Tutorial to MediaMonkey, anyone?

Post by almo9004 » Thu Aug 31, 2006 8:46 am

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
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."
Robert Wilensky, about the Infinite monkey theorem

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Thu Aug 31, 2006 9:17 am

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! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Lowlander
Posts: 46502
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Post by Lowlander » Thu Aug 31, 2006 9:28 am

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.
Lowlander (MediaMonkey user since 2003)

almo9004
Posts: 12
Joined: Wed May 03, 2006 6:29 am
Location: Sweden

Post by almo9004 » Thu Aug 31, 2006 12:14 pm

@ 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
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."
Robert Wilensky, about the Infinite monkey theorem

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Thu Aug 31, 2006 12:27 pm

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.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Peke
Posts: 12701
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Post by Peke » Thu Aug 31, 2006 1:20 pm

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.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

paulmt
Posts: 1170
Joined: Tue Jul 18, 2006 6:06 pm

Post by paulmt » Fri Sep 01, 2006 3:11 pm

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.

rovingcowboy
Posts: 14153
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy » Sat Sep 02, 2006 1:13 pm

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)
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy 5 Android 5) 6. Proscan tablet Android 4.3 ) 7. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

almo9004
Posts: 12
Joined: Wed May 03, 2006 6:29 am
Location: Sweden

Post by almo9004 » Sun Sep 03, 2006 4:27 am

: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!
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."
Robert Wilensky, about the Infinite monkey theorem

almo9004
Posts: 12
Joined: Wed May 03, 2006 6:29 am
Location: Sweden

Post by almo9004 » Sun Sep 10, 2006 4:57 am

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 :)
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."
Robert Wilensky, about the Infinite monkey theorem

Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex » Sun Sep 10, 2006 6:24 am

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
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Sun Sep 10, 2006 7:59 am

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.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Sun Sep 10, 2006 11:36 am

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.
Image

almo9004
Posts: 12
Joined: Wed May 03, 2006 6:29 am
Location: Sweden

Post by almo9004 » Mon Sep 11, 2006 4:39 am

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.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."
Robert Wilensky, about the Infinite monkey theorem

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Mon Sep 11, 2006 5:10 am

Try

Code: Select all

AND Genres.GenreName LIKE 'Pop'
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Post Reply