aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: 1 2 [3]

Author Topic: Full amule control by amulecmd  (Read 24999 times)

gwpl

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: Full amule control by amulecmd
« Reply #30 on: February 24, 2010, 10:46:22 PM »

Coming back to topic of my feature request,
Thank you very much wuischke for help at the topic: "EC for Python" http://forum.amule.org/index.php?topic=17548.0 .

 I've managed to achieve my goal ! :D

Here is a code that does "Result detailed" as python script with https://code.google.com/p/pyamulecmd/ .
Code: [Select]
#!/usr/bin/env python
import ec

def create_link(file):
    return "ed2k://|file|%s|%d|%s|/" % (file['name'], file['size'], file['hash'].encode('hex'))

ec_password="pgjxf1!"
ec_host="localhost"
ec_port=8963

e = ec.conn(ec_password, ec_host, ec_port);

res = e.search_results();

x=0
for r in res:
print 'Result-id: ' + str(x)
x = x + 1
print "Filename: %s" % r['name']
print "Size: %d" % r['size']
print "Sources-all: %d" % r['sources']
print "Sources-complete: %d" % r['sources_complete']
print 'ed2k: ' + create_link(r)
print ''


Btw. I haven't thought that I will achieve it at the same evening :D, it's my best after LuaGL opensource experience ;). Thanks again.
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Full amule control by amulecmd
« Reply #31 on: February 24, 2010, 11:12:09 PM »

The basics of XML are not more complex than Json. I wasn't taking about DTD, scheme, whatever of course. Just a little lightweight XML tree with the data. There are pretty tools available to map something like that into a data structure.
But I admit JSON looks nice.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Full amule control by amulecmd
« Reply #32 on: February 24, 2010, 11:56:25 PM »

json *is* really nice and imo easier to read than XML.

Compare json (array of two objects):
Code: [Select]
[{"hash": "bcaa0724d034db71dc0e88e369520a20",
  "name": "Linux-Knoppix.iso",
  "size": 4681994240,
  "sources": 8,
  "sources_complete": 4},
 {"hash": "d40fc1a022333e8d4485d8d29fbe6c7f",
  "name": "KNOPPIX_V5.1.1DVD-ES-2007-01-12.iso",
  "size": 4195794944,
  "sources": 1,
  "sources_complete": 1}]
To XML1:
Code: [Select]
<results>
<result hash="bcaa0724d034db71dc0e88e369520a20" name="Linux-Knoppix.iso" size="4681994240" sources="8" sources_complete="4"/>
<result hash="d40fc1a022333e8d4485d8d29fbe6c7f" name="KNOPPIX_V5.1.1DVD-ES-2007-01-12.iso" size="4195794944" sources="1" sources_complete="1"/>
</results>
and XML2:
Code: [Select]
<results>
<result>
  <hash>bcaa0724d034db71dc0e88e369520a20</hash>
  <name>Linux-Knoppix.iso</name>
  <size>4681994240</size>
  <sources>8</sources>
  <sources_complete>4</sources_complete>
</result>
<result>
  <hash>d40fc1a022333e8d4485d8d29fbe6c7f</hash>
  <name>KNOPPIX_V5.1.1DVD-ES-2007-01-12.iso</name>
  <size>4195794944</size>
  <sources>1</sources>
  <sources_complete>1</sources_complete>
</result>
</results>

The first one with attributes is pretty cryptic and the second one has a lot of noise. Unless one uses Java (which is well optimized for XML), JSON is imho preferable for simple data structures.
Logged

gwpl

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: Full amule control by amulecmd
« Reply #33 on: February 25, 2010, 08:31:43 AM »

1 voices for JSON, 1 voice for XML  - JSON wins! ;).

Btw. For all who want to serialize data into compact binary format (lice EC does) I recommend to check out Google's Protocolbuffers. They are opensourced, and their purpose is to do fast serialization/deserialization into/from compact binary code.
On the other hand EC could be implemented using protocol buffers, but that's just concept...
now EC is done, designed, documented and it works and look very well so let is be as it is, because it's good :).

