Programming Freaks  | دورات ومقالات برمجيه

Please login or register.

Login with username, password and session length
Advanced search  

News:

Please Read our FAQ

Pages: [1] 2

Author Topic: aria2c with xmlrpc  (Read 935 times)

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
aria2c with xmlrpc
« on: February 13, 2010, 04:53:14 PM »
السلام عليكم ورحمة الله
وحشتوني جيتلكم بسؤال جديد
i found an XML-RPC INTERFACE  for the download manager aria2c  :)

and i can interactive from python by code similar to this
Code: [Select]
import xmlrpclib
from pprint import pprint

s = xmlrpclib.ServerProxy("http://localhost:6800/rpc")
r = s.aria2.addUri(["http://localhost/aria2.tar.bz2"], {"dir":"/downloads"})
pprint(r)

the problem is that i always get refused connection error  >:(

https://sourceforge.net/apps/trac/aria2/wiki/XmlrpcInterface
Logged

abom

  • Ruby Fr34k
  • Just Joined
  • *
  • Posts: 20
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #1 on: February 13, 2010, 06:53:46 PM »
اتأكد من تشغيل aria و تفعيل xml-rpc
عن طريق الأمر

Code: [Select]
aria2c --enable-xml-rpc

ده كلام الصفحة:
https://sourceforge.net/apps/trac/aria2/wiki/XmlrpcInterface

Quote
First, run aria2 with --enable-xml-rpc:

و بعد كدة اعمل شغلك عادى فى بايثون
« Last Edit: February 13, 2010, 06:55:51 PM by abom »
Logged

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #2 on: February 13, 2010, 07:04:13 PM »
السيرفر مش بيشتغل بالامر ده
Code: [Select]
[ahmed@Lenovo src]$ aria2c --enable-xml-rpc --xml-rpc-listen-all --xml-rpc-listen-port=6801

2010-02-14 03:01:53.867532 WARN - You may encounter the certificate verification error with HTTPS server. See --ca-certificate and --check-certificate option.
                                                                                                                                                             
2010-02-14 03:01:57.307837 NOTICE - Shutdown sequence commencing... Press Ctrl-C again for emergency shutdown.

Download Results:
gid|stat|avg speed  |path/URI
===+====+===========+===========================================================


جيت في وقتك يا عبده البرنامج ده  بالروبي بيعمل نفس الشغل والغريبة انه بيتصل ويشتغل تمام

http://archive.xfce.org/src/apps/eatmonkey/0.1/eatmonkey-0.1.3.tar.bz2
« Last Edit: February 13, 2010, 07:08:44 PM by lio_013 »
Logged

abom

  • Ruby Fr34k
  • Just Joined
  • *
  • Posts: 20
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #3 on: February 13, 2010, 07:19:13 PM »
شغل aria2c
و سيبه شغال
أنا جربت على بايثون و اشتغل معايا!
و اعمل شغلك على بايثون


حتى داخل كود eatmonkey
Code: [Select]
				# Launch aria2c process
begin
command = "aria2c --disable-ipv6=true " \
"--enable-xml-rpc --xml-rpc-listen-port=#{@port} " \
"--conf-path=#{@confdir}/aria2.conf --log=#{@confdir}/aria2.log --log-level=notice " \
"--dht-file-path=#{@confdir}/dht.dat"
@@pid = spawn_server(command)


Code: [Select]
=begin
spawn_server:
Execute an aria2c process in background and wait for a positive response.
=end
def spawn_server(command)
pid = Process.spawn(command, :pgroup=>true, :chdir=>ENV['HOME'],
STDOUT=>"/dev/null", STDIN=>"/dev/null")
Process.detach(pid)
# Wait for the server to respond properly to requests
debug("waiting for a first response...")
Timeout::timeout(5) do
begin
begin
result = @@client.call("aria2.tellActive")
rescue
end
sleep 1 if result == nil
end while result == nil
end
debug("started server", command, pid)
pid
end
« Last Edit: February 13, 2010, 07:23:19 PM by abom »
Logged

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #4 on: February 13, 2010, 07:47:42 PM »
برضه مش شغال يا عبده قوللي انت عملت ايه بالظبط
وايه الكود اللي استخدمته في بايثون ؟؟؟؟؟؟؟؟
Logged

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: aria2c with xmlrpc
« Reply #5 on: February 14, 2010, 03:15:47 AM »
Code: [Select]
>>> import os
>>> os.system('aria2c -D --enable-xml-rpc') #starting as Daemon.
0
>>> import xmlrpclib
>>> from pprint import pprint
>>> s=xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> s
<ServerProxy for localhost:6800/rpc>
>>> s.aria2.getVersion()
{'version': '1.6.3', 'enabledFeatures': ['Async DNS', 'BitTorrent', 'Firefox3 Cookie', 'GZip', 'HTTPS', 'Message Digest', 'Metalink', 'XML-RPC']}
>>> s.aria2.addUri(['http://services.netbeans.org/bouncer/index.php?product=netbeans-6.8-ml-javase&os=linux'], {'dir':'/home/xmonader/' } )
'2'
>>> s.aria2.tellActive()
[{'status': 'active', 'numPieces': '47', 'downloadSpeed': '118786', 'pieceLength': '1048576', 'bitfield': '000000000000', 'connections': '5', 'gid': '2', 'completedLength': '393216', 'uploadSpeed': '0', 'uploadLength': '0', 'totalLength': '49047552'}]
>>> s.aria2.tellActive()
[{'status': 'active', 'numPieces': '47', 'downloadSpeed': '121583', 'pieceLength': '1048576', 'bitfield': '000000000000', 'connections': '5', 'gid': '2', 'completedLength': '540672', 'uploadSpeed': '0', 'uploadLength': '0', 'totalLength': '49047552'}]

Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #6 on: February 14, 2010, 06:50:43 PM »
تمام يا ابوحميد
مشكلتي كانت في اني باستخدم بورت 6801 مش عارف جبتها منين  :)
مع ان المانيوال بيقول 6800
تمام شغال كده
Logged

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: aria2c with xmlrpc
« Reply #7 on: February 15, 2010, 02:25:31 AM »
هيكون مشروع جميل اذا بتفكر تعمل Download manager/Bittorrent client ببايثون واستخدام ال xml-rpc


Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #8 on: February 15, 2010, 02:47:23 AM »
قاريني يا ابوحميد
ادعيلي بس اقدر عليه
 :D
