Working with Python (Google Music API)

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Working with Python (Google Music API)

Postby wormywyrm » Sat Mar 03, 2012 4:45 pm

I am working on a playlist/library uploader that will sync mediamonkey and google music, but I may need some help.

Simon Weber recently released an unofficial API for google music at https://github.com/simon-weber/Unoffici ... -Music-API

The API is written in python, so I just downloaded python and will be working with it for the first time. What I could really use advice on is how to integrate mediamonkey and python. So far this is all the information I was able to find:

http://www.mediamonkey.com/wiki/index.p ... _scripting
http://origin.mediamonkey.com/wiki/inde ... t_handling

I'm not sure if it is going to be enough to figure out everything based on. Could allow me to see an example of their python plug-in or point me in the right direction?
MM to Grooveshark Playlist Sync w/ MonkeyShark.
http://lysle.net/projects/monkeyshark.php
wormywyrm
 
Posts: 59
Joined: Tue Jan 12, 2010 4:40 pm

Re: Working with Python (Google Music API)

Postby Thanasis » Sun Mar 04, 2012 1:53 am

If nothing else works there is a loose alternative....

Using vbscript write all the variables in a text file and then call your Python Script (from within .vbs) to read the variables and execute the calculations !!!!
Thanasis
 
Posts: 84
Joined: Sun Aug 28, 2011 2:53 am

Re: Working with Python (Google Music API)

Postby mcow » Sun Mar 18, 2012 3:08 pm

There are different things you'll need to do depending on how the script is run. Those two pages you are looking at should be enough to get you accessing MM from Python code. If you're just going to launch the script in parallel to MM (from a desktop icon, say) there isn't much else you need to do.

To launch a Python script from within MM, I use this technique:
Code: Select all
Sub StartPyScript
  Set WshShell = CreateObject("WScript.Shell")
  Set oFSO = CreateObject("Scripting.FileSystemObject")
  ' Example: path to the script, in the MM Scripts folder... but could be anywhere
  path = SDB.ScriptsPath & "PyScript.pyw"
  ' Launch the script...
  paths = oFSO.GetFile(path).ShortPath
  WshShell.Run paths
End Sub

You'll need the pywin32 package for MM access, which means you'll have the PythonWin IDE to work in. With that, you can try various bits of code interactively; and if you type the name of a MM interface object, and then a dot (.), PythonWin will put up a code-completion window that shows all the accessible member elements. Select one and <tab> to enter that element name as if you'd typed it. (Note that the window also shows a handful of members that you can't actually access: CLSID, AddRef, GetTypeInfo. These are elements of the COM interface that, as a rule, you don't need.)
mcow
 
Posts: 440
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: Working with Python (Google Music API)

Postby Thanasis » Sat Mar 31, 2012 2:37 pm

Yes but I think mcow's solution will invoke the Windows UAC message !!!
Thanasis
 
Posts: 84
Joined: Sun Aug 28, 2011 2:53 am

Re: Working with Python (Google Music API)

Postby simon_weber » Mon Apr 02, 2012 1:44 am

Hey, all. I'm Simon - the one who made the linked api.

I just posted in another thread about creating a syncing tool: viewtopic.php?f=3&t=57831&p=335183#p335183. Head over there to check it out; I'm fairly confident my plan will work.
simon_weber
 

Re: Working with Python (Google Music API)

Postby mcow » Fri Apr 06, 2012 12:07 am

Thanasis wrote:Yes but I think mcow's solution will invoke the Windows UAC message !!!

I can't specifically say no because I'm not using Windows 7, but on XP I run as an ordinary user and run my scripts all the time with no permissions failure.
mcow
 
Posts: 440
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California

Re: Working with Python (Google Music API)

Postby wormywyrm » Fri Sep 07, 2012 12:17 am

Just an update... I did get started learning Python and playing with all that, but I just have been too busy with gradschool to do a lot. This is something I plan to do someday though. Hopefully someone will come along and do it first :lol:
MM to Grooveshark Playlist Sync w/ MonkeyShark.
http://lysle.net/projects/monkeyshark.php
wormywyrm
 
Posts: 59
Joined: Tue Jan 12, 2010 4:40 pm

Re: Working with Python (Google Music API)

Postby cobooboc » Fri Sep 07, 2012 12:30 am

mcow wrote:
Thanasis wrote:Yes but I think mcow's solution will invoke the Windows UAC message !!!

I can't specifically say no because I'm not using Windows 7, but on XP I run as an ordinary user and run my scripts all the time with no permissions failure.

I use Windows 7, but I also did not succeed, and this has always been a problem.
cobooboc
 
Posts: 8
Joined: Mon Sep 03, 2012 10:43 pm


Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 3 guests