The branch, frodo has been updated
       via  429b2adadfa8bb4fea810d530ae409f8541b50c6 (commit)
      from  114909bc777c459bac5b65fa59b8cafa1fd437f8 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=429b2adadfa8bb4fea810d530ae409f8541b50c6

commit 429b2adadfa8bb4fea810d530ae409f8541b50c6
Author: beenje <[email protected]>
Date:   Sat Dec 21 15:48:20 2013 +0100

    [plugin.program.jdownloader] updated to version 1.3.1

diff --git a/plugin.program.jdownloader/addon.xml 
b/plugin.program.jdownloader/addon.xml
index 005a663..0ae9caf 100644
--- a/plugin.program.jdownloader/addon.xml
+++ b/plugin.program.jdownloader/addon.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="plugin.program.jdownloader"
        name="JDownloader"
-       version="1.3.0"
+       version="1.3.1"
        provider-name="pgoeri">
   <requires>
-    <import addon="xbmc.python" version="2.0"/>
+    <import addon="xbmc.python" version="2.1.0"/>
   </requires>
   <extension point="xbmc.python.pluginsource"
              library="default.py">
@@ -17,8 +17,14 @@
 It is also possible to update, restart and shutdown the JDownloader 
application.</description>
     <description lang="de">Dieses Plugin zeigt den aktuellen 
JDownloader-Status an. Die folgenden Aktionen werden unterstützt: Start, Stop, 
Pause, Speedlimit festlegen, max. gleichzeitige Downloads festlegen.
 Es ist weiters möglich die JDownloader Anwendung zu aktualisieren, neu zu 
starten oder zu schließen.</description>
+    <platform>all</platform>
+    <language></language>
+    <license>GNU GENERAL PUBLIC LICENSE. Version 3, 29 June 2007</license>
+    <forum>http://forum.xbmc.org/showthread.php?pid=600896</forum>
+    <website>http://pgoeri-xbmc-plugins.googlecode.com/</website>
+    
<source>http://pgoeri-xbmc-plugins.googlecode.com/svn/trunk/plugin.program.jdownloader/</source>
+    <email> pgoeri85 at gmail dot com</email>
     <disclaimer lang="en">Make sure to enable the 'Remote Control' extension 
(default port 10025) in JDownloader!</disclaimer>
     <disclaimer lang="de">Die 'Remote Control'-Erweiterung (Defaultport 10025) 
muss im JDownloader aktiviert sein!</disclaimer>
-    <platform>all</platform>
   </extension>
 </addon>
diff --git a/plugin.program.jdownloader/changelog.txt 
b/plugin.program.jdownloader/changelog.txt
index 7ca5ec2..d2385d2 100644
--- a/plugin.program.jdownloader/changelog.txt
+++ b/plugin.program.jdownloader/changelog.txt
@@ -1,4 +1,9 @@
-[B]Version 1.3.0[/B]
+[B]Version 1.3.1 - 20.12.2013[/B]
+    * bug - XBMC 12.2 FRODO: fixed broken dependence
+    * improvement - pkg_list: display "No Package!" if there are no packages 
at all
+    * improvement - general: point out that the JD application cannot be 
reached in case of connection problems. "server" was not clear
+
+[B]Version 1.3.0 - 18.06.2012[/B]
     * bug - jdnightly: fixed problems with nightly version of JDownloader
     * bug - pkg_list: fixed empty list in 'finished packages' sub menu
     * bug - add_links: fixed problem with automatic start of downloads: 'Start 
downloading after adding new links' feature did not work, when the dl list was 
completely empty
diff --git a/plugin.program.jdownloader/default.py 
b/plugin.program.jdownloader/default.py
index a6565ef..865cfb5 100644
--- a/plugin.program.jdownloader/default.py
+++ b/plugin.program.jdownloader/default.py
@@ -1,282 +1,285 @@
-# script constants

-__plugin__                     = "JDownloader"

-__addonID__                    = "plugin.program.jdownloader"

-__author__                     = "Ppic & pgoeri"

-__url__                                = 
"http://pgoeri-xbmc-plugins.googlecode.com";

-__svn_url__                    = 
"http://pgoeri-xbmc-plugins.googlecode.com/svn/trunk/plugin.program.jdownloader/";

-__credits__                    = "Team XBMC passion, http://passion-xbmc.org & 
pgoeri"

-__platform__           = "xbmc media center, [LINUX, OS X, WIN32]"

-__date__                       = "11-06-2012"

-__version__                    = "1.3.0"

-__XBMC_Revision__      = "11.0" # Eden

-__useragent__          = "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; 
rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"

-

-from traceback import print_exc

-import xbmc,xbmcplugin,xbmcgui,xbmcaddon

-import os,urllib,time

-

-__addon__              = xbmcaddon.Addon(__addonID__)

-__dialog__             = xbmcgui.Dialog()

-__language__   = __addon__.getLocalizedString

-__dbg__                        = __addon__.getSetting( "debug" ) == "true"

-__logprefix__  = "p.p.jd-"+__version__+": "

-

-# add lib directoy to sys path (in order to import the jdownloader python file)

-BASE_RESOURCE_PATH = os.path.join( __addon__.getAddonInfo('path'), "resources" 
)

-sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )

-

-import jdownloader

-

-

-# shows a more userfriendly notification

-def showMessage(heading, message):

-       xbmc.executebuiltin('XBMC.Notification("%s", "%s")' % ( heading, 
message, ) )

-       

-def showError(heading, message):

-       xbmc.executebuiltin('XBMC.Notification("%s", "%s", 1500, 
"DefaultIconError.png")' % ( heading, message, ) )

-

-def addDir(name,url,mode,iconimage, c_items = None ):

-       u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)

-       ok=True

-       liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", 
thumbnailImage=iconimage)

-       if c_items : liz.addContextMenuItems( c_items, replaceItems=True )

-       liz.setInfo( type="Video", infoLabels={ "Title": name } )

-       
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)

-

-def addLink(name,url,iconimage, c_items = None ):

-       ok=True

-       liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", 
thumbnailImage=iconimage)

-       if c_items : liz.addContextMenuItems( c_items, replaceItems=True )

-       liz.setInfo( type="Video", infoLabels={ "Title": name } )

-       
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)

-       return ok

-

-def end_of_directory( OK ): 

-       xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=OK )

-       

-def get_params():

-       param=[]

-       paramstring=sys.argv[2]

-       if len(paramstring)>=2:

-               params=sys.argv[2]

-               cleanedparams=params.replace('?','')

-               if (params[len(params)-1]=='/'):

-                       params=params[0:len(params)-2]

-               pairsofparams=cleanedparams.split('&')

-               param={}

-               for i in range(len(pairsofparams)):

-                       splitparams={}

-                       splitparams=pairsofparams[i].split('=')

-                       if (len(splitparams))==2:

-                               param[splitparams[0]]=splitparams[1]

-       return param

-       

-def get_filename( mode = 0):

-       if mode == 0:

-               # mode 0 --> TXT File

-               def_file_setting_id = "def_txt_file"

-               heading = __language__(30069)

-               mask = ".txt"

-       else:

-               # mode 1 --> DLC File

-               def_file_setting_id = "def_dlc_file"

-               heading = __language__(30070)