Logged

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #9 on: March 02, 2010, 05:02:45 PM »
دلوقتي وصلت لجزء من الكود بيبدأ الداونلود ويبعت الداتا الاولية لجدول في قاعدة بيانات
هل فيه طريقة احترافية  تخليه يحدث الداتا باستمرار ويعدل قيمها في الجدول
ولا استخدم تايمر يجيب الداتا الجديدة كل فترة زمنية معينة
؟؟؟؟؟؟؟؟؟
Logged

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: aria2c with xmlrpc
« Reply #10 on: March 02, 2010, 09:05:59 PM »
اعتقد تخلى التحديث لما يتم استكمال الداونلود ؟
Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #11 on: March 03, 2010, 10:26:30 AM »
كده مفهمتنيش يا احمد
انا قصدي الداتا اللي بتتعرض لليوزر زي نسبة التحميل وسرعته و........الخ
عندي دالة بتجيب الداتا دي مرة فهل اعمل لووب يكرر تنفيذ الدالة دي ولا التايمر افضل ولا في حاجة افضل من الاتنين
؟؟؟؟؟
Logged

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: aria2c with xmlrpc
« Reply #12 on: March 03, 2010, 12:29:34 PM »
نفس الشئ كدا انت هتعمل مثلا الف استعلام على الداتابيز اثناء عملية التحميل
كل اللى انت محتاجه فعلا انك تاخد البيانات المبدأية وتزود عليها "داخل البرنامج"  وبعد انتهاء معالجتها كلها سواء انتهاء الدونلود او ايقافه تسجلها فى الداتابيز

Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/

lio_013

  • Just Joined
  • *
  • Posts: 35
  • No-Pain-No-Gain
    • View Profile
    • Email
Re: aria2c with xmlrpc
« Reply #13 on: March 03, 2010, 12:54:56 PM »
بس كده اليوزر لو حب يشوف البروجريس في اي وقت مش يعرف
Logged

Striky

  • Helping Freak
  • Administrator
  • Posting Freak
  • *****
  • Posts: 252
    • View Profile
    • WWW
    • Email
Re: aria2c with xmlrpc
« Reply #14 on: March 03, 2010, 04:12:46 PM »
عشان اريحك
ملف بتحمله مثلا 500 ميجا
لما تيجى تهيئ عملية التحميل خزن البيانات بتاعته فى الداتابيز وبعدها هتبدأ تعالج البيانات دى وتزود عليها --ودى هى اللى تستخدمها فى البروجريس او اياكان. ولما يوقف التحميل لأى سبب سواء ايقاف من المستخدم او انتهاءه تقوم تخزن البيانات اللى فى الميمورى وتحدث بيها قاعدة البيانات
Logged

Life is just a chance to grow a soul. - A. Powell
Weblog: http://ahmedyoussef.wordpress.com/
Pages: [1] 2