[PY] Phoenix MUS Interface

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    [PY] Phoenix MUS Interface

    Hi! I have written a full Python interface to the Phoenix MUS server, and am releasing it here now.

    What's this good for?
    If you're writing an application/script/anything in Python, you will be able to use this module to interact with your Phoenix server. All the MUS commands currently in the emulator have been implemented.

    How do I use it?
    You must create a Phoenix class and pass two arguments -- the server host, and port. It will not connect immediately, however it will once you issue a command. You can edit the timeout limit by modifying the Phoenix.timeout variable to an integer of your choice.

    Any docs?
    All functions have a docstring, so you can take a peek at the source if you want. Soon, I will be posting proper documentation up at this module's PyPI page.

    Can you give me an example of how to use this?
    Code:
    import phoenix
    
    emu = phoenix.Phoenix('localhost', 1233)
    emu.hotel_alert('hello everyone')
    emu.unload_room(55)
    emu.update_catalogue()
    emu.sock.close()
    Of course, that's not how you should be using it. Embed it in your applications!

    Where do I download it?
    You can find the full Python package at the module's PyPI page: https://pypi.python.org/pypi/phoenix

    You can also install the package with pip or easy_install:
    Code:
    pip install phoenix
    easy_install phoenix
    Please report any bugs you find, and give me any suggestions you'd like implemented. There's not much to do in regards with adding more commands, since they are all in the emulator. I will, of course, add support for any that appear in future Phoenix releases.

    Enjoy!
    Last edited by Bui; 03-04-13 at 07:45 AM.


  2. #2
    Valued Member Thekguy is offline
    MemberRank
    Dec 2011 Join Date
    DksvLocation
    122Posts

    Re: [PY] Phoenix MUS Interface

    Anny screenshots?

  3. #3
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Thekguy View Post
    Anny screenshots?
    I'm not completely sure on how I'm supposed to provide screenshots of a Python library. If you just want proof it works, here:


  4. #4
    Valued Member Monsma is offline
    MemberRank
    Dec 2011 Join Date
    The NetherlandsLocation
    126Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Funixeh View Post
    I'm not completely sure on how I'm supposed to provide screenshots of a Python library. If you just want proof it works, here:

    Cool! nice release

  5. #5
    i am a person Riley H is offline
    MemberRank
    Mar 2010 Join Date
    United StatesLocation
    203Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Funixeh View Post
    I'm not completely sure on how I'm supposed to provide screenshots of a Python library. If you just want proof it works, here:

    Nice release. But I think your date's wrong?

  6. #6
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Riley H View Post
    Nice release. But I think your date's wrong?
    The date is from Python 2.7.3, not from his PC.

  7. #7
    i am a person Riley H is offline
    MemberRank
    Mar 2010 Join Date
    United StatesLocation
    203Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Tha View Post
    The date is from Python 2.7.3, not from his PC.
    Ah, I'm not familiar with Python, so I wouldn't know. But thanks for clearing it up.

  8. #8
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Riley H View Post
    Nice release. But I think your date's wrong?
    Nope, it's the date the Python installation was built on.

    I'm going to do documentation properly in a while (and maybe use something like Sphinx), as well as possibly adding a few extra retro-helpful functions as well.

    If you have any suggestions, just post them.

  9. #9
    Evil Italian Overlowrd Droppy is offline
    [Internal Coder]Rank
    Feb 2012 Join Date
    /home/droppyLocation
    2,046Posts

    Re: [PY] Phoenix MUS Interface

    Good System. Unfortnely I don't like Python so much, but will be useful for a lot of other persons, with Mac's, etc. :)

  10. #10
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Droppy View Post
    Good System. Unfortnely I don't like Python so much, but will be useful for a lot of other persons, with Mac's, etc. :)
    I don't see the relation between Python and Macs. Thanks anyway!

  11. #11
    retired Andrew is offline
    MemberRank
    Jun 2008 Join Date
    985Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Funixeh View Post
    I don't see the relation between Python and Macs. Thanks anyway!
    I think he's referring to the fact python comes pre-installed to the OS on a Mac.

    Not entirely useful, but a nice proof of concept. Could possibly be tied in to a unix-based python web server if you were using something like FAPWS3 (my favourite python web server) with your CMS.

    Python is a lovely language. well done :)

  12. #12
    Web & Interaction Design Gangnam is offline
    MemberRank
    Dec 2010 Join Date
    Lincoln, UKLocation
    1,983Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Funixeh View Post
    I don't see the relation between Python and Macs. Thanks anyway!
    As opposed to a Windows executable (C#, etc.)

  13. #13
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: [PY] Phoenix MUS Interface

    Quote Originally Posted by Andrew View Post
    I think he's referring to the fact python comes pre-installed to the OS on a Mac.

    Not entirely useful, but a nice proof of concept. Could possibly be tied in to a unix-based python web server if you were using something like FAPWS3 (my favourite python web server) with your CMS.

    Python is a lovely language. well done :)
    Thanks! It's true that this probably won't get used a lot in a CMS, unless you were to have a Python API server to interact with Phoenix, and just use that in your PHP CMS. Although it would probably be easier to do the Phoenix MUS in PHP.

    Quote Originally Posted by n0minal View Post
    As opposed to a Windows executable (C#, etc.)
    I'm not a big fan of writing .NET; it all seems unnecessarily complicated. Python can still be run on Windows anyway, and is usually much more readable.

  14. #14
    beep Bui is offline
    MemberRank
    Jan 2012 Join Date
    United KingdomLocation
    459Posts

    Re: [PY] Phoenix MUS Interface

    Updated the module to 0.9.1. Changelog:

    • Fixed setup.py to use correct data directory.
    • Added function web_build(hotel='com', short=False). Returns the latest web_build used by the Hotel given, and if short is True, then only the four-digit build number is returned.
    • Added function hotel_build(hotel='com'). Returns the latest hotel build that's displayed in the Hotel's meta tags.
    • Added function phoenix_version(otaku_u, otaku_p). Requires 2 params; Otaku.cm username and password. Used to connect to the licence server to find and return the latest Phoenix build, as an integer.


    These do kinda sound a little pointless to me too, but I haven't had much time to come up with better ideas. Perhaps I should create more functions that just use the database (eg. ban()), or maybe even do a web-based Housekeeping in Python. I'll see.

    Still working on docs.

    Oh, and because I know people are going to start bitching and claiming phoenix_version() is a keylogger or something dumb (and don't even check the source), here's the function so you can shut up before posting:

    Code:
    def phoenix_version(otaku_u, otaku_p):
        """Returns the latest available version of Phoenix."""
        opener = urllib2.build_opener()
        opener.addheaders.append(('AuthName', otaku_u))
        opener.addheaders.append(('AuthPass', otaku_p))
        opener.addheaders.append(('AuthBuild', '14986'))
        opener.addheaders.append(('AuthServer', 'Phoenix'))
    
        res = opener.open('http://otaku.cm/phx/licence.php?')
        return int(res.headers['CurBuild'])

  15. #15
    retired Andrew is offline
    MemberRank
    Jun 2008 Join Date
    985Posts

    Re: [PY] Phoenix MUS Interface

    I can see this turning into a hotel management tool that is done via command line.

    No need for Housekeeping - give your mods manage.py and an access token, and they login with their hotel user/pass. idk jus tan idea.



Page 1 of 2 12 LastLast

Advertisement