-               mask = ".dlc"

-       

-       # get settings

-       def_file_path = __addon__.getSetting("def_file_path")

-       def_file = __addon__.getSetting(def_file_setting_id)

-       

-       # try default file

-       if not def_file == "" and os.path.exists(def_file):

-               filename = def_file

-       else:

-               # show browse dialog

-               filename = __dialog__.browse( 1 , heading , "files", mask, 
False, False, def_file_path)

-               # verify selection

-               if not os.path.isfile(filename):

-                       filename = ""

-       return filename

-

-def item_is_finished(percent):

-       if (percent == "100,00" or percent == "100.00"):

-               return True

-       else:

-               return False

-       

-def force_view():

-       # change to list view if set in settings

-       if (__addon__.getSetting( "list_view" ) == "true"):

-               xbmc.executebuiltin("Container.SetViewMode(51)")

-

-def auto_refresh(status, force=False):

-       refresh = False

-       

-       if (force):

-               refresh = True

-               seconds = 3

-       elif (__addon__.getSetting( "auto_refresh" ) == "true" and status != 
jdownloader.STATE_NOTRUNNING):

-               refresh = True

-               seconds = int(__addon__.getSetting( "refresh_interval" ))

-               seconds = min(seconds,60)

-               seconds = max(seconds,1)

-       

-       if (refresh):