Thanks to "wuischke", I've implemented with him my previous feature request in python (code above).

Now I have another feature request for amulecmd (or other utilities, like pyamulecmd).

When downloading something in amuleweb, amulegui, than, there  we work with "tabs", representing "categories" (destination folders).
My request is a according to those "Tabs":

* possibility of adding links to given categories like in amuleweb  "Download -> Music".

* (and maybe in future...) possibility of defining new, configuring existing "categories"
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Full amule control by amulecmd
« Reply #34 on: February 25, 2010, 08:08:52 PM »

Code: [Select]
<results>
<result hash="bcaa0724d034db71dc0e88e369520a20"
        name="Linux-Knoppix.iso"
        size="4681994240"
        sources="8"
        sources_complete="4"
/>
<result hash="d40fc1a022333e8d4485d8d29fbe6c7f"
        name="KNOPPIX_V5.1.1DVD-ES-2007-01-12.iso"
        size="4195794944"
        sources="1"
        sources_complete="1"
/>
</results>
Better? That's XML1 with a little whitespace. I don't find readability different from json. And it's supposed to be machine-readable, so human readability doesn't count so much.
(Man, me advocating for XML. Didn't expect to see that day...  ::) )

My request is a according to those "Tabs":
* possibility of adding links to given categories like in amuleweb  "Download -> Music".
* (and maybe in future...) possibility of defining new, configuring existing "categories"
Both is possible with amulegui.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Full amule control by amulecmd
« Reply #35 on: February 25, 2010, 08:59:24 PM »

I must say, Stu is right in that your examples seems a bit biased, wuischke (no intent to hurt your feelings there). XML1 formatted is not different from JSON. I like JSON for what it does, but it's just an extra unneeded dependency for no actual gain.
Logged

gwpl

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: Full amule control by amulecmd
« Reply #36 on: February 26, 2010, 12:19:10 AM »

Code: [Select]
<results>
<result hash="bcaa0724d034db71dc0e88e369520a20"
        name="Linux-Knoppix.iso"
        size="4681994240"
        sources="8"
        sources_complete="4"
/>

Ok, now it looks ok ;).

To me it's ok, cause output will be well formatted so reader is not big deal at all.
The worse might be to support xml as input for aMule, cause no guarantees about formatting, only a lot of possibilities coming from xml format.
On the other hand, there are xml parsers for that ;).
So those arguments are ok to me.
What about dependency... I feel it might be not big deal, cause usually json parsers are one, small file you just include to distribution (that's why there are no json specific distro packages, while it's used in many places).
Logged

gwpl

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
Re: Full amule control by amulecmd
« Reply #37 on: February 26, 2010, 12:21:55 AM »

My request is a according to those "Tabs":
* possibility of adding links to given categories like in amuleweb  "Download -> Music".
* (and maybe in future...) possibility of defining new, configuring existing "categories"
Both is possible with amulegui.

I know that many things are possible in amulegui. But this thread is about, what do we wish amulecmd/pyamulecmd etc, to be possible ;).
Logged

gav616

  • Guest
Re: Full amule control by amulecmd
« Reply #38 on: April 27, 2010, 02:53:20 AM »

my dream is aMuleGUI in console form, much like a  htop look.

*goes and learns how to read/write code*
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: Full amule control by amulecmd
« Reply #39 on: April 27, 2010, 10:31:28 AM »

Start with learning ncurses
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Full amule control by amulecmd
« Reply #40 on: April 27, 2010, 07:29:24 PM »

Looks like Turbo Vision. Cute.  :)

Before you start anything, take a screenshot of aMule and a text editor. Try to fit the information into the existing text space. See if you can get anything that looks worth digging deeper into the subject to you.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

gav616

  • Guest
Re: Full amule control by amulecmd
« Reply #41 on: April 28, 2010, 11:47:52 AM »

obviously information menus on clients/files/the log, would be on a separate screen, much like how rtorrent handles all the data  but keeps the downloads/uploads in the main screen.

example;


pressing right arrow on a certain file takes it to info screen;
Logged
Pages: 1 2 [3]