INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS and Python  (Read 2256 times)

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
MCWS and Python
« on: May 26, 2014, 06:46:52 am »

ive been reading through this forum and the web the whole morning and I could not find any guidance. :) so I just ask.

im trying to connect a VMeter to mc ( http://vmeter.net/ ).
im not very familiar with Python, but im playing around with it for a while (hello world). on the vmeter site they have some stuff in python that communicates with the vmeter, so that is why I choose python. and I thought that using MCWS was a good idea (rather not the com object).

now the problem is as always... getting started. how do I get anything from or to mc with python using MCSW. for instance print the artist name of the currently playing song... or pause\play...

any help would be much appreciated.

 :)
gab
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: MCWS and Python
« Reply #1 on: May 26, 2014, 12:20:54 pm »

You'll need to find and use python libraries that provide authenticated HTTP requests.  Once you can make an AUTH request, then its just a matter of formatting the messages and reading the responses.  You'll also probably also want HTML Entities & URI encoding/decoding and XML modules.  If you are going to write values back to MC, you'll also want a CSV module.  You can look at my perl script modules, specifically MCUtils/MCWS.pm for any of pscriptor, amg.pl, or discogs.pl.  Look at connect(), send(), send_items(), and possibly do_mcc_command().
Logged
The opinions I express represent my own folly.

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: MCWS and Python
« Reply #2 on: May 27, 2014, 01:19:10 am »

thank you very much... that helps a lot.. have some more puzzling to do.

 :)
gab
Logged
Pages: [1]   Go Up