-               xbmc.executebuiltin('XBMC.AlarmClock(JDAutoRefresh, 
XBMC.RunPlugin(plugin://%s?mode=5&url=refresh), 00:00:%02d, true)' % 
(__addonID__, seconds ) )

-

-

-params=get_params()

-url=None

-mode=None

-

-try: url=urllib.unquote_plus(params["url"])

-except: pass

-

-try: mode=int(params["mode"])

-except: pass

-

-try: 

-       if "action" in params: mode=3

-except: pass

-

-if __dbg__:

-       print __logprefix__ + "MODE: " + str(mode) + " URL: " + str(url)

-

-#check connection (and get state only once)

-try:

-       status = jdownloader.get(jdownloader.GET_STATUS)

-except jdownloader.JDError, error:

-       (type, e, traceback) = sys.exc_info()

-       showError(xbmc.getLocalizedString(257), e.message)

-       mode=-1

-       url="error"

-

-#main menu:

-if mode==None or mode==0:

-       #status color

-       if jdownloader.STATE_NOTRUNNING in status:

-               status_display = status.replace( status , 
"[COLOR=FFFF0000]%s[/COLOR]" % ( status ))    # RED

-       elif jdownloader.STATE_RUNNING in status:

-               status_display = status.replace( status , 
"[COLOR=ff00FF00]%s[/COLOR]" % ( status ))    # GREEN

-       elif jdownloader.STATE_STOPPING in status:

-               status_display = status.replace( status , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( status ))    # YELLOW

-       else:

-               status_display = status

-       

-       #downloadspeed color (change color to YELLOW if speed limit is set)

-       downloadspeed = jdownloader.get(jdownloader.GET_SPEED)

-       speedlimit = jdownloader.get(jdownloader.GET_SPEEDLIMIT)

-       if not speedlimit == 0 and not speedlimit == "none":

-               downloadspeed = downloadspeed.replace( downloadspeed , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( downloadspeed ))

-       

-       #add the three main list entrys

-       addDir( __language__(30051) + ": %s - %s: %s KB/s - %s %s" % 
(status_display , __language__(30052) , downloadspeed, 
jdownloader.get(jdownloader.GET_CURRENTFILECNT), __language__(30053)) , 
"actions" , 2 , "" )

-       addDir( __language__(30050), "alllist" , 1 , "" )

-       addDir( __language__(30056), "finishedlist" , 1 , "" )

-       

-       force_view()

-       

-       end_of_directory( True )

-       

-       auto_refresh(status)

-       

-#list of packages

-if mode==1:

-       addDir( __language__(30058), "", None, "") # add dummy entry in first 
line, for prettier behavior on auto refresh

-       pkglist = jdownloader.get_pkglist(url)

-       for pkg in pkglist:

-               summary = pkg["percent"] + "%"

-               if (pkg["eta"] != "~"):

-                       summary += " - " + pkg["eta"]

-               summary += " | " + pkg["display"] + " | " + pkg["size"]

-               

-               #modify color (YELLOW = active downloading, GREEN = finished) 

-               if not pkg["eta"] == "~": summary = summary.replace( summary , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( summary )) # YELLOW

-               elif item_is_finished(pkg["percent"]): summary = 
summary.replace( summary , "[COLOR=ff00FF00]%s[/COLOR]" % ( summary )) # GREEN

-               

-               #only add finished packages in finishedlist

-               if (url == "finishedlist" and not 
item_is_finished(pkg["percent"])): continue

-                       

-               addDir( summary , pkg["name"] , 4, "" )

-       

-       force_view()

-               

-       end_of_directory( True )

-       

-       auto_refresh(status)

-

-#choose action

-if mode== 2:

-       xbmc.executebuiltin('XBMC.CancelAlarm(JDAutoRefresh, true)')

-       

-       actions = jdownloader.getAvailableActions(status)

-       actionlabels = []

-       for i in actions:

-               actionlabels.append(__language__(jdownloader.ALL_ACTIONS[i]))

-       select = __dialog__.select(__language__(30054) , actionlabels)

-       

-       if not select == -1: 

-               if actions[select] in 
[jdownloader.ACTION_SPEEDLIMIT,jdownloader.ACTION_MAXDOWNLOADS]:

-                       limit = __dialog__.numeric( 0 , __language__(30055) )

-                       result = jdownloader.action(actions[select],limit)

-               elif actions[select] == jdownloader.ACTION_JD_UPDATE:

-                       limit = __dialog__.yesno( "JDownloader" , 
__language__(30057) )

-                       result = jdownloader.action(actions[select],limit) 

-               elif actions[select] == jdownloader.ACTION_ADD_LINKS:

-                       filename = get_filename(0);

-                       if not filename == "":

-                               result = 
jdownloader.action_addlinks_from_file(filename)

-                       else:

-                               result = "No file selected"

-               elif actions[select] == jdownloader.ACTION_ADD_DLC:

-                       filename = get_filename(1);

-                       if not filename == "":

-                               result = 
jdownloader.action_addcontainer(filename)

-                       else:

-                               result = "No file selected"

-               else:

-                       result = jdownloader.action(actions[select])

-               

-               # correct result when changing reconnect setting

-               if actions[select] == jdownloader.ACTION_ENA_RECONNECT:

-                       result = 
result.replace("reconnect=false","reconnect=true")

-               elif actions[select] == jdownloader.ACTION_DIS_RECONNECT:

-                       result = 
result.replace("reconnect=true","reconnect=false")

-               

-               showMessage("JDownloader" , result )

-               

-               auto_refresh(status,True)

-

-#interface for other addons

-if mode==3:

-       if (params["action"] == "addlink"):

-               jdownloader.action_addlink(url)

-       if (params["action"] == "addlinklist"):

-               jdownloader.action_addlinklist(url)

-       if (params["action"] == "addcontainer"):

-               jdownloader.action_addcontainer(url)

-       if (params["action"] == "reconnect"):

-               jdownloader.action(jdownloader.ACTION_RECONNECT)

-

-#list of files per package

-if mode==4: 

-       addLink( __language__(30059),"","") # add dummy entry in first line, 
for prettier behavior on auto refresh

-       filelist = jdownloader.get_filelist(url)

-       for file in filelist:

-               summary = file["name"] + " | " + file["status"]

-               

-               #modify color (YELLOW = active downloading, GREEN = finished) 

-               if not file["speed"] == "0": summary = summary.replace( summary 
, "[COLOR=ffFFFF00]%s[/COLOR]" % ( summary )) # YELLOW

-               elif item_is_finished(file["percent"]): summary = 
summary.replace( summary , "[COLOR=ff00FF00]%s[/COLOR]" % ( summary )) # GREEN

-               

-               addLink( summary , "" , "" )

-       

-       force_view()

-               

-       end_of_directory( True )

-       

-       auto_refresh(status)

-

-#refresh

-if mode==5:

+# script constants
+__plugin__                     = "JDownloader"
+__addonID__                    = "plugin.program.jdownloader"
+__author__                     = "Ppic & pgoeri"
+__url__                                = 
"http://pgoeri-xbmc-plugins.googlecode.com";
+__svn_url__                    = 
"http://pgoeri-xbmc-plugins.googlecode.com/svn/trunk/plugin.program.jdownloader/";
+__credits__                    = "Team XBMC passion, http://passion-xbmc.org & 
pgoeri"
+__platform__           = "xbmc media center, [LINUX, OS X, WIN32]"
+__date__                       = "20-12-2013"
+__version__                    = "1.3.1"
+__XBMC_Revision__      = "12.2" # FRODO
+__useragent__          = "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; 
rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"
+
+from traceback import print_exc
+import xbmc,xbmcplugin,xbmcgui,xbmcaddon
+import os,urllib,time
+
+__addon__              = xbmcaddon.Addon(__addonID__)
+__dialog__             = xbmcgui.Dialog()
+__language__   = __addon__.getLocalizedString
+__dbg__                        = __addon__.getSetting( "debug" ) == "true"
+__logprefix__  = "p.p.jd-"+__version__+": "
+
+# add lib directoy to sys path (in order to import the jdownloader python file)
+BASE_RESOURCE_PATH = os.path.join( __addon__.getAddonInfo('path'), "resources" 
)
+sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
+
+import jdownloader
+
+
+# shows a more userfriendly notification
+def showMessage(heading, message):
+       xbmc.executebuiltin('XBMC.Notification("%s", "%s")' % ( heading, 
message, ) )
+       
+def showError(heading, message):
+       xbmc.executebuiltin('XBMC.Notification("%s", "%s", 1500, 
"DefaultIconError.png")' % ( heading, message, ) )
+
+def addDir(name,url,mode,iconimage, c_items = None ):
+       u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)
+       ok=True
+       liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png", 
thumbnailImage=iconimage)
+       if c_items : liz.addContextMenuItems( c_items, replaceItems=True )
+       liz.setInfo( type="Video", infoLabels={ "Title": name } )
+       
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
+
+def addLink(name,url,iconimage, c_items = None ):
+       ok=True
+       liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", 
thumbnailImage=iconimage)
+       if c_items : liz.addContextMenuItems( c_items, replaceItems=True )
+       liz.setInfo( type="Video", infoLabels={ "Title": name } )
+       
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
+       return ok
+
+def end_of_directory( OK ): 
+       xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=OK )
+       
+def get_params():
+       param=[]
+       paramstring=sys.argv[2]
+       if len(paramstring)>=2:
+               params=sys.argv[2]
+               cleanedparams=params.replace('?','')
+               if (params[len(params)-1]=='/'):
+                       params=params[0:len(params)-2]
+               pairsofparams=cleanedparams.split('&')
+               param={}
+               for i in range(len(pairsofparams)):
+                       splitparams={}
+                       splitparams=pairsofparams[i].split('=')
+                       if (len(splitparams))==2:
+                               param[splitparams[0]]=splitparams[1]
+       return param
+       
+def get_filename( mode = 0):
+       if mode == 0:
+               # mode 0 --> TXT File
+               def_file_setting_id = "def_txt_file"
+               heading = __language__(30069)
+               mask = ".txt"
+       else:
+               # mode 1 --> DLC File
+               def_file_setting_id = "def_dlc_file"
+               heading = __language__(30070)
+               mask = ".dlc"
+       
+       # get settings
+       def_file_path = __addon__.getSetting("def_file_path")
+       def_file = __addon__.getSetting(def_file_setting_id)
+       
+       # try default file
+       if not def_file == "" and os.path.exists(def_file):
+               filename = def_file
+       else:
+               # show browse dialog
+               filename = __dialog__.browse( 1 , heading , "files", mask, 
False, False, def_file_path)
+               # verify selection
+               if not os.path.isfile(filename):
+                       filename = ""
+       return filename
+
+def item_is_finished(percent):
+       if (percent == "100,00" or percent == "100.00"):
+               return True
+       else:
+               return False
+       
+def force_view():
+       # change to list view if set in settings
+       if (__addon__.getSetting( "list_view" ) == "true"):
+               xbmc.executebuiltin("Container.SetViewMode(51)")
+
+def auto_refresh(status, force=False):
+       refresh = False
+       
+       if (force):
+               refresh = True
+               seconds = 3
+       elif (__addon__.getSetting( "auto_refresh" ) == "true" and status != 
jdownloader.STATE_NOTRUNNING):
+               refresh = True
+               seconds = int(__addon__.getSetting( "refresh_interval" ))
+               seconds = min(seconds,60)
+               seconds = max(seconds,1)
+       
+       if (refresh):
+               xbmc.executebuiltin('XBMC.AlarmClock(JDAutoRefresh, 
XBMC.RunPlugin(plugin://%s?mode=5&url=refresh), 00:00:%02d, true)' % 
(__addonID__, seconds ) )
+
+
+params=get_params()
+url=None
+mode=None
+
+try: url=urllib.unquote_plus(params["url"])
+except: pass
+
+try: mode=int(params["mode"])
+except: pass
+
+try: 
+       if "action" in params: mode=3
+except: pass
+
+if __dbg__:
+       print __logprefix__ + "MODE: " + str(mode) + " URL: " + str(url)
+
+#check connection (and get state only once)
+try:
+       status = jdownloader.get(jdownloader.GET_STATUS)
+except jdownloader.JDError, error:
+       (type, e, traceback) = sys.exc_info()
+       showError(xbmc.getLocalizedString(257), e.message)
+       mode=-1
+       url="error"
+
+#main menu:
+if mode==None or mode==0:
+       #status color
+       if jdownloader.STATE_NOTRUNNING in status:
+               status_display = status.replace( status , 
"[COLOR=FFFF0000]%s[/COLOR]" % ( status ))    # RED
+       elif jdownloader.STATE_RUNNING in status:
+               status_display = status.replace( status , 
"[COLOR=ff00FF00]%s[/COLOR]" % ( status ))    # GREEN
+       elif jdownloader.STATE_STOPPING in status:
+               status_display = status.replace( status , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( status ))    # YELLOW
+       else:
+               status_display = status
+       
+       #downloadspeed color (change color to YELLOW if speed limit is set)
+       downloadspeed = jdownloader.get(jdownloader.GET_SPEED)
+       speedlimit = jdownloader.get(jdownloader.GET_SPEEDLIMIT)
+       if not speedlimit == 0 and not speedlimit == "none":
+               downloadspeed = downloadspeed.replace( downloadspeed , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( downloadspeed ))
+       
+       #add the three main list entrys
+       addDir( __language__(30051) + ": %s - %s: %s KB/s - %s %s" % 
(status_display , __language__(30052) , downloadspeed, 
jdownloader.get(jdownloader.GET_CURRENTFILECNT), __language__(30053)) , 
"actions" , 2 , "" )
+       addDir( __language__(30050), "alllist" , 1 , "" )
+       addDir( __language__(30056), "finishedlist" , 1 , "" )
+       
+       force_view()
+       
+       end_of_directory( True )
+       
+       auto_refresh(status)
+       
+#list of packages
+if mode==1:
+       pkglist = jdownloader.get_pkglist(url)
+       if len(pkglist)==0:
+               addDir( __language__(30080), "", None, "")
+       else:
+               addDir( __language__(30058), "", None, "") # add dummy entry in 
first line, for prettier behavior on auto refresh
+       for pkg in pkglist:
+               summary = pkg["percent"] + "%"
+               if (pkg["eta"] != "~"):
+                       summary += " - " + pkg["eta"]
+               summary += " | " + pkg["display"] + " | " + pkg["size"]
+               
+               #modify color (YELLOW = active downloading, GREEN = finished) 
+               if not pkg["eta"] == "~": summary = summary.replace( summary , 
"[COLOR=ffFFFF00]%s[/COLOR]" % ( summary )) # YELLOW
+               elif item_is_finished(pkg["percent"]): summary = 
summary.replace( summary , "[COLOR=ff00FF00]%s[/COLOR]" % ( summary )) # GREEN
+               
+               #only add finished packages in finishedlist
+               if (url == "finishedlist" and not 
item_is_finished(pkg["percent"])): continue
+                       
+               addDir( summary , pkg["name"] , 4, "" )
+       
+       force_view()
+               
+       end_of_directory( True )
+       
+       auto_refresh(status)
+
+#choose action
+if mode== 2:
+       xbmc.executebuiltin('XBMC.CancelAlarm(JDAutoRefresh, true)')
+       
+       actions = jdownloader.getAvailableActions(status)
+       actionlabels = []
+       for i in actions:
+               actionlabels.append(__language__(jdownloader.ALL_ACTIONS[i]))
+       select = __dialog__.select(__language__(30054) , actionlabels)
+       
+       if not select == -1: 
+               if actions[select] in 
[jdownloader.ACTION_SPEEDLIMIT,jdownloader.ACTION_MAXDOWNLOADS]:
+                       limit = __dialog__.numeric( 0 , __language__(30055) )
+                       result = jdownloader.action(actions[select],limit)
+               elif actions[select] == jdownloader.ACTION_JD_UPDATE:
+                       limit = __dialog__.yesno( "JDownloader" , 
__language__(30057) )
+                       result = jdownloader.action(actions[select],limit) 
+               elif actions[select] == jdownloader.ACTION_ADD_LINKS:
+                       filename = get_filename(0);
+                       if not filename == "":
+                               result = 
jdownloader.action_addlinks_from_file(filename)
+                       else:
+                               result = "No file selected"
+               elif actions[select] == jdownloader.ACTION_ADD_DLC:
+                       filename = get_filename(1);
+                       if not filename == "":
+                               result = 
jdownloader.action_addcontainer(filename)
+                       else:
+                               result = "No file selected"
+               else:
+                       result = jdownloader.action(actions[select])
+               
+               # correct result when changing reconnect setting
+               if actions[select] == jdownloader.ACTION_ENA_RECONNECT:
+                       result = 
result.replace("reconnect=false","reconnect=true")
+               elif actions[select] == jdownloader.ACTION_DIS_RECONNECT:
+                       result = 
result.replace("reconnect=true","reconnect=false")
+               
+               showMessage("JDownloader" , result )
+               
+               auto_refresh(status,True)
+
+#interface for other addons
+if mode==3:
+       if (params["action"] == "addlink"):
+               jdownloader.action_addlink(url)
+       if (params["action"] == "addlinklist"):
+               jdownloader.action_addlinklist(url)
+       if (params["action"] == "addcontainer"):
+               jdownloader.action_addcontainer(url)
+       if (params["action"] == "reconnect"):
+               jdownloader.action(jdownloader.ACTION_RECONNECT)
+
+#list of files per package
+if mode==4:
+       addLink( __language__(30059),"","") # add dummy entry in first line, 
for prettier behavior on auto refresh
+       filelist = jdownloader.get_filelist(url)
+       for file in filelist:
+               summary = file["name"] + " | " + file["status"]
+               
+               #modify color (YELLOW = active downloading, GREEN = finished) 
+               if not file["speed"] == "0": summary = summary.replace( summary 
, "[COLOR=ffFFFF00]%s[/COLOR]" % ( summary )) # YELLOW
+               elif item_is_finished(file["percent"]): summary = 
summary.replace( summary , "[COLOR=ff00FF00]%s[/COLOR]" % ( summary )) # GREEN
+               
+               addLink( summary , "" , "" )
+       
+       force_view()
+               
+       end_of_directory( True )
+       
+       auto_refresh(status)
+
+#refresh
+if mode==5:
        xbmc.executebuiltin("XBMC.Container.Refresh") 
\ No newline at end of file
diff --git a/plugin.program.jdownloader/resources/language/English/strings.xml 
b/plugin.program.jdownloader/resources/language/English/strings.xml
index 58684f9..86383b7 100644
--- a/plugin.program.jdownloader/resources/language/English/strings.xml
+++ b/plugin.program.jdownloader/resources/language/English/strings.xml
@@ -54,4 +54,6 @@
   <string id="30073">Disable 'reconnect'</string>

   <string id="30074">Enable 'premium'</string>

   <string id="30075">Disable 'premium'</string>

+  

+  <string id="30080">No Packages!</string>

 </strings>
\ No newline at end of file
diff --git a/plugin.program.jdownloader/resources/language/German/strings.xml 
b/plugin.program.jdownloader/resources/language/German/strings.xml
index e581f42..d89b88a 100644
--- a/plugin.program.jdownloader/resources/language/German/strings.xml
+++ b/plugin.program.jdownloader/resources/language/German/strings.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>

+<?xml version="1.0" encoding="utf-8" standalone="yes"?>

 <strings>

   <!-- strings 32000 thru 32999 reserved for scripts -->

   <!--SETTINGS STRINGS -->

diff --git a/plugin.program.jdownloader/resources/lib/jdownloader.py 
b/plugin.program.jdownloader/resources/lib/jdownloader.py
index 6d67066..472e9f5 100644
--- a/plugin.program.jdownloader/resources/lib/jdownloader.py
+++ b/plugin.program.jdownloader/resources/lib/jdownloader.py
@@ -1,370 +1,370 @@
-import socket,urllib,urllib2,httplib,os

-from xml.dom import minidom

-from traceback import print_exc

-import xbmc,xbmcaddon

-import sys,time

-

-__addon__                      = sys.modules[ "__main__" ].__addon__

-__dbg__                                = sys.modules[ "__main__" ].__dbg__

-__logprefix__          = sys.modules[ "__main__" ].__logprefix__

-

-#defines

-GET_SPEED                      = "downloadspeed"

-GET_SPEEDLIMIT         = "speedlimit"

-GET_ISRECONNECT                = "isreconnect"

-GET_STATUS                     = "status"

-GET_CURRENTFILECNT     = "currentfilecount"

-

-STATE_RUNNING          = "RUNNING"

-STATE_NOTRUNNING       = "NOT_RUNNING"

-STATE_STOPPING         = "STOPPING"

-

-ACTION_START                   = "01 start"

-ACTION_STOP                            = "02 stop"

-ACTION_PAUSE                   = "03 pause"

-ACTION_TOGGLE                  = "04 toggle"

-

-ACTION_SPEEDLIMIT              = "05 speed limit"

-ACTION_MAXDOWNLOADS            = "06 max downloads"

-

-ACTION_ADD_LINKS               = "07 add links"

-ACTION_ADD_DLC                 = "08 add dlc"

-

-ACTION_RECONNECT               = "10 reconnect"

-

-ACTION_ENA_RECONNECT   = "11 enable reconnect"

-ACTION_DIS_RECONNECT   = "12 set reconnect"

-ACTION_ENA_PREMIUM             = "13 enable premium"

-ACTION_DIS_PREMIUM             = "14 disable premium"

-

-ACTION_JD_UPDATE               = "20 update JDownloader"

-ACTION_JD_RESTART              = "21 restart JDownloader"

-ACTION_JD_SHUTDOWN             = "22 shutdown JDownloader"

-

-ALL_ACTIONS = {

-       ACTION_START:                   30060,

-       ACTION_STOP:                    30061,

-       ACTION_PAUSE:                   30062,

-       ACTION_TOGGLE:                  30063,

-       ACTION_SPEEDLIMIT:              30064,

-       ACTION_MAXDOWNLOADS:    30065,

-       ACTION_ADD_LINKS:               30069,

-       ACTION_ADD_DLC:                 30070,

-       ACTION_RECONNECT:               30071,

-       ACTION_ENA_RECONNECT:   30072,

-       ACTION_DIS_RECONNECT:   30073,

-       ACTION_ENA_PREMIUM:             30074,

-       ACTION_DIS_PREMIUM:             30075,

-       ACTION_JD_UPDATE:               30066,

-       ACTION_JD_RESTART:              30067,

-       ACTION_JD_SHUTDOWN:             30068

-}

-

-

-class JDError(Exception):

-        def __init__(self, message='', original=None):

-                 Exception.__init__(self, message)

-                 self.message = message

-                 self.original = original

-

-        def __str__(self):

-                 if self.original:

-                       original_name = type(self.original).__name__

-                       return '%s Original exception: %s, "%s"' % 
(self.message, original_name, self.original.args)

-                 else:

-                       return self.message

-

-def _http_query_with_urlprefix(query,urlPrefix):

-       request = urlPrefix+query

-       if __dbg__:

-               print __logprefix__ + "httpQuery: " + repr(request)

-       request_count = 0

-       while True:

-               error_data = ""

-               try:

-                       try:

-                               socket.setdefaulttimeout(10)

-                               response = urllib2.urlopen(request)

-                               break

-                       except urllib2.URLError, error:

-                               raise JDError('Failed to connect to server.')

-                       except httplib.BadStatusLine, error:

-                               if (request_count > 1):

-                                       raise JDError('Failed to request %s 
"%s".' % (self.url, query))

-               finally:

-                       if error_data:

-                               self._debug_response(error, error_data)

-               request_count = request_count + 1

-       result = response.read()

-       response.close()

-       return result

-

-

-def _get_urlprefix(setting_suffix):

-       # load settings

-       ip_adress = str(__addon__.getSetting("ip_adress"+setting_suffix))

-       ip_port = str(__addon__.getSetting("ip_port"+setting_suffix))

-       use_hostname = __addon__.getSetting("use_hostname"+setting_suffix) == 
"true"

-       hostname = str(__addon__.getSetting("hostname"+setting_suffix))

-       

-       if (use_hostname):

-               urlPrefix = 'http://' + hostname + ':' + ip_port

-       else:

-               urlPrefix = 'http://' + ip_adress + ':' + ip_port

-       

-       return urlPrefix

-

-def _http_query(query):

-       try:

-               result = _http_query_with_urlprefix(query, _get_urlprefix(""))

-       except JDError, error:

-               use_conn2 = __addon__.getSetting("use_conn2") == "true"

-               if (use_conn2):

-                       result = _http_query_with_urlprefix(query, 
_get_urlprefix("2"))

-               else:

-                       raise error

-       return result

-

-# determine the current remote control api version (nightly or stable)

-nightly = False

-try:

-       if (int(_http_query("/get/rcversion")) > 9568 ):

-               nightly = True

-except: pass

-

-# Get Info #

-

-def load_pkglist(which):

-       if (nightly):

-               if (which == "finishedlist"):

-                       getStr = "finished/list"

-               else:

-                       getStr = "all/list"

-       else:

-               getStr = which

-       

-       result = _http_query('/get/downloads/%s' % getStr)

-       

-       return result

-

-def get_pkglist(which):

-       pkgxml = load_pkglist(which)

-       

-       xmldoc = minidom.parseString(pkgxml)

-       if (nightly):

-               itemlist = xmldoc.getElementsByTagName('packages')

-       else:

-               itemlist = xmldoc.getElementsByTagName('package')

-       pkglist = []

-       for item in itemlist :

-               package = {}

-               package["name"] = item.attributes['package_name'].value

-               package["eta"] = item.attributes['package_ETA'].value

-               package["size"] = item.attributes['package_size'].value

-               package["percent"] = item.attributes['package_percent'].value

-                       

-               # HACK: try to improve packagename

-               package["display"] = package["name"]

-               if (package["name"].startswith("Added ")):

-                       files = item.getElementsByTagName('file')

-                       if (len(files)>0):

-                               filename = 
files[0].attributes['file_name'].value

-                               if (".part" in filename):

-                                       package["display"] = 
filename.split(".part")[0]

-                               else:

-                                       package["display"] = filename

-                       

-               pkglist.append(package)

-       return pkglist

-

-def get_filelist(which):

-       pkgxml = load_pkglist("alllist")

-       

-       xmldoc = minidom.parseString(pkgxml)

-       if (nightly):

-               packages = xmldoc.getElementsByTagName('packages')

-       else:

-               packages = xmldoc.getElementsByTagName('package')

-       filelist = []

-       for pkgitem in packages:

-               if (pkgitem.attributes['package_name'].value == which):

-                       files = pkgitem.getElementsByTagName('file')

-                       for fileitem in files:

-                               file = {}

-                               file["name"] =          
fileitem.attributes['file_name'].value

-                               file["percent"] =       
fileitem.attributes['file_percent'].value

-                               file["speed"] =         
fileitem.attributes['file_speed'].value

-                               file["status"] =        
fileitem.attributes['file_status'].value

-                               filelist.append(file)

-       return filelist

-

-def get(x):

-       if x == GET_SPEED:

-               getStr = '/get/speed'

-       if x == GET_SPEEDLIMIT:

-               getStr = '/get/speedlimit'

-       if x == GET_ISRECONNECT:

-               getStr = '/get/isreconnect'

-       if x == GET_STATUS:

-               getStr = '/get/downloadstatus'

-       if x == GET_CURRENTFILECNT:

-               if (nightly):

-                       getStr = '/get/downloads/current/count'

-               else:

-                       getStr = '/get/downloads/currentcount'

-       

-       result = _http_query(getStr)

-       if result.startswith("0"): result = 'none'

-       return result

-

-# Actions #

-def getAvailableActions(status):

-       actions = ALL_ACTIONS.keys();

-       

-       actions.sort();

-       

-       if STATE_NOTRUNNING in status: 

-               for i in 
[ACTION_STOP,ACTION_PAUSE,ACTION_SPEEDLIMIT,ACTION_MAXDOWNLOADS]:

-                       actions.remove(i)

-       elif STATE_RUNNING in status:

-               actions.remove(ACTION_START)

-       elif STATE_STOPPING in status: # no status changes possible 

-               for i in 
[ACTION_START,ACTION_STOP,ACTION_PAUSE,ACTION_TOGGLE,ACTION_SPEEDLIMIT,ACTION_MAXDOWNLOADS]:

-                       actions.remove(i)

-                       

-       # handle reconnect action

-       if get(GET_ISRECONNECT) == "true":

-               actions.remove(ACTION_ENA_RECONNECT)

-       else:

-               actions.remove(ACTION_DIS_RECONNECT)

-       

-       return actions

-

-def action( x , limit = "0" ):

-       if x == ACTION_START:

-               actionStr = '/action/start'

-       if x == ACTION_STOP:

-               actionStr = '/action/stop'

-       if x == ACTION_PAUSE:

-               actionStr = '/action/pause'

-       if x == ACTION_TOGGLE:

-               actionStr = '/action/toggle'

-       if x == ACTION_RECONNECT:

-               actionStr = '/action/reconnect'

-       if (nightly):

-               if x == ACTION_SPEEDLIMIT:

-                       actionStr = '/set/download/limit/' + str(limit)

-               if x == ACTION_MAXDOWNLOADS:

-                       actionStr = '/set/download/max/' + str(limit)

-               if x == ACTION_ENA_RECONNECT:

-                       actionStr = '/set/reconnect/true'

-               if x == ACTION_DIS_RECONNECT:

-                       actionStr = '/set/reconnect/false' 

-               if x == ACTION_ENA_PREMIUM:

-                       actionStr = '/set/premium/true'

-               if x == ACTION_DIS_PREMIUM:

-                       actionStr = '/set/premium/false'

-               if x == ACTION_JD_UPDATE:

-                       if (limit==1):

-                               actionStr = '/action/forceupdate'

-                       else:

-                               actionStr = '/action/update'

-       else:

-               if x == ACTION_SPEEDLIMIT:

-                       actionStr = '/action/set/download/limit/' + str(limit)

-               if x == ACTION_MAXDOWNLOADS:

-                       actionStr = '/action/set/download/max/' + str(limit)

-               if x == ACTION_ENA_RECONNECT:

-                       actionStr = '/action/set/reconnectenabled/false' # 
interface is wrong, expects the opposite values

-               if x == ACTION_DIS_RECONNECT:

-                       actionStr = '/action/set/reconnectenabled/true' # 
interface is wrong, expects the opposite values

-               if x == ACTION_ENA_PREMIUM:

-                       actionStr = '/action/set/premiumenabled/true'

-               if x == ACTION_DIS_PREMIUM:

-                       actionStr = '/action/set/premiumenabled/false'

-               if x == ACTION_JD_UPDATE:

-                       actionStr = '/action/update/force%s/' % str(limit)

-                       

-       if x == ACTION_JD_RESTART:

-               actionStr = '/action/restart'

-       if x == ACTION_JD_SHUTDOWN:

-               actionStr = '/action/shutdown'

-

-       result = _http_query(actionStr)

-       

-       return result

-

-def action_addcontainer(link):

-       # get settings

-       grabber = __addon__.getSetting("add_use_grabber")

-       start = __addon__.getSetting("add_start")

-       # add link

-       # Parameter 'start' is not supported with rc-version 9568!

-       #_http_query('/action/add/container/grabber' + str(grabber) + '/start' 
+ str(start) + '/' + str(link))

-       result = _http_query('/action/add/container/grabber' + str(grabber) + 
'/' + str(link))

-       

-       force_start()

-       

-       return result

-

-# Links separated by spaces, won't work, call this functions for each link 
separately

-def action_addlink(link):

-       # get settings

-       grabber = __addon__.getSetting("add_use_grabber")

-       start = __addon__.getSetting("add_start")

-       # prepare link - quote special chars, e.g '?'

-       link = urllib.quote(link)

-       # restore double point (won't work atm)

-       link = link.replace( '%3A', ':' )

-       # add link

-       result = _http_query('/action/add/links/grabber' + str(grabber) + 
'/start' + str(start) + '/' + str(link))

-       

-       force_start()

-       

-       return result

-

-# Links separated by spaces, won't work, but as parameters 
(&l1=<link1>&l2=<link2>&...) it works (in r9568)

-# expects multiple links separated by '|'

-def action_addlinklist(linklist):

-       # get settings

-       grabber = __addon__.getSetting("add_use_grabber")

-       start = __addon__.getSetting("add_start")

-       

-       links = ""

-       first = True

-       idx=0

-       for link in linklist.split(" "):

-               # prepare link - quote special chars, e.g '?'

-               link = urllib.quote(link)

-               # restore double point (won't work atm)

-               link = link.replace( '%3A', ':' )

-               # add link

-               if (first):

-                       links = "?l"

-                       first = False

-               else:

-                       links += "&l"

-               links += str(idx) + "=" + link

-               idx += 1

-       

-       result = _http_query('/action/add/links/grabber' + str(grabber) + 
'/start' + str(start) + '/' + str(links))

-       

-       force_start()

-       

-       return result

-

-def action_addlinks_from_file(filename):

-       txt_file = open(filename,'r')

-       lines= txt_file.readlines()

-       

-       for line in lines:

-               action_addlink(line)

-       return "%d link(s) added" % (len(lines), )

-

-# HACK: fixes problem, that jd already stopped again before the links are 
added to the dl list (decrypting takes a few seconds) 

-def force_start():

-       if (__addon__.getSetting("add_start") == "1"):

-               now = time.time();

-               while ((get(GET_STATUS) != STATE_RUNNING or get(GET_SPEED) == 
"none") and now + 20.0 > time.time()): # try for a maximum of 20 seconds to 
start jd

-                       action(ACTION_START)

+import socket,urllib,urllib2,httplib,os
+from xml.dom import minidom
+from traceback import print_exc
+import xbmc,xbmcaddon
+import sys,time
+
+__addon__                      = sys.modules[ "__main__" ].__addon__
+__dbg__                                = sys.modules[ "__main__" ].__dbg__
+__logprefix__          = sys.modules[ "__main__" ].__logprefix__
+
+#defines
+GET_SPEED                      = "downloadspeed"
+GET_SPEEDLIMIT         = "speedlimit"
+GET_ISRECONNECT                = "isreconnect"
+GET_STATUS                     = "status"
+GET_CURRENTFILECNT     = "currentfilecount"
+
+STATE_RUNNING          = "RUNNING"
+STATE_NOTRUNNING       = "NOT_RUNNING"
+STATE_STOPPING         = "STOPPING"
+
+ACTION_START                   = "01 start"
+ACTION_STOP                            = "02 stop"
+ACTION_PAUSE                   = "03 pause"
+ACTION_TOGGLE                  = "04 toggle"
+
+ACTION_SPEEDLIMIT              = "05 speed limit"
+ACTION_MAXDOWNLOADS            = "06 max downloads"
+
+ACTION_ADD_LINKS               = "07 add links"
+ACTION_ADD_DLC                 = "08 add dlc"
+
+ACTION_RECONNECT               = "10 reconnect"
+
+ACTION_ENA_RECONNECT   = "11 enable reconnect"
+ACTION_DIS_RECONNECT   = "12 set reconnect"
+ACTION_ENA_PREMIUM             = "13 enable premium"
+ACTION_DIS_PREMIUM             = "14 disable premium"
+
+ACTION_JD_UPDATE               = "20 update JDownloader"
+ACTION_JD_RESTART              = "21 restart JDownloader"
+ACTION_JD_SHUTDOWN             = "22 shutdown JDownloader"
+
+ALL_ACTIONS = {
+       ACTION_START:                   30060,
+       ACTION_STOP:                    30061,
+       ACTION_PAUSE:                   30062,
+       ACTION_TOGGLE:                  30063,
+       ACTION_SPEEDLIMIT:              30064,
+       ACTION_MAXDOWNLOADS:    30065,
+       ACTION_ADD_LINKS:               30069,
+       ACTION_ADD_DLC:                 30070,
+       ACTION_RECONNECT:               30071,
+       ACTION_ENA_RECONNECT:   30072,
+       ACTION_DIS_RECONNECT:   30073,
+       ACTION_ENA_PREMIUM:             30074,
+       ACTION_DIS_PREMIUM:             30075,
+       ACTION_JD_UPDATE:               30066,
+       ACTION_JD_RESTART:              30067,
+       ACTION_JD_SHUTDOWN:             30068
+}
+
+
+class JDError(Exception):
+        def __init__(self, message='', original=None):
+                 Exception.__init__(self, message)
+                 self.message = message
+                 self.original = original
+
+        def __str__(self):
+                 if self.original:
+                       original_name = type(self.original).__name__
+                       return '%s Original exception: %s, "%s"' % 
(self.message, original_name, self.original.args)
+                 else:
+                       return self.message
+
+def _http_query_with_urlprefix(query,urlPrefix):
+       request = urlPrefix+query
+       if __dbg__:
+               print __logprefix__ + "httpQuery: " + repr(request)
+       request_count = 0
+       while True:
+               error_data = ""
+               try:
+                       try:
+                               socket.setdefaulttimeout(10)
+                               response = urllib2.urlopen(request)
+                               break
+                       except urllib2.URLError, error:
+                               raise JDError('Failed to connect to server 
(=JDownloader application).')
+                       except httplib.BadStatusLine, error:
+                               if (request_count > 1):
+                                       raise JDError('Failed to request %s 
"%s".' % (self.url, query))
+               finally:
+                       if error_data:
+                               self._debug_response(error, error_data)
+               request_count = request_count + 1
+       result = response.read()
+       response.close()
+       return result
+
+
+def _get_urlprefix(setting_suffix):
+       # load settings
+       ip_adress = str(__addon__.getSetting("ip_adress"+setting_suffix))
+       ip_port = str(__addon__.getSetting("ip_port"+setting_suffix))
+       use_hostname = __addon__.getSetting("use_hostname"+setting_suffix) == 
"true"
+       hostname = str(__addon__.getSetting("hostname"+setting_suffix))
+       
+       if (use_hostname):
+               urlPrefix = 'http://' + hostname + ':' + ip_port
+       else:
+               urlPrefix = 'http://' + ip_adress + ':' + ip_port
+       
+       return urlPrefix
+
+def _http_query(query):
+       try:
+               result = _http_query_with_urlprefix(query, _get_urlprefix(""))
+       except JDError, error:
+               use_conn2 = __addon__.getSetting("use_conn2") == "true"
+               if (use_conn2):
+                       result = _http_query_with_urlprefix(query, 
_get_urlprefix("2"))
+               else:
+                       raise error
+       return result
+
+# determine the current remote control api version (nightly or stable)
+nightly = False
+try:
+       if (int(_http_query("/get/rcversion")) > 9568 ):
+               nightly = True
+except: pass
+
+# Get Info #
+
+def load_pkglist(which):
+       if (nightly):
+               if (which == "finishedlist"):
+                       getStr = "finished/list"
+               else:
+                       getStr = "all/list"
+       else:
+               getStr = which
+       
+       result = _http_query('/get/downloads/%s' % getStr)
+       
+       return result
+
+def get_pkglist(which):
+       pkgxml = load_pkglist(which)
+       
+       xmldoc = minidom.parseString(pkgxml)
+       if (nightly):
+               itemlist = xmldoc.getElementsByTagName('packages')
+       else:
+               itemlist = xmldoc.getElementsByTagName('package')
+       pkglist = []
+       for item in itemlist :
+               package = {}
+               package["name"] = item.attributes['package_name'].value
+               package["eta"] = item.attributes['package_ETA'].value
+               package["size"] = item.attributes['package_size'].value
+               package["percent"] = item.attributes['package_percent'].value
+                       
+               # HACK: try to improve packagename
+               package["display"] = package["name"]
+               if (package["name"].startswith("Added ")):
+                       files = item.getElementsByTagName('file')
+                       if (len(files)>0):
+                               filename = 
files[0].attributes['file_name'].value
+                               if (".part" in filename):
+                                       package["display"] = 
filename.split(".part")[0]
+                               else:
+                                       package["display"] = filename
+                       
+               pkglist.append(package)
+       return pkglist
+
+def get_filelist(which):
+       pkgxml = load_pkglist("alllist")
+       
+       xmldoc = minidom.parseString(pkgxml)
+       if (nightly):
+               packages = xmldoc.getElementsByTagName('packages')
+       else:
+               packages = xmldoc.getElementsByTagName('package')
+       filelist = []
+       for pkgitem in packages:
+               if (pkgitem.attributes['package_name'].value == which):
+                       files = pkgitem.getElementsByTagName('file')
+                       for fileitem in files:
+                               file = {}
+                               file["name"] =          
fileitem.attributes['file_name'].value
+                               file["percent"] =       
fileitem.attributes['file_percent'].value
+                               file["speed"] =         
fileitem.attributes['file_speed'].value
+                               file["status"] =        
fileitem.attributes['file_status'].value
+                               filelist.append(file)
+       return filelist
+
+def get(x):
+       if x == GET_SPEED:
+               getStr = '/get/speed'
+       if x == GET_SPEEDLIMIT:
+               getStr = '/get/speedlimit'
+       if x == GET_ISRECONNECT:
+               getStr = '/get/isreconnect'
+       if x == GET_STATUS:
+               getStr = '/get/downloadstatus'
+       if x == GET_CURRENTFILECNT:
+               if (nightly):
+                       getStr = '/get/downloads/current/count'
+               else:
+                       getStr = '/get/downloads/currentcount'
+       
+       result = _http_query(getStr)
+       if result.startswith("0"): result = 'none'
+       return result
+
+# Actions #
+def getAvailableActions(status):
+       actions = ALL_ACTIONS.keys();
+       
+       actions.sort();
+       
+       if STATE_NOTRUNNING in status: 
+               for i in 
[ACTION_STOP,ACTION_PAUSE,ACTION_SPEEDLIMIT,ACTION_MAXDOWNLOADS]:
+                       actions.remove(i)
+       elif STATE_RUNNING in status:
+               actions.remove(ACTION_START)
+       elif STATE_STOPPING in status: # no status changes possible 
+               for i in 
[ACTION_START,ACTION_STOP,ACTION_PAUSE,ACTION_TOGGLE,ACTION_SPEEDLIMIT,ACTION_MAXDOWNLOADS]:
+                       actions.remove(i)
+                       
+       # handle reconnect action
+       if get(GET_ISRECONNECT) == "true":
+               actions.remove(ACTION_ENA_RECONNECT)
+       else:
+               actions.remove(ACTION_DIS_RECONNECT)
+       
+       return actions
+
+def action( x , limit = "0" ):
+       if x == ACTION_START:
+               actionStr = '/action/start'
+       if x == ACTION_STOP:
+               actionStr = '/action/stop'
+       if x == ACTION_PAUSE:
+               actionStr = '/action/pause'
+       if x == ACTION_TOGGLE:
+               actionStr = '/action/toggle'
+       if x == ACTION_RECONNECT:
+               actionStr = '/action/reconnect'
+       if (nightly):
+               if x == ACTION_SPEEDLIMIT:
+                       actionStr = '/set/download/limit/' + str(limit)
+               if x == ACTION_MAXDOWNLOADS:
+                       actionStr = '/set/download/max/' + str(limit)
+               if x == ACTION_ENA_RECONNECT:
+                       actionStr = '/set/reconnect/true'
+               if x == ACTION_DIS_RECONNECT:
+                       actionStr = '/set/reconnect/false' 
+               if x == ACTION_ENA_PREMIUM:
+                       actionStr = '/set/premium/true'
+               if x == ACTION_DIS_PREMIUM:
+                       actionStr = '/set/premium/false'
+               if x == ACTION_JD_UPDATE:
+                       if (limit==1):
+                               actionStr = '/action/forceupdate'
+                       else:
+                               actionStr = '/action/update'
+       else:
+               if x == ACTION_SPEEDLIMIT:
+                       actionStr = '/action/set/download/limit/' + str(limit)
+               if x == ACTION_MAXDOWNLOADS:
+                       actionStr = '/action/set/download/max/' + str(limit)
+               if x == ACTION_ENA_RECONNECT:
+                       actionStr = '/action/set/reconnectenabled/false' # 
interface is wrong, expects the opposite values
+               if x == ACTION_DIS_RECONNECT:
+                       actionStr = '/action/set/reconnectenabled/true' # 
interface is wrong, expects the opposite values
+               if x == ACTION_ENA_PREMIUM:
+                       actionStr = '/action/set/premiumenabled/true'
+               if x == ACTION_DIS_PREMIUM:
+                       actionStr = '/action/set/premiumenabled/false'
+               if x == ACTION_JD_UPDATE:
+                       actionStr = '/action/update/force%s/' % str(limit)
+                       
+       if x == ACTION_JD_RESTART:
+               actionStr = '/action/restart'
+       if x == ACTION_JD_SHUTDOWN:
+               actionStr = '/action/shutdown'
+
+       result = _http_query(actionStr)
+       
+       return result
+
+def action_addcontainer(link):
+       # get settings
+       grabber = __addon__.getSetting("add_use_grabber")
+       start = __addon__.getSetting("add_start")
+       # add link
+       # Parameter 'start' is not supported with rc-version 9568!
+       #_http_query('/action/add/container/grabber' + str(grabber) + '/start' 
+ str(start) + '/' + str(link))
+       result = _http_query('/action/add/container/grabber' + str(grabber) + 
'/' + str(link))
+       
+       force_start()
+       
+       return result
+
+# Links separated by spaces, won't work, call this functions for each link 
separately
+def action_addlink(link):
+       # get settings
+       grabber = __addon__.getSetting("add_use_grabber")
+       start = __addon__.getSetting("add_start")
+       # prepare link - quote special chars, e.g '?'
+       link = urllib.quote(link)
+       # restore double point (won't work atm)
+       link = link.replace( '%3A', ':' )
+       # add link
+       result = _http_query('/action/add/links/grabber' + str(grabber) + 
'/start' + str(start) + '/' + str(link))
+       
+       force_start()
+       
+       return result
+
+# Links separated by spaces, won't work, but as parameters 
(&l1=<link1>&l2=<link2>&...) it works (in r9568)
+# expects multiple links separated by '|'
+def action_addlinklist(linklist):
+       # get settings
+       grabber = __addon__.getSetting("add_use_grabber")
+       start = __addon__.getSetting("add_start")
+       
+       links = ""
+       first = True
+       idx=0
+       for link in linklist.split(" "):
+               # prepare link - quote special chars, e.g '?'
+               link = urllib.quote(link)
+               # restore double point (won't work atm)
+               link = link.replace( '%3A', ':' )
+               # add link
+               if (first):
+                       links = "?l"
+                       first = False
+               else:
+                       links += "&l"
+               links += str(idx) + "=" + link
+               idx += 1
+       
+       result = _http_query('/action/add/links/grabber' + str(grabber) + 
'/start' + str(start) + '/' + str(links))
+       
+       force_start()
+       
+       return result
+
+def action_addlinks_from_file(filename):
+       txt_file = open(filename,'r')
+       lines= txt_file.readlines()
+       
+       for line in lines:
+               action_addlink(line)
+       return "%d link(s) added" % (len(lines), )
+
+# HACK: fixes problem, that jd already stopped again before the links are 
added to the dl list (decrypting takes a few seconds) 
+def force_start():
+       if (__addon__.getSetting("add_start") == "1"):
+               now = time.time();
+               while ((get(GET_STATUS) != STATE_RUNNING or get(GET_SPEED) == 
"none") and now + 20.0 > time.time()): # try for a maximum of 20 seconds to 
start jd
+                       action(ACTION_START)
                        time.sleep(4.0)
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 plugin.program.jdownloader/addon.xml               |   12 +-
 plugin.program.jdownloader/changelog.txt           |    7 +-
 plugin.program.jdownloader/default.py              |  565 ++++++++--------
 .../resources/language/English/strings.xml         |    2 +
 .../resources/language/German/strings.xml          |    2 +-
 .../resources/lib/jdownloader.py                   |  738 ++++++++++----------
 6 files changed, 671 insertions(+), 655 deletions(-)


hooks/post-receive
-- 
Plugins

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to