Plans for Terminal or Script commands

Asked by Mateo Salta on 2012-07-29

Hi, I was wondering if there was implementation of commands to call on from terminal for NitroShare, or if there are plans for this.

I think that If the basic functions could be accessed from a script it would make integrating the commands into various desktops or file managers like Kubuntu (Dolphin) or Xubuntu.

Point me in the right direction, and I could try to help implement them.

Question information

Language:
English Edit question
Status:
Solved
For:
NitroShare Edit question
Assignee:
No assignee Edit question
Solved by:
Nathan Osman
Solved:
2012-07-30
Last query:
2012-07-30
Last reply:
2012-07-29
Best Nathan Osman (george-edison55) said : #1

Actually, Nitroshare exposes an XML RPC API (which the Nautilus plugin uses). The API is very basic at this point. I would suggest taking a look at the Nautilus plugin to get an idea of how it works.

Mateo Salta (mateo-salta) said : #2

awesome, almost there, kde uses .desktops files for plugins, Placed in /usr/share/kde4/services/ServiceMenus/
Also for calling on a file it uses %f , I was looking at this as a template to make the launcher- http://clusterbleep.net/blog/2012/01/11/getting-a-dropbox-public-link-in-kde-using-dolphin/

So, I have the basic .desktop file that displays on rightclick in dolphin, but i'm not quite sure how to add the functionality.

<pre>[Desktop Entry]
Actions=NitroShareSend;
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=all/all;

[Desktop Action NitroShareSend]
Exec=
Name=Send Files with NitroShare

Icon=nitroshare</pre>

Mateo Salta (mateo-salta) said : #3

would something like in this link work, espasally the sections that make commands to call on from terminal or script. http://www.zugiart.com/2011/10/generic-python-xml-rpc-cli-client-with-apache-extension-support/

Nathan Osman (george-edison55) said : #4

(I'm using a Kindle right now, so typing is a little awkward.)

Unfortunately plugins implemented via .desktop files are limited in capability. They must invoke a single command and the menu items cannot be disabled based on context. The Nautilus extension avoids these problems by integrating directly with Nautilus' C API (well, almost - it uses a Python module thatdoes).

There are basically two options here. One is to write a short Python script that accepts filenames as command line arguments and uses the XML RPC API. The other is to write a full-fledged plugin for Dolphin in C++.

Mateo Salta (mateo-salta) said : #5

yeah, there are some trade offs with the .desktop file with a python script. We could have it launch nitroshare if it was not open (I think). And the benefit would be a script that could be called on in most any desktop, and in terminal. Although, If things are changing in the program alot It may be better to wait and have full plugins.

Mateo Salta (mateo-salta) said : #6

Thanks Nathan Osman, that solved my question.

Mateo Salta (mateo-salta) said : #7

looking into useing "argparse" to make the commands, but I am having a hard time seperating the functionality of sending the file from the Natulius part.

Some thing I have been looking at, http://www.doughellmann.com/PyMOTW/argparse/ http://www.pyroelectro.com/tutorials/mp3-tags-1/list.html

So the thought was to get a .py script to accept file names, or a directory as a argument.