diff options
| author | 2010-08-25 16:48:55 +0200 | |
|---|---|---|
| committer | 2010-08-25 16:48:55 +0200 | |
| commit | 3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea (patch) | |
| tree | c5b2b1bfeb7eb8df2b97be118f6cbcec4e29cb3b /core | |
| parent | ul.to fetching, so.biz expire (diff) | |
| download | pyload-3c9f55270a83b0e88ec0dc516f9d9921e4d7b6ea.tar.xz | |
merged gui
Diffstat (limited to 'core')
287 files changed, 28068 insertions, 0 deletions
diff --git a/core/icons/add.png b/core/icons/add.png Binary files differnew file mode 100644 index 000000000..2acdd8f51 --- /dev/null +++ b/core/icons/add.png diff --git a/core/icons/del.png b/core/icons/del.png Binary files differnew file mode 100644 index 000000000..c5524f728 --- /dev/null +++ b/core/icons/del.png diff --git a/core/icons/down.png b/core/icons/down.png Binary files differnew file mode 100644 index 000000000..371e764fc --- /dev/null +++ b/core/icons/down.png diff --git a/core/icons/logo.png b/core/icons/logo.png Binary files differnew file mode 100644 index 000000000..72a95b740 --- /dev/null +++ b/core/icons/logo.png diff --git a/core/icons/pause.png b/core/icons/pause.png Binary files differnew file mode 100644 index 000000000..08a39aa18 --- /dev/null +++ b/core/icons/pause.png diff --git a/core/icons/pyload.ico b/core/icons/pyload.ico Binary files differnew file mode 100644 index 000000000..58b1f4b89 --- /dev/null +++ b/core/icons/pyload.ico diff --git a/core/icons/pyload2.ico b/core/icons/pyload2.ico Binary files differnew file mode 100644 index 000000000..c2b497986 --- /dev/null +++ b/core/icons/pyload2.ico diff --git a/core/icons/setup.png b/core/icons/setup.png Binary files differnew file mode 100644 index 000000000..1badf1d67 --- /dev/null +++ b/core/icons/setup.png diff --git a/core/icons/start.png b/core/icons/start.png Binary files differnew file mode 100644 index 000000000..c59243a91 --- /dev/null +++ b/core/icons/start.png diff --git a/core/icons/stop.png b/core/icons/stop.png Binary files differnew file mode 100644 index 000000000..7066394d8 --- /dev/null +++ b/core/icons/stop.png diff --git a/core/icons/up.png b/core/icons/up.png Binary files differnew file mode 100644 index 000000000..48699dac6 --- /dev/null +++ b/core/icons/up.png diff --git a/core/locale/cli.pot b/core/locale/cli.pot new file mode 100644 index 000000000..ffdd7361f --- /dev/null +++ b/core/locale/cli.pot @@ -0,0 +1,145 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-04 18:59+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: pyLoadCli.py:48 +msgid "pyLoadCore not running" +msgstr "" + +#: pyLoadCli.py:54 pyLoadCli.py:113 +msgid " Command Line Interface" +msgstr "" + +#: pyLoadCli.py:115 +msgid "%s Downloads:" +msgstr "" + +#: pyLoadCli.py:125 +msgid " Finished in: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " ID: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " Size: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " Speed: " +msgstr "" + +#: pyLoadCli.py:130 +msgid "waiting: " +msgstr "" + +#: pyLoadCli.py:136 pyLoadCli.py:138 +msgid " Files in queue: " +msgstr "" + +#: pyLoadCli.py:136 pyLoadCli.py:138 +msgid " total Speed: " +msgstr "" + +#: pyLoadCli.py:136 pyLoadCli.py:138 +msgid "Status: " +msgstr "" + +#: pyLoadCli.py:150 +msgid "Menu:" +msgstr "" + +#: pyLoadCli.py:155 +msgid " Add Links" +msgstr "" + +#: pyLoadCli.py:157 +msgid " Manage Links" +msgstr "" + +#: pyLoadCli.py:159 +msgid " (Un)Pause Server" +msgstr "" + +#: pyLoadCli.py:161 +msgid " Kill Server" +msgstr "" + +#: pyLoadCli.py:163 +msgid " Quit" +msgstr "" + +#: pyLoadCli.py:173 +msgid "Name your package." +msgstr "" + +#: pyLoadCli.py:183 pyLoadCli.py:200 pyLoadCli.py:244 +msgid " back to main menu" +msgstr "" + +#: pyLoadCli.py:188 +msgid "Package: %s" +msgstr "" + +#: pyLoadCli.py:190 +msgid "Parse the links you want to add." +msgstr "" + +#: pyLoadCli.py:192 +msgid "Type %s when done." +msgstr "" + +#: pyLoadCli.py:194 +msgid "Links added: " +msgstr "" + +#: pyLoadCli.py:206 +msgid "Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it." +msgstr "" + +#: pyLoadCli.py:222 +msgid "Type d(number) of the link you want to delete or r(number) to restart." +msgstr "" + +#: pyLoadCli.py:242 +msgid " - next" +msgstr "" + +#: pyLoadCli.py:242 +msgid " - previous" +msgstr "" + +#: pyLoadCli.py:459 +msgid "Username: " +msgstr "" + +#: pyLoadCli.py:460 +msgid "Adress: " +msgstr "" + +#: pyLoadCli.py:461 +msgid "Use SSL? ([y]/n): " +msgstr "" + +#: pyLoadCli.py:466 +msgid "Port: " +msgstr "" + +#: pyLoadCli.py:468 +msgid "Password: " +msgstr "" + diff --git a/core/locale/core.pot b/core/locale/core.pot new file mode 100644 index 000000000..ece179de0 --- /dev/null +++ b/core/locale/core.pot @@ -0,0 +1,204 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: ./module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: ./module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: ./module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: ./module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: ./module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: ./module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: ./module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: ./module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: ./module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: ./module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: ./module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: ./module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: ./module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: ./module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: ./module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: ./module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: ./module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: ./module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: ./pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: ./pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: ./pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: ./pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: ./pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: ./pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: ./pyLoadCore.py:118 +msgid "folder for logs" +msgstr "" + +#: ./pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "" + +#: ./pyLoadCore.py:120 +msgid "file for links" +msgstr "" + +#: ./pyLoadCore.py:121 +msgid "file for failed links" +msgstr "" + +#: ./pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: ./pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: ./pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: ./pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "" + +#: ./pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" + +#: ./pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" + +#: ./pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" + +#: ./pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" + +#: ./pyLoadCore.py:203 +msgid "Failed starting XMLRPC server CLI and GUI will not be available: %s" +msgstr "" + +#: ./pyLoadCore.py:272 +msgid "%s created" +msgstr "" + +#: ./pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: ./pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: ./pyLoadCore.py:305 +msgid "%s added" +msgstr "" + +#: ./pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: ./pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: ./pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: ./pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: ./pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: ./pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" diff --git a/core/locale/de/LC_MESSAGES/pyLoad.mo b/core/locale/de/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..4ac56cbc7 --- /dev/null +++ b/core/locale/de/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/de/LC_MESSAGES/pyLoad.po b/core/locale/de/LC_MESSAGES/pyLoad.po new file mode 100755 index 000000000..c6ec1b4e2 --- /dev/null +++ b/core/locale/de/LC_MESSAGES/pyLoad.po @@ -0,0 +1,253 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:38+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/download_thread.py:115 +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "Hoster nicht verfÃŒgbar, bitte 60 Sekunden warten" + +#: ./module/download_thread.py:117 +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "Konnte Fehlercode nicht bestimmen: %s" + +#: ./module/download_thread.py:163 +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "PrÃŒfsumme richtig ('%s')" + +#: ./module/download_thread.py:165 +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "PrÃŒfsumme stimmt nicht ÃŒberein! ('%s')" + +#: ./module/download_thread.py:167 +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "Konnte keine PrÃŒfsumme fÃŒr %s ermitteln" + +#: ./module/download_thread.py:169 +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "PrÃŒfsumme nicht implementiert fÃŒr %s" + +#: ./module/file_list.py:87 +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "%s Links im Linksammler" + +#: ./module/file_list.py:89 +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "%s Pakete nicht in der Warteschlange" + +#: ./module/file_list.py:91 +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "%s Pakete in der Warteschlange" + +#: ./module/thread_list.py:88 +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "Hole Links von: %s" + +#: ./module/thread_list.py:90 +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "Starte Download: %s" + +#: ./module/thread_list.py:136 +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "Gefundene Links in %s: %i" + +#: ./module/thread_list.py:138 +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "Keine Links in %s" + +#: ./module/thread_list.py:145 +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "Download fertiggestellt: %s" + +#: ./module/thread_list.py:151 +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "Download fehlgeschlagen: %s | %s" + +#: ./module/thread_list.py:156 +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "Download abgebrochen: %s" + +#: ./module/thread_list.py:206 +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "Starte Reconnect" + +#: ./module/thread_list.py:220 +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "Neue Verbindung aufgebaut, IP: %s" + +#: ./pyLoadCore.py:111 +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "pyCrypto um Containerdateien zu öffnen" + +#: ./pyLoadCore.py:112 +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "Python Image Library (PIL) fÃŒr CAPTCHA-Erkennung" + +#: ./pyLoadCore.py:113 +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "Du kannst python installieren, um eine bessere Download-Performance zu erhalten" + +#: ./pyLoadCore.py:114 +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "Django fÃŒr das Webinterface" + +#: ./pyLoadCore.py:115 +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "Tesseract fÃŒr die CAPTCHA-Erkennung" + +#: ./pyLoadCore.py:116 +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "GOCR fÃŒr die CAPTCHA-Erkennung" + +#: ./pyLoadCore.py:118 +#: pyLoadCore.py:118 +msgid "folder for logs" +msgstr "Ordner fÃŒr Logs" + +#: ./pyLoadCore.py:119 +#: pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "Downloadordner" + +#: ./pyLoadCore.py:120 +#: pyLoadCore.py:120 +msgid "file for links" +msgstr "Linkdatei" + +#: ./pyLoadCore.py:121 +#: pyLoadCore.py:121 +msgid "file for failed links" +msgstr "Datei mit fehlgeschlagenen Downloads" + +#: ./pyLoadCore.py:124 +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "OpenSSL fÃŒr eine sichere Verbindung" + +#: ./pyLoadCore.py:125 +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "SSL-Zertifikat" + +#: ./pyLoadCore.py:126 +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "SSL-SchlÃŒssel" + +#: ./pyLoadCore.py:150 +#: pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "Downloadzeit: %s" + +#: ./pyLoadCore.py:179 +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "starte pyLoad neu" + +#: ./pyLoadCore.py:183 +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "pyLoad beendet" + +#: ./pyLoadCore.py:194 +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "Sicherer XMLRPC Server gestartet" + +#: ./pyLoadCore.py:197 +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "XMLRPC Server gestartet..." + +#: ./pyLoadCore.py:203 +msgid "Failed starting XMLRPC server CLI and GUI will not be available: %s" +msgstr "Starten des XMLRPC-Servers fehlgeschlagen, CLI und GUI nicht verfÃŒgbar: %s" + +#: ./pyLoadCore.py:272 +#: pyLoadCore.py:272 +msgid "%s created" +msgstr "%s erstellt" + +#: ./pyLoadCore.py:275 +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "Konnte %s: %s nicht finden" + +#: ./pyLoadCore.py:277 +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "Konnte %s: %s nicht erstellen" + +#: ./pyLoadCore.py:305 +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "%s hinzugefÃŒgt" + +#: ./pyLoadCore.py:306 +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "Pluginindex erstellt" + +#: ./pyLoadCore.py:325 +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "Beenden..." + +#: ./pyLoadCore.py:341 +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "Keine Updates fÃŒr pyLoad" + +#: ./pyLoadCore.py:344 +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "Neue pyLoad Version - %s - verfÃŒgbar" + +#: ./pyLoadCore.py:369 +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "Automatische Installation gescheitert" + +#: ./pyLoadCore.py:607 +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "pyLoad vom Terminal beendet." + diff --git a/core/locale/de/LC_MESSAGES/pyLoadCli.mo b/core/locale/de/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..97c1d0969 --- /dev/null +++ b/core/locale/de/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/de/LC_MESSAGES/pyLoadCli.po b/core/locale/de/LC_MESSAGES/pyLoadCli.po new file mode 100755 index 000000000..2c9cfbe76 --- /dev/null +++ b/core/locale/de/LC_MESSAGES/pyLoadCli.po @@ -0,0 +1,158 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010 pyLoad Team +# FIRST AUTHOR <bauerj@pyload.org>, 2010. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-04 18:59+CET\n" +"PO-Revision-Date: 2010-03-24 15:37+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: pyLoadCli.py:48 +msgid "pyLoadCore not running" +msgstr "pyLoadCore lÀuft nicht" + +#: pyLoadCli.py:54 +#: pyLoadCli.py:113 +msgid " Command Line Interface" +msgstr " Kommandozeileninterface" + +#: pyLoadCli.py:115 +msgid "%s Downloads:" +msgstr "%s Downloads:" + +#: pyLoadCli.py:125 +msgid " Finished in: " +msgstr " Fertig in: " + +#: pyLoadCli.py:125 +msgid " ID: " +msgstr " ID: " + +#: pyLoadCli.py:125 +msgid " Size: " +msgstr " GröÃe: " + +#: pyLoadCli.py:125 +msgid " Speed: " +msgstr " Geschwindigkeit: " + +#: pyLoadCli.py:130 +msgid "waiting: " +msgstr "wartend: " + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " Files in queue: " +msgstr " In Warteschlange: " + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " total Speed: " +msgstr " ges. Geschw.: " + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid "Status: " +msgstr "Status: " + +#: pyLoadCli.py:150 +msgid "Menu:" +msgstr "MenÃŒ:" + +#: pyLoadCli.py:155 +msgid " Add Links" +msgstr " Links hinzufÃŒgen" + +#: pyLoadCli.py:157 +msgid " Manage Links" +msgstr " Links verwalten" + +#: pyLoadCli.py:159 +msgid " (Un)Pause Server" +msgstr " Server (ent)pausieren" + +#: pyLoadCli.py:161 +msgid " Kill Server" +msgstr " Server beenden" + +#: pyLoadCli.py:163 +msgid " Quit" +msgstr " Beenden" + +#: pyLoadCli.py:173 +msgid "Name your package." +msgstr "Benenne dein Paket." + +#: pyLoadCli.py:183 +#: pyLoadCli.py:200 +#: pyLoadCli.py:244 +msgid " back to main menu" +msgstr " zurÃŒck zum MenÃŒ" + +#: pyLoadCli.py:188 +msgid "Package: %s" +msgstr "Packet: %s" + +#: pyLoadCli.py:190 +msgid "Parse the links you want to add." +msgstr "Kopiere die Links, die du hinzufÃŒgen willst." + +#: pyLoadCli.py:192 +msgid "Type %s when done." +msgstr "Tippe %s wenn du fertig bist." + +#: pyLoadCli.py:194 +msgid "Links added: " +msgstr "Links hinzugefÃŒgt: " + +#: pyLoadCli.py:206 +msgid "Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it." +msgstr "Tippe d(Nummer des Paketes) um es zu löschen, r um es neu zu starten oder ohne d,r um hineinzuschauen." + +#: pyLoadCli.py:222 +msgid "Type d(number) of the link you want to delete or r(number) to restart." +msgstr "Tippe d(Nummer) um den Link zu löschen oder r(#) um ihn neuzustarten." + +#: pyLoadCli.py:242 +msgid " - next" +msgstr " - nÀchste Seite" + +#: pyLoadCli.py:242 +msgid " - previous" +msgstr " - vorige Seite" + +#: pyLoadCli.py:459 +msgid "Username: " +msgstr "Benutzername: " + +#: pyLoadCli.py:460 +msgid "Adress: " +msgstr "Adresse: " + +#: pyLoadCli.py:461 +msgid "Use SSL? ([y]/n): " +msgstr "SSL? ([y]/n): " + +#: pyLoadCli.py:466 +msgid "Port: " +msgstr "Port: " + +#: pyLoadCli.py:468 +msgid "Password: " +msgstr "Passwort: " + +#~ msgid "n" +#~ msgstr "n" +#~ msgid "p" +#~ msgstr "p" + diff --git a/core/locale/de/LC_MESSAGES/pyLoadGui.po b/core/locale/de/LC_MESSAGES/pyLoadGui.po new file mode 100644 index 000000000..ec597343c --- /dev/null +++ b/core/locale/de/LC_MESSAGES/pyLoadGui.po @@ -0,0 +1,261 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:36+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/gui/CaptchaDock.py:25 +msgid "Captcha" +msgstr "Captcha" + +#: ./module/gui/CaptchaDock.py:56 +#: ./module/gui/PWInputWindow.py:28 +msgid "OK" +msgstr "OK" + +#: ./module/gui/CaptchaDock.py:57 +#: ./module/gui/ConnectionManager.py:154 +#: ./module/gui/PWInputWindow.py:29 +msgid "Cancel" +msgstr "Abbrechen" + +#: ./module/gui/ConnectionManager.py:33 +msgid "New" +msgstr "Neu" + +#: ./module/gui/ConnectionManager.py:34 +msgid "Edit" +msgstr "Bearbeiten" + +#: ./module/gui/ConnectionManager.py:35 +#: ./module/gui/MainWindow.py:191 +#: ./module/gui/MainWindow.py:205 +msgid "Remove" +msgstr "Entfernen" + +#: ./module/gui/ConnectionManager.py:36 +msgid "Connect" +msgstr "Verbinden" + +#: ./module/gui/ConnectionManager.py:76 +msgid "%s (Default)" +msgstr "%s (Standard)" + +#: ./module/gui/ConnectionManager.py:138 +msgid "Name:" +msgstr "Name:" + +#: ./module/gui/ConnectionManager.py:139 +msgid "Host:" +msgstr "Host:" + +#: ./module/gui/ConnectionManager.py:140 +msgid "SSL:" +msgstr "SSL:" + +#: ./module/gui/ConnectionManager.py:141 +msgid "Local:" +msgstr "Lokal:" + +#: ./module/gui/ConnectionManager.py:142 +msgid "User:" +msgstr "Benutzer:" + +#: ./module/gui/ConnectionManager.py:143 +msgid "Port:" +msgstr "Port:" + +#: ./module/gui/ConnectionManager.py:153 +msgid "Save" +msgstr "Speichern" + +#: ./module/gui/MainWindow.py:33 +msgid "pyLoad Client" +msgstr "pyLoad Client" + +#: ./module/gui/MainWindow.py:60 +msgid "Status: Not Connected" +msgstr "Status: nicht verbunden" + +#: ./module/gui/MainWindow.py:65 +msgid "File" +msgstr "Datei" + +#: ./module/gui/MainWindow.py:66 +msgid "Connections" +msgstr "Verbindungen" + +#: ./module/gui/MainWindow.py:70 +msgid "Exit" +msgstr "Beenden" + +#: ./module/gui/MainWindow.py:71 +msgid "Connection manager" +msgstr "Verbindungen verwalten" + +#: ./module/gui/MainWindow.py:88 +msgid "Queue" +msgstr "Warteschlange" + +#: ./module/gui/MainWindow.py:89 +msgid "Collector" +msgstr "Linksammler" + +#: ./module/gui/MainWindow.py:90 +msgid "Settings" +msgstr "Einstellungen" + +#: ./module/gui/MainWindow.py:91 +msgid "Log" +msgstr "Log" + +#: ./module/gui/MainWindow.py:117 +msgid "Main Toolbar" +msgstr "Toolbar" + +#: ./module/gui/MainWindow.py:120 +msgid "Toggle Pause/Resume" +msgstr "pause/fortsetzen" + +#: ./module/gui/MainWindow.py:126 +msgid "Stop" +msgstr "Stop" + +#: ./module/gui/MainWindow.py:128 +msgid "Add" +msgstr "HinzufÃŒgen" + +#: ./module/gui/MainWindow.py:130 +msgid "Check Clipboard" +msgstr "Zwischenablage ÃŒberwachen" + +#: ./module/gui/MainWindow.py:137 +msgid "Package" +msgstr "Paket" + +#: ./module/gui/MainWindow.py:138 +msgid "Links" +msgstr "Links" + +#: ./module/gui/MainWindow.py:139 +msgid "Container" +msgstr "Container" + +#: ./module/gui/MainWindow.py:156 +msgid "Packages" +msgstr "Pakete" + +#: ./module/gui/MainWindow.py:158 +msgid "Push selected packages to queue" +msgstr "Verschiebe ausgewÀhlte Pakete in die Warteschlange" + +#: ./module/gui/MainWindow.py:192 +msgid "Restart" +msgstr "Neustarten" + +#: ./module/gui/MainWindow.py:193 +msgid "Pull out" +msgstr "in Linksammler verschieben" + +#: ./module/gui/MainWindow.py:206 +msgid "Push to queue" +msgstr "in Warteschlange verschieben" + +#: ./module/gui/MainWindow.py:207 +msgid "Edit Name" +msgstr "Name bearbeiten" + +#: ./module/gui/MainWindow.py:277 +msgid "All Container Types (%s)" +msgstr "Alle Container Arten (%s)" + +#: ./module/gui/MainWindow.py:278 +msgid "DLC (%s)" +msgstr "DLC (%s)" + +#: ./module/gui/MainWindow.py:279 +msgid "CCF (%s)" +msgstr "CCF (%s)" + +#: ./module/gui/MainWindow.py:280 +msgid "RSDF (%s)" +msgstr "RSDF (%s)" + +#: ./module/gui/MainWindow.py:281 +msgid "Text Files (%s)" +msgstr "Text Dateien (%s)" + +#: ./module/gui/MainWindow.py:283 +msgid "Open container" +msgstr "Container öffnen" + +#: ./module/gui/MainWindow.py:306 +msgid "Single Links" +msgstr "Einzelne Links" + +#: ./module/gui/PWInputWindow.py:27 +msgid "Password:" +msgstr "Passwort:" + +#: ./module/gui/PackageDock.py:24 +msgid "New Package" +msgstr "Neues Paket" + +#: ./module/gui/PackageDock.py:50 +#: ./pyLoadGui.py:236 +msgid "Name" +msgstr "Name" + +#: ./module/gui/PackageDock.py:53 +msgid "Links in this Package" +msgstr "Links in diesem Paket" + +#: ./module/gui/PackageDock.py:68 +msgid "Create" +msgstr "Erstellen" + +#: ./pyLoadGui.py:236 +msgid "Plugin" +msgstr "Plugin" + +#: ./pyLoadGui.py:236 +msgid "Progress" +msgstr "Fortschritt" + +#: ./pyLoadGui.py:236 +msgid "Status" +msgstr "Status" + +#: ./pyLoadGui.py:252 +msgid "Paused" +msgstr "Pausiert" + +#: ./pyLoadGui.py:254 +msgid "Running" +msgstr "LÀuft" + +#: ./pyLoadGui.py:256 +msgid "Status: %(status)s | Speed: %(speed)s kb/s" +msgstr "Status: %(status)s | Geschwindigkeit: %(speed)s kb/s" + +#: ./pyLoadGui.py:281 +msgid "Update Available" +msgstr "Update verfÃŒgbar" + +#: ./pyLoadGui.py:305 +msgid "Unnamed" +msgstr "Unbenannt" + diff --git a/core/locale/de/LC_MESSAGES/setup.mo b/core/locale/de/LC_MESSAGES/setup.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/de/LC_MESSAGES/setup.mo diff --git a/core/locale/de/de.po b/core/locale/de/de.po new file mode 100644 index 000000000..1994499df --- /dev/null +++ b/core/locale/de/de.po @@ -0,0 +1,205 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: pyLoadCore.py:118 +msgid "folder for logs" +msgstr "" + +#: pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "" + +#: pyLoadCore.py:120 +msgid "file for links" +msgstr "" + +#: pyLoadCore.py:121 +msgid "file for failed links" +msgstr "" + +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "" + +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" + +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" + +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" + +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" + +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "" + +#: pyLoadCore.py:272 +msgid "%s created" +msgstr "" + +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "" + +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" + diff --git a/core/locale/en/LC_MESSAGES/pyLoad.mo b/core/locale/en/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/en/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/en/LC_MESSAGES/pyLoadCli.mo b/core/locale/en/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/en/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/en/LC_MESSAGES/setup.mo b/core/locale/en/LC_MESSAGES/setup.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/en/LC_MESSAGES/setup.mo diff --git a/core/locale/en/en.po b/core/locale/en/en.po new file mode 100644 index 000000000..4d5bc4ee3 --- /dev/null +++ b/core/locale/en/en.po @@ -0,0 +1,209 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: 2010-02-02 23:05+0200\n" +"Last-Translator: Marius <mkaay@mkaay.de>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "Hoster unvailable, wait 60 seconds" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "Error getting error code: %s" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "Checksum ok ('%s')" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "Checksum not matched! ('%s')" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "Can't get checksum for %s" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "Checksum not implemented for %s" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "Found %s links in linkcollector" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "Found %s unqueued packages" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "Added %s packages to queue" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "Get links from: %s" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "Download starts: %s" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "Parsed links from %s: %i" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "No links in %s" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "Download finished: %s" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "Download failed: %s | %s" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "Download aborted: %s" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "Starting reconnect" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "Reconnected, new IP: %s" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "pycrypto to decode container files" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "Python Image Libary (PIL) for captha reading" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "pycurl for lower memory footprint while downloading" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "Django for webinterface" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "tesseract for captcha reading" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "gocr for captcha reading" + +#: pyLoadCore.py:118 +msgid "folder for logs" +msgstr "folder for logs" + +#: pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "folder for downloads" + +#: pyLoadCore.py:120 +msgid "file for links" +msgstr "file for links" + +#: pyLoadCore.py:121 +msgid "file for failed links" +msgstr "file for failed links" + +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "OpenSSL for secure connection" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "ssl certificate" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "ssl key" + +#: pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "Downloadtime: %s" + +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "restarting pyLoad" + +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "pyLoad quits" + +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "Secure XMLRPC Server Started" + +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "Auth XMLRPC Server Started" + +#~ msgid "Failed starting socket server, CLI and GUI will not be available: %s" +#~ msgstr "" + +#: pyLoadCore.py:272 +msgid "%s created" +msgstr "%s created" + +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "could not find %s: %s" + +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "could not create %s: %s" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "%s added" + +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "created index of plugins" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "shutting down..." + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "No Updates for pyLoad" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "New pyLoad Version %s available" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "Auto install Failed" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "killed pyLoad from Terminal" + +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "Failed starting XMLRPC server, CLI and GUI will not be available: %s" diff --git a/core/locale/es/LC_MESSAGES/pyLoad.mo b/core/locale/es/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/es/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/es/LC_MESSAGES/pyLoadCli.mo b/core/locale/es/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/es/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/fi/LC_MESSAGES/pyLoad.mo b/core/locale/fi/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/fi/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/fi/LC_MESSAGES/pyLoadCli.mo b/core/locale/fi/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/fi/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/fr/LC_MESSAGES/pyLoad.mo b/core/locale/fr/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..0f33727f0 --- /dev/null +++ b/core/locale/fr/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/fr/LC_MESSAGES/pyLoadCli.mo b/core/locale/fr/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/fr/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/fr/fr.po b/core/locale/fr/fr.po new file mode 100644 index 000000000..1994499df --- /dev/null +++ b/core/locale/fr/fr.po @@ -0,0 +1,205 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-02 21:54+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: pyLoadCore.py:118 +msgid "folder for logs" +msgstr "" + +#: pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "" + +#: pyLoadCore.py:120 +msgid "file for links" +msgstr "" + +#: pyLoadCore.py:121 +msgid "file for failed links" +msgstr "" + +#: pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "" + +#: pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" + +#: pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" + +#: pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" + +#: pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" + +#: pyLoadCore.py:203 +msgid "Failed starting XMLRPC server, CLI and GUI will not be available: %s" +msgstr "" + +#: pyLoadCore.py:272 +msgid "%s created" +msgstr "" + +#: pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: pyLoadCore.py:305 +msgid "%s added" +msgstr "" + +#: pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" + diff --git a/core/locale/gui.pot b/core/locale/gui.pot new file mode 100644 index 000000000..aae5349f0 --- /dev/null +++ b/core/locale/gui.pot @@ -0,0 +1,254 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/gui/CaptchaDock.py:25 +msgid "Captcha" +msgstr "" + +#: ./module/gui/CaptchaDock.py:56 ./module/gui/PWInputWindow.py:28 +msgid "OK" +msgstr "" + +#: ./module/gui/CaptchaDock.py:57 ./module/gui/ConnectionManager.py:154 +#: ./module/gui/PWInputWindow.py:29 +msgid "Cancel" +msgstr "" + +#: ./module/gui/ConnectionManager.py:33 +msgid "New" +msgstr "" + +#: ./module/gui/ConnectionManager.py:34 +msgid "Edit" +msgstr "" + +#: ./module/gui/ConnectionManager.py:35 ./module/gui/MainWindow.py:191 +#: ./module/gui/MainWindow.py:205 +msgid "Remove" +msgstr "" + +#: ./module/gui/ConnectionManager.py:36 +msgid "Connect" +msgstr "" + +#: ./module/gui/ConnectionManager.py:76 +msgid "%s (Default)" +msgstr "" + +#: ./module/gui/ConnectionManager.py:138 +msgid "Name:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:139 +msgid "Host:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:140 +msgid "SSL:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:141 +msgid "Local:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:142 +msgid "User:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:143 +msgid "Port:" +msgstr "" + +#: ./module/gui/ConnectionManager.py:153 +msgid "Save" +msgstr "" + +#: ./module/gui/MainWindow.py:33 +msgid "pyLoad Client" +msgstr "" + +#: ./module/gui/MainWindow.py:60 +msgid "Status: Not Connected" +msgstr "" + +#: ./module/gui/MainWindow.py:65 +msgid "File" +msgstr "" + +#: ./module/gui/MainWindow.py:66 +msgid "Connections" +msgstr "" + +#: ./module/gui/MainWindow.py:70 +msgid "Exit" +msgstr "" + +#: ./module/gui/MainWindow.py:71 +msgid "Connection manager" +msgstr "" + +#: ./module/gui/MainWindow.py:88 +msgid "Queue" +msgstr "" + +#: ./module/gui/MainWindow.py:89 +msgid "Collector" +msgstr "" + +#: ./module/gui/MainWindow.py:90 +msgid "Settings" +msgstr "" + +#: ./module/gui/MainWindow.py:91 +msgid "Log" +msgstr "" + +#: ./module/gui/MainWindow.py:117 +msgid "Main Toolbar" +msgstr "" + +#: ./module/gui/MainWindow.py:120 +msgid "Toggle Pause/Resume" +msgstr "" + +#: ./module/gui/MainWindow.py:126 +msgid "Stop" +msgstr "" + +#: ./module/gui/MainWindow.py:128 +msgid "Add" +msgstr "" + +#: ./module/gui/MainWindow.py:130 +msgid "Check Clipboard" +msgstr "" + +#: ./module/gui/MainWindow.py:137 +msgid "Package" +msgstr "" + +#: ./module/gui/MainWindow.py:138 +msgid "Links" +msgstr "" + +#: ./module/gui/MainWindow.py:139 +msgid "Container" +msgstr "" + +#: ./module/gui/MainWindow.py:156 +msgid "Packages" +msgstr "" + +#: ./module/gui/MainWindow.py:158 +msgid "Push selected packages to queue" +msgstr "" + +#: ./module/gui/MainWindow.py:192 +msgid "Restart" +msgstr "" + +#: ./module/gui/MainWindow.py:193 +msgid "Pull out" +msgstr "" + +#: ./module/gui/MainWindow.py:206 +msgid "Push to queue" +msgstr "" + +#: ./module/gui/MainWindow.py:207 +msgid "Edit Name" +msgstr "" + +#: ./module/gui/MainWindow.py:277 +msgid "All Container Types (%s)" +msgstr "" + +#: ./module/gui/MainWindow.py:278 +msgid "DLC (%s)" +msgstr "" + +#: ./module/gui/MainWindow.py:279 +msgid "CCF (%s)" +msgstr "" + +#: ./module/gui/MainWindow.py:280 +msgid "RSDF (%s)" +msgstr "" + +#: ./module/gui/MainWindow.py:281 +msgid "Text Files (%s)" +msgstr "" + +#: ./module/gui/MainWindow.py:283 +msgid "Open container" +msgstr "" + +#: ./module/gui/MainWindow.py:306 +msgid "Single Links" +msgstr "" + +#: ./module/gui/PWInputWindow.py:27 +msgid "Password:" +msgstr "" + +#: ./module/gui/PackageDock.py:24 +msgid "New Package" +msgstr "" + +#: ./module/gui/PackageDock.py:50 ./pyLoadGui.py:236 +msgid "Name" +msgstr "" + +#: ./module/gui/PackageDock.py:53 +msgid "Links in this Package" +msgstr "" + +#: ./module/gui/PackageDock.py:68 +msgid "Create" +msgstr "" + +#: ./pyLoadGui.py:236 +msgid "Plugin" +msgstr "" + +#: ./pyLoadGui.py:236 +msgid "Progress" +msgstr "" + +#: ./pyLoadGui.py:236 +msgid "Status" +msgstr "" + +#: ./pyLoadGui.py:252 +msgid "Paused" +msgstr "" + +#: ./pyLoadGui.py:254 +msgid "Running" +msgstr "" + +#: ./pyLoadGui.py:256 +msgid "Status: %(status)s | Speed: %(speed)s kb/s" +msgstr "" + +#: ./pyLoadGui.py:281 +msgid "Update Available" +msgstr "" + +#: ./pyLoadGui.py:305 +msgid "Unnamed" +msgstr "" + diff --git a/core/locale/it/LC_MESSAGES/pyLoad.mo b/core/locale/it/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/it/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/it/LC_MESSAGES/pyLoadCli.mo b/core/locale/it/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/it/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/nl/LC_MESSAGES/pyLoad.mo b/core/locale/nl/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..97a1a4bc6 --- /dev/null +++ b/core/locale/nl/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/nl/LC_MESSAGES/pyLoad.po b/core/locale/nl/LC_MESSAGES/pyLoad.po new file mode 100755 index 000000000..11c0a4ba9 --- /dev/null +++ b/core/locale/nl/LC_MESSAGES/pyLoad.po @@ -0,0 +1,205 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:40+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Translate Toolkit 1.5.1\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "" + +#: ./module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "" + +#: ./module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "" + +#: ./module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "" + +#: ./module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "" + +#: ./module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "" + +#: ./module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "" + +#: ./module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "" + +#: ./module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "" + +#: ./module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "" + +#: ./module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "" + +#: ./module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "" + +#: ./module/thread_list.py:138 +msgid "No links in %s" +msgstr "" + +#: ./module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "" + +#: ./module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "" + +#: ./module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "" + +#: ./module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "" + +#: ./module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "" + +#: ./pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "" + +#: ./pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "" + +#: ./pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "" + +#: ./pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "" + +#: ./pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "" + +#: ./pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "" + +#: ./pyLoadCore.py:118 +msgid "folder for logs" +msgstr "" + +#: ./pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "" + +#: ./pyLoadCore.py:120 +msgid "file for links" +msgstr "" + +#: ./pyLoadCore.py:121 +msgid "file for failed links" +msgstr "" + +#: ./pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "" + +#: ./pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "" + +#: ./pyLoadCore.py:126 +msgid "ssl key" +msgstr "" + +#: ./pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "" + +#: ./pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "" + +#: ./pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "" + +#: ./pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "" + +#: ./pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "" + +#: ./pyLoadCore.py:203 +msgid "Failed starting XMLRPC server CLI and GUI will not be available: %s" +msgstr "" + +#: ./pyLoadCore.py:272 +msgid "%s created" +msgstr "" + +#: ./pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "" + +#: ./pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "" + +#: ./pyLoadCore.py:305 +msgid "%s added" +msgstr "" + +#: ./pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "" + +#: ./pyLoadCore.py:325 +msgid "shutting down..." +msgstr "" + +#: ./pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "" + +#: ./pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "" + +#: ./pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "" + +#: ./pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "" + diff --git a/core/locale/nl/LC_MESSAGES/pyLoadCli.mo b/core/locale/nl/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..cb683c71f --- /dev/null +++ b/core/locale/nl/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/nl/LC_MESSAGES/pyLoadCli.po b/core/locale/nl/LC_MESSAGES/pyLoadCli.po new file mode 100755 index 000000000..6d00b8f86 --- /dev/null +++ b/core/locale/nl/LC_MESSAGES/pyLoadCli.po @@ -0,0 +1,151 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010 pyLoad Team +# FIRST AUTHOR <bauerj@pyload.org>, 2010. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-04 18:59+CET\n" +"PO-Revision-Date: 2010-03-24 15:40+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Translate Toolkit 1.5.1\n" +"Generated-By: pygettext.py 1.5\n" + +#: pyLoadCli.py:48 +msgid "pyLoadCore not running" +msgstr "" + +#: pyLoadCli.py:54 +#: pyLoadCli.py:113 +msgid " Command Line Interface" +msgstr "" + +#: pyLoadCli.py:115 +msgid "%s Downloads:" +msgstr "" + +#: pyLoadCli.py:125 +msgid " Finished in: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " ID: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " Size: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " Speed: " +msgstr "" + +#: pyLoadCli.py:130 +msgid "waiting: " +msgstr "" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " Files in queue: " +msgstr "" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " total Speed: " +msgstr "" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid "Status: " +msgstr "" + +#: pyLoadCli.py:150 +msgid "Menu:" +msgstr "" + +#: pyLoadCli.py:155 +msgid " Add Links" +msgstr "" + +#: pyLoadCli.py:157 +msgid " Manage Links" +msgstr "" + +#: pyLoadCli.py:159 +msgid " (Un)Pause Server" +msgstr "" + +#: pyLoadCli.py:161 +msgid " Kill Server" +msgstr "" + +#: pyLoadCli.py:163 +msgid " Quit" +msgstr "" + +#: pyLoadCli.py:173 +msgid "Name your package." +msgstr "" + +#: pyLoadCli.py:183 +#: pyLoadCli.py:200 +#: pyLoadCli.py:244 +msgid " back to main menu" +msgstr "" + +#: pyLoadCli.py:188 +msgid "Package: %s" +msgstr "" + +#: pyLoadCli.py:190 +msgid "Parse the links you want to add." +msgstr "" + +#: pyLoadCli.py:192 +msgid "Type %s when done." +msgstr "" + +#: pyLoadCli.py:194 +msgid "Links added: " +msgstr "" + +#: pyLoadCli.py:206 +msgid "Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it." +msgstr "" + +#: pyLoadCli.py:222 +msgid "Type d(number) of the link you want to delete or r(number) to restart." +msgstr "" + +#: pyLoadCli.py:242 +msgid " - next" +msgstr "" + +#: pyLoadCli.py:242 +msgid " - previous" +msgstr "" + +#: pyLoadCli.py:459 +msgid "Username: " +msgstr "" + +#: pyLoadCli.py:460 +msgid "Adress: " +msgstr "" + +#: pyLoadCli.py:461 +msgid "Use SSL? ([y]/n): " +msgstr "" + +#: pyLoadCli.py:466 +msgid "Port: " +msgstr "" + +#: pyLoadCli.py:468 +msgid "Password: " +msgstr "" + diff --git a/core/locale/nl/LC_MESSAGES/pyLoadGui.po b/core/locale/nl/LC_MESSAGES/pyLoadGui.po new file mode 100755 index 000000000..ebf81e6e4 --- /dev/null +++ b/core/locale/nl/LC_MESSAGES/pyLoadGui.po @@ -0,0 +1,262 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:41+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/gui/CaptchaDock.py:25 +msgid "Captcha" +msgstr "Captcha" + +#: ./module/gui/CaptchaDock.py:56 +#: ./module/gui/PWInputWindow.py:28 +msgid "OK" +msgstr "OK" + +#: ./module/gui/CaptchaDock.py:57 +#: ./module/gui/ConnectionManager.py:154 +#: ./module/gui/PWInputWindow.py:29 +msgid "Cancel" +msgstr "Annuleer" + +#: ./module/gui/ConnectionManager.py:33 +msgid "New" +msgstr "Nieuw" + +#: ./module/gui/ConnectionManager.py:34 +msgid "Edit" +msgstr "Wijzigen" + +#: ./module/gui/ConnectionManager.py:35 +#: ./module/gui/MainWindow.py:191 +#: ./module/gui/MainWindow.py:205 +msgid "Remove" +msgstr "Verwijder" + +#: ./module/gui/ConnectionManager.py:36 +msgid "Connect" +msgstr "Verbinden" + +#: ./module/gui/ConnectionManager.py:76 +msgid "%s (Default)" +msgstr "%s (Standaard)" + +#: ./module/gui/ConnectionManager.py:138 +msgid "Name:" +msgstr "Naam:" + +#: ./module/gui/ConnectionManager.py:139 +msgid "Host:" +msgstr "Host:" + +#: ./module/gui/ConnectionManager.py:140 +msgid "SSL:" +msgstr "SSL:" + +#: ./module/gui/ConnectionManager.py:141 +msgid "Local:" +msgstr "Lokaal:" + +#: ./module/gui/ConnectionManager.py:142 +msgid "User:" +msgstr "Gebruiker:" + +#: ./module/gui/ConnectionManager.py:143 +msgid "Port:" +msgstr "Port:" + +#: ./module/gui/ConnectionManager.py:153 +msgid "Save" +msgstr "Opslaan" + +#: ./module/gui/MainWindow.py:33 +msgid "pyLoad Client" +msgstr "pyLoad cliënt" + +#: ./module/gui/MainWindow.py:60 +msgid "Status: Not Connected" +msgstr "Status: Niet verbonden" + +#: ./module/gui/MainWindow.py:65 +msgid "File" +msgstr "Bestand" + +#: ./module/gui/MainWindow.py:66 +msgid "Connections" +msgstr "Verbindingen" + +#: ./module/gui/MainWindow.py:70 +msgid "Exit" +msgstr "Afsluiten" + +#: ./module/gui/MainWindow.py:71 +msgid "Connection manager" +msgstr "Verbindingen beheer" + +#: ./module/gui/MainWindow.py:88 +msgid "Queue" +msgstr "Wachtrij" + +#: ./module/gui/MainWindow.py:89 +msgid "Collector" +msgstr "Verzamelaar" + +#: ./module/gui/MainWindow.py:90 +msgid "Settings" +msgstr "Instellingen" + +#: ./module/gui/MainWindow.py:91 +msgid "Log" +msgstr "Logboek" + +#: ./module/gui/MainWindow.py:117 +msgid "Main Toolbar" +msgstr "Hoofd Toolbar" + +#: ./module/gui/MainWindow.py:120 +msgid "Toggle Pause/Resume" +msgstr "Pauze/Herstarten" + +#: ./module/gui/MainWindow.py:126 +msgid "Stop" +msgstr "Stop" + +#: ./module/gui/MainWindow.py:128 +msgid "Add" +msgstr "Toevoegen" + +#: ./module/gui/MainWindow.py:130 +msgid "Check Clipboard" +msgstr "Check Klembord" + +#: ./module/gui/MainWindow.py:137 +msgid "Package" +msgstr "Pakket" + +#: ./module/gui/MainWindow.py:138 +msgid "Links" +msgstr "Links" + +#: ./module/gui/MainWindow.py:139 +msgid "Container" +msgstr "Container" + +#: ./module/gui/MainWindow.py:156 +msgid "Packages" +msgstr "Pakketen" + +#: ./module/gui/MainWindow.py:158 +msgid "Push selected packages to queue" +msgstr "Verplaats de geselecteerde pakketen naar de wacht rij" + +#: ./module/gui/MainWindow.py:192 +msgid "Restart" +msgstr "Herstart" + +# Don't know in wich context this is. +#: ./module/gui/MainWindow.py:193 +msgid "Pull out" +msgstr "Pull out" + +#: ./module/gui/MainWindow.py:206 +msgid "Push to queue" +msgstr "Verplaats naar wacht rij" + +#: ./module/gui/MainWindow.py:207 +msgid "Edit Name" +msgstr "Wijzig Naam" + +#: ./module/gui/MainWindow.py:277 +msgid "All Container Types (%s)" +msgstr "Alle Containers types (%s)" + +#: ./module/gui/MainWindow.py:278 +msgid "DLC (%s)" +msgstr "DLC (%s)" + +#: ./module/gui/MainWindow.py:279 +msgid "CCF (%s)" +msgstr "CCF (%s)" + +#: ./module/gui/MainWindow.py:280 +msgid "RSDF (%s)" +msgstr "RSDF (%s)" + +#: ./module/gui/MainWindow.py:281 +msgid "Text Files (%s)" +msgstr "Tekst Bestanden (%s)" + +#: ./module/gui/MainWindow.py:283 +msgid "Open container" +msgstr "Open container" + +#: ./module/gui/MainWindow.py:306 +msgid "Single Links" +msgstr "Enkele Links" + +#: ./module/gui/PWInputWindow.py:27 +msgid "Password:" +msgstr "Wachtwoord:" + +#: ./module/gui/PackageDock.py:24 +msgid "New Package" +msgstr "Nieuw Pakket" + +#: ./module/gui/PackageDock.py:50 +#: ./pyLoadGui.py:236 +msgid "Name" +msgstr "Naam" + +#: ./module/gui/PackageDock.py:53 +msgid "Links in this Package" +msgstr "Links in dit pakket" + +#: ./module/gui/PackageDock.py:68 +msgid "Create" +msgstr "Creëer" + +#: ./pyLoadGui.py:236 +msgid "Plugin" +msgstr "Plugin" + +#: ./pyLoadGui.py:236 +msgid "Progress" +msgstr "Vooruitgang" + +#: ./pyLoadGui.py:236 +msgid "Status" +msgstr "Status" + +#: ./pyLoadGui.py:252 +msgid "Paused" +msgstr "Gepauzeerd" + +#: ./pyLoadGui.py:254 +msgid "Running" +msgstr "Gestart" + +#: ./pyLoadGui.py:256 +msgid "Status: %(status)s | Speed: %(speed)s kb/s" +msgstr "Status: %(status)s | Snelheid: %(speed)s kb/s" + +#: ./pyLoadGui.py:281 +msgid "Update Available" +msgstr "Update Beschikbaar" + +#: ./pyLoadGui.py:305 +msgid "Unnamed" +msgstr "Naamloos" + diff --git a/core/locale/pl/LC_MESSAGES/pyLoad.mo b/core/locale/pl/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..ccb640f1b --- /dev/null +++ b/core/locale/pl/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/pl/LC_MESSAGES/pyLoad.po b/core/locale/pl/LC_MESSAGES/pyLoad.po new file mode 100755 index 000000000..1eb7414e3 --- /dev/null +++ b/core/locale/pl/LC_MESSAGES/pyLoad.po @@ -0,0 +1,207 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:42+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/download_thread.py:115 +msgid "Hoster unvailable, wait 60 seconds" +msgstr "Host niedostÄpny, czekam 60 sekund" + +#: ./module/download_thread.py:117 +msgid "Error getting error code: %s" +msgstr "BÅÄ
d pobierania kod bÅÄdu: %s" + +#: ./module/download_thread.py:163 +msgid "Checksum ok ('%s')" +msgstr "Suma kontrolna OK ('%s')" + +#: ./module/download_thread.py:165 +msgid "Checksum not matched! ('%s')" +msgstr "Suma kontrolna niepoprawna ('%s')" + +#: ./module/download_thread.py:167 +msgid "Can't get checksum for %s" +msgstr "Nie znaleziono sumy kontrolnej dla %s" + +#: ./module/download_thread.py:169 +msgid "Checksum not implemented for %s" +msgstr "Sprawdzanie sumy kontrolnej nie zaimplementowane dla %s" + +#: ./module/file_list.py:87 +msgid "Found %s links in linkcollector" +msgstr "Znaleziono %s linków w link kolektorze" + +#: ./module/file_list.py:89 +msgid "Found %s unqueued packages" +msgstr "Znaleziono %s paczek spoza kolejki" + +#: ./module/file_list.py:91 +msgid "Added %s packages to queue" +msgstr "Dodano %s paczek do kolejki" + +#: ./module/thread_list.py:88 +msgid "Get links from: %s" +msgstr "Pobierz linki z: %s" + +#: ./module/thread_list.py:90 +msgid "Download starts: %s" +msgstr "Pobieranie rozpocznie siÄ: %s" + +#: ./module/thread_list.py:136 +msgid "Parsed links from %s: %i" +msgstr "W %s znaleziono %i linków" + +#: ./module/thread_list.py:138 +msgid "No links in %s" +msgstr "Brak linków w %s" + +#: ./module/thread_list.py:145 +msgid "Download finished: %s" +msgstr "Pobieranie zakoÅczono: %s" + +#: ./module/thread_list.py:151 +msgid "Download failed: %s | %s" +msgstr "Pobieranie nie udaÅo siÄ: %s | %s" + +#: ./module/thread_list.py:156 +msgid "Download aborted: %s" +msgstr "Pobieranie przerwane: %s" + +#: ./module/thread_list.py:206 +msgid "Starting reconnect" +msgstr "Próba ponownego poÅÄ
czenia" + +#: ./module/thread_list.py:220 +msgid "Reconnected, new IP: %s" +msgstr "Ponownie poÅÄ
czony, nowe IP: %s" + +#: ./pyLoadCore.py:111 +msgid "pycrypto to decode container files" +msgstr "pycrypto aby dekodowaÄ pliki kontenerowe" + +#: ./pyLoadCore.py:112 +msgid "Python Image Libary (PIL) for captha reading" +msgstr "PIL aby odczytywaÄ tokeny (obrazki)" + +#: ./pyLoadCore.py:113 +msgid "pycurl for lower memory footprint while downloading" +msgstr "pycurl aby zmniejszyÄ zuÅŒycie pamiÄci w czasie pobierania" + +#: ./pyLoadCore.py:114 +msgid "Django for webinterface" +msgstr "Django aby mieÄ dostÄp do interfejsu WWW" + +#: ./pyLoadCore.py:115 +msgid "tesseract for captcha reading" +msgstr "tesseract aby odczytywaÄ tokeny (obrazki)" + +#: ./pyLoadCore.py:116 +msgid "gocr for captcha reading" +msgstr "gocr aby odczytywaÄ tokeny (obrazki)" + +#: ./pyLoadCore.py:118 +msgid "folder for logs" +msgstr "katalog na logi" + +#: ./pyLoadCore.py:119 +msgid "folder for downloads" +msgstr "katalog na pobrane pliki" + +#: ./pyLoadCore.py:120 +msgid "file for links" +msgstr "katalog na linki" + +#: ./pyLoadCore.py:121 +msgid "file for failed links" +msgstr "katalog na linki których nie udaÅo siÄ odnaleźÄ" + +#: ./pyLoadCore.py:124 +msgid "OpenSSL for secure connection" +msgstr "OpenSSL dla szyfrowanego poÅÄ
czenia" + +#: ./pyLoadCore.py:125 +msgid "ssl certificate" +msgstr "certyfikat ssl" + +#: ./pyLoadCore.py:126 +msgid "ssl key" +msgstr "klucz ssl" + +#: ./pyLoadCore.py:150 +msgid "Downloadtime: %s" +msgstr "Czas pobierania: %s" + +#: ./pyLoadCore.py:179 +msgid "restarting pyLoad" +msgstr "przeÅadowujÄ pyLoad" + +#: ./pyLoadCore.py:183 +msgid "pyLoad quits" +msgstr "pyLoad zakaÅcza dziaÅanie" + +#: ./pyLoadCore.py:194 +msgid "Secure XMLRPC Server Started" +msgstr "Szyfrowany serwis XMLRPC wystartowaÅ" + +#: ./pyLoadCore.py:197 +msgid "Auth XMLRPC Server Started" +msgstr "Serwis XMLRPC z autentykacjÄ
 wystartowaÅ" + +#: ./pyLoadCore.py:203 +msgid "Failed starting XMLRPC server CLI and GUI will not be available: %s" +msgstr "Nie udaÅo siÄ uruchomiÄ serwisu XMLRPC - CLI i GUI nie bÄdÄ
 dostÄpne: %s" + +#: ./pyLoadCore.py:272 +msgid "%s created" +msgstr "utworzono %s" + +#: ./pyLoadCore.py:275 +msgid "could not find %s: %s" +msgstr "nie moÅŒna znaleÅºÄ %s: %s" + +#: ./pyLoadCore.py:277 +msgid "could not create %s: %s" +msgstr "nie moÅŒna stworzyÄ %s: %s" + +#: ./pyLoadCore.py:305 +msgid "%s added" +msgstr "dodano %s" + +#: ./pyLoadCore.py:306 +msgid "created index of plugins" +msgstr "utworzono indeks wtyczek" + +#: ./pyLoadCore.py:325 +msgid "shutting down..." +msgstr "wyÅÄ
czanie..." + +#: ./pyLoadCore.py:341 +msgid "No Updates for pyLoad" +msgstr "Brak aktualizacji pyLoad" + +#: ./pyLoadCore.py:344 +msgid "New pyLoad Version %s available" +msgstr "DostÄpna nowa wersja %s pyLoad" + +#: ./pyLoadCore.py:369 +msgid "Auto install Failed" +msgstr "Automatyczna instalacja nie powiodÅa siÄ" + +#: ./pyLoadCore.py:607 +msgid "killed pyLoad from Terminal" +msgstr "ubito pyLoad z poziomu terminala" + diff --git a/core/locale/pl/LC_MESSAGES/pyLoadCli.mo b/core/locale/pl/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..f649a4078 --- /dev/null +++ b/core/locale/pl/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/pl/LC_MESSAGES/pyLoadCli.po b/core/locale/pl/LC_MESSAGES/pyLoadCli.po new file mode 100755 index 000000000..64776e317 --- /dev/null +++ b/core/locale/pl/LC_MESSAGES/pyLoadCli.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010 pyLoad Team +# FIRST AUTHOR <bauerj@pyload.org>, 2010. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-04 18:59+CET\n" +"PO-Revision-Date: 2010-03-24 15:42+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: pyLoadCli.py:48 +msgid "pyLoadCore not running" +msgstr "pyLoadCore nie uruchomiony" + +#: pyLoadCli.py:54 +#: pyLoadCli.py:113 +msgid " Command Line Interface" +msgstr "IInterfejs Linii Komend (CLI)" + +#: pyLoadCli.py:115 +msgid "%s Downloads:" +msgstr "%s pobraÅ:" + +#: pyLoadCli.py:125 +msgid " Finished in: " +msgstr "ZakoÅczono w:" + +#: pyLoadCli.py:125 +msgid " ID: " +msgstr "ID:" + +#: pyLoadCli.py:125 +msgid " Size: " +msgstr "Rozmiar:" + +#: pyLoadCli.py:125 +msgid " Speed: " +msgstr "PrÄdkoÅÄ:" + +#: pyLoadCli.py:130 +msgid "waiting: " +msgstr "oczekujÄ
:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " Files in queue: " +msgstr "Pliki w kolejce:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " total Speed: " +msgstr "sumaryczna prÄdkoÅÄ:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid "Status: " +msgstr "Stan:" + +#: pyLoadCli.py:150 +msgid "Menu:" +msgstr "Menu:" + +#: pyLoadCli.py:155 +msgid " Add Links" +msgstr "Dodaj linki" + +#: pyLoadCli.py:157 +msgid " Manage Links" +msgstr "ZarzÄ
dzaj linkami" + +#: pyLoadCli.py:159 +msgid " (Un)Pause Server" +msgstr "Zatrzymaj/Wznów serwer" + +#: pyLoadCli.py:161 +msgid " Kill Server" +msgstr "WyÅÄ
cz serwer" + +#: pyLoadCli.py:163 +msgid " Quit" +msgstr "WyjÅcie" + +#: pyLoadCli.py:173 +msgid "Name your package." +msgstr "Nazwij swój pakiet." + +#: pyLoadCli.py:183 +#: pyLoadCli.py:200 +#: pyLoadCli.py:244 +msgid " back to main menu" +msgstr "powrót do gÅównego menu" + +#: pyLoadCli.py:188 +msgid "Package: %s" +msgstr "Pakiet: %s" + +#: pyLoadCli.py:190 +msgid "Parse the links you want to add." +msgstr "Odczytaj linki które chcesz oddaÄ." + +#: pyLoadCli.py:192 +msgid "Type %s when done." +msgstr "Wypisz %s kiedy ukoÅczone." + +#: pyLoadCli.py:194 +msgid "Links added: " +msgstr "Dodanych linków:" + +#: pyLoadCli.py:206 +msgid "Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it." +msgstr "NaciÅnij d(numer paczki) aby jÄ
 usunÄ
Ä, r aby zrestartowaÄ lub bez d czy r aby do niej zajrzeÄ." + +#: pyLoadCli.py:222 +msgid "Type d(number) of the link you want to delete or r(number) to restart." +msgstr "NaciÅnij d(numer) linku który chcesz usunÄ
Ä lub r(numer) aby link zrestartowaÄ." + +#: pyLoadCli.py:242 +msgid " - next" +msgstr " - nastÄpny" + +#: pyLoadCli.py:242 +msgid " - previous" +msgstr "- poprzedni" + +#: pyLoadCli.py:459 +msgid "Username: " +msgstr "UÅŒytkownik:" + +#: pyLoadCli.py:460 +msgid "Adress: " +msgstr "Adres:" + +#: pyLoadCli.py:461 +msgid "Use SSL? ([y]/n): " +msgstr "UÅŒyÄ SSL? ([y]/n):" + +#: pyLoadCli.py:466 +msgid "Port: " +msgstr "Port:" + +#: pyLoadCli.py:468 +msgid "Password: " +msgstr "HasÅo:" + diff --git a/core/locale/pl/LC_MESSAGES/pyLoadGui.po b/core/locale/pl/LC_MESSAGES/pyLoadGui.po new file mode 100755 index 000000000..700aea0c3 --- /dev/null +++ b/core/locale/pl/LC_MESSAGES/pyLoadGui.po @@ -0,0 +1,261 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: 2010-03-24 15:41+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: ./module/gui/CaptchaDock.py:25 +msgid "Captcha" +msgstr "Token" + +#: ./module/gui/CaptchaDock.py:56 +#: ./module/gui/PWInputWindow.py:28 +msgid "OK" +msgstr "OK" + +#: ./module/gui/CaptchaDock.py:57 +#: ./module/gui/ConnectionManager.py:154 +#: ./module/gui/PWInputWindow.py:29 +msgid "Cancel" +msgstr "Anuluj" + +#: ./module/gui/ConnectionManager.py:33 +msgid "New" +msgstr "Nowy" + +#: ./module/gui/ConnectionManager.py:34 +msgid "Edit" +msgstr "Edytuj" + +#: ./module/gui/ConnectionManager.py:35 +#: ./module/gui/MainWindow.py:191 +#: ./module/gui/MainWindow.py:205 +msgid "Remove" +msgstr "UsuÅ" + +#: ./module/gui/ConnectionManager.py:36 +msgid "Connect" +msgstr "PoÅÄ
cz" + +#: ./module/gui/ConnectionManager.py:76 +msgid "%s (Default)" +msgstr "%s (domyÅlnie)" + +#: ./module/gui/ConnectionManager.py:138 +msgid "Name:" +msgstr "Nazwa:" + +#: ./module/gui/ConnectionManager.py:139 +msgid "Host:" +msgstr "Host:" + +#: ./module/gui/ConnectionManager.py:140 +msgid "SSL:" +msgstr "SSL:" + +#: ./module/gui/ConnectionManager.py:141 +msgid "Local:" +msgstr "Lokalny:" + +#: ./module/gui/ConnectionManager.py:142 +msgid "User:" +msgstr "UÅŒytkownik:" + +#: ./module/gui/ConnectionManager.py:143 +msgid "Port:" +msgstr "Port:" + +#: ./module/gui/ConnectionManager.py:153 +msgid "Save" +msgstr "Zapisz" + +#: ./module/gui/MainWindow.py:33 +msgid "pyLoad Client" +msgstr "Klient pyLoad" + +#: ./module/gui/MainWindow.py:60 +msgid "Status: Not Connected" +msgstr "Status: nie poÅÄ
czony" + +#: ./module/gui/MainWindow.py:65 +msgid "File" +msgstr "Plik" + +#: ./module/gui/MainWindow.py:66 +msgid "Connections" +msgstr "PoÅÄ
czenia" + +#: ./module/gui/MainWindow.py:70 +msgid "Exit" +msgstr "WyjÅcie" + +#: ./module/gui/MainWindow.py:71 +msgid "Connection manager" +msgstr "ZarzÄ
dzanie poÅÄ
czeniami" + +#: ./module/gui/MainWindow.py:88 +msgid "Queue" +msgstr "Kolejka" + +#: ./module/gui/MainWindow.py:89 +msgid "Collector" +msgstr "Kolektor" + +#: ./module/gui/MainWindow.py:90 +msgid "Settings" +msgstr "Ustawienia" + +#: ./module/gui/MainWindow.py:91 +msgid "Log" +msgstr "Log" + +#: ./module/gui/MainWindow.py:117 +msgid "Main Toolbar" +msgstr "GÅówny pasek" + +#: ./module/gui/MainWindow.py:120 +msgid "Toggle Pause/Resume" +msgstr "Wstrzymaj/Wznów" + +#: ./module/gui/MainWindow.py:126 +msgid "Stop" +msgstr "Zatrzymaj" + +#: ./module/gui/MainWindow.py:128 +msgid "Add" +msgstr "Dodaj" + +#: ./module/gui/MainWindow.py:130 +msgid "Check Clipboard" +msgstr "Sprawdź schowek" + +#: ./module/gui/MainWindow.py:137 +msgid "Package" +msgstr "Paczka" + +#: ./module/gui/MainWindow.py:138 +msgid "Links" +msgstr "Linki" + +#: ./module/gui/MainWindow.py:139 +msgid "Container" +msgstr "Kontener" + +#: ./module/gui/MainWindow.py:156 +msgid "Packages" +msgstr "Paczki" + +#: ./module/gui/MainWindow.py:158 +msgid "Push selected packages to queue" +msgstr "WyÅlij wybranÄ
 paczkÄ do kolejki" + +#: ./module/gui/MainWindow.py:192 +msgid "Restart" +msgstr "Restartuj" + +#: ./module/gui/MainWindow.py:193 +msgid "Pull out" +msgstr "Wycofaj" + +#: ./module/gui/MainWindow.py:206 +msgid "Push to queue" +msgstr "WyÅlij do kolejki" + +#: ./module/gui/MainWindow.py:207 +msgid "Edit Name" +msgstr "Edytuj nazwÄ" + +#: ./module/gui/MainWindow.py:277 +msgid "All Container Types (%s)" +msgstr "Wszystkie rodzaje kontenerów (%s)" + +#: ./module/gui/MainWindow.py:278 +msgid "DLC (%s)" +msgstr "DLC (%s)" + +#: ./module/gui/MainWindow.py:279 +msgid "CCF (%s)" +msgstr "CCF (%s)" + +#: ./module/gui/MainWindow.py:280 +msgid "RSDF (%s)" +msgstr "RSDF (%s)" + +#: ./module/gui/MainWindow.py:281 +msgid "Text Files (%s)" +msgstr "Pliki tekstowe (%s)" + +#: ./module/gui/MainWindow.py:283 +msgid "Open container" +msgstr "Otwórz kontener" + +#: ./module/gui/MainWindow.py:306 +msgid "Single Links" +msgstr "PojedyÅcze linki" + +#: ./module/gui/PWInputWindow.py:27 +msgid "Password:" +msgstr "HasÅo:" + +#: ./module/gui/PackageDock.py:24 +msgid "New Package" +msgstr "Nowa paczka" + +#: ./module/gui/PackageDock.py:50 +#: ./pyLoadGui.py:236 +msgid "Name" +msgstr "Nazwa" + +#: ./module/gui/PackageDock.py:53 +msgid "Links in this Package" +msgstr "Linki na tej stronie" + +#: ./module/gui/PackageDock.py:68 +msgid "Create" +msgstr "Utwórz" + +#: ./pyLoadGui.py:236 +msgid "Plugin" +msgstr "Wtyczka" + +#: ./pyLoadGui.py:236 +msgid "Progress" +msgstr "PostÄp" + +#: ./pyLoadGui.py:236 +msgid "Status" +msgstr "Stan" + +#: ./pyLoadGui.py:252 +msgid "Paused" +msgstr "Wstrzymany" + +#: ./pyLoadGui.py:254 +msgid "Running" +msgstr "Uruchomiony" + +#: ./pyLoadGui.py:256 +msgid "Status: %(status)s | Speed: %(speed)s kb/s" +msgstr "Stan: %(status)s | PrÄdkoÅÄ: %(speed)s kb/s" + +#: ./pyLoadGui.py:281 +msgid "Update Available" +msgstr "Jest dostÄpna aktualizacja" + +#: ./pyLoadGui.py:305 +msgid "Unnamed" +msgstr "Bez nazwy" + diff --git a/core/locale/plugins.pot b/core/locale/plugins.pot new file mode 100644 index 000000000..853d2acfd --- /dev/null +++ b/core/locale/plugins.pot @@ -0,0 +1,44 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2010-02-03 15:21+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: ./module/plugins/hooks/ExternalScripts.py:44 +msgid "folders for scripts" +msgstr "" + +#: ./module/plugins/hoster/RapidshareCom.py:50 +msgid "Rapidshare: Use Premium Account (%sGB left)" +msgstr "" + +#: ./module/plugins/hoster/RapidshareCom.py:65 +msgid "Rapidshare: Traffic Share (direct download)" +msgstr "" + +#: ./module/plugins/hoster/RapidshareCom.py:118 +msgid "Rapidshare: Not enough traffic left" +msgstr "" + +#: ./module/plugins/hoster/RapidshareCom.py:138 +msgid "Rapidshare: Already downloading, wait 30 minutes" +msgstr "" + +#: ./module/plugins/hoster/RapidshareCom.py:149 +msgid "Rapidshare: No free slots!" +msgstr "" + +#: ./module/plugins/hoster/UploadedTo.py:139 +msgid "UploadedTo indirect download" +msgstr "" diff --git a/core/locale/ro/LC_MESSAGES/pyLoad.mo b/core/locale/ro/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/ro/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/ro/LC_MESSAGES/pyLoadCli.mo b/core/locale/ro/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/ro/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/ru/LC_MESSAGES/pyLoad.mo b/core/locale/ru/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/ru/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/ru/LC_MESSAGES/pyLoadCli.mo b/core/locale/ru/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..1ae24953f --- /dev/null +++ b/core/locale/ru/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/tr/LC_MESSAGES/pyLoad.mo b/core/locale/tr/LC_MESSAGES/pyLoad.mo Binary files differnew file mode 100644 index 000000000..2c20cfbd4 --- /dev/null +++ b/core/locale/tr/LC_MESSAGES/pyLoad.mo diff --git a/core/locale/tr/LC_MESSAGES/pyLoadCli.mo b/core/locale/tr/LC_MESSAGES/pyLoadCli.mo Binary files differnew file mode 100644 index 000000000..30e94695b --- /dev/null +++ b/core/locale/tr/LC_MESSAGES/pyLoadCli.mo diff --git a/core/locale/tr/LC_MESSAGES/pyLoadCli.po b/core/locale/tr/LC_MESSAGES/pyLoadCli.po new file mode 100755 index 000000000..aa1421ecb --- /dev/null +++ b/core/locale/tr/LC_MESSAGES/pyLoadCli.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-04 18:59+CET\n" +"PO-Revision-Date: 2010-03-24 15:43+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: tr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Pootle 2.0.0\n" +"Generated-By: pygettext.py 1.5\n" + +#: pyLoadCli.py:48 +msgid "pyLoadCore not running" +msgstr "pyLoadCore çalıÅmıyor" + +#: pyLoadCli.py:54 +#: pyLoadCli.py:113 +msgid " Command Line Interface" +msgstr "" + +#: pyLoadCli.py:115 +msgid "%s Downloads:" +msgstr "" + +#: pyLoadCli.py:125 +msgid " Finished in: " +msgstr "BitiÅ zamanı" + +#: pyLoadCli.py:125 +msgid " ID: " +msgstr "" + +#: pyLoadCli.py:125 +msgid " Size: " +msgstr "BÃŒyÃŒklÃŒk:" + +#: pyLoadCli.py:125 +msgid " Speed: " +msgstr "Hız:" + +#: pyLoadCli.py:130 +msgid "waiting: " +msgstr "bekleniyor:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " Files in queue: " +msgstr "Beklemedeki dosyalar:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid " total Speed: " +msgstr "toplam hız:" + +#: pyLoadCli.py:136 +#: pyLoadCli.py:138 +msgid "Status: " +msgstr "StatÃŒ:" + +#: pyLoadCli.py:150 +msgid "Menu:" +msgstr "MenÃŒ:" + +#: pyLoadCli.py:155 +msgid " Add Links" +msgstr "Linkler ekle" + +#: pyLoadCli.py:157 +msgid " Manage Links" +msgstr "Linkleri yönet" + +#: pyLoadCli.py:159 +msgid " (Un)Pause Server" +msgstr "" + +#: pyLoadCli.py:161 +msgid " Kill Server" +msgstr "" + +#: pyLoadCli.py:163 +msgid " Quit" +msgstr "" + +#: pyLoadCli.py:173 +msgid "Name your package." +msgstr "Dosyayı adlandırınız." + +#: pyLoadCli.py:183 +#: pyLoadCli.py:200 +#: pyLoadCli.py:244 +msgid " back to main menu" +msgstr "" + +#: pyLoadCli.py:188 +msgid "Package: %s" +msgstr "" + +#: pyLoadCli.py:190 +msgid "Parse the links you want to add." +msgstr "" + +#: pyLoadCli.py:192 +msgid "Type %s when done." +msgstr "" + +#: pyLoadCli.py:194 +msgid "Links added: " +msgstr "Eklenen linkler:" + +#: pyLoadCli.py:206 +msgid "Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it." +msgstr "" + +#: pyLoadCli.py:222 +msgid "Type d(number) of the link you want to delete or r(number) to restart." +msgstr "" + +#: pyLoadCli.py:242 +msgid " - next" +msgstr "" + +#: pyLoadCli.py:242 +msgid " - previous" +msgstr "önceki" + +#: pyLoadCli.py:459 +msgid "Username: " +msgstr "Kullanıcı adı:" + +#: pyLoadCli.py:460 +msgid "Adress: " +msgstr "Adres:" + +#: pyLoadCli.py:461 +msgid "Use SSL? ([y]/n): " +msgstr "" + +#: pyLoadCli.py:466 +msgid "Port: " +msgstr "" + +#: pyLoadCli.py:468 +msgid "Password: " +msgstr "Åifre:" + diff --git a/core/module/AccountManager.py b/core/module/AccountManager.py new file mode 100644 index 000000000..fc122e760 --- /dev/null +++ b/core/module/AccountManager.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN +""" + +from os.path import exists +from shutil import copy + +ACC_VERSION = 1 + +######################################################################## +class AccountManager(): +	"""manages all accounts""" + +	#---------------------------------------------------------------------- +	def __init__(self, core): +		"""Constructor""" +		 +		self.core = core +		 +		self.accounts = {} # key = ( plugin ) +		self.plugins = {} +		 +		self.initAccountPlugins() +		self.loadAccounts() +		 +		self.saveAccounts() # save to add categories to conf +		 +	#---------------------------------------------------------------------- +	def getAccountPlugin(self, plugin): +		"""get account instance for plugin or None if anonymous""" +		if self.accounts.has_key(plugin): +			if not self.plugins.has_key(plugin): +				self.plugins[plugin] = self.core.pluginManager.getAccountPlugin(plugin)(self, self.accounts[plugin]) +				 +			return self.plugins[plugin] +		else: +			return None +		 +	def getAccountPlugins(self): +		""" get all account instances""" +		 +		plugins = [] +		for plugin in self.accounts.keys(): +			plugins.append(self.getAccountPlugin(plugin)) +			 +		return plugins +	#---------------------------------------------------------------------- +	def loadAccounts(self): +		"""loads all accounts available""" +		 +		if not exists("accounts.conf"): +			f = open("accounts.conf", "wb") +			f.write("version: " + str(ACC_VERSION)) +			f.close() +			 +		f = open("accounts.conf", "rb") +		content = f.readlines() +		 +		version = content.pop(0) +		 +		if int(version.split(":")[1]) < ACC_VERSION: +			copy("accounts.conf", "accounts.backup") +			f.close() +			f = open("accounts.conf", "wb") +			f.write("version: " + str(ACC_VERSION)) +			f.close() +			self.core.log.warning(_("Account settings deleted, due to new config format.")) +			return +			 +			 +		 +		plugin = "" +		account = "" + +		for line in content: +			line = line.strip() +			 +			if not line: continue +			if line.startswith("#"): continue +			if line.startswith("version"): continue +			 +			if line.endswith(":"): +				plugin = line[:-1] +				self.accounts[plugin] = {} +				 +			elif line.startswith("@"): +				option = line[1:].split() +				self.accounts[plugin][name]["options"].append(tuple(option)) +				 +			elif ":" in line: +				name, pw = line.split(":")[:] +				self.accounts[plugin][name] = {"password": pw, "options":  []} +		 +		 +		 +	#---------------------------------------------------------------------- +	def saveAccounts(self): +		"""save all account information""" +		 +		f = open("accounts.conf", "wb") +		f.write("version: " + str(ACC_VERSION) + "\n") +				 +		for plugin, accounts in self.accounts.iteritems(): +			f.write("\n") +			f.write(plugin+":\n") +			 +			for name,data in accounts.iteritems(): +				f.write("\n\t%s:%s\n" % (name,data["password"]) ) +				for option in data["options"]: +					f.write("\t@%s\n" % " ".join(option) ) +					 +		f.close() +			 +		 +	#---------------------------------------------------------------------- +	def initAccountPlugins(self): +		"""init names""" +		for name in self.core.pluginManager.getAccountPlugins(): +			self.accounts[name] = {} +		 +	#---------------------------------------------------------------------- +	def updateAccount(self, plugin , user, password, options): +		"""add or update account""" +		 +		if self.accounts.has_key(plugin): +			p = self.getAccountPlugin(plugin) +			p.updateAccounts(user, password, options) +			 +			if self.accounts[plugin].has_key(user): +				self.accounts[plugin][user]["password"] = password +				self.accounts[plugin][user]["options"] = options +			else: +				self.accounts[plugin][user] = {"password": password, "options": options} +		 +			self.saveAccounts() +				 +	#---------------------------------------------------------------------- +	def removeAccount(self, plugin, user): +		"""remove account""" +		 +		if self.accounts.has_key(plugin): +			p = self.getAccountPlugin(plugin) +			p.removeAccount(user) +			 +			if self.accounts[plugin].has_key(user): +				del self.accounts[plugin][user] +		 +			self.saveAccounts() diff --git a/core/module/BeautifulSoup.py b/core/module/BeautifulSoup.py new file mode 100644 index 000000000..748e6fe4b --- /dev/null +++ b/core/module/BeautifulSoup.py @@ -0,0 +1,2012 @@ +"""Beautiful Soup +Elixir and Tonic +"The Screen-Scraper's Friend" +http://www.crummy.com/software/BeautifulSoup/ + +Beautiful Soup parses a (possibly invalid) XML or HTML document into a +tree representation. It provides methods and Pythonic idioms that make +it easy to navigate, search, and modify the tree. + +A well-formed XML/HTML document yields a well-formed data +structure. An ill-formed XML/HTML document yields a correspondingly +ill-formed data structure. If your document is only locally +well-formed, you can use this library to find and process the +well-formed part of it. + +Beautiful Soup works with Python 2.2 and up. It has no external +dependencies, but you'll have more success at converting data to UTF-8 +if you also install these three packages: + +* chardet, for auto-detecting character encodings +  http://chardet.feedparser.org/ +* cjkcodecs and iconv_codec, which add more encodings to the ones supported +  by stock Python. +  http://cjkpython.i18n.org/ + +Beautiful Soup defines classes for two main parsing strategies: + + * BeautifulStoneSoup, for parsing XML, SGML, or your domain-specific +   language that kind of looks like XML. + + * BeautifulSoup, for parsing run-of-the-mill HTML code, be it valid +   or invalid. This class has web browser-like heuristics for +   obtaining a sensible parse tree in the face of common HTML errors. + +Beautiful Soup also defines a class (UnicodeDammit) for autodetecting +the encoding of an HTML or XML document, and converting it to +Unicode. Much of this code is taken from Mark Pilgrim's Universal Feed Parser. + +For more than you ever wanted to know about Beautiful Soup, see the +documentation: +http://www.crummy.com/software/BeautifulSoup/documentation.html + +Here, have some legalese: + +Copyright (c) 2004-2010, Leonard Richardson + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +  * Redistributions of source code must retain the above copyright +    notice, this list of conditions and the following disclaimer. + +  * Redistributions in binary form must reproduce the above +    copyright notice, this list of conditions and the following +    disclaimer in the documentation and/or other materials provided +    with the distribution. + +  * Neither the name of the the Beautiful Soup Consortium and All +    Night Kosher Bakery nor the names of its contributors may be +    used to endorse or promote products derived from this software +    without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE, DAMMIT. + +""" +from __future__ import generators + +__author__ = "Leonard Richardson (leonardr@segfault.org)" +__version__ = "3.0.8.1" +__copyright__ = "Copyright (c) 2004-2010 Leonard Richardson" +__license__ = "New-style BSD" + +from sgmllib import SGMLParser, SGMLParseError +import codecs +import markupbase +import types +import re +import sgmllib +try: +  from htmlentitydefs import name2codepoint +except ImportError: +  name2codepoint = {} +try: +    set +except NameError: +    from sets import Set as set + +#These hacks make Beautiful Soup able to parse XML with namespaces +sgmllib.tagfind = re.compile('[a-zA-Z][-_.:a-zA-Z0-9]*') +markupbase._declname_match = re.compile(r'[a-zA-Z][-_.:a-zA-Z0-9]*\s*').match + +DEFAULT_OUTPUT_ENCODING = "utf-8" + +def _match_css_class(str): +    """Build a RE to match the given CSS class.""" +    return re.compile(r"(^|.*\s)%s($|\s)" % str) + +# First, the classes that represent markup elements. + +class PageElement(object): +    """Contains the navigational information for some part of the page +    (either a tag or a piece of text)""" + +    def setup(self, parent=None, previous=None): +        """Sets up the initial relations between this element and +        other elements.""" +        self.parent = parent +        self.previous = previous +        self.next = None +        self.previousSibling = None +        self.nextSibling = None +        if self.parent and self.parent.contents: +            self.previousSibling = self.parent.contents[-1] +            self.previousSibling.nextSibling = self + +    def replaceWith(self, replaceWith): +        oldParent = self.parent +        myIndex = self.parent.index(self) +        if hasattr(replaceWith, "parent")\ +                  and replaceWith.parent is self.parent: +            # We're replacing this element with one of its siblings. +            index = replaceWith.parent.index(replaceWith) +            if index and index < myIndex: +                # Furthermore, it comes before this element. That +                # means that when we extract it, the index of this +                # element will change. +                myIndex = myIndex - 1 +        self.extract() +        oldParent.insert(myIndex, replaceWith) + +    def replaceWithChildren(self): +        myParent = self.parent +        myIndex = self.parent.index(self) +        self.extract() +        reversedChildren = list(self.contents) +        reversedChildren.reverse() +        for child in reversedChildren: +            myParent.insert(myIndex, child) + +    def extract(self): +        """Destructively rips this element out of the tree.""" +        if self.parent: +            try: +                del self.parent.contents[self.parent.index(self)] +            except ValueError: +                pass + +        #Find the two elements that would be next to each other if +        #this element (and any children) hadn't been parsed. Connect +        #the two. +        lastChild = self._lastRecursiveChild() +        nextElement = lastChild.next + +        if self.previous: +            self.previous.next = nextElement +        if nextElement: +            nextElement.previous = self.previous +        self.previous = None +        lastChild.next = None + +        self.parent = None +        if self.previousSibling: +            self.previousSibling.nextSibling = self.nextSibling +        if self.nextSibling: +            self.nextSibling.previousSibling = self.previousSibling +        self.previousSibling = self.nextSibling = None +        return self + +    def _lastRecursiveChild(self): +        "Finds the last element beneath this object to be parsed." +        lastChild = self +        while hasattr(lastChild, 'contents') and lastChild.contents: +            lastChild = lastChild.contents[-1] +        return lastChild + +    def insert(self, position, newChild): +        if isinstance(newChild, basestring) \ +            and not isinstance(newChild, NavigableString): +            newChild = NavigableString(newChild) + +        position =  min(position, len(self.contents)) +        if hasattr(newChild, 'parent') and newChild.parent is not None: +            # We're 'inserting' an element that's already one +            # of this object's children. +            if newChild.parent is self: +                index = self.index(newChild) +                if index > position: +                    # Furthermore we're moving it further down the +                    # list of this object's children. That means that +                    # when we extract this element, our target index +                    # will jump down one. +                    position = position - 1 +            newChild.extract() + +        newChild.parent = self +        previousChild = None +        if position == 0: +            newChild.previousSibling = None +            newChild.previous = self +        else: +            previousChild = self.contents[position-1] +            newChild.previousSibling = previousChild +            newChild.previousSibling.nextSibling = newChild +            newChild.previous = previousChild._lastRecursiveChild() +        if newChild.previous: +            newChild.previous.next = newChild + +        newChildsLastElement = newChild._lastRecursiveChild() + +        if position >= len(self.contents): +            newChild.nextSibling = None + +            parent = self +            parentsNextSibling = None +            while not parentsNextSibling: +                parentsNextSibling = parent.nextSibling +                parent = parent.parent +                if not parent: # This is the last element in the document. +                    break +            if parentsNextSibling: +                newChildsLastElement.next = parentsNextSibling +            else: +                newChildsLastElement.next = None +        else: +            nextChild = self.contents[position] +            newChild.nextSibling = nextChild +            if newChild.nextSibling: +                newChild.nextSibling.previousSibling = newChild +            newChildsLastElement.next = nextChild + +        if newChildsLastElement.next: +            newChildsLastElement.next.previous = newChildsLastElement +        self.contents.insert(position, newChild) + +    def append(self, tag): +        """Appends the given tag to the contents of this tag.""" +        self.insert(len(self.contents), tag) + +    def findNext(self, name=None, attrs={}, text=None, **kwargs): +        """Returns the first item that matches the given criteria and +        appears after this Tag in the document.""" +        return self._findOne(self.findAllNext, name, attrs, text, **kwargs) + +    def findAllNext(self, name=None, attrs={}, text=None, limit=None, +                    **kwargs): +        """Returns all items that match the given criteria and appear +        after this Tag in the document.""" +        return self._findAll(name, attrs, text, limit, self.nextGenerator, +                             **kwargs) + +    def findNextSibling(self, name=None, attrs={}, text=None, **kwargs): +        """Returns the closest sibling to this Tag that matches the +        given criteria and appears after this Tag in the document.""" +        return self._findOne(self.findNextSiblings, name, attrs, text, +                             **kwargs) + +    def findNextSiblings(self, name=None, attrs={}, text=None, limit=None, +                         **kwargs): +        """Returns the siblings of this Tag that match the given +        criteria and appear after this Tag in the document.""" +        return self._findAll(name, attrs, text, limit, +                             self.nextSiblingGenerator, **kwargs) +    fetchNextSiblings = findNextSiblings # Compatibility with pre-3.x + +    def findPrevious(self, name=None, attrs={}, text=None, **kwargs): +        """Returns the first item that matches the given criteria and +        appears before this Tag in the document.""" +        return self._findOne(self.findAllPrevious, name, attrs, text, **kwargs) + +    def findAllPrevious(self, name=None, attrs={}, text=None, limit=None, +                        **kwargs): +        """Returns all items that match the given criteria and appear +        before this Tag in the document.""" +        return self._findAll(name, attrs, text, limit, self.previousGenerator, +                           **kwargs) +    fetchPrevious = findAllPrevious # Compatibility with pre-3.x + +    def findPreviousSibling(self, name=None, attrs={}, text=None, **kwargs): +        """Returns the closest sibling to this Tag that matches the +        given criteria and appears before this Tag in the document.""" +        return self._findOne(self.findPreviousSiblings, name, attrs, text, +                             **kwargs) + +    def findPreviousSiblings(self, name=None, attrs={}, text=None, +                             limit=None, **kwargs): +        """Returns the siblings of this Tag that match the given +        criteria and appear before this Tag in the document.""" +        return self._findAll(name, attrs, text, limit, +                             self.previousSiblingGenerator, **kwargs) +    fetchPreviousSiblings = findPreviousSiblings # Compatibility with pre-3.x + +    def findParent(self, name=None, attrs={}, **kwargs): +        """Returns the closest parent of this Tag that matches the given +        criteria.""" +        # NOTE: We can't use _findOne because findParents takes a different +        # set of arguments. +        r = None +        l = self.findParents(name, attrs, 1) +        if l: +            r = l[0] +        return r + +    def findParents(self, name=None, attrs={}, limit=None, **kwargs): +        """Returns the parents of this Tag that match the given +        criteria.""" + +        return self._findAll(name, attrs, None, limit, self.parentGenerator, +                             **kwargs) +    fetchParents = findParents # Compatibility with pre-3.x + +    #These methods do the real heavy lifting. + +    def _findOne(self, method, name, attrs, text, **kwargs): +        r = None +        l = method(name, attrs, text, 1, **kwargs) +        if l: +            r = l[0] +        return r + +    def _findAll(self, name, attrs, text, limit, generator, **kwargs): +        "Iterates over a generator looking for things that match." + +        if isinstance(name, SoupStrainer): +            strainer = name +        # (Possibly) special case some findAll*(...) searches +        elif text is None and not limit and not attrs and not kwargs: +            # findAll*(True) +            if name is True: +                return [element for element in generator() +                        if isinstance(element, Tag)] +            # findAll*('tag-name') +            elif isinstance(name, basestring): +                return [element for element in generator() +                        if isinstance(element, Tag) and +                        element.name == name] +            else: +                strainer = SoupStrainer(name, attrs, text, **kwargs) +        # Build a SoupStrainer +        else: +            strainer = SoupStrainer(name, attrs, text, **kwargs) +        results = ResultSet(strainer) +        g = generator() +        while True: +            try: +                i = g.next() +            except StopIteration: +                break +            if i: +                found = strainer.search(i) +                if found: +                    results.append(found) +                    if limit and len(results) >= limit: +                        break +        return results + +    #These Generators can be used to navigate starting from both +    #NavigableStrings and Tags. +    def nextGenerator(self): +        i = self +        while i is not None: +            i = i.next +            yield i + +    def nextSiblingGenerator(self): +        i = self +        while i is not None: +            i = i.nextSibling +            yield i + +    def previousGenerator(self): +        i = self +        while i is not None: +            i = i.previous +            yield i + +    def previousSiblingGenerator(self): +        i = self +        while i is not None: +            i = i.previousSibling +            yield i + +    def parentGenerator(self): +        i = self +        while i is not None: +            i = i.parent +            yield i + +    # Utility methods +    def substituteEncoding(self, str, encoding=None): +        encoding = encoding or "utf-8" +        return str.replace("%SOUP-ENCODING%", encoding) + +    def toEncoding(self, s, encoding=None): +        """Encodes an object to a string in some encoding, or to Unicode. +        .""" +        if isinstance(s, unicode): +            if encoding: +                s = s.encode(encoding) +        elif isinstance(s, str): +            if encoding: +                s = s.encode(encoding) +            else: +                s = unicode(s) +        else: +            if encoding: +                s  = self.toEncoding(str(s), encoding) +            else: +                s = unicode(s) +        return s + +class NavigableString(unicode, PageElement): + +    def __new__(cls, value): +        """Create a new NavigableString. + +        When unpickling a NavigableString, this method is called with +        the string in DEFAULT_OUTPUT_ENCODING. That encoding needs to be +        passed in to the superclass's __new__ or the superclass won't know +        how to handle non-ASCII characters. +        """ +        if isinstance(value, unicode): +            return unicode.__new__(cls, value) +        return unicode.__new__(cls, value, DEFAULT_OUTPUT_ENCODING) + +    def __getnewargs__(self): +        return (NavigableString.__str__(self),) + +    def __getattr__(self, attr): +        """text.string gives you text. This is for backwards +        compatibility for Navigable*String, but for CData* it lets you +        get the string without the CData wrapper.""" +        if attr == 'string': +            return self +        else: +            raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__.__name__, attr) + +    def __unicode__(self): +        return str(self).decode(DEFAULT_OUTPUT_ENCODING) + +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        if encoding: +            return self.encode(encoding) +        else: +            return self + +class CData(NavigableString): + +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        return "<![CDATA[%s]]>" % NavigableString.__str__(self, encoding) + +class ProcessingInstruction(NavigableString): +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        output = self +        if "%SOUP-ENCODING%" in output: +            output = self.substituteEncoding(output, encoding) +        return "<?%s?>" % self.toEncoding(output, encoding) + +class Comment(NavigableString): +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        return "<!--%s-->" % NavigableString.__str__(self, encoding) + +class Declaration(NavigableString): +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        return "<!%s>" % NavigableString.__str__(self, encoding) + +class Tag(PageElement): + +    """Represents a found HTML tag with its attributes and contents.""" + +    def _invert(h): +        "Cheap function to invert a hash." +        i = {} +        for k,v in h.items(): +            i[v] = k +        return i + +    XML_ENTITIES_TO_SPECIAL_CHARS = { "apos" : "'", +                                      "quot" : '"', +                                      "amp" : "&", +                                      "lt" : "<", +                                      "gt" : ">" } + +    XML_SPECIAL_CHARS_TO_ENTITIES = _invert(XML_ENTITIES_TO_SPECIAL_CHARS) + +    def _convertEntities(self, match): +        """Used in a call to re.sub to replace HTML, XML, and numeric +        entities with the appropriate Unicode characters. If HTML +        entities are being converted, any unrecognized entities are +        escaped.""" +        x = match.group(1) +        if self.convertHTMLEntities and x in name2codepoint: +            return unichr(name2codepoint[x]) +        elif x in self.XML_ENTITIES_TO_SPECIAL_CHARS: +            if self.convertXMLEntities: +                return self.XML_ENTITIES_TO_SPECIAL_CHARS[x] +            else: +                return u'&%s;' % x +        elif len(x) > 0 and x[0] == '#': +            # Handle numeric entities +            if len(x) > 1 and x[1] == 'x': +                return unichr(int(x[2:], 16)) +            else: +                return unichr(int(x[1:])) + +        elif self.escapeUnrecognizedEntities: +            return u'&%s;' % x +        else: +            return u'&%s;' % x + +    def __init__(self, parser, name, attrs=None, parent=None, +                 previous=None): +        "Basic constructor." + +        # We don't actually store the parser object: that lets extracted +        # chunks be garbage-collected +        self.parserClass = parser.__class__ +        self.isSelfClosing = parser.isSelfClosingTag(name) +        self.name = name +        if attrs is None: +            attrs = [] +        self.attrs = attrs +        self.contents = [] +        self.setup(parent, previous) +        self.hidden = False +        self.containsSubstitutions = False +        self.convertHTMLEntities = parser.convertHTMLEntities +        self.convertXMLEntities = parser.convertXMLEntities +        self.escapeUnrecognizedEntities = parser.escapeUnrecognizedEntities + +        # Convert any HTML, XML, or numeric entities in the attribute values. +        convert = lambda(k, val): (k, +                                   re.sub("&(#\d+|#x[0-9a-fA-F]+|\w+);", +                                          self._convertEntities, +                                          val)) +        self.attrs = map(convert, self.attrs) + +    def getString(self): +        if (len(self.contents) == 1 +            and isinstance(self.contents[0], NavigableString)): +            return self.contents[0] + +    def setString(self, string): +        """Replace the contents of the tag with a string""" +        self.clear() +        self.append(string) + +    string = property(getString, setString) + +    def getText(self, separator=u""): +        if not len(self.contents): +            return u"" +        stopNode = self._lastRecursiveChild().next +        strings = [] +        current = self.contents[0] +        while current is not stopNode: +            if isinstance(current, NavigableString): +                strings.append(current.strip()) +            current = current.next +        return separator.join(strings) + +    text = property(getText) + +    def get(self, key, default=None): +        """Returns the value of the 'key' attribute for the tag, or +        the value given for 'default' if it doesn't have that +        attribute.""" +        return self._getAttrMap().get(key, default) + +    def clear(self): +        """Extract all children.""" +        for child in self.contents[:]: +            child.extract() + +    def index(self, element): +        for i, child in enumerate(self.contents): +            if child is element: +                return i +        raise ValueError("Tag.index: element not in tag") + +    def has_key(self, key): +        return self._getAttrMap().has_key(key) + +    def __getitem__(self, key): +        """tag[key] returns the value of the 'key' attribute for the tag, +        and throws an exception if it's not there.""" +        return self._getAttrMap()[key] + +    def __iter__(self): +        "Iterating over a tag iterates over its contents." +        return iter(self.contents) + +    def __len__(self): +        "The length of a tag is the length of its list of contents." +        return len(self.contents) + +    def __contains__(self, x): +        return x in self.contents + +    def __nonzero__(self): +        "A tag is non-None even if it has no contents." +        return True + +    def __setitem__(self, key, value): +        """Setting tag[key] sets the value of the 'key' attribute for the +        tag.""" +        self._getAttrMap() +        self.attrMap[key] = value +        found = False +        for i in range(0, len(self.attrs)): +            if self.attrs[i][0] == key: +                self.attrs[i] = (key, value) +                found = True +        if not found: +            self.attrs.append((key, value)) +        self._getAttrMap()[key] = value + +    def __delitem__(self, key): +        "Deleting tag[key] deletes all 'key' attributes for the tag." +        for item in self.attrs: +            if item[0] == key: +                self.attrs.remove(item) +                #We don't break because bad HTML can define the same +                #attribute multiple times. +            self._getAttrMap() +            if self.attrMap.has_key(key): +                del self.attrMap[key] + +    def __call__(self, *args, **kwargs): +        """Calling a tag like a function is the same as calling its +        findAll() method. Eg. tag('a') returns a list of all the A tags +        found within this tag.""" +        return apply(self.findAll, args, kwargs) + +    def __getattr__(self, tag): +        #print "Getattr %s.%s" % (self.__class__, tag) +        if len(tag) > 3 and tag.rfind('Tag') == len(tag)-3: +            return self.find(tag[:-3]) +        elif tag.find('__') != 0: +            return self.find(tag) +        raise AttributeError, "'%s' object has no attribute '%s'" % (self.__class__, tag) + +    def __eq__(self, other): +        """Returns true iff this tag has the same name, the same attributes, +        and the same contents (recursively) as the given tag. + +        NOTE: right now this will return false if two tags have the +        same attributes in a different order. Should this be fixed?""" +        if other is self: +            return True +        if not hasattr(other, 'name') or not hasattr(other, 'attrs') or not hasattr(other, 'contents') or self.name != other.name or self.attrs != other.attrs or len(self) != len(other): +            return False +        for i in range(0, len(self.contents)): +            if self.contents[i] != other.contents[i]: +                return False +        return True + +    def __ne__(self, other): +        """Returns true iff this tag is not identical to the other tag, +        as defined in __eq__.""" +        return not self == other + +    def __repr__(self, encoding=DEFAULT_OUTPUT_ENCODING): +        """Renders this tag as a string.""" +        return self.__str__(encoding) + +    def __unicode__(self): +        return self.__str__(None) + +    BARE_AMPERSAND_OR_BRACKET = re.compile("([<>]|" +                                           + "&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)" +                                           + ")") + +    def _sub_entity(self, x): +        """Used with a regular expression to substitute the +        appropriate XML entity for an XML special character.""" +        return "&" + self.XML_SPECIAL_CHARS_TO_ENTITIES[x.group(0)[0]] + ";" + +    def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING, +                prettyPrint=False, indentLevel=0): +        """Returns a string or Unicode representation of this tag and +        its contents. To get Unicode, pass None for encoding. + +        NOTE: since Python's HTML parser consumes whitespace, this +        method is not certain to reproduce the whitespace present in +        the original string.""" + +        encodedName = self.toEncoding(self.name, encoding) + +        attrs = [] +        if self.attrs: +            for key, val in self.attrs: +                fmt = '%s="%s"' +                if isinstance(val, basestring): +                    if self.containsSubstitutions and '%SOUP-ENCODING%' in val: +                        val = self.substituteEncoding(val, encoding) + +                    # The attribute value either: +                    # +                    # * Contains no embedded double quotes or single quotes. +                    #   No problem: we enclose it in double quotes. +                    # * Contains embedded single quotes. No problem: +                    #   double quotes work here too. +                    # * Contains embedded double quotes. No problem: +                    #   we enclose it in single quotes. +                    # * Embeds both single _and_ double quotes. This +                    #   can't happen naturally, but it can happen if +                    #   you modify an attribute value after parsing +                    #   the document. Now we have a bit of a +                    #   problem. We solve it by enclosing the +                    #   attribute in single quotes, and escaping any +                    #   embedded single quotes to XML entities. +                    if '"' in val: +                        fmt = "%s='%s'" +                        if "'" in val: +                            # TODO: replace with apos when +                            # appropriate. +                            val = val.replace("'", "&squot;") + +                    # Now we're okay w/r/t quotes. But the attribute +                    # value might also contain angle brackets, or +                    # ampersands that aren't part of entities. We need +                    # to escape those to XML entities too. +                    val = self.BARE_AMPERSAND_OR_BRACKET.sub(self._sub_entity, val) + +                attrs.append(fmt % (self.toEncoding(key, encoding), +                                    self.toEncoding(val, encoding))) +        close = '' +        closeTag = '' +        if self.isSelfClosing: +            close = ' /' +        else: +            closeTag = '</%s>' % encodedName + +        indentTag, indentContents = 0, 0 +        if prettyPrint: +            indentTag = indentLevel +            space = (' ' * (indentTag-1)) +            indentContents = indentTag + 1 +        contents = self.renderContents(encoding, prettyPrint, indentContents) +        if self.hidden: +            s = contents +        else: +            s = [] +            attributeString = '' +            if attrs: +                attributeString = ' ' + ' '.join(attrs) +            if prettyPrint: +                s.append(space) +            s.append('<%s%s%s>' % (encodedName, attributeString, close)) +            if prettyPrint: +                s.append("\n") +            s.append(contents) +            if prettyPrint and contents and contents[-1] != "\n": +                s.append("\n") +            if prettyPrint and closeTag: +                s.append(space) +            s.append(closeTag) +            if prettyPrint and closeTag and self.nextSibling: +                s.append("\n") +            s = ''.join(s) +        return s + +    def decompose(self): +        """Recursively destroys the contents of this tree.""" +        self.extract() +        if len(self.contents) == 0: +            return +        current = self.contents[0] +        while current is not None: +            next = current.next +            if isinstance(current, Tag): +                del current.contents[:] +            current.parent = None +            current.previous = None +            current.previousSibling = None +            current.next = None +            current.nextSibling = None +            current = next + +    def prettify(self, encoding=DEFAULT_OUTPUT_ENCODING): +        return self.__str__(encoding, True) + +    def renderContents(self, encoding=DEFAULT_OUTPUT_ENCODING, +                       prettyPrint=False, indentLevel=0): +        """Renders the contents of this tag as a string in the given +        encoding. If encoding is None, returns a Unicode string..""" +        s=[] +        for c in self: +            text = None +            if isinstance(c, NavigableString): +                text = c.__str__(encoding) +            elif isinstance(c, Tag): +                s.append(c.__str__(encoding, prettyPrint, indentLevel)) +            if text and prettyPrint: +                text = text.strip() +            if text: +                if prettyPrint: +                    s.append(" " * (indentLevel-1)) +                s.append(text) +                if prettyPrint: +                    s.append("\n") +        return ''.join(s) + +    #Soup methods + +    def find(self, name=None, attrs={}, recursive=True, text=None, +             **kwargs): +        """Return only the first child of this Tag matching the given +        criteria.""" +        r = None +        l = self.findAll(name, attrs, recursive, text, 1, **kwargs) +        if l: +            r = l[0] +        return r +    findChild = find + +    def findAll(self, name=None, attrs={}, recursive=True, text=None, +                limit=None, **kwargs): +        """Extracts a list of Tag objects that match the given +        criteria.  You can specify the name of the Tag and any +        attributes you want the Tag to have. + +        The value of a key-value pair in the 'attrs' map can be a +        string, a list of strings, a regular expression object, or a +        callable that takes a string and returns whether or not the +        string matches for some custom definition of 'matches'. The +        same is true of the tag name.""" +        generator = self.recursiveChildGenerator +        if not recursive: +            generator = self.childGenerator +        return self._findAll(name, attrs, text, limit, generator, **kwargs) +    findChildren = findAll + +    # Pre-3.x compatibility methods +    first = find +    fetch = findAll + +    def fetchText(self, text=None, recursive=True, limit=None): +        return self.findAll(text=text, recursive=recursive, limit=limit) + +    def firstText(self, text=None, recursive=True): +        return self.find(text=text, recursive=recursive) + +    #Private methods + +    def _getAttrMap(self): +        """Initializes a map representation of this tag's attributes, +        if not already initialized.""" +        if not getattr(self, 'attrMap'): +            self.attrMap = {} +            for (key, value) in self.attrs: +                self.attrMap[key] = value +        return self.attrMap + +    #Generator methods +    def childGenerator(self): +        # Just use the iterator from the contents +        return iter(self.contents) + +    def recursiveChildGenerator(self): +        if not len(self.contents): +            raise StopIteration +        stopNode = self._lastRecursiveChild().next +        current = self.contents[0] +        while current is not stopNode: +            yield current +            current = current.next + + +# Next, a couple classes to represent queries and their results. +class SoupStrainer: +    """Encapsulates a number of ways of matching a markup element (tag or +    text).""" + +    def __init__(self, name=None, attrs={}, text=None, **kwargs): +        self.name = name +        if isinstance(attrs, basestring): +            kwargs['class'] = _match_css_class(attrs) +            attrs = None +        if kwargs: +            if attrs: +                attrs = attrs.copy() +                attrs.update(kwargs) +            else: +                attrs = kwargs +        self.attrs = attrs +        self.text = text + +    def __str__(self): +        if self.text: +            return self.text +        else: +            return "%s|%s" % (self.name, self.attrs) + +    def searchTag(self, markupName=None, markupAttrs={}): +        found = None +        markup = None +        if isinstance(markupName, Tag): +            markup = markupName +            markupAttrs = markup +        callFunctionWithTagData = callable(self.name) \ +                                and not isinstance(markupName, Tag) + +        if (not self.name) \ +               or callFunctionWithTagData \ +               or (markup and self._matches(markup, self.name)) \ +               or (not markup and self._matches(markupName, self.name)): +            if callFunctionWithTagData: +                match = self.name(markupName, markupAttrs) +            else: +                match = True +                markupAttrMap = None +                for attr, matchAgainst in self.attrs.items(): +                    if not markupAttrMap: +                         if hasattr(markupAttrs, 'get'): +                            markupAttrMap = markupAttrs +                         else: +                            markupAttrMap = {} +                            for k,v in markupAttrs: +                                markupAttrMap[k] = v +                    attrValue = markupAttrMap.get(attr) +                    if not self._matches(attrValue, matchAgainst): +                        match = False +                        break +            if match: +                if markup: +                    found = markup +                else: +                    found = markupName +        return found + +    def search(self, markup): +        #print 'looking for %s in %s' % (self, markup) +        found = None +        # If given a list of items, scan it for a text element that +        # matches. +        if hasattr(markup, "__iter__") \ +                and not isinstance(markup, Tag): +            for element in markup: +                if isinstance(element, NavigableString) \ +                       and self.search(element): +                    found = element +                    break +        # If it's a Tag, make sure its name or attributes match. +        # Don't bother with Tags if we're searching for text. +        elif isinstance(markup, Tag): +            if not self.text: +                found = self.searchTag(markup) +        # If it's text, make sure the text matches. +        elif isinstance(markup, NavigableString) or \ +                 isinstance(markup, basestring): +            if self._matches(markup, self.text): +                found = markup +        else: +            raise Exception, "I don't know how to match against a %s" \ +                  % markup.__class__ +        return found + +    def _matches(self, markup, matchAgainst): +        #print "Matching %s against %s" % (markup, matchAgainst) +        result = False +        if matchAgainst is True: +            result = markup is not None +        elif callable(matchAgainst): +            result = matchAgainst(markup) +        else: +            #Custom match methods take the tag as an argument, but all +            #other ways of matching match the tag name as a string. +            if isinstance(markup, Tag): +                markup = markup.name +            if markup and not isinstance(markup, basestring): +                markup = unicode(markup) +            #Now we know that chunk is either a string, or None. +            if hasattr(matchAgainst, 'match'): +                # It's a regexp object. +                result = markup and matchAgainst.search(markup) +            elif hasattr(matchAgainst, '__iter__'): # list-like +                result = markup in matchAgainst +            elif hasattr(matchAgainst, 'items'): +                result = markup.has_key(matchAgainst) +            elif matchAgainst and isinstance(markup, basestring): +                if isinstance(markup, unicode): +                    matchAgainst = unicode(matchAgainst) +                else: +                    matchAgainst = str(matchAgainst) + +            if not result: +                result = matchAgainst == markup +        return result + +class ResultSet(list): +    """A ResultSet is just a list that keeps track of the SoupStrainer +    that created it.""" +    def __init__(self, source): +        list.__init__([]) +        self.source = source + +# Now, some helper functions. + +def buildTagMap(default, *args): +    """Turns a list of maps, lists, or scalars into a single map. +    Used to build the SELF_CLOSING_TAGS, NESTABLE_TAGS, and +    NESTING_RESET_TAGS maps out of lists and partial maps.""" +    built = {} +    for portion in args: +        if hasattr(portion, 'items'): +            #It's a map. Merge it. +            for k,v in portion.items(): +                built[k] = v +        elif hasattr(portion, '__iter__'): # is a list +            #It's a list. Map each item to the default. +            for k in portion: +                built[k] = default +        else: +            #It's a scalar. Map it to the default. +            built[portion] = default +    return built + +# Now, the parser classes. + +class BeautifulStoneSoup(Tag, SGMLParser): + +    """This class contains the basic parser and search code. It defines +    a parser that knows nothing about tag behavior except for the +    following: + +      You can't close a tag without closing all the tags it encloses. +      That is, "<foo><bar></foo>" actually means +      "<foo><bar></bar></foo>". + +    [Another possible explanation is "<foo><bar /></foo>", but since +    this class defines no SELF_CLOSING_TAGS, it will never use that +    explanation.] + +    This class is useful for parsing XML or made-up markup languages, +    or when BeautifulSoup makes an assumption counter to what you were +    expecting.""" + +    SELF_CLOSING_TAGS = {} +    NESTABLE_TAGS = {} +    RESET_NESTING_TAGS = {} +    QUOTE_TAGS = {} +    PRESERVE_WHITESPACE_TAGS = [] + +    MARKUP_MASSAGE = [(re.compile('(<[^<>]*)/>'), +                       lambda x: x.group(1) + ' />'), +                      (re.compile('<!\s+([^<>]*)>'), +                       lambda x: '<!' + x.group(1) + '>') +                      ] + +    ROOT_TAG_NAME = u'[document]' + +    HTML_ENTITIES = "html" +    XML_ENTITIES = "xml" +    XHTML_ENTITIES = "xhtml" +    # TODO: This only exists for backwards-compatibility +    ALL_ENTITIES = XHTML_ENTITIES + +    # Used when determining whether a text node is all whitespace and +    # can be replaced with a single space. A text node that contains +    # fancy Unicode spaces (usually non-breaking) should be left +    # alone. +    STRIP_ASCII_SPACES = { 9: None, 10: None, 12: None, 13: None, 32: None, } + +    def __init__(self, markup="", parseOnlyThese=None, fromEncoding=None, +                 markupMassage=True, smartQuotesTo=XML_ENTITIES, +                 convertEntities=None, selfClosingTags=None, isHTML=False): +        """The Soup object is initialized as the 'root tag', and the +        provided markup (which can be a string or a file-like object) +        is fed into the underlying parser. + +        sgmllib will process most bad HTML, and the BeautifulSoup +        class has some tricks for dealing with some HTML that kills +        sgmllib, but Beautiful Soup can nonetheless choke or lose data +        if your data uses self-closing tags or declarations +        incorrectly. + +        By default, Beautiful Soup uses regexes to sanitize input, +        avoiding the vast majority of these problems. If the problems +        don't apply to you, pass in False for markupMassage, and +        you'll get better performance. + +        The default parser massage techniques fix the two most common +        instances of invalid HTML that choke sgmllib: + +         <br/> (No space between name of closing tag and tag close) +         <! --Comment--> (Extraneous whitespace in declaration) + +        You can pass in a custom list of (RE object, replace method) +        tuples to get Beautiful Soup to scrub your input the way you +        want.""" + +        self.parseOnlyThese = parseOnlyThese +        self.fromEncoding = fromEncoding +        self.smartQuotesTo = smartQuotesTo +        self.convertEntities = convertEntities +        # Set the rules for how we'll deal with the entities we +        # encounter +        if self.convertEntities: +            # It doesn't make sense to convert encoded characters to +            # entities even while you're converting entities to Unicode. +            # Just convert it all to Unicode. +            self.smartQuotesTo = None +            if convertEntities == self.HTML_ENTITIES: +                self.convertXMLEntities = False +                self.convertHTMLEntities = True +                self.escapeUnrecognizedEntities = True +            elif convertEntities == self.XHTML_ENTITIES: +                self.convertXMLEntities = True +                self.convertHTMLEntities = True +                self.escapeUnrecognizedEntities = False +            elif convertEntities == self.XML_ENTITIES: +                self.convertXMLEntities = True +                self.convertHTMLEntities = False +                self.escapeUnrecognizedEntities = False +        else: +            self.convertXMLEntities = False +            self.convertHTMLEntities = False +            self.escapeUnrecognizedEntities = False + +        self.instanceSelfClosingTags = buildTagMap(None, selfClosingTags) +        SGMLParser.__init__(self) + +        if hasattr(markup, 'read'):        # It's a file-type object. +            markup = markup.read() +        self.markup = markup +        self.markupMassage = markupMassage +        try: +            self._feed(isHTML=isHTML) +        except StopParsing: +            pass +        self.markup = None                 # The markup can now be GCed + +    def convert_charref(self, name): +        """This method fixes a bug in Python's SGMLParser.""" +        try: +            n = int(name) +        except ValueError: +            return +        if not 0 <= n <= 127 : # ASCII ends at 127, not 255 +            return +        return self.convert_codepoint(n) + +    def _feed(self, inDocumentEncoding=None, isHTML=False): +        # Convert the document to Unicode. +        markup = self.markup +        if isinstance(markup, unicode): +            if not hasattr(self, 'originalEncoding'): +                self.originalEncoding = None +        else: +            dammit = UnicodeDammit\ +                     (markup, [self.fromEncoding, inDocumentEncoding], +                      smartQuotesTo=self.smartQuotesTo, isHTML=isHTML) +            markup = dammit.unicode +            self.originalEncoding = dammit.originalEncoding +            self.declaredHTMLEncoding = dammit.declaredHTMLEncoding +        if markup: +            if self.markupMassage: +                if not hasattr(self.markupMassage, "__iter__"): +                    self.markupMassage = self.MARKUP_MASSAGE +                for fix, m in self.markupMassage: +                    markup = fix.sub(m, markup) +                # TODO: We get rid of markupMassage so that the +                # soup object can be deepcopied later on. Some +                # Python installations can't copy regexes. If anyone +                # was relying on the existence of markupMassage, this +                # might cause problems. +                del(self.markupMassage) +        self.reset() + +        SGMLParser.feed(self, markup) +        # Close out any unfinished strings and close all the open tags. +        self.endData() +        while self.currentTag.name != self.ROOT_TAG_NAME: +            self.popTag() + +    def __getattr__(self, methodName): +        """This method routes method call requests to either the SGMLParser +        superclass or the Tag superclass, depending on the method name.""" +        #print "__getattr__ called on %s.%s" % (self.__class__, methodName) + +        if methodName.startswith('start_') or methodName.startswith('end_') \ +               or methodName.startswith('do_'): +            return SGMLParser.__getattr__(self, methodName) +        elif not methodName.startswith('__'): +            return Tag.__getattr__(self, methodName) +        else: +            raise AttributeError + +    def isSelfClosingTag(self, name): +        """Returns true iff the given string is the name of a +        self-closing tag according to this parser.""" +        return self.SELF_CLOSING_TAGS.has_key(name) \ +               or self.instanceSelfClosingTags.has_key(name) + +    def reset(self): +        Tag.__init__(self, self, self.ROOT_TAG_NAME) +        self.hidden = 1 +        SGMLParser.reset(self) +        self.currentData = [] +        self.currentTag = None +        self.tagStack = [] +        self.quoteStack = [] +        self.pushTag(self) + +    def popTag(self): +        tag = self.tagStack.pop() + +        #print "Pop", tag.name +        if self.tagStack: +            self.currentTag = self.tagStack[-1] +        return self.currentTag + +    def pushTag(self, tag): +        #print "Push", tag.name +        if self.currentTag: +            self.currentTag.contents.append(tag) +        self.tagStack.append(tag) +        self.currentTag = self.tagStack[-1] + +    def endData(self, containerClass=NavigableString): +        if self.currentData: +            currentData = u''.join(self.currentData) +            if (currentData.translate(self.STRIP_ASCII_SPACES) == '' and +                not set([tag.name for tag in self.tagStack]).intersection( +                    self.PRESERVE_WHITESPACE_TAGS)): +                if '\n' in currentData: +                    currentData = '\n' +                else: +                    currentData = ' ' +            self.currentData = [] +            if self.parseOnlyThese and len(self.tagStack) <= 1 and \ +                   (not self.parseOnlyThese.text or \ +                    not self.parseOnlyThese.search(currentData)): +                return +            o = containerClass(currentData) +            o.setup(self.currentTag, self.previous) +            if self.previous: +                self.previous.next = o +            self.previous = o +            self.currentTag.contents.append(o) + + +    def _popToTag(self, name, inclusivePop=True): +        """Pops the tag stack up to and including the most recent +        instance of the given tag. If inclusivePop is false, pops the tag +        stack up to but *not* including the most recent instqance of +        the given tag.""" +        #print "Popping to %s" % name +        if name == self.ROOT_TAG_NAME: +            return + +        numPops = 0 +        mostRecentTag = None +        for i in range(len(self.tagStack)-1, 0, -1): +            if name == self.tagStack[i].name: +                numPops = len(self.tagStack)-i +                break +        if not inclusivePop: +            numPops = numPops - 1 + +        for i in range(0, numPops): +            mostRecentTag = self.popTag() +        return mostRecentTag + +    def _smartPop(self, name): + +        """We need to pop up to the previous tag of this type, unless +        one of this tag's nesting reset triggers comes between this +        tag and the previous tag of this type, OR unless this tag is a +        generic nesting trigger and another generic nesting trigger +        comes between this tag and the previous tag of this type. + +        Examples: +         <p>Foo<b>Bar *<p>* should pop to 'p', not 'b'. +         <p>Foo<table>Bar *<p>* should pop to 'table', not 'p'. +         <p>Foo<table><tr>Bar *<p>* should pop to 'tr', not 'p'. + +         <li><ul><li> *<li>* should pop to 'ul', not the first 'li'. +         <tr><table><tr> *<tr>* should pop to 'table', not the first 'tr' +         <td><tr><td> *<td>* should pop to 'tr', not the first 'td' +        """ + +        nestingResetTriggers = self.NESTABLE_TAGS.get(name) +        isNestable = nestingResetTriggers != None +        isResetNesting = self.RESET_NESTING_TAGS.has_key(name) +        popTo = None +        inclusive = True +        for i in range(len(self.tagStack)-1, 0, -1): +            p = self.tagStack[i] +            if (not p or p.name == name) and not isNestable: +                #Non-nestable tags get popped to the top or to their +                #last occurance. +                popTo = name +                break +            if (nestingResetTriggers is not None +                and p.name in nestingResetTriggers) \ +                or (nestingResetTriggers is None and isResetNesting +                    and self.RESET_NESTING_TAGS.has_key(p.name)): + +                #If we encounter one of the nesting reset triggers +                #peculiar to this tag, or we encounter another tag +                #that causes nesting to reset, pop up to but not +                #including that tag. +                popTo = p.name +                inclusive = False +                break +            p = p.parent +        if popTo: +            self._popToTag(popTo, inclusive) + +    def unknown_starttag(self, name, attrs, selfClosing=0): +        #print "Start tag %s: %s" % (name, attrs) +        if self.quoteStack: +            #This is not a real tag. +            #print "<%s> is not real!" % name +            attrs = ''.join([' %s="%s"' % (x, y) for x, y in attrs]) +            self.handle_data('<%s%s>' % (name, attrs)) +            return +        self.endData() + +        if not self.isSelfClosingTag(name) and not selfClosing: +            self._smartPop(name) + +        if self.parseOnlyThese and len(self.tagStack) <= 1 \ +               and (self.parseOnlyThese.text or not self.parseOnlyThese.searchTag(name, attrs)): +            return + +        tag = Tag(self, name, attrs, self.currentTag, self.previous) +        if self.previous: +            self.previous.next = tag +        self.previous = tag +        self.pushTag(tag) +        if selfClosing or self.isSelfClosingTag(name): +            self.popTag() +        if name in self.QUOTE_TAGS: +            #print "Beginning quote (%s)" % name +            self.quoteStack.append(name) +            self.literal = 1 +        return tag + +    def unknown_endtag(self, name): +        #print "End tag %s" % name +        if self.quoteStack and self.quoteStack[-1] != name: +            #This is not a real end tag. +            #print "</%s> is not real!" % name +            self.handle_data('</%s>' % name) +            return +        self.endData() +        self._popToTag(name) +        if self.quoteStack and self.quoteStack[-1] == name: +            self.quoteStack.pop() +            self.literal = (len(self.quoteStack) > 0) + +    def handle_data(self, data): +        self.currentData.append(data) + +    def _toStringSubclass(self, text, subclass): +        """Adds a certain piece of text to the tree as a NavigableString +        subclass.""" +        self.endData() +        self.handle_data(text) +        self.endData(subclass) + +    def handle_pi(self, text): +        """Handle a processing instruction as a ProcessingInstruction +        object, possibly one with a %SOUP-ENCODING% slot into which an +        encoding will be plugged later.""" +        if text[:3] == "xml": +            text = u"xml version='1.0' encoding='%SOUP-ENCODING%'" +        self._toStringSubclass(text, ProcessingInstruction) + +    def handle_comment(self, text): +        "Handle comments as Comment objects." +        self._toStringSubclass(text, Comment) + +    def handle_charref(self, ref): +        "Handle character references as data." +        if self.convertEntities: +            data = unichr(int(ref)) +        else: +            data = '&#%s;' % ref +        self.handle_data(data) + +    def handle_entityref(self, ref): +        """Handle entity references as data, possibly converting known +        HTML and/or XML entity references to the corresponding Unicode +        characters.""" +        data = None +        if self.convertHTMLEntities: +            try: +                data = unichr(name2codepoint[ref]) +            except KeyError: +                pass + +        if not data and self.convertXMLEntities: +                data = self.XML_ENTITIES_TO_SPECIAL_CHARS.get(ref) + +        if not data and self.convertHTMLEntities and \ +            not self.XML_ENTITIES_TO_SPECIAL_CHARS.get(ref): +                # TODO: We've got a problem here. We're told this is +                # an entity reference, but it's not an XML entity +                # reference or an HTML entity reference. Nonetheless, +                # the logical thing to do is to pass it through as an +                # unrecognized entity reference. +                # +                # Except: when the input is "&carol;" this function +                # will be called with input "carol". When the input is +                # "AT&T", this function will be called with input +                # "T". We have no way of knowing whether a semicolon +                # was present originally, so we don't know whether +                # this is an unknown entity or just a misplaced +                # ampersand. +                # +                # The more common case is a misplaced ampersand, so I +                # escape the ampersand and omit the trailing semicolon. +                data = "&%s" % ref +        if not data: +            # This case is different from the one above, because we +            # haven't already gone through a supposedly comprehensive +            # mapping of entities to Unicode characters. We might not +            # have gone through any mapping at all. So the chances are +            # very high that this is a real entity, and not a +            # misplaced ampersand. +            data = "&%s;" % ref +        self.handle_data(data) + +    def handle_decl(self, data): +        "Handle DOCTYPEs and the like as Declaration objects." +        self._toStringSubclass(data, Declaration) + +    def parse_declaration(self, i): +        """Treat a bogus SGML declaration as raw data. Treat a CDATA +        declaration as a CData object.""" +        j = None +        if self.rawdata[i:i+9] == '<![CDATA[': +             k = self.rawdata.find(']]>', i) +             if k == -1: +                 k = len(self.rawdata) +             data = self.rawdata[i+9:k] +             j = k+3 +             self._toStringSubclass(data, CData) +        else: +            try: +                j = SGMLParser.parse_declaration(self, i) +            except SGMLParseError: +                toHandle = self.rawdata[i:] +                self.handle_data(toHandle) +                j = i + len(toHandle) +        return j + +class BeautifulSoup(BeautifulStoneSoup): + +    """This parser knows the following facts about HTML: + +    * Some tags have no closing tag and should be interpreted as being +      closed as soon as they are encountered. + +    * The text inside some tags (ie. 'script') may contain tags which +      are not really part of the document and which should be parsed +      as text, not tags. If you want to parse the text as tags, you can +      always fetch it and parse it explicitly. + +    * Tag nesting rules: + +      Most tags can't be nested at all. For instance, the occurance of +      a <p> tag should implicitly close the previous <p> tag. + +       <p>Para1<p>Para2 +        should be transformed into: +       <p>Para1</p><p>Para2 + +      Some tags can be nested arbitrarily. For instance, the occurance +      of a <blockquote> tag should _not_ implicitly close the previous +      <blockquote> tag. + +       Alice said: <blockquote>Bob said: <blockquote>Blah +        should NOT be transformed into: +       Alice said: <blockquote>Bob said: </blockquote><blockquote>Blah + +      Some tags can be nested, but the nesting is reset by the +      interposition of other tags. For instance, a <tr> tag should +      implicitly close the previous <tr> tag within the same <table>, +      but not close a <tr> tag in another table. + +       <table><tr>Blah<tr>Blah +        should be transformed into: +       <table><tr>Blah</tr><tr>Blah +        but, +       <tr>Blah<table><tr>Blah +        should NOT be transformed into +       <tr>Blah<table></tr><tr>Blah + +    Differing assumptions about tag nesting rules are a major source +    of problems with the BeautifulSoup class. If BeautifulSoup is not +    treating as nestable a tag your page author treats as nestable, +    try ICantBelieveItsBeautifulSoup, MinimalSoup, or +    BeautifulStoneSoup before writing your own subclass.""" + +    def __init__(self, *args, **kwargs): +        if not kwargs.has_key('smartQuotesTo'): +            kwargs['smartQuotesTo'] = self.HTML_ENTITIES +        kwargs['isHTML'] = True +        BeautifulStoneSoup.__init__(self, *args, **kwargs) + +    SELF_CLOSING_TAGS = buildTagMap(None, +                                    ('br' , 'hr', 'input', 'img', 'meta', +                                    'spacer', 'link', 'frame', 'base', 'col')) + +    PRESERVE_WHITESPACE_TAGS = set(['pre', 'textarea']) + +    QUOTE_TAGS = {'script' : None, 'textarea' : None} + +    #According to the HTML standard, each of these inline tags can +    #contain another tag of the same type. Furthermore, it's common +    #to actually use these tags this way. +    NESTABLE_INLINE_TAGS = ('span', 'font', 'q', 'object', 'bdo', 'sub', 'sup', +                            'center') + +    #According to the HTML standard, these block tags can contain +    #another tag of the same type. Furthermore, it's common +    #to actually use these tags this way. +    NESTABLE_BLOCK_TAGS = ('blockquote', 'div', 'fieldset', 'ins', 'del') + +    #Lists can contain other lists, but there are restrictions. +    NESTABLE_LIST_TAGS = { 'ol' : [], +                           'ul' : [], +                           'li' : ['ul', 'ol'], +                           'dl' : [], +                           'dd' : ['dl'], +                           'dt' : ['dl'] } + +    #Tables can contain other tables, but there are restrictions. +    NESTABLE_TABLE_TAGS = {'table' : [], +                           'tr' : ['table', 'tbody', 'tfoot', 'thead'], +                           'td' : ['tr'], +                           'th' : ['tr'], +                           'thead' : ['table'], +                           'tbody' : ['table'], +                           'tfoot' : ['table'], +                           } + +    NON_NESTABLE_BLOCK_TAGS = ('address', 'form', 'p', 'pre') + +    #If one of these tags is encountered, all tags up to the next tag of +    #this type are popped. +    RESET_NESTING_TAGS = buildTagMap(None, NESTABLE_BLOCK_TAGS, 'noscript', +                                     NON_NESTABLE_BLOCK_TAGS, +                                     NESTABLE_LIST_TAGS, +                                     NESTABLE_TABLE_TAGS) + +    NESTABLE_TAGS = buildTagMap([], NESTABLE_INLINE_TAGS, NESTABLE_BLOCK_TAGS, +                                NESTABLE_LIST_TAGS, NESTABLE_TABLE_TAGS) + +    # Used to detect the charset in a META tag; see start_meta +    CHARSET_RE = re.compile("((^|;)\s*charset=)([^;]*)", re.M) + +    def start_meta(self, attrs): +        """Beautiful Soup can detect a charset included in a META tag, +        try to convert the document to that charset, and re-parse the +        document from the beginning.""" +        httpEquiv = None +        contentType = None +        contentTypeIndex = None +        tagNeedsEncodingSubstitution = False + +        for i in range(0, len(attrs)): +            key, value = attrs[i] +            key = key.lower() +            if key == 'http-equiv': +                httpEquiv = value +            elif key == 'content': +                contentType = value +                contentTypeIndex = i + +        if httpEquiv and contentType: # It's an interesting meta tag. +            match = self.CHARSET_RE.search(contentType) +            if match: +                if (self.declaredHTMLEncoding is not None or +                    self.originalEncoding == self.fromEncoding): +                    # An HTML encoding was sniffed while converting +                    # the document to Unicode, or an HTML encoding was +                    # sniffed during a previous pass through the +                    # document, or an encoding was specified +                    # explicitly and it worked. Rewrite the meta tag. +                    def rewrite(match): +                        return match.group(1) + "%SOUP-ENCODING%" +                    newAttr = self.CHARSET_RE.sub(rewrite, contentType) +                    attrs[contentTypeIndex] = (attrs[contentTypeIndex][0], +                                               newAttr) +                    tagNeedsEncodingSubstitution = True +                else: +                    # This is our first pass through the document. +                    # Go through it again with the encoding information. +                    newCharset = match.group(3) +                    if newCharset and newCharset != self.originalEncoding: +                        self.declaredHTMLEncoding = newCharset +                        self._feed(self.declaredHTMLEncoding) +                        raise StopParsing +                    pass +        tag = self.unknown_starttag("meta", attrs) +        if tag and tagNeedsEncodingSubstitution: +            tag.containsSubstitutions = True + +class StopParsing(Exception): +    pass + +class ICantBelieveItsBeautifulSoup(BeautifulSoup): + +    """The BeautifulSoup class is oriented towards skipping over +    common HTML errors like unclosed tags. However, sometimes it makes +    errors of its own. For instance, consider this fragment: + +     <b>Foo<b>Bar</b></b> + +    This is perfectly valid (if bizarre) HTML. However, the +    BeautifulSoup class will implicitly close the first b tag when it +    encounters the second 'b'. It will think the author wrote +    "<b>Foo<b>Bar", and didn't close the first 'b' tag, because +    there's no real-world reason to bold something that's already +    bold. When it encounters '</b></b>' it will close two more 'b' +    tags, for a grand total of three tags closed instead of two. This +    can throw off the rest of your document structure. The same is +    true of a number of other tags, listed below. + +    It's much more common for someone to forget to close a 'b' tag +    than to actually use nested 'b' tags, and the BeautifulSoup class +    handles the common case. This class handles the not-co-common +    case: where you can't believe someone wrote what they did, but +    it's valid HTML and BeautifulSoup screwed up by assuming it +    wouldn't be.""" + +    I_CANT_BELIEVE_THEYRE_NESTABLE_INLINE_TAGS = \ +     ('em', 'big', 'i', 'small', 'tt', 'abbr', 'acronym', 'strong', +      'cite', 'code', 'dfn', 'kbd', 'samp', 'strong', 'var', 'b', +      'big') + +    I_CANT_BELIEVE_THEYRE_NESTABLE_BLOCK_TAGS = ('noscript',) + +    NESTABLE_TAGS = buildTagMap([], BeautifulSoup.NESTABLE_TAGS, +                                I_CANT_BELIEVE_THEYRE_NESTABLE_BLOCK_TAGS, +                                I_CANT_BELIEVE_THEYRE_NESTABLE_INLINE_TAGS) + +class MinimalSoup(BeautifulSoup): +    """The MinimalSoup class is for parsing HTML that contains +    pathologically bad markup. It makes no assumptions about tag +    nesting, but it does know which tags are self-closing, that +    <script> tags contain Javascript and should not be parsed, that +    META tags may contain encoding information, and so on. + +    This also makes it better for subclassing than BeautifulStoneSoup +    or BeautifulSoup.""" + +    RESET_NESTING_TAGS = buildTagMap('noscript') +    NESTABLE_TAGS = {} + +class BeautifulSOAP(BeautifulStoneSoup): +    """This class will push a tag with only a single string child into +    the tag's parent as an attribute. The attribute's name is the tag +    name, and the value is the string child. An example should give +    the flavor of the change: + +    <foo><bar>baz</bar></foo> +     => +    <foo bar="baz"><bar>baz</bar></foo> + +    You can then access fooTag['bar'] instead of fooTag.barTag.string. + +    This is, of course, useful for scraping structures that tend to +    use subelements instead of attributes, such as SOAP messages. Note +    that it modifies its input, so don't print the modified version +    out. + +    I'm not sure how many people really want to use this class; let me +    know if you do. Mainly I like the name.""" + +    def popTag(self): +        if len(self.tagStack) > 1: +            tag = self.tagStack[-1] +            parent = self.tagStack[-2] +            parent._getAttrMap() +            if (isinstance(tag, Tag) and len(tag.contents) == 1 and +                isinstance(tag.contents[0], NavigableString) and +                not parent.attrMap.has_key(tag.name)): +                parent[tag.name] = tag.contents[0] +        BeautifulStoneSoup.popTag(self) + +#Enterprise class names! It has come to our attention that some people +#think the names of the Beautiful Soup parser classes are too silly +#and "unprofessional" for use in enterprise screen-scraping. We feel +#your pain! For such-minded folk, the Beautiful Soup Consortium And +#All-Night Kosher Bakery recommends renaming this file to +#"RobustParser.py" (or, in cases of extreme enterprisiness, +#"RobustParserBeanInterface.class") and using the following +#enterprise-friendly class aliases: +class RobustXMLParser(BeautifulStoneSoup): +    pass +class RobustHTMLParser(BeautifulSoup): +    pass +class RobustWackAssHTMLParser(ICantBelieveItsBeautifulSoup): +    pass +class RobustInsanelyWackAssHTMLParser(MinimalSoup): +    pass +class SimplifyingSOAPParser(BeautifulSOAP): +    pass + +###################################################### +# +# Bonus library: Unicode, Dammit +# +# This class forces XML data into a standard format (usually to UTF-8 +# or Unicode).  It is heavily based on code from Mark Pilgrim's +# Universal Feed Parser. It does not rewrite the XML or HTML to +# reflect a new encoding: that happens in BeautifulStoneSoup.handle_pi +# (XML) and BeautifulSoup.start_meta (HTML). + +# Autodetects character encodings. +# Download from http://chardet.feedparser.org/ +try: +    import chardet +#    import chardet.constants +#    chardet.constants._debug = 1 +except ImportError: +    chardet = None + +# cjkcodecs and iconv_codec make Python know about more character encodings. +# Both are available from http://cjkpython.i18n.org/ +# They're built in if you use Python 2.4. +try: +    import cjkcodecs.aliases +except ImportError: +    pass +try: +    import iconv_codec +except ImportError: +    pass + +class UnicodeDammit: +    """A class for detecting the encoding of a *ML document and +    converting it to a Unicode string. If the source encoding is +    windows-1252, can replace MS smart quotes with their HTML or XML +    equivalents.""" + +    # This dictionary maps commonly seen values for "charset" in HTML +    # meta tags to the corresponding Python codec names. It only covers +    # values that aren't in Python's aliases and can't be determined +    # by the heuristics in find_codec. +    CHARSET_ALIASES = { "macintosh" : "mac-roman", +                        "x-sjis" : "shift-jis" } + +    def __init__(self, markup, overrideEncodings=[], +                 smartQuotesTo='xml', isHTML=False): +        self.declaredHTMLEncoding = None +        self.markup, documentEncoding, sniffedEncoding = \ +                     self._detectEncoding(markup, isHTML) +        self.smartQuotesTo = smartQuotesTo +        self.triedEncodings = [] +        if markup == '' or isinstance(markup, unicode): +            self.originalEncoding = None +            self.unicode = unicode(markup) +            return + +        u = None +        for proposedEncoding in overrideEncodings: +            u = self._convertFrom(proposedEncoding) +            if u: break +        if not u: +            for proposedEncoding in (documentEncoding, sniffedEncoding): +                u = self._convertFrom(proposedEncoding) +                if u: break + +        # If no luck and we have auto-detection library, try that: +        if not u and chardet and not isinstance(self.markup, unicode): +            u = self._convertFrom(chardet.detect(self.markup)['encoding']) + +        # As a last resort, try utf-8 and windows-1252: +        if not u: +            for proposed_encoding in ("utf-8", "windows-1252"): +                u = self._convertFrom(proposed_encoding) +                if u: break + +        self.unicode = u +        if not u: self.originalEncoding = None + +    def _subMSChar(self, orig): +        """Changes a MS smart quote character to an XML or HTML +        entity.""" +        sub = self.MS_CHARS.get(orig) +        if isinstance(sub, tuple): +            if self.smartQuotesTo == 'xml': +                sub = '&#x%s;' % sub[1] +            else: +                sub = '&%s;' % sub[0] +        return sub + +    def _convertFrom(self, proposed): +        proposed = self.find_codec(proposed) +        if not proposed or proposed in self.triedEncodings: +            return None +        self.triedEncodings.append(proposed) +        markup = self.markup + +        # Convert smart quotes to HTML if coming from an encoding +        # that might have them. +        if self.smartQuotesTo and proposed.lower() in("windows-1252", +                                                      "iso-8859-1", +                                                      "iso-8859-2"): +            markup = re.compile("([\x80-\x9f])").sub \ +                     (lambda(x): self._subMSChar(x.group(1)), +                      markup) + +        try: +            # print "Trying to convert document to %s" % proposed +            u = self._toUnicode(markup, proposed) +            self.markup = u +            self.originalEncoding = proposed +        except Exception, e: +            # print "That didn't work!" +            # print e +            return None +        #print "Correct encoding: %s" % proposed +        return self.markup + +    def _toUnicode(self, data, encoding): +        '''Given a string and its encoding, decodes the string into Unicode. +        %encoding is a string recognized by encodings.aliases''' + +        # strip Byte Order Mark (if present) +        if (len(data) >= 4) and (data[:2] == '\xfe\xff') \ +               and (data[2:4] != '\x00\x00'): +            encoding = 'utf-16be' +            data = data[2:] +        elif (len(data) >= 4) and (data[:2] == '\xff\xfe') \ +                 and (data[2:4] != '\x00\x00'): +            encoding = 'utf-16le' +            data = data[2:] +        elif data[:3] == '\xef\xbb\xbf': +            encoding = 'utf-8' +            data = data[3:] +        elif data[:4] == '\x00\x00\xfe\xff': +            encoding = 'utf-32be' +            data = data[4:] +        elif data[:4] == '\xff\xfe\x00\x00': +            encoding = 'utf-32le' +            data = data[4:] +        newdata = unicode(data, encoding) +        return newdata + +    def _detectEncoding(self, xml_data, isHTML=False): +        """Given a document, tries to detect its XML encoding.""" +        xml_encoding = sniffed_xml_encoding = None +        try: +            if xml_data[:4] == '\x4c\x6f\xa7\x94': +                # EBCDIC +                xml_data = self._ebcdic_to_ascii(xml_data) +            elif xml_data[:4] == '\x00\x3c\x00\x3f': +                # UTF-16BE +                sniffed_xml_encoding = 'utf-16be' +                xml_data = unicode(xml_data, 'utf-16be').encode('utf-8') +            elif (len(xml_data) >= 4) and (xml_data[:2] == '\xfe\xff') \ +                     and (xml_data[2:4] != '\x00\x00'): +                # UTF-16BE with BOM +                sniffed_xml_encoding = 'utf-16be' +                xml_data = unicode(xml_data[2:], 'utf-16be').encode('utf-8') +            elif xml_data[:4] == '\x3c\x00\x3f\x00': +                # UTF-16LE +                sniffed_xml_encoding = 'utf-16le' +                xml_data = unicode(xml_data, 'utf-16le').encode('utf-8') +            elif (len(xml_data) >= 4) and (xml_data[:2] == '\xff\xfe') and \ +                     (xml_data[2:4] != '\x00\x00'): +                # UTF-16LE with BOM +                sniffed_xml_encoding = 'utf-16le' +                xml_data = unicode(xml_data[2:], 'utf-16le').encode('utf-8') +            elif xml_data[:4] == '\x00\x00\x00\x3c': +                # UTF-32BE +                sniffed_xml_encoding = 'utf-32be' +                xml_data = unicode(xml_data, 'utf-32be').encode('utf-8') +            elif xml_data[:4] == '\x3c\x00\x00\x00': +                # UTF-32LE +                sniffed_xml_encoding = 'utf-32le' +                xml_data = unicode(xml_data, 'utf-32le').encode('utf-8') +            elif xml_data[:4] == '\x00\x00\xfe\xff': +                # UTF-32BE with BOM +                sniffed_xml_encoding = 'utf-32be' +                xml_data = unicode(xml_data[4:], 'utf-32be').encode('utf-8') +            elif xml_data[:4] == '\xff\xfe\x00\x00': +                # UTF-32LE with BOM +                sniffed_xml_encoding = 'utf-32le' +                xml_data = unicode(xml_data[4:], 'utf-32le').encode('utf-8') +            elif xml_data[:3] == '\xef\xbb\xbf': +                # UTF-8 with BOM +                sniffed_xml_encoding = 'utf-8' +                xml_data = unicode(xml_data[3:], 'utf-8').encode('utf-8') +            else: +                sniffed_xml_encoding = 'ascii' +                pass +        except: +            xml_encoding_match = None +        xml_encoding_match = re.compile( +            '^<\?.*encoding=[\'"](.*?)[\'"].*\?>').match(xml_data) +        if not xml_encoding_match and isHTML: +            regexp = re.compile('<\s*meta[^>]+charset=([^>]*?)[;\'">]', re.I) +            xml_encoding_match = regexp.search(xml_data) +        if xml_encoding_match is not None: +            xml_encoding = xml_encoding_match.groups()[0].lower() +            if isHTML: +                self.declaredHTMLEncoding = xml_encoding +            if sniffed_xml_encoding and \ +               (xml_encoding in ('iso-10646-ucs-2', 'ucs-2', 'csunicode', +                                 'iso-10646-ucs-4', 'ucs-4', 'csucs4', +                                 'utf-16', 'utf-32', 'utf_16', 'utf_32', +                                 'utf16', 'u16')): +                xml_encoding = sniffed_xml_encoding +        return xml_data, xml_encoding, sniffed_xml_encoding + + +    def find_codec(self, charset): +        return self._codec(self.CHARSET_ALIASES.get(charset, charset)) \ +               or (charset and self._codec(charset.replace("-", ""))) \ +               or (charset and self._codec(charset.replace("-", "_"))) \ +               or charset + +    def _codec(self, charset): +        if not charset: return charset +        codec = None +        try: +            codecs.lookup(charset) +            codec = charset +        except (LookupError, ValueError): +            pass +        return codec + +    EBCDIC_TO_ASCII_MAP = None +    def _ebcdic_to_ascii(self, s): +        c = self.__class__ +        if not c.EBCDIC_TO_ASCII_MAP: +            emap = (0,1,2,3,156,9,134,127,151,141,142,11,12,13,14,15, +                    16,17,18,19,157,133,8,135,24,25,146,143,28,29,30,31, +                    128,129,130,131,132,10,23,27,136,137,138,139,140,5,6,7, +                    144,145,22,147,148,149,150,4,152,153,154,155,20,21,158,26, +                    32,160,161,162,163,164,165,166,167,168,91,46,60,40,43,33, +                    38,169,170,171,172,173,174,175,176,177,93,36,42,41,59,94, +                    45,47,178,179,180,181,182,183,184,185,124,44,37,95,62,63, +                    186,187,188,189,190,191,192,193,194,96,58,35,64,39,61,34, +                    195,97,98,99,100,101,102,103,104,105,196,197,198,199,200, +                    201,202,106,107,108,109,110,111,112,113,114,203,204,205, +                    206,207,208,209,126,115,116,117,118,119,120,121,122,210, +                    211,212,213,214,215,216,217,218,219,220,221,222,223,224, +                    225,226,227,228,229,230,231,123,65,66,67,68,69,70,71,72, +                    73,232,233,234,235,236,237,125,74,75,76,77,78,79,80,81, +                    82,238,239,240,241,242,243,92,159,83,84,85,86,87,88,89, +                    90,244,245,246,247,248,249,48,49,50,51,52,53,54,55,56,57, +                    250,251,252,253,254,255) +            import string +            c.EBCDIC_TO_ASCII_MAP = string.maketrans( \ +            ''.join(map(chr, range(256))), ''.join(map(chr, emap))) +        return s.translate(c.EBCDIC_TO_ASCII_MAP) + +    MS_CHARS = { '\x80' : ('euro', '20AC'), +                 '\x81' : ' ', +                 '\x82' : ('sbquo', '201A'), +                 '\x83' : ('fnof', '192'), +                 '\x84' : ('bdquo', '201E'), +                 '\x85' : ('hellip', '2026'), +                 '\x86' : ('dagger', '2020'), +                 '\x87' : ('Dagger', '2021'), +                 '\x88' : ('circ', '2C6'), +                 '\x89' : ('permil', '2030'), +                 '\x8A' : ('Scaron', '160'), +                 '\x8B' : ('lsaquo', '2039'), +                 '\x8C' : ('OElig', '152'), +                 '\x8D' : '?', +                 '\x8E' : ('#x17D', '17D'), +                 '\x8F' : '?', +                 '\x90' : '?', +                 '\x91' : ('lsquo', '2018'), +                 '\x92' : ('rsquo', '2019'), +                 '\x93' : ('ldquo', '201C'), +                 '\x94' : ('rdquo', '201D'), +                 '\x95' : ('bull', '2022'), +                 '\x96' : ('ndash', '2013'), +                 '\x97' : ('mdash', '2014'), +                 '\x98' : ('tilde', '2DC'), +                 '\x99' : ('trade', '2122'), +                 '\x9a' : ('scaron', '161'), +                 '\x9b' : ('rsaquo', '203A'), +                 '\x9c' : ('oelig', '153'), +                 '\x9d' : '?', +                 '\x9e' : ('#x17E', '17E'), +                 '\x9f' : ('Yuml', ''),} + +####################################################################### + + +#By default, act as an HTML pretty-printer. +if __name__ == '__main__': +    import sys +    soup = BeautifulSoup(sys.stdin) +    print soup.prettify() diff --git a/core/module/CaptchaManager.py b/core/module/CaptchaManager.py new file mode 100644 index 000000000..d6a8fd077 --- /dev/null +++ b/core/module/CaptchaManager.py @@ -0,0 +1,116 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from uuid import uuid4 as uuid +from threading import Lock + +class CaptchaManager(): +    def __init__(self, core): +        self.lock = Lock() +        self.core = core +        self.tasks = [] +     +    def newTask(self, plugin): +        task = CaptchaTask(plugin, self) +        self.lock.acquire() +        self.tasks.append(task) +        self.lock.release() +        return task +     +    def removeTask(self, task): +        self.lock.acquire() +        self.tasks.remove(task) +        self.lock.release() +     +    def getTask(self): +        self.lock.acquire() +        for task in self.tasks: +            status = task.getStatus() +            if status == "waiting" or status == "shared-user": +                self.lock.release() +                return task +        self.lock.release() +        return None +     +    def getTaskFromID(self, tid): +        self.lock.acquire() +        for task in self.tasks: +            if task.getID() == tid: +                self.lock.release() +                return task +        self.lock.release() +        return None + +class CaptchaTask(): +    def __init__(self, plugin, manager): +        self.lock = Lock() +        self.plugin = plugin +        self.manager = manager +        self.captchaImg = None +        self.captchaType = None +        self.result = None +        self.status = "preparing" +        self.id = uuid().hex +     +    def setCaptcha(self, img, imgType): +        self.lock.acquire() +        self.captchaImg = img +        self.captchaType = imgType +        self.lock.release() +     +    def getCaptcha(self): +        return self.captchaImg, self.captchaType +     +    def setResult(self, result): +        self.lock.acquire() +        self.result = result +        self.lock.release() +     +    def getResult(self): +        return self.result +     +    def getID(self): +        return self.id +     +    def getStatus(self): +        return self.status +     +    def setDone(self): +        self.lock.acquire() +        self.status = "done" +        self.lock.release() +     +    def setWaiting(self): +        self.lock.acquire() +        self.status = "waiting" +        self.lock.release() +     +    def setWatingForUser(self, exclusive): +        self.lock.acquire() +        if exclusive: +            self.status = "user" +        else: +            self.status = "shared-user" +        self.lock.release() +     +    def removeTask(self): +        self.manager.removeTask(self) +     +    def __str__(self): +        return "<CaptchaTask '%s'>" % (self.getID(),) diff --git a/core/module/ConfigParser.py b/core/module/ConfigParser.py new file mode 100644 index 000000000..c4a507689 --- /dev/null +++ b/core/module/ConfigParser.py @@ -0,0 +1,364 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement +from time import sleep +from os.path import exists +from os.path import join +from shutil import copy + + +CONF_VERSION = 1 + +######################################################################## +class ConfigParser: +    """ +    holds and manage the configuration +     +    current dict layout: +     +    { +     +     section : {  +      option : {  +            value: +            type: +            desc: +      } +      desc:  +     +    } +     +     +    """ + +    #---------------------------------------------------------------------- +    def __init__(self): +        """Constructor""" +        self.config = {} # the config values +        self.plugin = {} # the config for plugins +         +        self.username = "" +        self.password = "" +        #stored outside and may not modified +         +         +        self.checkVersion() +         +        self.readConfig() +     +    #---------------------------------------------------------------------- +    def checkVersion(self, n=0): +        """determines if config need to be copied""" +        try: +            if not exists("pyload.conf"): +                copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") +                 +            if not exists("plugin.conf"): +                f = open("plugin.conf", "wb") +                f.write("version: "+str(CONF_VERSION)) +                f.close() +             +            f = open("pyload.conf", "rb") +            v = f.readline() +            f.close() +            v = v[v.find(":")+1:].strip() +             +            if int(v) < CONF_VERSION: +                copy(join(pypath,"module", "config", "default.conf"), "pyload.conf") +                print "Old version of config was replaced" +             +            f = open("plugin.conf", "rb") +            v = f.readline() +            f.close() +            v = v[v.find(":")+1:].strip() +               +            if int(v) < CONF_VERSION: +                f = open("plugin.conf", "wb") +                f.write("version: "+str(CONF_VERSION)) +                f.close() +                print "Old version of config was replaced" +        except: +            if n < 3: +                sleep(0.3) +                self.checkVersion(n+1) +            else: +                raise +         +    #---------------------------------------------------------------------- +    def readConfig(self): +        """reads the config file""" +         +        self.config = self.parseConfig(join(pypath,"module", "config", "default.conf")) +        self.plugin = self.parseConfig("plugin.conf") +         +        try: +            homeconf = self.parseConfig("pyload.conf") +            self.updateValues(homeconf, self.config) +             +        except Exception, e: +            print e +         +             +        self.username = self.config["remote"]["username"]["value"] +        del self.config["remote"]["username"] +         +        self.password = self.config["remote"]["password"]["value"] +        del self.config["remote"]["password"] +         +         +    #---------------------------------------------------------------------- +    def parseConfig(self, config): +        """parses a given configfile""" +         +        f = open(config) +         +        config = f.read() + +        config = config.split("\n")[1:] +         +        conf = {} +         +        section, option, value, typ, desc = "","","","","" +         +        listmode = False +         +        for line in config: +             +            line = line.rpartition("#") # removes comments +             +            if line[1]: +                line = line[0] +            else: +                line = line[2] +             +            line = line.strip()             +             +            try: +             +                if line == "": +                    continue +                elif line.endswith(":"): +                    section, none, desc = line[:-1].partition('-') +                    section = section.strip() +                    desc = desc.replace('"', "").strip() +                    conf[section] = { "desc" : desc } +                else: +                    if listmode: +                         +                        if line.endswith("]"): +                            listmode = False +                            line = line.replace("]","") +                             +                        value += [self.cast(typ, x.strip()) for x in line.split(",") if x] +                         +                        if not listmode: +                            conf[section][option] = { "desc" : desc, +                                                      "type" : typ, +                                                      "value" : value}  +                         +                         +                    else: +                        content, none, value = line.partition("=") +                         +                        content, none, desc = content.partition(":") +                         +                        desc = desc.replace('"', "").strip() +     +                        typ, option = content.split() +                                                 +                        value = value.strip() +                         +                        if value.startswith("["): +                            if value.endswith("]"):                             +                                listmode = False +                                value = value[:-1] +                            else: +                                listmode = True +                           +                            value = [self.cast(typ, x.strip()) for x in value[1:].split(",") if x] +                        else: +                            value = self.cast(typ, value) +                         +                        if not listmode: +                            conf[section][option] = { "desc" : desc, +                                                      "type" : typ, +                                                      "value" : value} +                 +            except: +                pass +                     +                         +        f.close() +        return conf +         +     +     +    #---------------------------------------------------------------------- +    def updateValues(self, config, dest): +        """sets the config values from a parsed config file to values in destination""" +                                 +        for section in config.iterkeys(): +     +            if dest.has_key(section): +                 +                for option in config[section].iterkeys(): +                     +                    if option == "desc": continue +                     +                    if dest[section].has_key(option): +                        dest[section][option]["value"] = config[section][option]["value"] +                         +                    else: +                        dest[section][option] = config[section][option] +                 +                 +            else: +                dest[section] = config[section] + +    #---------------------------------------------------------------------- +    def saveConfig(self, config, filename): +        """saves config to filename""" +        with open(filename, "wb") as f: +            f.write("version: %i \n" % CONF_VERSION) +            for section in config.iterkeys(): +                f.write('\n%s - "%s":\n' % (section, config[section]["desc"])) +                 +                for option, data in config[section].iteritems(): +                     +                    if option == "desc": continue +                     +                    if isinstance(data["value"], list): +                        value = "[ \n" +                        for x in data["value"]: +                            value += "\t\t" + str(x) + ",\n" +                        value += "\t\t]\n" +                    else: +                        value = str(data["value"]) + "\n" +                     +                    f.write('\t%s %s : "%s" = %s' % (data["type"], option, data["desc"], value) ) +    #---------------------------------------------------------------------- +    def cast(self, typ, value): +        """cast value to given format""" +        if type(value) not in (str, unicode): +            return value +         +        if typ == "int": +            return int(value) +        elif typ == "bool": +            return True if value.lower() in ("1","true", "on", "an","yes") else False +        else: +            return value +                 +    #---------------------------------------------------------------------- +    def save(self): +        """saves the configs to disk""" +         +        self.config["remote"]["username"] = { +            "desc" : "Username", +            "type": "str", +            "value": self.username +        } +         +        self.config["remote"]["password"] = { +            "desc" : "Password", +            "type": "str", +            "value": self.password +        }  +         +        self.saveConfig(self.config, "pyload.conf") +         +        del self.config["remote"]["username"] +        del self.config["remote"]["password"] +         +        self.saveConfig(self.plugin, "plugin.conf") +         +    #---------------------------------------------------------------------- +    def __getitem__(self, section): +        """provides dictonary like access: c['section']['option']""" +        return Section(self, section) +     +    #---------------------------------------------------------------------- +    def get(self, section, option): +        """get value""" +        return self.config[section][option]["value"] +         +    #---------------------------------------------------------------------- +    def set(self, section, option, value): +        """set value""" + +        value = self.cast(self.config[section][option]["type"], value) +             +        self.config[section][option]["value"] = value +        self.save() +         +    #---------------------------------------------------------------------- +    def getPlugin(self, plugin, option): +        """gets a value for a plugin""" +        return self.plugin[plugin][option]["value"] +     +    #---------------------------------------------------------------------- +    def setPlugin(self, plugin, option, value): +        """sets a value for a plugin""" + +        value = self.cast(self.plugin[plugin][option]["type"], value) +         +        self.plugin[plugin][option]["value"] = value +        self.save() +         +    #---------------------------------------------------------------------- +    def addPluginConfig(self, config): +        """adds config option with tuple (plugin, name, type, desc, default)""" +         +        if not self.plugin.has_key(config[0]): +            self.plugin[config[0]] = { "desc" : config[0], +                                       config[1] : { +                                           "desc" : config[3], +                                           "type" : config[2], +                                           "value" : self.cast(config[2], config[4]) +                                       } } +        else: +            if not self.plugin[config[0]].has_key(config[1]): +                self.plugin[config[0]][config[1]] = { +                                           "desc" : config[3], +                                           "type" : config[2], +                                           "value" : self.cast(config[2], config[4]) +                                       } + +######################################################################## +class Section: +    """provides dictionary like access for configparser""" + +    #---------------------------------------------------------------------- +    def __init__(self, parser, section): +        """Constructor""" +        self.parser = parser +        self.section = section +         +    #---------------------------------------------------------------------- +    def __getitem__(self, item): +        """getitem""" +        return self.parser.get(self.section, item) +         +    #---------------------------------------------------------------------- +    def __setitem__(self, item, value): +        """setitem""" +        self.parser.set(self.section, item, value) +         + +     +if __name__ == "__main__": +    pypath = "" + +    from time import time +     +    a = time() +     +    c = ConfigParser() +     +    b = time() +     +    print "sec", b-a     +     +    print c.config +     +    c.saveConfig(c.config, "user.conf") diff --git a/core/module/FileDatabase.py b/core/module/FileDatabase.py new file mode 100644 index 000000000..bf7b768fe --- /dev/null +++ b/core/module/FileDatabase.py @@ -0,0 +1,1118 @@ +#!/usr/bin/env python +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN +    @author: mkaay +""" +from Queue import Queue +from os import remove +from os.path import exists +from shutil import move +import sqlite3 +from threading import Lock +from threading import RLock +from threading import Thread +from time import sleep +from time import time +import traceback + +from module.PullEvents import InsertEvent +from module.PullEvents import ReloadAllEvent +from module.PullEvents import RemoveEvent +from module.PullEvents import UpdateEvent + + +DB_VERSION = 2 + +statusMap = { +    "finished":    0, +    "offline":     1, +    "online":      2, +    "queued":      3, +    "checking":    4, +    "waiting":     5, +    "reconnected": 6, +    "starting":    7, +    "failed":      8, +    "aborted":     9, +    "decrypting":  10, +    "custom":      11, +    "downloading": 12, +    "processing":  13, +    "unknown":     14 +} + +def formatSize(size): +    """formats size of bytes""" +    size = int(size) +    steps = 0 +    sizes = ["B", "KB", "MB", "GB", "TB"] +     +    while size > 1000: +        size /= 1024.0 +        steps += 1 +     +    return "%.2f %s" % (size, sizes[steps]) + + +######################################################################## +class FileHandler: +    """Handles all request made to obtain information,  +    modify status or other request for links or packages""" + +     +    #---------------------------------------------------------------------- +    def __init__(self, core): +        """Constructor""" +        self.core = core + +        # translations +        self.statusMsg = [_("finished"), _("offline"), _("online"), _("queued"), _("checking"), _("waiting"), _("reconnected"), _("starting"), _("failed"), _("aborted"), _("decrypting"), _("custom"), _("downloading"), _("processing"), _("unknown")] +         +        self.cache = {} #holds instances for files +        self.packageCache = {}  # same for packages +        #@TODO: purge the cache + +        self.jobCache = {} +         +        self.lock = RLock()  #@TODO should be a Lock w/o R +         +        self.filecount = -1 # if an invalid value is set get current value from db         +        self.unchanged = False #determines if any changes was made since last call + +        self.db = FileDatabaseBackend(self) # the backend + + +    def change(func): +        def new(*args): +            args[0].unchanged = False +            args[0].filecount = -1 +            args[0].jobCache = {} +            return func(*args) +        return new +     +    def lock(func): +        def new(*args): +            args[0].lock.acquire()             +            res = func(*args) +            args[0].lock.release() +            return res +        return new +     +    #---------------------------------------------------------------------- +    def save(self): +        """saves all data to backend""" +        self.db.commit() + +    #---------------------------------------------------------------------- +    def syncSave(self): +        """saves all data to backend and waits until all data are written""" +        self.db.syncSave() +         +    #---------------------------------------------------------------------- +    def getCompleteData(self, queue=1): +        """gets a complete data representation""" + +        data = self.db.getAllLinks(queue) +        packs = self.db.getAllPackages(queue) +         +        data.update([(str(x.id), x.toDbDict()[x.id]) for x in self.cache.itervalues()]) +        packs.update([(str(x.id), x.toDict()[x.id]) for x in self.packageCache.itervalues() if x.queue == queue]) + +        for key, value in data.iteritems(): +            if packs.has_key(str(value["package"])): +                packs[str(value["package"])]["links"][key] = value + +        return packs + +    #---------------------------------------------------------------------- +    @lock +    @change +    def addLinks(self, urls, package): +        """adds links""" +         +        data = self.core.pluginManager.parseUrls(urls) +         +        self.db.addLinks(data, package) +        self.core.threadManager.createInfoThread(data, package) +         +        #@TODO package update event + +    #---------------------------------------------------------------------- +    @change +    def addPackage(self, name, folder, queue=0): +        """adds a package, default to link collector""" +        lastID = self.db.addPackage(name, folder, queue) +        p = self.db.getPackage(lastID) +        e = InsertEvent("pack", lastID, p.order, "collector" if not queue else "queue") +        self.core.pullManager.addEvent(e) +        return lastID + +    #---------------------------------------------------------------------- +    @lock +    @change +    def deletePackage(self, id): +        """delete package and all contained links""" +         +        p = self.getPackage(id) +        e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") +         +        pyfiles = self.cache.values() +         +        for pyfile in pyfiles: +            if pyfile.packageid == id: +                pyfile.abortDownload() +                pyfile.release() + +        self.db.deletePackage(p) +        self.core.pullManager.addEvent(e) +         +        if self.packageCache.has_key(id): +            del self.packageCache[id] + +    #---------------------------------------------------------------------- +    @lock     +    @change +    def deleteLink(self, id): +        """deletes links""" +         +        f = self.getFile(id) +        pid = f.packageid +         +        if not f: +            return None +         +        e = RemoveEvent("file", id, "collector" if not f.package().queue else "queue") +         +         +        if id in self.core.threadManager.processingIds(): +            self.cache[id].abortDownload() +         +        if self.cache.has_key(id): +            del self.cache[id] +             +        self.db.deleteLink(f) +         +        self.core.pullManager.addEvent(e) +         +        p = self.getPackage(pid) +        if len(p.getChildren()) == 0: +            p.delete() + +    #---------------------------------------------------------------------- +    def releaseLink(self, id): +        """removes pyfile from cache""" +        if self.cache.has_key(id): +            del self.cache[id] + +    #---------------------------------------------------------------------- +    def releasePackage(self, id): +        """removes package from cache""" +        if self.packageCache.has_key(id): +            del self.packageCache[id] + +    #---------------------------------------------------------------------- +    def updateLink(self, pyfile): +        """updates link""" +        self.db.updateLink(pyfile) +         +        e = UpdateEvent("file", pyfile.id, "collector" if not pyfile.package().queue else "queue") +        self.core.pullManager.addEvent(e) + +    #---------------------------------------------------------------------- +    def updatePackage(self, pypack): +        """updates a package""" +        self.db.updatePackage(pypack) +         +        e = UpdateEvent("pack", pypack.id, "collector" if not pypack.queue else "queue") +        self.core.pullManager.addEvent(e) + +    #---------------------------------------------------------------------- +    def getPackage(self, id): +        """return package instance""" +         +        if self.packageCache.has_key(id): +            return self.packageCache[id] +        else: +            return self.db.getPackage(id) +     +    #---------------------------------------------------------------------- +    def getPackageData(self, id): +        """returns dict with package information""" +        pack = self.getPackage(id) +         +        if not pack: +            return None +         +        pack = pack.toDict()[id] +         +        data = self.db.getPackageData(id) +         +        tmplist = [] +        for x in self.cache.itervalues(): +            if int(x.toDbDict()[x.id]["package"]) == int(id): +                tmplist.append((str(x.id), x.toDbDict()[x.id])) +        data.update(tmplist) +         +        pack["links"] = data +         +        return pack +     +    #---------------------------------------------------------------------- +    def getFileData(self, id): +        """returns dict with file information""" +        if self.cache.has_key(id): +            return self.cache[id].toDbDict() +         +        return self.db.getLinkData(id) +     +    #---------------------------------------------------------------------- +    def getFile(self, id): +        """returns pyfile instance""" +        if self.cache.has_key(id): +            return self.cache[id] +        else: +            return self.db.getFile(id) + +    #---------------------------------------------------------------------- +    @lock +    def getJob(self, occ): +        """get suitable job""" +         +        #@TODO clean mess +         +        if self.jobCache.has_key(occ): +            if self.jobCache[occ]: +                id = self.jobCache[occ].pop() +                if id == "empty": +                    pyfile = None +                    self.jobCache[occ].append("empty") +                else: +                    pyfile = self.getFile(id) +            else: +                jobs = self.db.getJob(occ) +                jobs.reverse() +                if not jobs: +                    self.jobCache[occ].append("empty") +                    pyfile = None +                else: +                    self.jobCache[occ].extend(jobs) +                    pyfile = self.getFile(self.jobCache[occ].pop()) +                 +        else: +            self.jobCache = {} #better not caching to much +            jobs = self.db.getJob(occ) +            jobs.reverse() +            self.jobCache[occ] = jobs +             +            if not jobs: +                self.jobCache[occ].append("empty") +                pyfile = None +         +            pyfile = self.getFile(self.jobCache[occ].pop()) +            #@TODO: maybe the new job has to be approved... +                     +         +        #pyfile = self.getFile(self.jobCache[occ].pop()) +        return pyfile + +    #---------------------------------------------------------------------- +    def getFileCount(self): +        """returns number of files""" + +        if self.filecount == -1: +            self.filecount = self.db.filecount(1) +         +        return self.filecount +     +    #---------------------------------------------------------------------- +    def getQueueCount(self): +        """number of files that have to be processed""" +        pass +     +    #---------------------------------------------------------------------- +    @lock     +    @change +    def restartPackage(self, id): +        """restart package""" +        pyfiles = self.cache.values() +        for pyfile in pyfiles: +            if pyfile.packageid == id: +                self.restartFile(pyfile.id) +         +        self.db.restartPackage(id) +         +        e = UpdateEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue") +        self.core.pullManager.addEvent(e) +     +    @lock     +    @change +    def restartFile(self, id): +        """ restart file""" +        if self.cache.has_key(id): +            self.cache[id].status = 3 +            self.cache[id].name = self.cache[id].url +            self.cache[id].error = "" +            self.cache[id].abortDownload() +         +         +        self.db.restartFile(id) +         +        e = UpdateEvent("file", id, "collector" if not self.getFile(id).package().queue else "queue") +        self.core.pullManager.addEvent(e) +     +    @lock   +    @change +    def setPackageLocation(self, id, queue): +        """push package to queue""" +         +        pack = self.db.getPackage(id) +         +        e = RemoveEvent("pack", id, "collector" if not pack.queue else "queue") +        self.core.pullManager.addEvent(e) +         +        self.db.clearPackageOrder(pack) +         +        pack = self.db.getPackage(id) +         +        pack.queue = queue +        self.db.updatePackage(pack) +         +        self.db.reorderPackage(pack, -1, True) +         +        self.db.commit() +        self.releasePackage(id) +        pack = self.getPackage(id) +        e = InsertEvent("pack", id, pack.order, "collector" if not pack.queue else "queue") +        self.core.pullManager.addEvent(e) +     +    @lock +    @change +    def reorderPackage(self, id, position): +        p = self.db.getPackage(id) +         +        e = RemoveEvent("pack", id, "collector" if not p.queue else "queue") +        self.core.pullManager.addEvent(e) +         +        self.db.reorderPackage(p, position) +         +        self.db.commit() +         +        e = ReloadAllEvent("collector" if not p.queue else "queue") +        self.core.pullManager.addEvent(e) +     +    @lock +    @change +    def reorderFile(self, id, position): +        f = self.getFileData(id) +         +        #@TODO test... +         +        e = RemoveEvent("file", id, "collector" if not self.getPackage(f[str(id)]["package"]).queue else "queue") +        self.core.pullManager.addEvent(e) +         +        self.db.reorderLink(f, position) +         +        if self.cache.has_key(id): +            self.cache[id].order = position +         +        self.db.commit() +         +        e = ReloadAllEvent("collector" if not self.getPackage(f[str(id)]["package"]).queue else "queue") + +         +        self.core.pullManager.addEvent(e) +         +    @change +    def updateFileInfo(self, data, pid): +        """ updates file info (name, size, status, url)""" +        self.db.updateLinkInfo(data) +         +        #@TODO package update event +         +    def checkPackageFinished(self, pyfile): +        """ checks if package is finished and calls hookmanager """ +         +        ids = self.db.getUnfinished(pyfile.packageid) +        if not ids or (pyfile.id in ids and len(ids) == 1): +            if not pyfile.package().setFinished: +                self.core.log.info(_("Package finished: %s") % pyfile.package().name) +                self.core.hookManager.packageFinished(pyfile.package()) +                pyfile.package().setFinished = True +                 +                 +    def reCheckPackage(self, pid): +        """ recheck links in package """ +        data = self.db.getPackageData() + +        urls = [] +         +        for pyfile in data.itervalues(): +            if pyfile.status not in  (0, 12, 13): +                urls.append((pyfile["url"], pyfile["plugin"])) +                 +        self.core.threadManager.createInfoThread(urls, pid) + +######################################################################### +class FileDatabaseBackend(Thread): +    """underlying backend for the filehandler to save the data""" + +    def __init__(self, manager): +        Thread.__init__(self) + +        self.setDaemon(True) + +        self.manager = manager +         +        self.lock = Lock() + +        self.jobs = Queue() # queues for jobs +        self.res = Queue() + +        self._checkVersion() +         +        self.start() + + +    def queue(func): +        """use as decorator when fuction directly executes sql commands""" +        def new(*args): +            args[0].lock.acquire() +            args[0].jobs.put((func, args, 0)) +            res = args[0].res.get() +            args[0].lock.release() +            return res +         +             +        return new + +    def async(func): +        """use as decorator when function does not return anything and asynchron execution is wanted""" +        def new(*args): +            args[0].lock.acquire() +            args[0].jobs.put((func, args, 1)) +            args[0].lock.release() +            return True +        return new + +    def run(self): +        """main loop, which executes commands""" + +        self.conn = sqlite3.connect("files.db") +        self.c = self.conn.cursor() +        #self.c.execute("PRAGMA synchronous = OFF") +        self._createTables() +        self.c.close() + +        while True: +            try: +                f, args, async = self.jobs.get() +                if f == "quit": return True +                self.c = self.conn.cursor() +                res = f(*args) +                self.c.close() +                if not async: self.res.put(res) +            except Exception, e: +                #@TODO log etc +                print "Database Error @", f.__name__, args[1:], e +                traceback.print_exc() +                if not async: self.res.put(None) + +    def shutdown(self): +        self.save() +        self.jobs.put(("quit", "", 0)) + +    def _checkVersion(self): +        """ check db version and delete it if needed""" +        if not exists("files.version"): +            f = open("files.version", "wb") +            f.write(str(DB_VERSION)) +            f.close() +            return +         +        f = open("files.version", "rb") +        v = int(f.read().strip()) +        f.close() +        if v < DB_VERSION: +            self.manager.core.log.warning(_("Filedatabase was deleted due to incompatible version.")) +            remove("files.version") +            move("files.db", "files.backup.db") +            f = open("files.version", "wb") +            f.write(str(DB_VERSION)) +            f.close() +         +    def _createTables(self): +        """create tables for database""" + +        self.c.execute('CREATE TABLE IF NOT EXISTS "packages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "folder" TEXT, "password" TEXT, "site" TEXT, "queue" INTEGER DEFAULT 0 NOT NULL, "packageorder" INTEGER DEFAULT 0 NOT NULL, "priority" INTEGER DEFAULT 0 NOT NULL)') +        self.c.execute('CREATE TABLE IF NOT EXISTS "links" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "url" TEXT NOT NULL, "name" TEXT, "size" INTEGER DEFAULT 0 NOT NULL, "status" INTEGER DEFAULT 3 NOT NULL, "plugin" TEXT DEFAULT "BasePlugin" NOT NULL, "error" TEXT DEFAULT "", "linkorder" INTEGER DEFAULT 0 NOT NULL, "package" INTEGER DEFAULT 0 NOT NULL, FOREIGN KEY(package) REFERENCES packages(id))') +        self.c.execute('CREATE INDEX IF NOT EXISTS "pIdIndex" ON links(package)') +        self.c.execute('VACUUM') +         +    #---------------------------------------------------------------------- +    @queue +    def filecount(self, queue): +        """returns number of files in queue""" +        self.c.execute("SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? ORDER BY l.id", (queue, )) +        r = self.c.fetchall() +        return len(r) +     +    def _nextPackageOrder(self, queue=0): +        self.c.execute('SELECT packageorder FROM packages WHERE queue=?', (queue,)) +        o = -1 +        for r in self.c: +            if r[0] > o: o = r[0] +        return o + 1 +     +    def _nextFileOrder(self, package): +        self.c.execute('SELECT linkorder FROM links WHERE package=?', (package,)) +        o = -1 +        for r in self.c: +            if r[0] > o: o = r[0] +        return o + 1 +     +    @queue +    def addLink(self, url, name, plugin, package): +        order = self._nextFileOrder(package) +        self.c.execute('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', (url, name, plugin, package, order)) +        return self.c.lastrowid + +    @queue +    def addLinks(self, links, package): +        """ links is a list of tupels (url,plugin)""" +        order = self._nextFileOrder(package) +        orders = [order + x for x in range(len(links))] +        links = [(x[0], x[0], x[1], package, o) for x, o in zip(links, orders)] +        self.c.executemany('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', links) + +    @queue +    def addPackage(self, name, folder, queue): +        order = self._nextPackageOrder(queue) +        self.c.execute('INSERT INTO packages(name, folder, queue, packageorder) VALUES(?,?,?,?)', (name, folder, queue, order)) +        return self.c.lastrowid + +    @queue +    def deletePackage(self, p): + +        self.c.execute('DELETE FROM links WHERE package=?', (str(p.id),)) +        self.c.execute('DELETE FROM packages WHERE id=?', (str(p.id),)) +        self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=?', (p.order, p.queue)) + +    @queue +    def deleteLink(self, f): + +        self.c.execute('DELETE FROM links WHERE id=?', (str(f.id),)) +        self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder > ? AND package=?', (f.order, str(f.packageid))) + + +    @queue +    def getAllLinks(self, q): +        """return information about all links in queue q + +        q0 queue +        q1 collector + +        format: + +        { +            id: {'name': name, ... 'package': id }, ... +        } + +        """ +        self.c.execute('SELECT l.id,l.url,l.name,l.size,l.status,l.error,l.plugin,l.package,l.linkorder FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? ORDER BY l.linkorder', (q,)) +        data = {} +        for r in self.c: +            data[str(r[0])] = { +                'url': r[1], +                'name': r[2], +                'size': r[3], +                'format_size': formatSize(r[3]), +                'status': r[4], +                'statusmsg': self.manager.statusMsg[r[4]], +                'error': r[5], +                'plugin': r[6], +                'package': r[7], +                'order': r[8] +            } + +        return data + +    @queue +    def getAllPackages(self, q): +        """return information about packages in queue q +        (only useful in get all data) + +        q0 queue +        q1 collector + +        format: + +        { +            id: {'name': name ... 'links': {} }, ... +        } +        """ +        self.c.execute('SELECT id,name,folder,site,password,queue,packageorder,priority FROM packages WHERE queue=? ORDER BY packageorder', str(q)) + +        data = {} +        for r in self.c: +            data[str(r[0])] = { +                'name': r[1], +                'folder': r[2], +                'site': r[3], +                'password': r[4], +                'queue': r[5], +                'order': r[6], +                'priority': r[7], +                'links': {} +            } + +        return data +     +    @queue +    def getLinkData(self, id): +        """get link information as dict""" +        self.c.execute('SELECT id,url,name,size,status,error,plugin,package,linkorder FROM links WHERE id=?', (str(id), )) +        data = {} +        r = self.c.fetchone() +        if not r: +            return None +        data[str(r[0])] = { +            'url': r[1], +            'name': r[2], +            'size': r[3], +            'format_size': formatSize(r[3]), +            'status': r[4], +            'statusmsg': self.manager.statusMsg[r[4]], +            'error': r[5], +            'plugin': r[6], +            'package': r[7], +            'order': r[8] +        } + +        return data + +    @queue +    def getPackageData(self, id): +        """get package data""" +        self.c.execute('SELECT id,url,name,size,status,error,plugin,package,linkorder FROM links WHERE package=? ORDER BY linkorder', (str(id), )) + +        data = {} +        for r in self.c: +            data[str(r[0])] = { +                'url': r[1], +                'name': r[2], +                'size': r[3], +                'format_size': formatSize(r[3]), +                'status': r[4], +                'statusmsg': self.manager.statusMsg[r[4]], +                'error': r[5], +                'plugin': r[6], +                'package': r[7], +                'order': r[8] +            } + +        return data + + +    @async +    def updateLink(self, f): +        self.c.execute('UPDATE links SET url=?,name=?,size=?,status=?,error=?,package=? WHERE id=?', (f.url, f.name, f.size, f.status, f.error, str(f.packageid), str(f.id))) + +    @queue +    def updatePackage(self, p): +        self.c.execute('UPDATE packages SET name=?,folder=?,site=?,password=?,queue=?,priority=? WHERE id=?', (p.name, p.folder, p.site, p.password, p.queue, p.priority, str(p.id))) +         +    @async     +    def updateLinkInfo(self, data): +        """ data is list of tupels (name, size, status, url) """ +        self.c.executemany('UPDATE links SET name=?, size=?, status=? WHERE url=? AND status NOT IN (0,12,13)', data) +         +    @queue +    def reorderPackage(self, p, position, noMove=False): +        if position == -1: +            position = self._nextPackageOrder(p.queue) +        if not noMove: +            self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=? AND packageorder > 0', (p.order, p.queue)) +            self.c.execute('UPDATE packages SET packageorder=packageorder+1 WHERE packageorder >= ? AND queue=? AND packageorder > 0', (position, p.queue)) +        self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (position, str(p.id))) +     +    @queue +    def reorderLink(self, f, position): +        """ reorder link with f as dict for pyfile  """ +        id = f.keys[0] +        self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder > ? AND package=?', (f[str(id)]["order"], str(f[str(id)]["package"]))) +        self.c.execute('UPDATE links SET linkorder=linkorder+1 WHERE linkorder >= ? AND package=?', (position, str(f[str(id)]["package"]))) +        self.c.execute('UPDATE links SET linkorder=? WHERE id=?', (position, str(id))) +         +         +    @queue +    def clearPackageOrder(self, p): +        self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (-1, str(p.id))) +        self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=? AND id != ?', (p.order, p.queue, str(p.id))) +     +    @async +    def restartFile(self, id): +        self.c.execute('UPDATE links SET status=3,error="" WHERE id=?', (str(id),)) + +    @async +    def restartPackage(self, id): +        self.c.execute('UPDATE links SET status=3 WHERE package=?', (str(id),)) +         +    @async +    def commit(self): +        self.conn.commit() +         +    @queue +    def syncSave(self): +        self.conn.commit() + +    @queue +    def getPackage(self, id): +        """return package instance from id""" +        self.c.execute("SELECT name,folder,site,password,queue,packageorder,priority FROM packages WHERE id=?", (str(id), )) +        r = self.c.fetchone() +        if not r: return None +        return PyPackage(self.manager, id, * r) + +    #---------------------------------------------------------------------- +    @queue +    def getFile(self, id): +        """return link instance from id""" +        self.c.execute("SELECT url, name, size, status, error, plugin, package, linkorder FROM links WHERE id=?", (str(id), )) +        r = self.c.fetchone() +        if not r: return None +        return PyFile(self.manager, id, * r) + + +    @queue +    def getJob(self, occ): +        """return pyfile instance, which is suitable for download and dont use a occupied plugin""" +         +        cmd = "(" +        i = 0 +        for item in occ: +            if i != 0: cmd += ", " +            cmd += "'%s'" % item +         +        cmd += ")" +         +        cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=1 AND l.plugin NOT IN %s AND l.status IN (2,3,6,14) ORDER BY p.priority DESC, p.packageorder ASC, l.linkorder ASC LIMIT 5" % cmd +             +        self.c.execute(cmd) # very bad! + +        return [x[0] for x in self.c] +     +    @queue +    def getUnfinished(self, pid): +        """return list of ids with pyfiles in package not finished or processed""" +         +        self.c.execute("SELECT id FROM links WHERE package=? AND status NOT IN (0, 13)", (str(pid),)) +        return [r[0] for r in self.c] +         + +class PyFile(): +    def __init__(self, manager, id, url, name, size, status, error, pluginname, package, order): +        self.m = manager +         +        self.id = int(id) +        self.url = url +        self.name = name +        self.size = size +        self.status = status +        self.pluginname = pluginname +        self.packageid = package #should not be used, use package() instead +        self.error = error +        self.order = order +        # database information ends here +         +        self.plugin = None +             +        self.waitUntil = 0 # time() + time to wait +         +        # status attributes +        self.active = False #obsolete? +        self.abort = False +        self.reconnected = False +         +        #hook progress +        self.alternativePercent = None + +        self.m.cache[int(id)] = self +         +         +    def __repr__(self): +        return "PyFile %s: %s@%s" % (self.id, self.name, self.pluginname) +         +    def initPlugin(self): +        """ inits plugin instance """ +        self.pluginmodule = self.m.core.pluginManager.getPlugin(self.pluginname) +        self.pluginclass = getattr(self.pluginmodule, self.pluginname) +        self.plugin = self.pluginclass(self) +     +     +    def package(self): +        """ return package instance""" +        return self.m.getPackage(self.packageid) + +    def setStatus(self, status): +        self.status = statusMap[status] +        self.sync() #@TODO needed aslong no better job approving exists +     +    def hasStatus(self, status): +        return statusMap[status] == self.status +     +    def sync(self): +        """sync PyFile instance with database""" +        self.m.updateLink(self) + +    def release(self): +        """sync and remove from cache""" +        self.sync() +        self.m.releaseLink(self.id) + +    def delete(self): +        """delete pyfile from database""" +        self.m.deleteLink(self.id) + +    def toDict(self): +        """return dict with all information for interface""" +        return self.toDbDict() + +    def toDbDict(self): +        """return data as dict for databse + +        format: + +        { +            id: {'url': url, 'name': name ... } +        } + +        """ +        return { +            self.id: { +                'url': self.url, +                'name': self.name, +                'plugin': self.pluginname, +                'size': self.getSize(), +                'format_size': self.formatSize(), +                'status': self.status, +                'statusmsg': self.m.statusMsg[self.status], +                'package': self.packageid, +                'error': self.error, +                'order': self.order +            } +        } +     +    def abortDownload(self): +        """abort pyfile if possible""" +        while self.id in self.m.core.threadManager.processingIds(): +            self.abort = True +            if self.plugin and self.plugin.req: self.plugin.req.abort = True +            sleep(0.1) +         +        abort = False  +        if self.plugin and self.plugin.req: self.plugin.req.abort = False +         +    def finishIfDone(self): +        """set status to finish and release file if every thread is finished with it""" +         +        if self.id in self.m.core.threadManager.processingIds(): +            return False +         +        self.setStatus("finished") +        self.release() +        return True +     +    def formatWait(self): +        """ formats and return wait time in humanreadable format """ +        seconds = self.waitUntil - time() +         +        if seconds < 0: return "00:00:00" +                 +        hours, seconds = divmod(seconds, 3600) +        minutes, seconds = divmod(seconds, 60) +        return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) +     +    def formatSize(self): +        """ formats size to readable format """ +        return formatSize(self.getSize()) + +    def formatETA(self): +        """ formats eta to readable format """ +        seconds = self.getETA() +         +        if seconds < 0: return "00:00:00" +                 +        hours, seconds = divmod(seconds, 3600) +        minutes, seconds = divmod(seconds, 60) +        return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) +     +    def getSpeed(self): +        """ calculates speed """ +        try: +            return self.plugin.req.get_speed() +        except: +            return 0 +         +    def getETA(self): +        """ gets established time of arrival""" +        try: +            return self.plugin.req.get_ETA() +        except: +            return 0 +     +    def getBytesLeft(self): +        """ gets bytes left """ +        try: +            return self.plugin.req.bytes_left() +        except: +            return 0 +     +    def getPercent(self): +        """ get % of download """ +        if self.alternativePercent: return self.alternativePercent +        try: +            return int((float(self.plugin.req.dl_arrived)  / self.plugin.req.dl_size) * 100) +        except: +            return 0 +         +    def getSize(self): +        """ get size of download """ +        if self.size: return self.size +        else: +            try: +                return self.plugin.req.dl_size +            except: +                return 0 +                 +    def notifyChange(self): +        e = UpdateEvent("file", self.id, "collector" if not self.package().queue else "queue") +        self.m.core.pullManager.addEvent(e) + +class PyPackage(): +    def __init__(self, manager, id, name, folder, site, password, queue, order, priority): +        self.m = manager +        self.m.packageCache[int(id)] = self + +        self.id = int(id) +        self.name = name +        self.folder = folder +        self.site = site +        self.password = password +        self.queue = queue +        self.order = order +        self.priority = priority +         +         +        self.setFinished = False + +    def toDict(self): +        """return data as dict + +        format: + +        { +            id: {'name': name ... 'links': {} } } +        } + +        """ +        return { +            self.id: { +                'name': self.name, +                'folder': self.folder, +                'site': self.site, +                'password': self.password, +                'queue': self.queue, +                'order': self.order, +                'priority': self.priority, +                'links': {} +            } +        } + +    def getChildren(self): +        """get information about contained links""" +        return self.m.getPackageData(self.id)["links"] +     +    def setPriority(self, priority): +        self.priority = priority +        self.sync() + +    def sync(self): +        """sync with db""" +        self.m.updatePackage(self) + +    def release(self): +        """sync and delete from cache""" +        self.sync() +        self.m.releasePackage(self.id) + +    def delete(self): +        self.m.deletePackage(self.id) +                 +    def notifyChange(self): +        e = UpdateEvent("file", self.id, "collector" if not self.queue else "queue") +        self.m.core.pullManager.addEvent(e) + + +if __name__ == "__main__": + +    pypath = "." +    _ = lambda x: x +     +    db = FileHandler(None) + +    #p = PyFile(db, 5) +    #sleep(0.1) + +    a = time() + +    #print db.addPackage("package", "folder" , 1) +     +    pack = db.db.addPackage("package", "folder", 1) +     +    updates = [] +     +     +    for x in range(0, 200):        +        x = str(x) +        db.db.addLink("http://somehost.com/hoster/file/download?file_id=" + x, x, "BasePlugin", pack) +        updates.append(("new name" + x, 0, 3, "http://somehost.com/hoster/file/download?file_id=" + x)) + + +    for x in range(0, 100): +        updates.append(("unimportant%s" % x, 0, 3, "a really long non existent url%s" % x)) +         +    db.db.commit() + +    b = time() +    print "adding 200 links, single sql execs, no commit", b-a +     +    print db.getCompleteData(1) +  +    c  = time() +     + +    db.db.updateLinkInfo(updates) +     +    d = time() +     +    print "updates", d-c + +    print db.getCompleteData(1) +     +     +    e = time() +     +    print "complete data", e-d diff --git a/core/module/FileList.py b/core/module/FileList.py new file mode 100644 index 000000000..6a43f7d54 --- /dev/null +++ b/core/module/FileList.py @@ -0,0 +1,485 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +    @author: RaNaN +    @version: v0.3.2 +    @list-version: v4 +""" + +LIST_VERSION = 4 + +from operator import attrgetter +from operator import concat +from os.path import join +from threading import RLock +from time import sleep + +import cPickle +from module.DownloadThread import Status +from module.PullEvents import InsertEvent +from module.PullEvents import RemoveEvent +from module.PullEvents import UpdateEvent + +class NoSuchElementException(Exception): +    pass + +class FileList(object): +    def __init__(self, core): +        self.core = core +        self.lock = RLock() +        self.download_folder = self.core.config["general"]["download_folder"] +        self.collector = self.pyLoadCollector(self) +        self.packager = self.pyLoadPackager(self) +         +        self.data = { +            "version": LIST_VERSION, +            "queue": [], +            "packages": [], +            "collector": [] +        } +        self.load() +         +    def load(self): +        self.lock.acquire() +        try: +            pkl_file = open(join(self.core.configdir, "links.pkl"), "rb") +            obj = cPickle.load(pkl_file) +        except: +            obj = False +        if obj != False and obj["version"] == LIST_VERSION: +            packages = [] +            queue = [] +            collector = [] +            for n, pd in enumerate(obj["packages"]): +                p = PyLoadPackage() +                pd.get(p, self) +                packages.append(p) +            for pd in obj["queue"]: +                p = PyLoadPackage() +                pd.get(p, self) +                queue.append(p) +            for fd in obj["collector"]: +                f = PyLoadFile("", self) +                fd.get(f) +                collector.append(f) +            obj["packages"] = packages +            obj["queue"] = queue +            obj["collector"] = collector +            self.data = obj +        self.lock.release() +         +        if len(self.data["collector"]) > 0: +            self.core.logger.info(_("Found %s links in linkcollector") % len(self.data["collector"])) +        if len(self.data["packages"]) > 0: +            self.core.logger.info(_("Found %s unqueued packages") % len(self.data["packages"])) +        if len(self.data["queue"]) > 0: +            self.core.logger.info(_("Added %s packages to queue") % len(self.data["queue"])) +     +    def save(self): +        self.lock.acquire() +         +        pdata = { +            "version": LIST_VERSION, +            "queue": [], +            "packages": [], +            "collector": [] +        } + +        pdata["packages"] = [PyLoadPackageData().set(x) for x in self.data["packages"]] +        pdata["queue"] = [PyLoadPackageData().set(x) for x in self.data["queue"]] +        pdata["collector"] = [PyLoadFileData().set(x) for x in self.data["collector"]] +         +        output = open(join(self.core.configdir, "links.pkl"), "wb") +        cPickle.dump(pdata, output, -1) +         +        self.lock.release() +     +    def queueEmpty(self): +        return (self.data["queue"] == []) +     +    def getDownloadList(self, occ): +        """ +            for thread_list only, returns all elements that are suitable for downloadthread +        """ +        files = [] +        files += [[x for x in p.files if x.status.type == None and x.plugin.__type__ == "container" and not x.active] for p in self.data["queue"] + self.data["packages"]] +        files += [[x for x in p.files if (x.status.type == None or x.status.type == "reconnected") and not x.active and not x.plugin.__name__ in occ] for p in self.data["queue"]] + +        return reduce(concat, files, []) +     +    def getAllFiles(self): +         +        return map(attrgetter("files"), self.data["queue"] + self.data["packages"]) +     +    def countDownloads(self): +        """ simply return len of all files in all packages(which have no type) in queue and collector""" +        return len(reduce(concat, [[x for x in p.files if x.status.type == None] for p in self.data["queue"] + self.data["packages"]], [])) +     +    def getFileInfo(self, id): +        try: +            n, pyfile = self.collector._getFileFromID(id) +        except NoSuchElementException: +            key, n, pyfile, pypack, pid = self.packager._getFileFromID(id) +        info = {} +        info["id"] = pyfile.id +        info["url"] = pyfile.url +        info["folder"] = pyfile.folder +        info["filename"] = pyfile.status.filename +        info["status_type"] = pyfile.status.type +        info["status_url"] = pyfile.status.url +        info["status_filename"] = pyfile.status.filename +        info["status_error"] = pyfile.status.error +        info["size"] = pyfile.status.size() +        info["active"] = pyfile.active +        info["plugin"] = pyfile.plugin.__name__ +        try: +            info["package"] = pypack.data["id"] +        except: +            pass +        return info + +    def continueAborted(self): +        [[self.packager.resetFileStatus(x.id) for x in p.files if x.status.type == "aborted"] for p in self.data["queue"]] +     +    class pyLoadCollector(): +        def __init__(collector, file_list): +            collector.file_list = file_list +         +        def _getFileFromID(collector, id): +            """ +                returns PyLoadFile instance and position in collector with given id +            """ +            for n, pyfile in enumerate(collector.file_list.data["collector"]): +                if pyfile.id == id: +                    return (n, pyfile) +            raise NoSuchElementException() +         +        def _getFreeID(collector): +            """ +                returns a free id +            """ +            ids = [] +            for pypack in (collector.file_list.data["packages"] + collector.file_list.data["queue"]): +                for pyf in pypack.files: +                    ids.append(pyf.id) +            ids += map(attrgetter("id"), collector.file_list.data["collector"]) +            id = 1 +            while id in ids: +                id += 1 +            return id +         +        def getFile(collector, id): +            """ +                returns PyLoadFile instance from given id +            """ +            return collector._getFileFromID(id)[1] +             +        def popFile(collector, id): +            """ +                returns PyLoadFile instance given id and remove it from the collector +            """ +            collector.file_list.lock.acquire() +            try: +                n, pyfile = collector._getFileFromID(id) +                del collector.file_list.data["collector"][n] +                collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) +            except Exception, e: +                raise Exception, e +            else: +                return pyfile +            finally: +                collector.file_list.lock.release() +         +        def addLink(collector, url): +            """ +                appends a new PyLoadFile instance to the end of the collector +            """ +            pyfile = PyLoadFile(url, collector.file_list) +            pyfile.id = collector._getFreeID() +            pyfile.folder = collector.file_list.download_folder +            collector.file_list.lock.acquire() +            collector.file_list.data["collector"].append(pyfile) +            collector.file_list.lock.release() +            collector.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, "collector")) +            return pyfile.id +         +        def removeFile(collector, id): +            """ +                removes PyLoadFile instance with the given id from collector +            """ +            collector.popFile(id) +            collector.file_list.core.pullManager.addEvent(RemoveEvent("file", id, "collector")) +         +        def replaceFile(collector, newpyfile): +            """ +                replaces PyLoadFile instance with the given PyLoadFile instance at the given id +            """ +            collector.file_list.lock.acquire() +            try: +                n, pyfile = collector._getFileFromID(newpyfile.id) +                collector.file_list.data["collector"][n] = newpyfile +                collector.file_list.core.pullManager.addEvent(UpdateEvent("file", newpyfile.id, "collector")) +            finally: +                collector.file_list.lock.release() +         +    class pyLoadPackager(): +        def __init__(packager, file_list): +            packager.file_list = file_list +         +        def _getFreeID(packager): +            """ +                returns a free id +            """ +            ids = [pypack.data["id"] for pypack in packager.file_list.data["packages"] + packager.file_list.data["queue"]] +             +            id = 1 +            while id in ids: +                id += 1 +            return id +         +        def _getPackageFromID(packager, id): +            """ +                returns PyLoadPackage instance and position with given id +            """ +            for n, pypack in enumerate(packager.file_list.data["packages"]): +                if pypack.data["id"] == id: +                    return ("packages", n, pypack) +            for n, pypack in enumerate(packager.file_list.data["queue"]): +                if pypack.data["id"] == id: +                    return ("queue", n, pypack) +            raise NoSuchElementException() +         +        def _getFileFromID(packager, id): +            """ +                returns PyLoadFile instance and position with given id +            """ +            for n, pypack in enumerate(packager.file_list.data["packages"]): +                for pyfile in pypack.files: +                    if pyfile.id == id: +                        return ("packages", n, pyfile, pypack, pypack.data["id"]) +            for n, pypack in enumerate(packager.file_list.data["queue"]): +                for pyfile in pypack.files: +                    if pyfile.id == id: +                        return ("queue", n, pyfile, pypack, pypack.data["id"]) +            raise NoSuchElementException() +         +        def addNewPackage(packager, package_name=None): +            pypack = PyLoadPackage() +            pypack.data["id"] = packager._getFreeID() +            if package_name is not None: +                pypack.data["package_name"] = package_name +            packager.file_list.data["packages"].append(pypack) +            packager.file_list.core.pullManager.addEvent(InsertEvent("pack", pypack.data["id"], -2, "packages")) +            return pypack.data["id"] +         +        def removePackage(packager, id): +            packager.file_list.lock.acquire() +            try: +                key, n, pypack = packager._getPackageFromID(id) +                for pyfile in pypack.files: +                    pyfile.plugin.req.abort = True +                sleep(0.1) +                del packager.file_list.data[key][n] +                packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, key)) +            finally: +                packager.file_list.lock.release() +         +        def removeFile(packager, id): +            """ +                removes PyLoadFile instance with the given id from package +            """ +            packager.file_list.lock.acquire() +            try: +                key, n, pyfile, pypack, pid = packager._getFileFromID(id) +                pyfile.plugin.req.abort = True +                sleep(0.1) +                packager.removeFileFromPackage(id, pid) +                if not pypack.files: +                    packager.removePackage(pid) +            finally: +                packager.file_list.lock.release() +         +        def pushPackage2Queue(packager, id): +            packager.file_list.lock.acquire() +            try: +                key, n, pypack = packager._getPackageFromID(id) +                if key == "packages": +                    del packager.file_list.data["packages"][n] +                    packager.file_list.data["queue"].append(pypack) +                    packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "packages")) +                    packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "queue")) +            finally: +                packager.file_list.lock.release() +         +        def pullOutPackage(packager, id): +            packager.file_list.lock.acquire() +            try: +                key, n, pypack = packager._getPackageFromID(id) +                if key == "queue": +                    del packager.file_list.data["queue"][n] +                    packager.file_list.data["packages"].append(pypack) +                    packager.file_list.core.pullManager.addEvent(RemoveEvent("pack", id, "queue")) +                    packager.file_list.core.pullManager.addEvent(InsertEvent("pack", id, -2, "packages")) +            finally: +                packager.file_list.lock.release() +         +        def setPackageData(packager, id, package_name=None, folder=None): +            packager.file_list.lock.acquire() +            try: +                key, n, pypack = packager._getPackageFromID(id) +                if package_name is not None: +                    pypack.data["package_name"] = package_name +                if folder is not None: +                    pypack.data["folder"] = folder +                packager.file_list.data[key][n] = pypack +                packager.file_list.core.pullManager.addEvent(UpdateEvent("pack", id, key)) +            finally: +                packager.file_list.lock.release() +         +        def getPackageData(packager, id): +            key, n, pypack = packager._getPackageFromID(id) +            return pypack.data +         +        def getPackageFiles(packager, id): +            key, n, pypack = packager._getPackageFromID(id) +            ids = map(attrgetter("id"), pypack.files) +             +            return ids +         +        def addFileToPackage(packager, id, pyfile): +            key, n, pypack = packager._getPackageFromID(id) +            pyfile.package = pypack +            pypack.files.append(pyfile) +            packager.file_list.data[key][n] = pypack +            packager.file_list.core.pullManager.addEvent(InsertEvent("file", pyfile.id, -2, key)) +         +        def resetFileStatus(packager, fileid): +            packager.file_list.lock.acquire() +            try: +                key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) +                pyfile.init() +                pyfile.status.type = None +                packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) +            finally: +                packager.file_list.lock.release() +         +        def abortFile(packager, fileid): +            packager.file_list.lock.acquire() +            try: +                key, n, pyfile, pypack, pid = packager._getFileFromID(fileid) +                pyfile.plugin.req.abort = True +                packager.file_list.core.pullManager.addEvent(UpdateEvent("file", fileid, key)) +            finally: +                packager.file_list.lock.release() +        +        def removeFileFromPackage(packager, id, pid): +            key, n, pypack = packager._getPackageFromID(pid) +            for k, pyfile in enumerate(pypack.files): +                if id == pyfile.id: +                    del pypack.files[k] +                    packager.file_list.core.pullManager.addEvent(RemoveEvent("file", pyfile.id, key)) +                    if not pypack.files: +                        packager.removePackage(pid) +                    return True +            raise NoSuchElementException() + +class PyLoadPackage(): +    def __init__(self): +        self.files = [] +        self.data = { +            "id": None, +            "package_name": "new_package", +            "folder": "" +        } + +class PyLoadFile(): +    def __init__(self, url, file_list): +        self.id = None +        self.url = url +        self.folder = "" +        self.file_list = file_list +        self.core = file_list.core +        self.package = None +        self.filename = "n/a" +        self.init() +     +    def init(self): +        self.active = False +        pluginClass = self.core.pluginManager.getPluginFromPattern(self.url) +        self.plugin = pluginClass(self) +        self.status = Status(self) +        self.status.filename = self.url + +    def init_download(self): +        if self.core.config['proxy']['activated']: +            self.plugin.req.add_proxy(self.core.config['proxy']['protocol'], self.core.config['proxy']['adress']) + +class PyLoadFileData(): +    def __init__(self): +        self.id = None +        self.url = None +        self.folder = None +        self.pack_id = None +        self.filename = None +        self.status_type = None +        self.status_url = None + +    def set(self, pyfile): +        self.id = pyfile.id +        self.url = pyfile.url +        self.folder = pyfile.folder +        self.parsePackage(pyfile.package) +        self.filename = pyfile.filename +        self.status_type = pyfile.status.type +        self.status_url = pyfile.status.url +        self.status_filename = pyfile.status.filename +        self.status_error = pyfile.status.error + +        return self + +    def get(self, pyfile): +        pyfile.id = self.id +        pyfile.url = self.url +        pyfile.folder = self.folder +        pyfile.filename = self.filename +        pyfile.status.type = self.status_type +        pyfile.status.url = self.status_url +        pyfile.status.filename = self.status_filename +        pyfile.status.error = self.status_error +     +    def parsePackage(self, pack): +        if pack: +            self.pack_id = pack.data["id"] + +class PyLoadPackageData(): +    def __init__(self): +        self.data = None +        self.files = [] + +    def set(self, pypack): +        self.data = pypack.data +        self.files = [PyLoadFileData().set(x) for x in pypack.files] +        return self +         +    def get(self, pypack, fl): +        pypack.data = self.data +        for fdata in self.files: +            pyfile = PyLoadFile(fdata.url, fl) +            fdata.get(pyfile) +            pyfile.package = pypack +            pypack.files.append(pyfile) diff --git a/core/module/HookManager.py b/core/module/HookManager.py new file mode 100644 index 000000000..77a17b0aa --- /dev/null +++ b/core/module/HookManager.py @@ -0,0 +1,128 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: mkaay +    @interface-version: 0.1 +""" + +import traceback +from threading import RLock +from module.PluginThread import HookThread +from time import time + +class HookManager(): +    def __init__(self, core): +        self.core = core + +        self.config = self.core.config + +        self.log = self.core.log +        self.plugins = [] +        self.lock = RLock() +        self.createIndex() + +    def lock(func): +        def new(*args): +            args[0].lock.acquire() +            res = func(*args) +            args[0].lock.release() +            return res +        return new +     +    def try_catch(func): +        def new(*args): +            try: +                return func(*args) +            except Exception, e: +                args[0].log.error(_("Error executing hooks: %s") % str(e)) +        return new + +    def createIndex(self): + +        plugins = [] +        for pluginClass in self.core.pluginManager.getHookPlugins(): +            try: +                #hookClass = getattr(plugin, plugin.__name__) +                 +                if self.core.config.getPlugin(pluginClass.__name__, "load"): +                    #@TODO handle in pluginmanager +                    plugin = pluginClass(self.core) +                    plugins.append(plugin) +                    self.log.info(_("%s loaded, activated %s") % (pluginClass.__name__, plugin.isActivated() )) +            except: +                self.log.warning(_("Failed activating %(name)s") % {"name":pluginClass.__name__}) +                if self.core.debug: +                    traceback.print_exc() + +        self.plugins = plugins + +         +    @try_catch +    def periodical(self): +        for plugin in self.plugins: +            if plugin.isActivated() and plugin.lastCall + plugin.interval < time(): +                plugin.periodical() +                plugin.lastCall = time() +     +     +    @try_catch +    def coreReady(self): +        for plugin in self.plugins: +            if plugin.isActivated(): +                plugin.coreReady() + +    @lock +    def downloadStarts(self, pyfile): + +        for plugin in self.plugins: +            if plugin.isActivated(): +                plugin.downloadStarts(pyfile) + +    @lock +    def downloadFinished(self, pyfile): + +        for plugin in self.plugins: +            if plugin.isActivated(): +                if "downloadFinished" in plugin.__threaded__: +                    self.startThread(plugin.downloadFinished, pyfile) +                else: +                    plugin.downloadFinished(pyfile) +     +    @lock +    def packageFinished(self, package): + +        for plugin in self.plugins: +            if plugin.isActivated(): +                if "packageFinished" in plugin.__threaded__: +                    self.startThread(plugin.packageFinished, package) +                else: +                    plugin.packageFinished(package) +     +    @lock +    def beforeReconnecting(self, ip): + +        for plugin in self.plugins: +            plugin.beforeReconnecting(ip) +     +    @lock +    def afterReconnecting(self, ip): + +        for plugin in self.plugins: +            if plugin.isActivated(): +                plugin.afterReconnecting(ip) + +    def startThread(self, function, pyfile): +        t = HookThread(self.core.threadManager, function, pyfile) diff --git a/core/module/InitHomeDir.py b/core/module/InitHomeDir.py new file mode 100644 index 000000000..0c66b5c32 --- /dev/null +++ b/core/module/InitHomeDir.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN + +	This modules inits working directories and global variables, pydir and homedir +""" + + +from os import makedirs +from os import path +from os import chdir +from sys import platform +from sys import argv + +import __builtin__ +__builtin__.pypath = path.abspath(path.join(__file__,"..","..")) + + +homedir = "" + +if platform == 'nt': +	homedir = path.expanduser("~") +	if homedir == "~": +		import ctypes +		CSIDL_APPDATA = 26 +		_SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW +		_SHGetFolderPath.argtypes = [ctypes.wintypes.HWND, +			                         ctypes.c_int, +			                         ctypes.wintypes.HANDLE, +			                         ctypes.wintypes.DWORD, ctypes.wintypes.LPCWSTR] +	 +		path_buf = ctypes.wintypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) +		result = _SHGetFolderPath(0, CSIDL_APPDATA, 0, 0, path_buf) +		homedir = path_buf.value +else: +	homedir = path.expanduser("~") + +__builtin__.homedir = homedir + + +args = " ".join(argv[1:]) + +# dirty method to set configdir from commandline arguments + +if path.exists(path.join(pypath, "module", "config", "configdir")): +	f = open(path.join(pypath, "module", "config", "configdir"), "rb") +	c = f.read().strip() +	configdir = path.join(pypath, c) +                +elif "--configdir=" in args: +	pos = args.find("--configdir=") +	end = args.find("-", pos+12) +	 +	if end == -1: +		configdir = args[pos+12:].strip() +	else: +		configdir = args[pos+12:end].strip() +else: +	if platform in ("posix","linux2"): +		configdir = path.join(homedir, ".pyload") +	else: +		configdir = path.join(homedir, "pyload") +		 +if not path.exists(configdir): +	makedirs(configdir, 0700) + +__builtin__.configdir = configdir +chdir(configdir) + +#print "Using %s as working directory." % configdir diff --git a/core/module/PluginManager.py b/core/module/PluginManager.py new file mode 100644 index 000000000..8f00b9f25 --- /dev/null +++ b/core/module/PluginManager.py @@ -0,0 +1,314 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay, RaNaN +""" + +import re +import sys + +from os import listdir +from os import makedirs + +from os.path import isfile +from os.path import join +from os.path import exists +from os.path import abspath + +from sys import version_info +from itertools import chain + + +class PluginManager(): +    def __init__(self, core): +        self.core = core +         +        #self.config = self.core.config +        self.log = core.log +         +        self.crypterPlugins = {} +        self.containerPlugins = {} +        self.hosterPlugins = {} +        self.captchaPlugins = {} +        self.accountPlugins = {} +        self.hookPlugins = {} +         +        self.createHomeDirs() +         +        self.createIndex() +         +        #@TODO plugin updater +    #---------------------------------------------------------------------- +    def createHomeDirs(self): +        """create homedirectories containing plugins""" +        #@TODO implement... +        pass +     +    def createIndex(self): +        """create information for all plugins available""" +         +        sys.path.append(abspath("")) +         +        if not exists("userplugins"): +            makedirs("userplugins") +        if not exists(join("userplugins", "__init__.py")): +            f = open(join("userplugins", "__init__.py"), "wb") +            f.close() +         +        self.rePattern = re.compile(r'__pattern__.*=.*r("|\')([^"\']+)') +        self.reVersion = re.compile(r'__version__.*=.*("|\')([0-9.]+)') +        self.reConfig = re.compile(r'__config__.*=.*\[([^\]]+)', re.MULTILINE) +         +        self.crypterPlugins = self.parse(_("Crypter"), "crypter", pattern=True) +        self.containerPlugins = self.parse(_("Container"), "container", pattern=True) +        self.hosterPlugins = self.parse(_("Hoster") ,"hoster", pattern=True) +         +        self.captchaPlugins = self.parse(_("Captcha"), "captcha") +        self.accountPlugins = self.parse(_("Account"), "accounts", create=True) +        self.hookPlugins = self.parse(_("Hook"), "hooks") +         +        self.log.info(_("created index of plugins")) +     +    def parse(self, typ, folder, create=False, pattern=False, home={}): +        """ +        returns dict with information  +        home contains parsed plugins from module. +         +        { +        name : {path, version, config, (pattern, re), (plugin, class)} +        } +         +        """ +        plugins = {} +        if home: +            pfolder = join("userplugins", folder) +            if not exists(pfolder): +                makedirs(pfolder) +            if not exists(join(pfolder, "__init__.py")): +                f = open(join(pfolder, "__init__.py"), "wb") +                f.close() + +        else: +            pfolder = join(pypath, "module", "plugins", folder) +             +        for f in listdir(pfolder): +            if (isfile(join(pfolder, f)) and f.endswith(".py") or f.endswith("_25.pyc") or f.endswith("_26.pyc") or f.endswith("_27.pyc")) and not f.startswith("_"): +                data = open(join(pfolder, f)) +                content = data.read() +                data.close() +                 +                if f.endswith("_25.pyc") and not version_info[0:2] == (2, 5): +                    continue +                elif f.endswith("_26.pyc") and not version_info[0:2] == (2, 6): +                    continue +                elif f.endswith("_27.pyc") and not version_info[0:2] == (2, 7): +                    continue +                                               +                name = f[:-3] +                if name[-1] == "." : name = name[:-4] +                 +                 +                version = self.reVersion.findall(content) +                if version: +                    version = float(version[0][1]) +                else: +                    version = 0 +                 +                if home and home.has_key(name): +                    if home[name]["v"] > version: +                        continue +                 +                 +                plugins[name] = {} +                plugins[name]["v"] = version +                 +                 +                module = f.replace(".pyc","").replace(".py","") +                if home: +                    path = "userplugins.%s.%s" % (folder, module) +                else: +                    path = "module.plugins.%s.%s" % (folder, module) +                     +                plugins[name]["name"] = module                 +                plugins[name]["path"] = path +                 +                 +                if pattern: +                    pattern = self.rePattern.findall(content) +                     +                    if pattern: +                        pattern = pattern[0][1] +                    else: +                        pattern = "^unmachtable$" +                         +                    plugins[name]["pattern"] = pattern +                     +                    try: +                        plugins[name]["re"] = re.compile(pattern) +                    except: +                        self.log.error(_("%s has invalid pattern.") % name) + +                 +                config = self.reConfig.findall(content) +                 +                if config: +                    config = [ [y.strip() for y in x.replace("'","").replace('"',"").replace(")","").split(",")] for x in config[0].split("(") if x.strip()] +                     +                    if folder == "hooks": +                        config.append( ["load", "bool", "Load on startup", True if name not in ("XMPPInterface", "MultiHome") else False] )  +                     +                    for item in config: +                        self.core.config.addPluginConfig([name]+item) +     +        if not home: +            temp = self.parse(typ, folder, create, pattern, plugins) +            plugins.update(temp) +             +        return plugins +         +    #---------------------------------------------------------------------- +    def parseUrls(self, urls): +        """parse plugins for given list of urls""" +         +        last = None +        res = [] # tupels of (url, plugin) +         +        for url in urls: + +            found = False +             +            if last and last[1]["re"].match(url): +                res.append((url, last[0])) +                continue +             +            for name, value in chain(self.crypterPlugins.iteritems(), self.hosterPlugins.iteritems(), self.containerPlugins.iteritems() ): +                if value["re"].match(url): +                    res.append((url, name)) +                    last = (name, value) +                    found = True +                    break +                 +            if not found: +                res.append((url, "BasePlugin"))  +         +        return res +     +    #---------------------------------------------------------------------- +    def getPlugin(self, name): +        """return plugin module from hoster|decrypter|container""" +        plugin = None +         +        if self.containerPlugins.has_key(name): +            plugin = self.containerPlugins[name] +        if self.crypterPlugins.has_key(name): +            plugin = self.crypterPlugins[name] +        if self.hosterPlugins.has_key(name): +            plugin = self.hosterPlugins[name] +         +             +        if plugin.has_key("module"): +            return plugin["module"] +         +        plugin["module"] = __import__(plugin["path"], globals(), locals(), [plugin["name"]] , -1) +         +        return plugin["module"] +         +             +    #---------------------------------------------------------------------- +    def getCaptchaPlugin(self, name): +        """return captcha modul if existent""" +        if self.captchaPlugins.has_key(name): +            plugin = self.captchaPlugins[name] +            if plugin.has_key("class"): +                return plugin["class"] +         +            module = __import__(plugin["path"], globals(), locals(), [plugin["name"]] , -1) +            plugin["class"] = getattr(module, name) +         +            return plugin["class"] +         +        return None +    #---------------------------------------------------------------------- +    def getAccountPlugin(self, name): +        """return account class if existent""" +        if self.accountPlugins.has_key(name): +            plugin = self.accountPlugins[name] +            if plugin.has_key("class"): +                return plugin["class"] +             +            module = __import__(plugin["path"], globals(), locals(), [plugin["name"]] , -1) +            plugin["class"] = getattr(module, plugin["name"]) +                  +            return plugin["class"] +         +        return None +         +    #---------------------------------------------------------------------- +    def getAccountPlugins(self): +        """return list of account plugin names""" +        res = [] +         +        for name in self.accountPlugins.keys(): +            res.append(name) +     +        return res +    #---------------------------------------------------------------------- +    def getHookPlugins(self): +        """return list of hook classes""" +         +        classes = [] +         +        for name, value in self.hookPlugins.iteritems(): +            if value.has_key("class"): +                classes.append(value["class"]) +                continue +             +            if not self.core.config.getPlugin(name, "load"): +                continue +             +            try: +                module = __import__(value["path"], globals(), locals(), [value["name"]] , -1) +            except Exception, e: +                self.log.error(_("Error importing %s: %s") % (name, str(e))) +                self.log.error(_("You should fix dependicies or deactivate load on startup.")) +                continue +                 +            pluginClass = getattr(module, name) +             +            value["class"] = pluginClass + +            classes.append(pluginClass)             +         +        return classes + + +if __name__ == "__main__": +    _ = lambda x : x +    pypath = "/home/christian/Projekte/pyload-0.4/module/plugins" +     +    from time import time +     +    p = PluginManager(None) +     +    a = time()  +     +    test = [ "http://www.youtube.com/watch?v=%s" % x for x in range(0,100) ] +    print p.parseUrls(test) +     +    b = time() +     +    print b-a ,"s" +     diff --git a/core/module/PluginThread.py b/core/module/PluginThread.py new file mode 100644 index 000000000..0175bb419 --- /dev/null +++ b/core/module/PluginThread.py @@ -0,0 +1,381 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN +""" + +from Queue import Queue +from threading import Thread +from time import sleep +from time import strftime +from traceback import print_exc, format_exc +from pprint import pformat +from sys import exc_info +from types import InstanceType +from types import MethodType + +from module.plugins.Plugin import Abort +from module.plugins.Plugin import Fail +from module.plugins.Plugin import Reconnect +from module.plugins.Plugin import Retry +from pycurl import error +from module.FileDatabase import PyFile + +######################################################################## +class PluginThread(Thread): +    """abstract base class for thread types""" + +    #---------------------------------------------------------------------- +    def __init__(self, manager): +        """Constructor""" +        Thread.__init__(self) +        self.setDaemon(True) +        self.m = manager #thread manager +         +         +    def writeDebugReport(self, pyfile): +        dump = "pyLoad %s Debug Report of %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % (self.m.core.server_methods.get_server_version(), pyfile.pluginname, format_exc()) +                     +        tb = exc_info()[2] +        stack = [] +        while tb: +            stack.append(tb.tb_frame) +            tb = tb.tb_next + +        for frame in stack[1:]: +             +            dump += "\nFrame %s in %s at line %s\n" % (frame.f_code.co_name, +                                                     frame.f_code.co_filename, +                                                     frame.f_lineno) +             +            for key, value in frame.f_locals.items(): +                dump += "\t%20s = " % key +                try: +                    dump += pformat(value) + "\n" +                except: +                    dump += "<ERROR WHILE PRINTING VALUE>\n" +                                    +        dump += "\n\nPLUGIN OBJECT DUMP: \n\n" +         +        for name in dir(pyfile.plugin): +            attr = getattr(pyfile.plugin, name) +            if not name.endswith("__") and type(attr) != MethodType: +                dump += "\t%20s = " % name +                dump += pformat(attr) +"\n" +        +        dump += "\nPYFILE OBJECT DUMP: \n\n" +         +        for name in dir(pyfile): +            attr = getattr(pyfile, name) +            if not name.endswith("__") and type(attr) != MethodType: +                dump += "\t%20s = " % name +                dump += pformat(attr) +"\n" +             +         +        if self.m.core.config.plugin.has_key(pyfile.pluginname): +            dump += "\n\nCONFIG: \n\n" +            dump += pformat(self.m.core.config.plugin[pyfile.pluginname]) +"\n" +                 +         +             +        dump_name = "debug_%s_%s.txt" % (pyfile.pluginname, strftime("%d-%m-%Y_%H-%M-%S")) +        self.m.core.log.info("Debug Report written to %s" % dump_name)  +                                 +        f = open(dump_name, "wb") +        f.write(dump) +        f.close() + + +######################################################################## +class DownloadThread(PluginThread): +    """thread for downloading files from 'real' hoster plugins""" + +    #---------------------------------------------------------------------- +    def __init__(self, manager): +        """Constructor""" +        PluginThread.__init__(self, manager) + +        self.queue = Queue() # job queue +        self.active = False + +        self.start() + +    #---------------------------------------------------------------------- +    def run(self): +        """run method""" + +        while True: +            self.active = self.queue.get() +            pyfile = self.active + +            if self.active == "quit": +                return True + +            self.m.log.info(_("Download starts: %s" % pyfile.name)) + +            try: +                self.m.core.hookManager.downloadStarts(pyfile) +                pyfile.plugin.preprocessing(self) + +            except NotImplementedError: + +                self.m.log.error(_("Plugin %s is missing a function.") % pyfile.pluginname) +                continue + +            except Abort: +                self.m.log.info(_("Download aborted: %s") % pyfile.name) +                pyfile.setStatus("aborted") + +                pyfile.plugin.req.clean() +                self.active = False +                pyfile.release() +                continue + +            except Reconnect: +                self.queue.put(pyfile) +                #@TODO +                #pyfile.req.clearCookies() + +                while self.m.reconnecting.isSet(): +                    sleep(0.5) + +                continue + +            except Retry: + +                self.m.log.info(_("Download restarted: %s") % pyfile.name) +                self.queue.put(pyfile) +                continue + +            except Fail, e: + +                msg = e.args[0] + +                if msg == "offline": +                    pyfile.setStatus("offline") +                    self.m.log.warning(_("Download is offline: %s") % pyfile.name) +                else: +                    pyfile.setStatus("failed") +                    self.m.log.warning(_("Download failed: %s | %s") % (pyfile.name, msg)) +                    pyfile.error = msg + +                pyfile.plugin.req.clean() +                self.active = False +                pyfile.release() +                continue + +            except error, e: +                code, msg = e +                 +                if self.m.core.debug: +                    print "pycurl error", code, msg +                    print_exc() +                    self.writeDebugReport(pyfile) + +                if code in (7,52): +                    self.m.log.warning(_("Couldn't connect to host waiting 1 minute and retry.")) +                    sleep(60) +                    self.queue.put(pyfile) +                    continue + +                pyfile.plugin.req.clean() +                self.active = False +                pyfile.release() +                continue + +            except Exception, e: +                pyfile.setStatus("failed") +                self.m.log.error(_("Download failed: %s | %s") % (pyfile.name, str(e))) +                pyfile.error = str(e) + +                if self.m.core.debug: +                    print_exc()                     +                    self.writeDebugReport(pyfile) + +                pyfile.plugin.req.clean() +                self.active = False +                pyfile.release() +                continue + + +            finally: +                self.m.core.files.save() + + +            self.m.log.info(_("Download finished: %s") % pyfile.name) +            pyfile.plugin.req.clean() + +            self.m.core.hookManager.downloadFinished(pyfile) + +            self.m.core.files.checkPackageFinished(pyfile) + +            self.active = False +            pyfile.finishIfDone() +            self.m.core.files.save() + +    #---------------------------------------------------------------------- +    def put(self, job): +        """assing job to thread""" +        self.queue.put(job) + +    #---------------------------------------------------------------------- +    def stop(self): +        """stops the thread""" +        self.put("quit") + + + +######################################################################## +class DecrypterThread(PluginThread): +    """thread for decrypting""" + +    #---------------------------------------------------------------------- +    def __init__(self, manager, pyfile): +        """constructor""" +        PluginThread.__init__(self, manager) + +        self.active = pyfile +        manager.localThreads.append(self) + +        pyfile.setStatus("decrypting") + +        self.start() + +    #---------------------------------------------------------------------- +    def run(self): +        """run method""" + +        pyfile = self.active + +        try: +            self.m.log.info(_("Decrypting starts: %s") % self.active.name) +            self.active.plugin.preprocessing(self) + +        except NotImplementedError: + +            self.m.log.error(_("Plugin %s is missing a function.") % self.active.pluginname) +            return + +        except Fail, e: + +            msg = e.args[0] + +            if msg == "offline": +                self.active.setStatus("offline") +                self.m.log.warning(_("Download is offline: %s") % self.active.name) +            else: +                self.active.setStatus("failed") +                self.m.log.warning(_("Decrypting failed: %s | %s") % (self.active.name, msg)) +                self.active.error = msg + +            return + + +        except Exception, e: + +            self.active.setStatus("failed") +            self.m.log.error(_("Decrypting failed: %s | %s") % (self.active.name, str(e))) +            self.active.error = str(e) + +            if self.m.core.debug: +                print_exc() +                self.writeDebugReport(pyfile) + +            return + + +        finally: +            self.active.release() +            self.active = False +            self.m.core.files.save() +            self.m.localThreads.remove(self) + + +        #self.m.core.hookManager.downloadFinished(pyfile) + + +        #self.m.localThreads.remove(self) +        #self.active.finishIfDone() +        pyfile.delete() + +######################################################################## +class HookThread(PluginThread): +    """thread for hooks""" + +    #---------------------------------------------------------------------- +    def __init__(self, m, function, pyfile): +        """Constructor""" +        PluginThread.__init__(self, m) + +        self.f = function +        self.active = pyfile + +        m.localThreads.append(self) +         +        if isinstance(pyfile, PyFile): +            pyfile.setStatus("processing") + +        self.start() + +    def run(self): +        self.f(self.active) + + +        self.m.localThreads.remove(self) +        if isinstance(self.active, PyFile): +            self.active.finishIfDone() + +######################################################################## +class InfoThread(PluginThread): + +    #---------------------------------------------------------------------- +    def __init__(self, manager, data, pid): +        """Constructor""" +        PluginThread.__init__(self, manager) + +        self.data = data +        self.pid = pid # package id +        # [ .. (name, plugin) .. ] +        self.start() + +    #---------------------------------------------------------------------- +    def run(self): +        """run method""" + +        plugins = {} + +        for url, plugin in self.data: +            if plugins.has_key(plugin): +                plugins[plugin].append(url) +            else: +                plugins[plugin] = [url] + +        for pluginname, urls in plugins.iteritems(): +            plugin = self.m.core.pluginManager.getPlugin(pluginname) +            if hasattr(plugin, "getInfo"): +                try: +                    self.m.core.log.debug("Run Info Fetching for %s" % pluginname) +                    for result in plugin.getInfo(urls): +                        if not type(result) == list: result = [result] +                        self.m.core.files.updateFileInfo(result, self.pid) +     +                    self.m.core.log.debug("Finished Info Fetching for %s" % pluginname) +     +                    self.m.core.files.save() +                except Exception, e: +                    self.m.core.log.debug("Info Fetching for %s failed | %s" % (pluginname,str) ) +                    
\ No newline at end of file diff --git a/core/module/PullEvents.py b/core/module/PullEvents.py new file mode 100644 index 000000000..bbb3f3e6b --- /dev/null +++ b/core/module/PullEvents.py @@ -0,0 +1,111 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from time import time + +class PullManager(): +    def __init__(self, core): +        self.core = core +        self.clients = [] +     +    def newClient(self, uuid): +        self.clients.append(Client(uuid)) +     +    def clean(self): +        for n, client in enumerate(self.clients): +            if client.lastActive + 30 < time(): +                del self.clients[n] +     +    def getEvents(self, uuid): +        events = [] +        validUuid = False +        for client in self.clients: +            if client.uuid == uuid: +                client.lastActive = time() +                validUuid = True +                while client.newEvents(): +                    events.append(client.popEvent().toList()) +                break +        if not validUuid: +            self.newClient(uuid) +            events = [ReloadAllEvent("queue").toList(), ReloadAllEvent("collector").toList()] +        return events +     +    def addEvent(self, event): +        for client in self.clients: +            client.addEvent(event) + +class Client(): +    def __init__(self, uuid): +        self.uuid = uuid +        self.lastActive = time() +        self.events = [] +     +    def newEvents(self): +        return (len(self.events) > 0) +     +    def popEvent(self): +        if not len(self.events): +            return None +        return self.events.pop(0) +     +    def addEvent(self, event): +        self.events.append(event) + +class UpdateEvent(): +    def __init__(self, itype, iid, destination): +        assert itype == "pack" or itype == "file" +        assert destination == "queue" or destination == "collector" +        self.type = itype +        self.id = iid +        self.destination = destination +     +    def toList(self): +        return ["update", self.destination, self.type, self.id] + +class RemoveEvent(): +    def __init__(self, itype, iid, destination): +        assert itype == "pack" or itype == "file" +        assert destination == "queue" or destination == "collector" +        self.type = itype +        self.id = iid +        self.destination = destination +     +    def toList(self): +        return ["remove", self.destination, self.type, self.id] + +class InsertEvent(): +    def __init__(self, itype, iid, after, destination): +        assert itype == "pack" or itype == "file" +        assert destination == "queue" or destination == "collector" +        self.type = itype +        self.id = iid +        self.after = after +        self.destination = destination +     +    def toList(self): +        return ["insert", self.destination, self.type, self.id, self.after] + +class ReloadAllEvent(): +    def __init__(self, destination): +        assert destination == "queue" or destination == "collector" +        self.destination = destination +         +    def toList(self): +        return ["reload", self.destination] diff --git a/core/module/RequestFactory.py b/core/module/RequestFactory.py new file mode 100644 index 000000000..3885cae19 --- /dev/null +++ b/core/module/RequestFactory.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from threading import Lock +from module.network.Request import Request +from module.network.XdccRequest import XdccRequest +from module.network.FtpRequest import FtpRequest +from time import time + +class RequestFactory(): +    def __init__(self, core): +        self.lock = Lock() +        self.core = core +        self.requests = [] +        self.cookiejars = [] +        self.iface = self.core.config["general"]["download_interface"] +     +    def getRequest(self, pluginName, account=None, type="HTTP"): +        self.lock.acquire() +        if type == "HTTP": +            req = Request(interface=str(self.iface)) +            if account: +                cj = self.getCookieJar(pluginName, account) +                req.setCookieJar(cj) +            else: +                req.setCookieJar(CookieJar(pluginName)) +             +        elif type == "XDCC": +            req = XdccRequest() +             +        elif type == "FTP": +            req = FtpRequest() +             +        self.requests.append((pluginName, account, req)) +        self.lock.release() +        return req +     +    def clean(self): +        self.lock.acquire() +        for req in self.requests: +            req[2].clean() +        self.lock.release() +     +    def getCookieJar(self, plugin, account=None): +        for cj in self.cookiejars: +            if (cj.plugin, cj.account) == (plugin, account): +                return cj +        cj = CookieJar(plugin, account) +        self.cookiejars.append(cj) +        return cj +     +class CookieJar(): +    def __init__(self, plugin, account=None): +        self.cookies = {} +        self.plugin = plugin +        self.account = account +     +    def addCookies(self, clist): +        for c in clist: +            name = c.split("\t")[5] +            self.cookies[name] = c +     +    def getCookies(self): +        return self.cookies.values() +     +    def parseCookie(self, name): +        if cookies.has_key(name): +            return self.cookies[name].split("\t")[6] +        else: +            return None +     +    def getCookie(self, name): +        return self.parseCookie(name) +     +    def setCookie(self, domain, name, value, path="/", exp=time()+3600*24*180): +        s = ".%s	TRUE	%s	FALSE	%s	%s	%s" % (domain, path, exp, name, value) +        self.cookies[name] = s diff --git a/core/module/SpeedManager.py b/core/module/SpeedManager.py new file mode 100644 index 000000000..e69c641fc --- /dev/null +++ b/core/module/SpeedManager.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +    @version: v0.3.2 +""" + +from threading import Thread +from time import sleep, time + +class SpeedManager(Thread): +    def __init__(self, parent): +        Thread.__init__(self) +        self.parent = parent +        self.running = True +        self.lastSlowCheck = 0.0 +         +        stat = {} +        stat["slow_downloads"] = None +        stat["each_speed"] = None +        stat["each_speed_optimized"] = None +        self.stat = stat +         +        self.slowCheckInterval = 60 +        self.slowCheckTestTime = 25 +         +        self.logger = self.parent.parent.logger +        self.start() +     +    def run(self): +        while self.running: +            sleep(1) +            self.manageSpeed() +     +    def getMaxSpeed(self): +        return self.parent.parent.getMaxSpeed() +     +    def manageSpeed(self): +        maxSpeed = self.getMaxSpeed() +        if maxSpeed <= 0: +            for thread in self.parent.py_downloading: +                thread.plugin.req.speedLimitActive = False +            return +        threads = self.parent.py_downloading +        threadCount = len(threads) +        if threadCount <= 0: +            return +        eachSpeed = maxSpeed/threadCount +         +        currentOverallSpeed = 0 +        restSpeed = maxSpeed - currentOverallSpeed +        speeds = [] +        for thread in threads: +            currentOverallSpeed += thread.plugin.req.dl_speed +            speeds.append((thread.plugin.req.dl_speed, thread.plugin.req.averageSpeed, thread)) +            thread.plugin.req.speedLimitActive = True +         +        if currentOverallSpeed+50 < maxSpeed: +            for thread in self.parent.py_downloading: +                thread.plugin.req.speedLimitActive = False +            return +         +        slowCount = 0 +        slowSpeed = 0 +        if self.lastSlowCheck + self.slowCheckInterval + self.slowCheckTestTime < time.time(): +            self.lastSlowCheck = time.time() +        if self.lastSlowCheck + self.slowCheckInterval < time.time() < self.lastSlowCheck + self.slowCheckInterval + self.slowCheckTestTime: +            for speed in speeds: +                speed[2].plugin.req.isSlow = False +        else: +            for speed in speeds: +                if speed[0] <= eachSpeed-7: +                    if speed[1] < eachSpeed-15: +                        if speed[2].plugin.req.dl_time > 0 and speed[2].plugin.req.dl_time+30 < time.time(): +                            speed[2].plugin.req.isSlow = True +                            if not speed[1]-5 < speed[2].plugin.req.maxSpeed/1024 < speed[1]+5: +                                speed[2].plugin.req.maxSpeed = (speed[1]+10)*1024 +                if speed[2].plugin.req.isSlow: +                    slowCount += 1 +                    slowSpeed += speed[2].plugin.req.maxSpeed/1024 +        stat = {} +        stat["slow_downloads"] = slowCount +        stat["each_speed"] = eachSpeed +        eachSpeed = (maxSpeed - slowSpeed) / (threadCount - slowCount) +        stat["each_speed_optimized"] = eachSpeed +        self.stat = stat +         +        for speed in speeds: +            if speed[2].plugin.req.isSlow: +                continue +            speed[2].plugin.req.maxSpeed = eachSpeed*1024 +            print "max", speed[2].plugin.req.maxSpeed, "current", speed[2].plugin.req.dl_speed diff --git a/core/module/ThreadManager.py b/core/module/ThreadManager.py new file mode 100644 index 000000000..b9c407484 --- /dev/null +++ b/core/module/ThreadManager.py @@ -0,0 +1,189 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN +""" + +from os.path import exists, join +import re +from subprocess import Popen +from threading import Event +from time import sleep +from traceback import print_exc + +import PluginThread +from module.network.Request import getURL + +######################################################################## +class ThreadManager: +    """manages the download threads, assign jobs, reconnect etc""" + +    #---------------------------------------------------------------------- +    def __init__(self, core): +        """Constructor""" +        self.core = core +        self.log = core.log +                 +        self.threads = []  # thread list +        self.localThreads = []  #hook+decrypter threads +         +        #self.infoThread = PluginThread.InfoThread(self) +                 +        self.pause = True +         +        self.reconnecting = Event() +        self.reconnecting.clear() +         +        for i in range(0, self.core.config.get("general", "max_downloads")): +            self.createThread() +         +         +         +    #---------------------------------------------------------------------- +    def createThread(self): +        """create a download thread""" +         +        thread = PluginThread.DownloadThread(self)         +        self.threads.append(thread) +         +    #---------------------------------------------------------------------- +    def createInfoThread(self, data, pid): +        """ +        start a thread whichs fetches online status and other infos +        data = [ .. () .. ] +        """ +         +        PluginThread.InfoThread(self, data, pid) +         +         +    #---------------------------------------------------------------------- +    def downloadingIds(self): +        """get a list of the currently downloading pyfile's ids""" +        return [x.active.id for x in self.threads if x.active and x.active != "quit"] +     +    #---------------------------------------------------------------------- +    def processingIds(self): +        """get a id list of all pyfiles processed""" +        return [x.active.id for x in self.threads + self.localThreads if x.active and x.active != "quit"] +         +         +    #---------------------------------------------------------------------- +    def work(self): +        """run all task which have to be done (this is for repetivive call by core)""" +                 +        self.tryReconnect() +        self.checkThreadCount() +        self.assignJob() +     +    #---------------------------------------------------------------------- +    def tryReconnect(self): +        """checks if reconnect needed""" +         +        if not (self.core.server_methods.is_time_reconnect() and self.core.config["reconnect"]["activated"]): +            return False +                         +        active = [x.active.plugin.wantReconnect and x.active.plugin.waiting for x in self.threads if x.active] + +        if active.count(True) > 0 and len(active) == active.count(True): +         +            if not exists(self.core.config['reconnect']['method']): +                if exists(join(pypath, self.core.config['reconnect']['method'])): +                    self.core.config['reconnect']['method'] = join(pypath, self.core.config['reconnect']['method']) +                else: +                    self.core.config["reconnect"]["activated"] = False +                    self.log.warning(_("Reconnect script not found!")) +                    return +                 +                 +            self.reconnecting.set() +             +            #Do reconnect +            self.log.info(_("Starting reconnect")) + +             +            while [x.active.plugin.waiting for x in self.threads if x.active].count(True) != 0: +                sleep(0.25) +                 +                         +            ip = re.match(".*Current IP Address: (.*)</body>.*", getURL("http://checkip.dyndns.org/")).group(1) +             +            self.core.hookManager.beforeReconnecting(ip) +            reconn = Popen(self.core.config['reconnect']['method'])#, stdout=subprocess.PIPE) +            reconn.wait() +            sleep(1) +            ip = "" +            while ip == "": +                try: +                    ip = re.match(".*Current IP Address: (.*)</body>.*", getURL("http://checkip.dyndns.org/")).group(1) #get new ip +                except: +                    ip = "" +                sleep(1) +            self.core.hookManager.afterReconnecting(ip) +             +            self.log.info(_("Reconnected, new IP: %s") % ip) +     +                     +            self.reconnecting.clear() +     +    #---------------------------------------------------------------------- +    def checkThreadCount(self): +        """checks if there are need for increasing or reducing thread count""" +         +        if len(self.threads) == self.core.config.get("general", "max_downloads"): +            return True +        elif len(self.threads) < self.core.config.get("general", "max_downloads"): +            self.createThread() +        else: +            #@TODO: close thread +            pass +         +     +    #---------------------------------------------------------------------- +    def assignJob(self): +        """assing a job to a thread if possible""" +         +        if self.pause or not self.core.server_methods.is_time_download(): return +         +        free = [x for x in self.threads if not x.active] + + +         +        occ = [x.active.pluginname for x in self.threads if x.active and not x.active.plugin.multiDL] +        occ.sort() +        occ = tuple(set(occ)) +        job = self.core.files.getJob(occ) +        if job: +            try: +                job.initPlugin() +            except Exception, e: +                self.log.critical(str(e)) +                if self.core.debug: +                    print_exc() +             +            if job.plugin.__type__ == "hoster": +                if free: +                    thread = free[0] +                    thread.put(job) +                else: +                    #put job back +                    if not self.core.files.jobCache.has_key(occ): +                        self.core.files.jobCache[occ] = [] +                    self.core.files.jobCache[occ].append(job.id) +                     +            else: +                thread = PluginThread.DecrypterThread(self, job) +         diff --git a/core/module/Unzip.py b/core/module/Unzip.py new file mode 100644 index 000000000..f56fbe751 --- /dev/null +++ b/core/module/Unzip.py @@ -0,0 +1,50 @@ +import zipfile +import os + +class Unzip: +    def __init__(self): +        pass +         +    def extract(self, file, dir): +        if not dir.endswith(':') and not os.path.exists(dir): +            os.mkdir(dir) + +        zf = zipfile.ZipFile(file) + +        # create directory structure to house files +        self._createstructure(file, dir) + +        # extract files to directory structure +        for i, name in enumerate(zf.namelist()): + +            if not name.endswith('/') and not name.endswith("config"): +                print "extracting", name.replace("pyload/","") +                outfile = open(os.path.join(dir, name.replace("pyload/","")), 'wb') +                outfile.write(zf.read(name)) +                outfile.flush() +                outfile.close() + +    def _createstructure(self, file, dir): +        self._makedirs(self._listdirs(file), dir) + +    def _makedirs(self, directories, basedir): +        """ Create any directories that don't currently exist """ +        for dir in directories: +            curdir = os.path.join(basedir, dir) +            if not os.path.exists(curdir): +                os.mkdir(curdir) + +    def _listdirs(self, file): +        """ Grabs all the directories in the zip structure +        This is necessary to create the structure before trying +        to extract the file to it. """ +        zf = zipfile.ZipFile(file) + +        dirs = [] + +        for name in zf.namelist(): +            if name.endswith('/'): +                dirs.append(name.replace("pyload/","")) + +        dirs.sort() +        return dirs diff --git a/core/module/__init__.py b/core/module/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/__init__.py diff --git a/core/module/config/default.conf b/core/module/config/default.conf new file mode 100644 index 000000000..df8682804 --- /dev/null +++ b/core/module/config/default.conf @@ -0,0 +1,45 @@ +version: 1
 +
 +remote - "Remote":
 +	int port : "Port" = 7227
 +	ip listenaddr : "Adress" = 0.0.0.0
 +	str username : "Username" = admin
 +	str password : "Password" = pwhere
 +ssl - "SSL":
 +	bool activated : "Activated"= False
 +	str cert : "SSL Certificate" = ssl.crt
 +	str key : "SSL Key" = ssl.key
 +webinterface - "Webinterface":
 +	bool activated : "Activated" = True
 +	builtin;lighttpd;nginx;fastcgi server : "Server" = builtin
 +	bool https : "Use HTTPS" = False
 +	ip host : "IP" = 0.0.0.0
 +	int port : "Port" = 8001
 +	str template : "Template" = default
 +log - "Log":
 +	bool file_log : "File Log" = True
 +	str log_folder : "Folder" = Logs
 +	int log_count : "Count" = 5
 +general - "General":
 +	en;de;fr;nl;pl language : "Language" = en
 +	str download_folder : "Download Folder" = Downloads
 +	int max_downloads : "Max Parallel Downloads" = 3
 +	bool debug_mode : "Debug Mode" = False
 +	int max_download_time : "Max Download Time" = 5
 +	int download_speed_limit : "Download Speed Limit" = 0
 +	bool checksum : "Use Checksum" = False
 +	int min_free_space : "Min Free Space (MB)" = 200
 +	bool folder_per_package : "Create folder for each package" = True
 +	ip download_interface : "Outgoing IP address for downloads" = None
 +reconnect - "Reconnect":
 +	bool activated : "Use Reconnect" = False
 +	str method : "Method" = None
 +	time startTime : "Start" = 0:00
 +	time endTime : "End" = 0:00
 +downloadTime - "Download Time":
 +	time start : "Start" = 0:00
 +	time end : "End" = 0:00
 +proxy - "Proxy":
 +	bool activated : "Activated" = False
 +	str adress : "Adress" = http://localhost:8080
 +	str protocol : "Protocol" = http
 diff --git a/core/module/debug.py b/core/module/debug.py new file mode 100644 index 000000000..f3d8ad5cb --- /dev/null +++ b/core/module/debug.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +#coding:utf-8 + +import re +import InitHomeDir +from os import listdir + +class Wrapper(object): +	pass + +def filter_info(line): +	if "object at 0x" in line: +		return False +	elif " at line " in line: +		return False +	elif " <DownloadThread(" in line: +		return False +	elif "<class '" in line: +		return False +	elif "PyFile " in line: +		return False +	elif " <module '" in line: +		return False +	 +	else: +		return True +	 +def appendName(lines, name): +	test = re.compile("^[a-zA-z0-9]+ = ") +	 +	for i, line in enumerate(lines): +		if test.match(line): +			lines[i] = name+"."+line +			 +	return lines + +def initReport(): +	reports = [] +	for f in listdir("."): +		if f.startswith("debug_"): +			reports.append(f) +		 +	for i, f in enumerate(reports): +		print "%s. %s" % (i,f)  +	 +	choice = raw_input("Choose Report: ") +	 +	report = reports[int(choice)] +	 +	f = open(report, "rb") + +	content = f.readlines() +	content = [x.strip() for x in content if x.strip()] +	 +	frame = Wrapper() +	plugin = Wrapper() +	pyfile = Wrapper() +	 +	frame_c = []  +	plugin_c = [] +	pyfile_c = [] +	 +	dest = None +	 +	for line in  content: +		if line == "FRAMESTACK:": +			dest = frame_c +			continue +		elif line == "PLUGIN OBJECT DUMP:": +			dest = plugin_c +			continue +		elif line == "PYFILE OBJECT DUMP:": +			dest = pyfile_c +			continue +		elif line == "CONFIG:": +			dest = None +	 +		if dest != None: +			dest.append(line) +			 +			 +	frame_c = filter(filter_info, frame_c) +	plugin_c = filter(filter_info, plugin_c) +	pyfile_c = filter(filter_info, pyfile_c) +	 +	frame_c = appendName(frame_c, "frame") +	plugin_c = appendName(plugin_c, "plugin") +	pyfile_c = appendName(pyfile_c, "pyfile") +		 +	exec("\n".join(frame_c+plugin_c+pyfile_c) ) +	 +	return frame, plugin, pyfile +	 +if __name__=='__main__': +	print "No main method, use this module with your python shell"
\ No newline at end of file diff --git a/core/module/forwarder.py b/core/module/forwarder.py new file mode 100644 index 000000000..eacb33c2b --- /dev/null +++ b/core/module/forwarder.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN +""" + +from sys import argv +from sys import exit + +import socket +import thread + +from traceback import print_exc + +class Forwarder(): + +    def __init__(self, extip,extport=9666): +        print "Start portforwarding to %s:%s" % (extip, extport) +        proxy(extip, extport, 9666) + + +def proxy(*settings): +    while True: +        server(*settings) + +def server(*settings): +    try: +        dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +        dock_socket.bind(("127.0.0.1", settings[2])) +        dock_socket.listen(5) +        while True: +            client_socket = dock_socket.accept()[0] +            server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +            server_socket.connect((settings[0], settings[1])) +            thread.start_new_thread(forward, (client_socket, server_socket)) +            thread.start_new_thread(forward, (server_socket, client_socket)) +    except Exception: +        print_exc() +         +         +def forward(source, destination): +    string = ' ' +    while string: +        string = source.recv(1024) +        if string: +            destination.sendall(string) +        else: +            #source.shutdown(socket.SHUT_RD) +            destination.shutdown(socket.SHUT_WR) + +if __name__ == "__main__": +    args = argv[1:] +    if not args: +        print "Usage: forwarder.py <remote ip> <remote port>" +        exit() +    if len(args) == 1: +        args.append(9666) +         +    f = Forwarder(args[0], int(args[1])) +            
\ No newline at end of file diff --git a/core/module/network/FtpRequest.py b/core/module/network/FtpRequest.py new file mode 100644 index 000000000..eecb40c9f --- /dev/null +++ b/core/module/network/FtpRequest.py @@ -0,0 +1,259 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: spoob +    @author: RaNaN +    @author: mkaay +    @author: jeix +    @version: v0.4.0 +""" + +import time +from os import rename +from os.path import exists +from cStringIO import StringIO +import pycurl + +class AbortDownload(Exception): +    pass + +class FtpRequest: +    def __init__(self, interface=None): + +        self.dl_time = 0 +        self.dl_finished = 0 +        self.dl_size = 0 +        self.dl_arrived = 0 +        self.dl = False + +        self.abort = False + +        self.timeout = 5 +        self.auth = False +         +        bufferBase = 1024 +        bufferMulti = 4 +        self.bufferSize = bufferBase*bufferMulti +        self.canContinue = False +        self.offset = 0 +         +        self.dl_speed = 0.0 +        self.averageSpeed = 0.0 +        self.averageSpeeds = [] +        self.averageSpeedTime = 0.0 +        self.averageSpeedCount = 0.0 +         +        self.speedLimitActive = False +        self.maxSpeed = 0 +        self.isSlow = False +        self.interface = interface +         +        # change this for connection information +        self.debug = False + +        self.init_curl() + +    def set_timeout(self, timeout): +        self.timeout = int(timeout) + +    def init_curl(self): +        self.rep = StringIO() +        self.header = "" + +        self.pycurl = pycurl.Curl() +        self.pycurl.setopt(pycurl.FOLLOWLOCATION, 1) +        self.pycurl.setopt(pycurl.MAXREDIRS, 5) +        self.pycurl.setopt(pycurl.TIMEOUT, (self.timeout*3600)) +        self.pycurl.setopt(pycurl.CONNECTTIMEOUT, 30) +        self.pycurl.setopt(pycurl.NOSIGNAL, 1) +        self.pycurl.setopt(pycurl.NOPROGRESS, 0) +        self.pycurl.setopt(pycurl.PROGRESSFUNCTION, self.progress) +        self.pycurl.setopt(pycurl.AUTOREFERER, 1) +        self.pycurl.setopt(pycurl.BUFFERSIZE, self.bufferSize) +        self.pycurl.setopt(pycurl.SSL_VERIFYPEER, 0) +        if self.debug: +            self.pycurl.setopt(pycurl.VERBOSE, 1) +        if self.interface: +            self.pycurl.setopt(pycurl.INTERFACE, self.interface) +     +   +    def add_auth(self, user, pw):         +        self.auth = True +        self.pycurl.setopt(pycurl.USERNAME, user) +        self.pycurl.setopt(pycurl.PASSWORD, pw) + +    def add_proxy(self, protocol, adress): +        # @TODO: pycurl proxy protocoll selection +        self.pycurl.setopt(pycurl.PROXY, adress.split(":")[0]) +        self.pycurl.setopt(pycurl.PROXYPORT, adress.split(":")[1]) + +    def download(self, url, file_name): +        file_temp = self.get_free_name(file_name) + ".part" +        self.fp = open(file_temp, 'wb') + +        self.init_curl() +        self.pycurl.setopt(pycurl.URL, url) +                     +        self.dl_arrived = self.offset        +         +        if self.auth: +            self.add_auth(self.user, self.pw) + +        self.dl_time = time.time() +        self.dl = True +         +        self.chunkSize = 0 +        self.chunkRead = 0 +        self.subStartTime = 0 +        self.maxChunkSize = 0 +         +        def restLimit(): +            subTime = time.time() - self.subStartTime +            if subTime <= 1: +                if self.speedLimitActive: +                    return self.maxChunkSize +                else: +                    return -1 +            else: +                self.updateCurrentSpeed(float(self.chunkRead/1024) / subTime) +                 +                self.subStartTime = time.time() +                self.chunkRead = 0 +                if self.maxSpeed > 0: +                    self.maxChunkSize = self.maxSpeed +                else: +                    self.maxChunkSize = 0 +                return 0 + +        def writefunc(buf): +            if self.abort: +                return False +            chunkSize = len(buf) +            while chunkSize > restLimit() > -1: +                time.sleep(0.05) +            self.maxChunkSize -= chunkSize +            self.fp.write(buf) +            self.chunkRead += chunkSize +            self.dl_arrived += chunkSize +             +        self.pycurl.setopt(pycurl.WRITEFUNCTION, writefunc) +         +        try: +            self.pycurl.perform() +        except Exception, e: +            code, msg = e +            if not code == 23: +                raise Exception, e +                 +        self.fp.close() +         +        if self.abort: +            raise AbortDownload + +        free_name = self.get_free_name(file_name) +        rename(file_temp, free_name) +         +        self.dl = False +        self.dl_finished = time.time() + +        return free_name +     +    def updateCurrentSpeed(self, speed): +        self.dl_speed = speed +        if self.averageSpeedTime + 10 < time.time(): +            self.averageSpeeds = [] +            self.averageSpeeds.append(self.averageSpeed) +            self.averageSpeeds.append(speed) +            self.averageSpeed = (speed + self.averageSpeed)/2 +            self.averageSpeedTime = time.time() +            self.averageSpeedCount = 2 +        else: +            self.averageSpeeds.append(speed) +            self.averageSpeedCount += 1 +            allspeed = 0.0 +            for s in self.averageSpeeds: +                allspeed += s +            self.averageSpeed = allspeed / self.averageSpeedCount +     +    def write_header(self, string): +        self.header += string + +    def get_rep(self): +        value = self.rep.getvalue() +        self.rep.close() +        self.rep = StringIO() +        return value +     +    def get_header(self): +        h = self.header +        self.header = "" +        return h + +    def get_speed(self): +        try: +            return self.dl_speed +        except: +            return 0 + +    def get_ETA(self): +        try: +            return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time)) +        except: +            return 0 + +    def kB_left(self): +        return (self.dl_size - self.dl_arrived) / 1024 +     +    def progress(self, dl_t, dl_d, up_t, up_d): +        if self.abort: +            return False +        self.dl_arrived = int(dl_d) +        self.dl_size = int(dl_t) + +    def get_free_name(self, file_name): +        file_count = 0 +        while exists(file_name): +            file_count += 1 +            if "." in file_name: +                file_split = file_name.split(".") +                temp_name = "%s-%i.%s" % (".".join(file_split[:-1]), file_count, file_split[-1]) +            else: +                temp_name = "%s-%i" % (file_name, file_count) +            if not exists(temp_name): +                file_name = temp_name +        return file_name +     +    def __del__(self): +        self.clean() +     +    def clean(self): +        try: +            self.pycurl.close() +        except: +            pass + +# def getURL(url): +    # """ +        # currently used for update check +    # """ +    # req = Request() +    # c = req.load(url) +    # req.pycurl.close() +    # return c + +if __name__ == "__main__": +    import doctest +    doctest.testmod() diff --git a/core/module/network/MultipartPostHandler.py b/core/module/network/MultipartPostHandler.py new file mode 100644 index 000000000..6804bcc90 --- /dev/null +++ b/core/module/network/MultipartPostHandler.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +#### +# 02/2006 Will Holcomb <wholcomb@gmail.com> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +# Lesser General Public License for more details. +# +# 7/26/07 Slightly modified by Brian Schneider +# in order to support unicode files ( multipart_encode function ) +""" +Usage: +  Enables the use of multipart/form-data for posting forms + +Inspirations: +  Upload files in python: +    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306 +  urllib2_file: +    Fabien Seisen: <fabien@seisen.org> + +Example: +  import MultipartPostHandler, urllib2, cookielib + +  cookies = cookielib.CookieJar() +  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies), +                                MultipartPostHandler.MultipartPostHandler) +  params = { "username" : "bob", "password" : "riviera", +             "file" : open("filename", "rb") } +  opener.open("http://wwww.bobsite.com/upload/", params) + +Further Example: +  The main function of this file is a sample which downloads a page and +  then uploads it to the W3C validator. +""" + +import urllib +import urllib2 +import mimetools, mimetypes +import os, stat +from cStringIO import StringIO + +class Callable: +    def __init__(self, anycallable): +        self.__call__ = anycallable + +# Controls how sequences are uncoded. If true, elements may be given multiple values by +#  assigning a sequence. +doseq = 1 + +class MultipartPostHandler(urllib2.BaseHandler): +    handler_order = urllib2.HTTPHandler.handler_order - 10 # needs to run first + +    def http_request(self, request): +        data = request.get_data() +        if data is not None and type(data) != str: +            v_files = [] +            v_vars = [] +            try: +                 for(key, value) in data.items(): +                     if type(value) == file: +                         v_files.append((key, value)) +                     else: +                         v_vars.append((key, value)) +            except TypeError: +                systype, value, traceback = sys.exc_info() +                raise TypeError, "not a valid non-string sequence or mapping object", traceback + +            if len(v_files) == 0: +                data = urllib.urlencode(v_vars, doseq) +            else: +                boundary, data = self.multipart_encode(v_vars, v_files) + +                contenttype = 'multipart/form-data; boundary=%s' % boundary +                if(request.has_header('Content-Type') +                   and request.get_header('Content-Type').find('multipart/form-data') != 0): +                    print "Replacing %s with %s" % (request.get_header('content-type'), 'multipart/form-data') +                request.add_unredirected_header('Content-Type', contenttype) + +            request.add_data(data) + +        return request + +    def multipart_encode(vars, files, boundary = None, buf = None): +        if boundary is None: +            boundary = mimetools.choose_boundary() +        if buf is None: +            buf = StringIO() +        for(key, value) in vars: +            buf.write('--%s\r\n' % boundary) +            buf.write('Content-Disposition: form-data; name="%s"' % key) +            buf.write('\r\n\r\n' + value + '\r\n') +        for(key, fd) in files: +            file_size = os.fstat(fd.fileno())[stat.ST_SIZE] +            filename = fd.name.split('/')[-1] +            contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream' +            buf.write('--%s\r\n' % boundary) +            buf.write('Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename)) +            buf.write('Content-Type: %s\r\n' % contenttype) +            # buffer += 'Content-Length: %s\r\n' % file_size +            fd.seek(0) +            buf.write('\r\n' + fd.read() + '\r\n') +        buf.write('--' + boundary + '--\r\n\r\n') +        buf = buf.getvalue() +        return boundary, buf +    multipart_encode = Callable(multipart_encode) + +    https_request = http_request + +def main(): +    import tempfile, sys + +    validatorURL = "http://validator.w3.org/check" +    opener = urllib2.build_opener(MultipartPostHandler) + +    def validateFile(url): +        temp = tempfile.mkstemp(suffix=".html") +        os.write(temp[0], opener.open(url).read()) +        params = { "ss" : "0",            # show source +                   "doctype" : "Inline", +                   "uploaded_file" : open(temp[1], "rb") } +        print opener.open(validatorURL, params).read() +        os.remove(temp[1]) + +    if len(sys.argv[1:]) > 0: +        for arg in sys.argv[1:]: +            validateFile(arg) +    else: +        validateFile("http://www.google.com") + +if __name__=="__main__": +    main()
\ No newline at end of file diff --git a/core/module/network/Request.py b/core/module/network/Request.py new file mode 100755 index 000000000..75a490b9f --- /dev/null +++ b/core/module/network/Request.py @@ -0,0 +1,400 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: spoob +    @author: RaNaN +    @author: mkaay +    @version: v0.3.2 +""" + +import base64 +import time +from os import sep, rename, stat +from os.path import exists, join +from shutil import move +import urllib +from cStringIO import StringIO +import pycurl + +from module.plugins.Plugin import Abort + +class Request: +    def __init__(self, interface=None): + +        self.dl_time = 0 +        self.dl_finished = 0 +        self.dl_size = 0 +        self.dl_arrived = 0 +        self.dl = False + +        self.abort = False + +        self.lastEffectiveURL = None +        self.lastURL = None +        self.auth = False +         +        self.timeout = 5 +         +        bufferBase = 1024 +        bufferMulti = 4 +        self.bufferSize = bufferBase*bufferMulti +        self.canContinue = False +        self.offset = 0 +         +        self.dl_speed = 0.0 +        self.averageSpeed = 0.0 +        self.averageSpeeds = [] +        self.averageSpeedTime = 0.0 +        self.averageSpeedCount = 0.0 +         +        self.speedLimitActive = False +        self.maxSpeed = 0 +        self.isSlow = False +        self.cookieJar = None +        self.interface = interface +         +        # change this for connection information +        self.debug = False + +        self.init_curl() + +    def set_timeout(self, timeout): +        self.timeout = int(timeout) + +    def init_curl(self): +        self.rep = StringIO() +        self.header = "" +         +        self.pycurl = pycurl.Curl() +        self.pycurl.setopt(pycurl.FOLLOWLOCATION, 1) +        self.pycurl.setopt(pycurl.MAXREDIRS, 5) +        self.pycurl.setopt(pycurl.TIMEOUT, (self.timeout*3600)) +        self.pycurl.setopt(pycurl.CONNECTTIMEOUT, 30) +        self.pycurl.setopt(pycurl.NOSIGNAL, 1) +        self.pycurl.setopt(pycurl.NOPROGRESS, 0) +        self.pycurl.setopt(pycurl.PROGRESSFUNCTION, self.progress) +        self.pycurl.setopt(pycurl.AUTOREFERER, 1) +        self.pycurl.setopt(pycurl.HEADERFUNCTION, self.write_header) +        self.pycurl.setopt(pycurl.BUFFERSIZE, self.bufferSize) +        self.pycurl.setopt(pycurl.SSL_VERIFYPEER, 0) +         +        if self.debug: +            self.pycurl.setopt(pycurl.VERBOSE, 1) +        if self.interface and self.interface.lower() != "none": +            self.pycurl.setopt(pycurl.INTERFACE, self.interface) + + +        self.pycurl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10") +        if pycurl.version_info()[7]: +            self.pycurl.setopt(pycurl.ENCODING, "gzip, deflate") +        self.pycurl.setopt(pycurl.HTTPHEADER, ["Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", +                           "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", +                           "Connection: keep-alive", +                           "Keep-Alive: 300"]) +     +    def setCookieJar(self, j): +        self.cookieJar = j +     +    def addCookies(self): +        if self.cookieJar: +            self.cookieJar.addCookies(self.pycurl.getinfo(pycurl.INFO_COOKIELIST)) +        return +     +    def getCookies(self): +        if self.cookieJar: +            for c in self.cookieJar.getCookies(): +                self.pycurl.setopt(pycurl.COOKIELIST, c) +        return +     +    def getCookie(self, name): +        if self.cookieJar: +            return self.cookieJar.getCookie(name) +        return None +     +    def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, no_post_encode=False): +         +        self.pycurl.setopt(pycurl.NOPROGRESS, 1) +         +        url = str(url) + +        if post: +            if not no_post_encode: +                post = urllib.urlencode(post) +        else: +            post = None + +        if get: +            get = urllib.urlencode(get) +            url = "%s?%s" % (url, get) +        else: +            get = "" + +        self.pycurl.setopt(pycurl.URL, url) +        self.pycurl.setopt(pycurl.WRITEFUNCTION, self.rep.write) +         +        if cookies: +            self.curl_enable_cookies() +            self.getCookies() + +        if post: +            self.pycurl.setopt(pycurl.POSTFIELDS, post) + +        if ref and self.lastURL is not None: +            self.pycurl.setopt(pycurl.REFERER, self.lastURL) + +        if just_header: +            self.pycurl.setopt(pycurl.NOBODY, 1) +            self.pycurl.perform() +            self.lastEffectiveURL = self.pycurl.getinfo(pycurl.EFFECTIVE_URL) +            self.pycurl.setopt(pycurl.NOPROGRESS, 0) +            self.pycurl.setopt(pycurl.NOBODY, 0) +            return self.header + +        self.pycurl.perform() +         +        self.lastEffectiveURL = self.pycurl.getinfo(pycurl.EFFECTIVE_URL) +        self.addCookies() +         +        #reset progress +         +        self.dl_time = 0 +        self.dl_finished = 0 +        self.dl_size = 0 +        self.dl_arrived = 0 +         +        self.lastURL = url +        header = self.get_header() + +        return self.get_rep() +     +    def curl_enable_cookies(self): +        self.pycurl.setopt(pycurl.COOKIEFILE, "") +        self.pycurl.setopt(pycurl.COOKIEJAR, "") + +    def add_auth(self, user, pw): +         +        self.auth = True +        self.user = user +        self.pw = pw +         +        upwstr = str("%s:%s" % (user,pw)) +        self.pycurl.setopt(pycurl.HTTPHEADER, ['Authorization: Basic ' + base64.encodestring(upwstr)[:-1]]) +        self.pycurl.setopt(pycurl.USERPWD, upwstr) +        self.pycurl.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_ANY) + +    def clearCookies(self): +        self.pycurl.setopt(pycurl.COOKIELIST, "") + +    def add_proxy(self, protocol, adress): +        # @TODO: pycurl proxy protocol selection +        self.pycurl.setopt(pycurl.PROXY, adress.split(":")[0]) +        self.pycurl.setopt(pycurl.PROXYPORT, adress.split(":")[1]) + +    def download(self, url, file_name, folder, get={}, post={}, ref=True, cookies=True, no_post_encode=False): + +        url = str(url) +         +        self.pycurl.setopt(pycurl.NOPROGRESS, 0) +         +        if post: +            if not no_post_encode: +                post = urllib.urlencode(post) +        else: +            post = None + +        if get: +            get = urllib.urlencode(get) +            url = "%s?%s" % (url, get) +        else: +            get = "" + +        file_temp = self.get_free_name(folder,file_name) + ".part" +       +        self.fp = open(file_temp, 'wb' if not self.canContinue else 'ab') + +        partSize = self.fp.tell() + +        self.init_curl() + +        self.pycurl.setopt(pycurl.URL, url) +         +        if self.canContinue: +            self.offset = stat(file_temp).st_size +            self.pycurl.setopt(pycurl.RESUME_FROM, self.offset) +             +        self.dl_arrived = self.offset +         +        if cookies: +            self.curl_enable_cookies() +            self.getCookies() + +        if post: +            self.pycurl.setopt(pycurl.POSTFIELDS, post) +         +        if self.auth: +            self.add_auth(self.user, self.pw) + +        if ref and self.lastURL is not None: +            self.pycurl.setopt(pycurl.REFERER, self.lastURL) + +        self.dl_time = time.time() +        self.dl = True +         +        self.chunkSize = 0 +        self.chunkRead = 0 +        self.subStartTime = 0 +        self.maxChunkSize = 0 +         +        def restLimit(): +            subTime = time.time() - self.subStartTime +            if subTime <= 1: +                if self.speedLimitActive: +                    return self.maxChunkSize +                else: +                    return -1 +            else: +                self.updateCurrentSpeed(float(self.chunkRead/1024) / subTime) +                 +                self.subStartTime = time.time() +                self.chunkRead = 0 +                if self.maxSpeed > 0: +                    self.maxChunkSize = self.maxSpeed +                else: +                    self.maxChunkSize = 0 +                return 0 + +        def writefunc(buf): +            if self.abort: +                return False +            chunkSize = len(buf) +            while chunkSize > restLimit() > -1: +                time.sleep(0.05) +            self.maxChunkSize -= chunkSize +            self.fp.write(buf) +            self.chunkRead += chunkSize +            self.dl_arrived += chunkSize +             +        self.pycurl.setopt(pycurl.WRITEFUNCTION, writefunc) +         +        try: +            self.pycurl.perform() +        except Exception, e: +            code, msg = e +            if not code == 23: +                raise Exception, e +        finally: +            self.dl = False +            self.dl_finished = time.time() +                 +        self.addCookies() +        self.fp.close() +         +        if self.abort: raise Abort + +        free_name = self.get_free_name(folder, file_name) +        move(file_temp, free_name) +         +        #@TODO content disposition +         +        #return free_name +     +    def updateCurrentSpeed(self, speed): +        self.dl_speed = speed +        if self.averageSpeedTime + 10 < time.time(): +            self.averageSpeeds = [] +            self.averageSpeeds.append(self.averageSpeed) +            self.averageSpeeds.append(speed) +            self.averageSpeed = (speed + self.averageSpeed)/2 +            self.averageSpeedTime = time.time() +            self.averageSpeedCount = 2 +        else: +            self.averageSpeeds.append(speed) +            self.averageSpeedCount += 1 +            allspeed = 0.0 +            for s in self.averageSpeeds: +                allspeed += s +            self.averageSpeed = allspeed / self.averageSpeedCount +     +    def write_header(self, string): +        self.header += string + +    def get_rep(self): +        value = self.rep.getvalue() +        self.rep.close() +        self.rep = StringIO() +        return value +     +    def get_header(self): +        h = self.header +        self.header = "" +        return h + +    def get_speed(self): +        try: +            return self.dl_speed +        except: +            return 0 + +    def get_ETA(self): +        try: +            return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time)) +        except: +            return 0 + +    def bytes_left(self): +        return (self.dl_size - self.dl_arrived) +     +    def progress(self, dl_t, dl_d, up_t, up_d): +        if self.abort: +            return False +        self.dl_arrived = int(dl_d) +        self.dl_size = int(dl_t) +         +    def get_free_name(self, folder, file_name): +        file_count = 0 +        file_name = join(folder, file_name) +        while exists(file_name): +            file_count += 1 +            if "." in file_name: +                file_split = file_name.split(".") +                temp_name = "%s-%i.%s" % (".".join(file_split[:-1]), file_count, file_split[-1]) +            else: +                temp_name = "%s-%i" % (file_name, file_count) +            if not exists(temp_name): +                file_name = temp_name +        return file_name +     +    def __del__(self): +        self.clean() +     +    def clean(self): +        try: +            self.pycurl.close() +        except: +            pass + +def getURL(url, get={}, post={}): +    """ +        currently used for update check +    """ +    req = Request() +    c = req.load(url, get, post) +    req.pycurl.close() +    return c + +if __name__ == "__main__": +    import doctest +    doctest.testmod() diff --git a/core/module/network/XdccRequest.py b/core/module/network/XdccRequest.py new file mode 100644 index 000000000..ce764eb12 --- /dev/null +++ b/core/module/network/XdccRequest.py @@ -0,0 +1,338 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +"""
 +    This program is free software; you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation; either version 3 of the License,
 +    or (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +    See the GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program; if not, see <http://www.gnu.org/licenses/>.
 +    
 +    @author: spoob
 +    @author: RaNaN
 +    @author: mkaay
 +    @author: jeix
 +    @version: v0.4.0
 +"""
 +
 +import time
 +import socket
 +from select import select
 +import re
 +from os import sep, rename, stat
 +from os.path import exists
 +import struct
 +
 +class AbortDownload(Exception):
 +    pass
 +    
 +class IRCError(Exception):
 +    def __init__(self, value):
 +        self.value = value
 +    def __str__(self):
 +        return repr(self.value)
 +        
 +class XDCCError(Exception):
 +    def __init__(self, value):
 +        self.value = value
 +    def __str__(self):
 +        return repr(self.value)
 +
 +class XdccRequest:
 +    def __init__(self):
 +
 +        self.dl_time = 0
 +        self.dl_finished = 0
 +        self.dl_size = 0
 +        self.dl_arrived = 0
 +        self.dl = False
 +
 +        self.abort = False
 +       
 +        self.timeout = 20
 +        
 +        bufferBase = 1024
 +        bufferMulti = 4
 +        self.bufferSize = bufferBase*bufferMulti
 +        self.canContinue = False
 +        self.offset = 0
 +        
 +        self.dl_speed = 0.0
 +        self.averageSpeed = 0.0
 +        self.averageSpeeds = []
 +        self.averageSpeedTime = 0.0
 +        self.averageSpeedCount = 0.0
 +        
 +        self.speedLimitActive = False
 +        self.maxSpeed = 0
 +        self.isSlow = False
 +        
 +        # change this for connection information
 +        self.debug = False
 +
 +    def set_timeout(self, timeout):
 +        self.timeout = int(timeout)
 +       
 +    def add_proxy(self, protocol, adress):
 +        # @TODO: pycurl proxy protocoll selection
 +        raise NotImplementedError
 +
 +    # xdcc://irc.Abjects.net/[XDCC]|Shit/#0004/
 +    #nick, ident, realname, servers
 +    def download(self, bot, pack, path, nick, ident, realname, channel, host, port=6667):
 +        self.dl_time = time.time()
 +        self.dl = True
 +        
 +        self.chunkSize = 0
 +        self.chunkRead = 0
 +        self.subStartTime = 0
 +        self.maxChunkSize = 0
 +        
 +        def restLimit():
 +            subTime = time.time() - self.subStartTime
 +            if subTime <= 1:
 +                if self.speedLimitActive:
 +                    return self.maxChunkSize
 +                else:
 +                    return -1
 +            else:
 +                self.updateCurrentSpeed(float(self.chunkRead/1024) / subTime)
 +                
 +                self.subStartTime = time.time()
 +                self.chunkRead = 0
 +                if self.maxSpeed > 0:
 +                    self.maxChunkSize = self.maxSpeed
 +                else:
 +                    self.maxChunkSize = 0
 +                return 0
 +
 +        def writefunc(in_chunkSize):
 +            chunkSize = in_chunkSize
 +            while chunkSize > restLimit() > -1:
 +                time.sleep(0.05)
 +            self.maxChunkSize -= chunkSize
 +            self.chunkRead += chunkSize
 +            self.dl_arrived += chunkSize
 +            
 +            
 +        # connect to IRC
 +        sock = socket.socket()
 +        sock.connect((host, port))
 +        if nick == "pyload":
 +            nick = "pyload-%d" % (time.time() % 1000) # last 3 digits
 +        sock.send("NICK %s\r\n" % nick)
 +        sock.send("USER %s %s bla :%s\r\n" % (ident, host, realname))
 +        sock.send("JOIN #%s\r\n" % channel)
 +        sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
 +        
 +        # IRC recv loop
 +        readbuffer = ""
 +        while True:
 +            if self.abort:
 +                raise AbortDownload
 +        
 +            if self.dl_time + self.timeout < time.time():
 +                raise XDCCError("timeout, bot did not answer")
 +                
 +            #time.sleep(5) # cool down <- was a bullshit idea
 +            
 +            fdset = select([sock], [], [], 0)
 +            if sock not in fdset[0]:
 +                continue
 +                
 +            readbuffer += sock.recv(1024)
 +            temp = readbuffer.split("\n")
 +            readbuffer = temp.pop()
 +
 +            for line in temp:
 +                if self.debug: print "*> " + line
 +                line  = line.rstrip()
 +                first = line.split()
 +
 +                if(first[0] == "PING"):
 +                    sock.send("PONG %s\r\n" % first[1])
 +                    
 +                if first[0] == "ERROR":
 +                    raise IRCError(line)
 +                    
 +                msg = line.split(None, 3)
 +                if len(msg) != 4:
 +                    continue
 +                    
 +                msg = { \
 +                    "origin":msg[0][1:], \
 +                    "action":msg[1], \
 +                    "target":msg[2], \
 +                    "text"  :msg[3][1:] \
 +                }
 +                
 +
 +                if nick == msg["target"][0:len(nick)]\
 +                    and "PRIVMSG" == msg["action"]:
 +                    if msg["text"] == "\x01VERSION\x01":
 +                        if self.debug: print "Sending CTCP VERSION."
 +                        sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface"))
 +                    elif msg["text"] == "\x01TIME\x01":
 +                        if self.debug: print "Sending CTCP TIME."
 +                        sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
 +                    elif msg["text"] == "\x01LAG\x01":
 +                        pass # don't know how to answer
 +                
 +                if not (bot == msg["origin"][0:len(bot)] 
 +                    and nick == msg["target"][0:len(nick)] 
 +                    and "PRIVMSG" == msg["action"]):
 +                    continue
 +            
 +                m = re.match('\x01DCC SEND (.*?) (.*?) (.*?) (.*?)\x01', msg["text"])
 +                if m != None:
 +                    break
 +                
 +        # kill IRC socket
 +        sock.send("QUIT :byebye\r\n")
 +        sock.close()
 +
 +        # connect to XDCC Bot
 +        dcc = socket.socket()                        
 +        ip  = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
 +        port = int(m.group(3))
 +        dcc.connect((ip, port))
 +        
 +        dcc_packname = m.group(1)
 +        if len(m.groups()) > 3:
 +            self.dl_size = int(m.group(4))
 +        dcc_packname = self.get_free_name(path + '\\' + dcc_packname)
 +        dcc_fpointer = open(dcc_packname + ".part", "wb")
 +        dcc_total = 0
 +        
 +        # recv loop for dcc socket
 +        while True:
 +            if self.abort:
 +                dcc.close()
 +                dcc_fpointer.close()
 +                raise AbortDownload
 +                
 +            fdset = select([dcc], [], [], 0)
 +            if dcc not in fdset[0]:
 +                continue
 +                
 +            # recv something
 +            recvbytes = dcc.recv(2**14)
 +                
 +            # connection closed and everything received -> reset variables
 +            if len(recvbytes) == 0:
 +                dcc.close()
 +                dcc_fpointer.close()
 +                break
 +
 +            # status updates, speedmanaging, etc.
 +            writefunc(len(recvbytes))
 +
 +            # add response to file
 +            dcc_fpointer.write(recvbytes)
 +            dcc_total += len(recvbytes)
 +            
 +            # acknowledge data by sending number of recceived bytes
 +            dcc.send(struct.pack('!I', dcc_total))
 +        ########################
 +        
 +        free_name = self.get_free_name(dcc_packname)
 +        rename(dcc_packname + ".part", free_name)
 +        
 +        self.dl = False
 +        self.dl_finished = time.time()
 +
 +        return free_name
 +    
 +    def updateCurrentSpeed(self, speed):
 +        self.dl_speed = speed
 +        if self.averageSpeedTime + 10 < time.time():
 +            self.averageSpeeds = []
 +            self.averageSpeeds.append(self.averageSpeed)
 +            self.averageSpeeds.append(speed)
 +            self.averageSpeed = (speed + self.averageSpeed)/2
 +            self.averageSpeedTime = time.time()
 +            self.averageSpeedCount = 2
 +        else:
 +            self.averageSpeeds.append(speed)
 +            self.averageSpeedCount += 1
 +            allspeed = 0.0
 +            for s in self.averageSpeeds:
 +                allspeed += s
 +            self.averageSpeed = allspeed / self.averageSpeedCount
 +    
 +    def write_header(self, string):
 +        self.header += string
 +
 +    def get_rep(self):
 +        value = self.rep.getvalue()
 +        self.rep.close()
 +        self.rep = StringIO()
 +        return value
 +    
 +    def get_header(self):
 +        h = self.header
 +        self.header = ""
 +        return h
 +
 +    def get_speed(self):
 +        try:
 +            return self.dl_speed
 +        except:
 +            return 0
 +
 +    def get_ETA(self):
 +        try:
 +            return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time))
 +        except:
 +            return 0
 +
 +    def kB_left(self):
 +        return (self.dl_size - self.dl_arrived) / 1024
 +    
 +    def progress(self, dl_t, dl_d, up_t, up_d):
 +        if self.abort:
 +            return False
 +        self.dl_arrived = int(dl_d)
 +        self.dl_size = int(dl_t)
 +
 +    def get_free_name(self, file_name):
 +        file_count = 0
 +        while exists(file_name):
 +            file_count += 1
 +            if "." in file_name:
 +                file_split = file_name.split(".")
 +                temp_name = "%s-%i.%s" % (".".join(file_split[:-1]), file_count, file_split[-1])
 +            else:
 +                temp_name = "%s-%i" % (file_name, file_count)
 +            if not exists(temp_name):
 +                file_name = temp_name
 +        return file_name
 +    
 +    def __del__(self):
 +        self.clean()
 +    
 +    def clean(self):
 +        try:
 +            pass
 +            # self.pycurl.close()
 +        except:
 +            pass
 +
 +# def getURL(url):
 +    # """
 +        # currently used for update check
 +    # """
 +    # req = Request()
 +    # c = req.load(url)
 +    # req.pycurl.close()
 +    # return c
 +
 +if __name__ == "__main__":
 +    import doctest
 +    doctest.testmod()
 diff --git a/core/module/network/__init__.py b/core/module/network/__init__.py new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/core/module/network/__init__.py @@ -0,0 +1 @@ + diff --git a/core/module/plugins/Account.py b/core/module/plugins/Account.py new file mode 100644 index 000000000..61101347d --- /dev/null +++ b/core/module/plugins/Account.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from random import randrange +import re + +class Account(): +    __name__ = "Account" +    __version__ = "0.2" +    __type__ = "account" +    __description__ = """Account Plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def __init__(self, manager, accounts): +        self.manager = manager +        self.core = manager.core +        self.accounts = {} +        self.register = {} +        self.setAccounts(accounts) +         +    def login(self, user, data): +        pass +     +    def setAccounts(self, accounts): +        self.accounts = accounts +        for user, data in self.accounts.iteritems(): +            self.login(user, data) +     +    def updateAccounts(self, user, password, options): +        if self.accounts.has_key(user): +            self.accounts[user]["password"] = password +            self.accounts[user]["options"] = options +        else: +            self.accounts[user] = {"password" : password, "options": options} +             +        self.login(user, self.accounts[user]) +     +    def removeAccount(self, user): +        del self.accounts[user] +     +    def getAccountInfo(self, name): +        return { +            "validuntil": None, # -1 for unlimited +            "login": name, +            #"password": self.accounts[name]["password"], #@XXX: security +            "options": self.accounts[name]["options"], +            "trafficleft": None, # -1 for unlimited +            "maxtraffic": None, +            "type": self.__name__, +        } +     +    def getAllAccounts(self): +        return [self.getAccountInfo(user) for user, data in self.accounts.iteritems()] +     +    def getAccountRequest(self, plugin): +        user, data = self.getAccountData(plugin) +        req = self.core.requestFactory.getRequest(self.__name__, user) +        return req +         +    def getAccountData(self, plugin): +        if not len(self.accounts): +            return None +        if not self.register.has_key(plugin): +            account = self.selectAccount(plugin) +            self.register[plugin] = account +        else: +            account = self.register[plugin] +        return account +     +    def selectAccount(self, plugin): +        account = self.accounts.items()[randrange(0, len(self.accounts), 1)] +        return account +     +    def canUse(self): +        return len(self.accounts) +     +    def parseTraffic(self, string): #returns kbyte +        string = string.strip().lower() +        p = re.compile(r"(\d+[\.,]\d+)(.*)") +        m = p.match(string) +        if m: +            traffic = float(m.group(1).replace(",", ".")) +            unit = m.group(2).strip() +            if unit == "gb" or unit == "gig" or unit == "gbyte" or unit == "gigabyte": +                traffic *= 1024*1024 +            elif unit == "mb" or unit == "megabyte" or unit == "mbyte" or unit == "mib": +                traffic *= 1024 +            return traffic diff --git a/core/module/plugins/Container.py b/core/module/plugins/Container.py new file mode 100644 index 000000000..e7b7cc7d6 --- /dev/null +++ b/core/module/plugins/Container.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Crypter import Crypter + +from os.path import join, exists, basename +from os import remove +import re + +class Container(Crypter): +    __name__ = "Container" +    __version__ = "0.1" +    __pattern__ = None +    __type__ = "container" +    __description__ = """Base container plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") + +     +         +    #---------------------------------------------------------------------- +    def preprocessing(self, thread): +        """prepare""" +        self.thread = thread +         +        self.loadToDisk() + +        self.decrypt(self.pyfile) +        self.deleteTmp() +         +        self.createPackages() +     +     +    #---------------------------------------------------------------------- +    def loadToDisk(self): +        """loads container to disk if its stored remotely and overwrite url,  +        or check existent on several places at disk""" +         +        if self.pyfile.url.startswith("http://"): +            self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] +            content = self.load(self.pyfile.url) +            self.pyfile.url = join(self.config["general"]["download_folder"], self.pyfile.name) +            f = open(self.pyfile.url, "wb" ) +            f.write(content) +            f.close() +             +        else: +            self.pyfile.name = basename(self.pyfile.url) +            if not exists(self.pyfile.url): +                if exists(join(pypath, self.pyfile.url)): +                    self.pyfile.url = join(pypath, self.pyfile.url) +                else: +                    self.fail(_("File not exists.")) +       + +       +    #---------------------------------------------------------------------- +    def deleteTmp(self): +        if self.pyfile.name.startswith("tmp_"): +            remove(self.pyfile.url) + +         diff --git a/core/module/plugins/Crypter.py b/core/module/plugins/Crypter.py new file mode 100644 index 000000000..c72babb15 --- /dev/null +++ b/core/module/plugins/Crypter.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Plugin import Plugin + +from os.path import join, exists, basename + +class Crypter(Plugin): +    __name__ = "Crypter" +    __version__ = "0.1" +    __pattern__ = None +    __type__ = "container" +    __description__ = """Base crypter plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def __init__(self, pyfile): +        Plugin.__init__(self, pyfile) +         +        """ Put all packages here. It's a list of tuples like: +        ( name, [list of links], folder ) """ +        self.packages = [] +     +    #---------------------------------------------------------------------- +    def preprocessing(self, thread): +        """prepare""" +        self.thread = thread + +        self.decrypt(self.pyfile) +         +        self.createPackages() +         + +    #---------------------------------------------------------------------- +    def createPackages(self): +        """ create new packages from self.packages """ +        for pack in self.packages: + +            self.log.info(_("Parsed package %s with %s links") % (pack[0], len(pack[1]) ) ) +             +            self.core.server_methods.add_package(pack[0], pack[1], 1) +             diff --git a/core/module/plugins/Hook.py b/core/module/plugins/Hook.py new file mode 100644 index 000000000..fafa95efe --- /dev/null +++ b/core/module/plugins/Hook.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +    @interface-version: 0.2 +""" + + + +class Hook(): +    __name__ = "Hook" +    __version__ = "0.2" +    __type__ = "hook" +    __threaded__ = [] +    __config__ = [ ("name", "type", "desc" , "default") ] +    __description__ = """interface for hook""" +    __author_name__ = ("mkaay", "RaNaN") +    __author_mail__ = ("mkaay@mkaay.de", "RaNaN@pyload.org") +     +    def __init__(self, core): +        self.core = core  +        self.log = core.log +        self.config = core.config +         +        self.interval = 60 +        self.lastCall = 0 +         +        self.setup() +                +    def setup(self): +        """ more init stuff if needed""" +        pass +     +    def isActivated(self): +        """ checks if hook is activated""" +        return self.config.getPlugin(self.__name__, "activated") +     +    def getConfig(self, option): +        """ gets config values """ +        return self.config.getPlugin(self.__name__, option) +         +    def setConfig(self, option, value): +        """ sets config value """ +        self.config.setPlugin(self.__name__, option, value) +     +    def coreReady(self): +        pass +     +    def downloadStarts(self, pyfile): +        pass +     +    def downloadFinished(self, pyfile): +        pass +     +    def downloadFailed(self, pyfile): +        pass +     +    def packageFinished(self, pypack): +        pass +     +    def packageFailed(self, pypack): +        pass +     +    def beforeReconnecting(self, ip): +        pass +     +    def afterReconnecting(self, ip): +        pass +     +    def periodical(self): +        pass diff --git a/core/module/plugins/Hoster.py b/core/module/plugins/Hoster.py new file mode 100644 index 000000000..d4157f1f8 --- /dev/null +++ b/core/module/plugins/Hoster.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Plugin import Plugin + +class Hoster(Plugin): +    __name__ = "Hoster" +    __version__ = "0.1" +    __pattern__ = None +    __type__ = "hoster" +    __description__ = """Base hoster plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getInfo(self): +        return +         diff --git a/core/module/plugins/Plugin.py b/core/module/plugins/Plugin.py new file mode 100644 index 000000000..1f680032a --- /dev/null +++ b/core/module/plugins/Plugin.py @@ -0,0 +1,268 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: RaNaN, spoob, mkaay +""" + +import logging +from os.path import exists +from os.path import join + +from time import time +from time import sleep + +from random import randint + +import sys +from os.path import exists + +from os import remove +from os import makedirs + +from tempfile import NamedTemporaryFile +from mimetypes import guess_type + +from itertools import islice + +def chunks(iterable, size): +  it = iter(iterable) +  item = list(islice(it, size)) +  while item: +    yield item +    item = list(islice(it, size)) + +def dec(func): +    def new(*args): +        if args[0].pyfile.abort: +            raise Abort +        return func(*args) +    return new + +class Abort(Exception): +    """ raised when aborted """ + +class Fail(Exception): +    """ raised when failed """ + +class Reconnect(Exception): +    """ raised when reconnected """ + +class Retry(Exception): +    """ raised when start again from beginning """ + +class Plugin(object): +    __name__ = "Plugin" +    __version__ = "0.4" +    __pattern__ = None +    __type__ = "hoster" +    __config__ = [ ("name", "type", "desc" , "default") ] +    __description__ = """Base Plugin""" +    __author_name__ = ("RaNaN", "spoob", "mkaay") +    __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") + + +    def __init__(self, pyfile): +        self.config = pyfile.m.core.config +        self.core = pyfile.m.core + +        self.wantReconnect = False +        self.multiDL = True + +        self.waitUntil = 0 # time() + wait in seconds +        self.waiting = False +         +        self.premium = False + +        self.ocr = None  # captcha reader instance +        self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) # account handler instance +        if self.account and not self.account.canUse(): self.account = None +        if self.account: +            self.req = self.account.getAccountRequest(self) +        else: +            self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) + +        self.log = logging.getLogger("log") + +        self.pyfile = pyfile +        self.thread = None # holds thread in future + +        self.setup() + +    def __call__(self): +        return self.__name__ + +    def setup(self): +        """ more init stuff if needed """ +        pass + +    def preprocessing(self, thread): +        """ handles important things to do before starting """ +        self.thread = thread + +        if not self.account: +            self.req.clearCookies() + +        self.pyfile.setStatus("starting") + +        return self.process(self.pyfile) + +    #---------------------------------------------------------------------- +    def process(self, pyfile): +        """the 'main' method of every plugin""" +        raise NotImplementedError +     +    def resetAccount(self): +        self.account = None +        self.req = self.core.requestFactory.getRequest(self.__name__) +     +    def checksum(self, local_file=None): +        """ +        return codes: +        0  - checksum ok +        1  - checksum wrong +        5  - can't get checksum +        10 - not implemented +        20 - unknown error +        """ +        #@TODO checksum check hook + +        return (True, 10) + + +    def setConf(self, option, value): +        """ sets a config value """ +        self.config.setPlugin(self.__name__, option, value) + +    def removeConf(self, option): +        """ removes a config value """ +        raise NotImplementedError + +    def getConf(self, option): +        """ gets a config value """ +        return self.config.getPlugin(self.__name__, option) + +    def setConfig(self, option, value): +      """ sets a config value """ +      self.setConf(option, value) +       +    def getConfig(self, option): +      """ gets a config value """ +      return self.getConf(option) +       +       +    def setWait(self, seconds, reconnect=False): +        """ set the wait time to specified seconds """ +        if reconnect: +            self.wantReconnect = True +        self.pyfile.waitUntil = time() + int(seconds) + +    def wait(self): +        """ waits the time previously set """ +        self.waiting = True +        self.pyfile.setStatus("waiting") +         +        while self.pyfile.waitUntil > time(): +            self.thread.m.reconnecting.wait(2) +             +            if self.pyfile.abort: raise Abort +            if self.thread.m.reconnecting.isSet(): +                self.waiting = False +                self.wantReconnect = False +                raise Reconnect +         +        self.waiting = False +        self.pyfile.setStatus("starting") + +    def fail(self, reason): +        """ fail and give reason """ +        raise Fail(reason) + +    def offline(self): +        """ fail and indicate file is offline """ +        raise Fail("offline") + +    def retry(self): +        """ begin again from the beginning """ +        raise Retry + +    def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False): +        """ loads the catpcha and decrypt it or ask the user for input """ +         +        content = self.load(url, get=get, post=post, cookies=cookies) +         +        temp = NamedTemporaryFile() +        temp = open(join("tmp","tmpCaptcha_%s" % self.__name__ ), "wb") +         +        temp.write(content) +        temp.close() +         +         +        Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) +        if Ocr and not forceUser: +            sleep(randint(3000, 5000) / 1000.0) +            if self.pyfile.abort: raise Abort +             +            ocr = Ocr() +            result = ocr.get_captcha(temp.name) +        else: +            captchaManager = self.core.captchaManager +            mime = guess_type(temp.name) +            task = captchaManager.newTask(self) +            task.setCaptcha(content, mime[0]) +            task.setWaiting() +            while not task.getStatus() == "done": +                if not self.core.isClientConnected(): +                    task.removeTask() +                    #temp.unlink(temp.name) +                    self.fail(_("No Client connected for captcha decrypting.")) +                if self.pyfile.abort: raise Abort +                sleep(1) +            result = task.getResult() +            task.removeTask() + +        if not self.core.debug: +          try: +            remove(temp.name) +          except: +            pass +         +        return result + + +    def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False): +        """ returns the content loaded """ +        if self.pyfile.abort: raise Abort +         +        return self.req.load(url, get, post, ref, cookies, just_header) + +    def download(self, url, get={}, post={}, ref=True, cookies=True): +        """ downloads the url content to disk """ + +        self.pyfile.setStatus("downloading") + +        download_folder = self.config['general']['download_folder'] +         +        location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding().replace(":", ""))) # remove : for win compability + +        if not exists(location):  +            makedirs(location) + +        newname = self.req.download(url, self.pyfile.name, location, get, post, ref, cookies) + +        self.pyfile.size = self.req.dl_size + +        if newname: +            self.pyfile.name = newname diff --git a/core/module/plugins/ReCaptcha.py b/core/module/plugins/ReCaptcha.py new file mode 100644 index 000000000..d29530a64 --- /dev/null +++ b/core/module/plugins/ReCaptcha.py @@ -0,0 +1,17 @@ +import re + +class ReCaptcha(): +    def __init__(self, plugin): +        self.plugin = plugin +     +    def challenge(self, id): +        js = self.plugin.req.load("http://api.recaptcha.net/challenge", get={"k":id}, cookies=True) +         +        try: +            challenge = re.search("challenge : '(.*?)',", js).group(1) +            server = re.search("server : '(.*?)',", js).group(1) +        except: +            self.plugin.fail("recaptcha error") +        result = self.plugin.decryptCaptcha("%simage"%server, get={"c":challenge}, cookies=True) +         +        return challenge, result diff --git a/core/module/plugins/__init__.py b/core/module/plugins/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/__init__.py diff --git a/core/module/plugins/accounts/DepositfilesCom.py b/core/module/plugins/accounts/DepositfilesCom.py new file mode 100644 index 000000000..044f647be --- /dev/null +++ b/core/module/plugins/accounts/DepositfilesCom.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account +import re +from time import strptime, mktime +import hashlib + +class DepositfilesCom(Account): +    __name__ = "DepositfilesCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """depositfiles.com account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        req = self.core.requestFactory.getRequest(self.__name__, user) +         +        src = req.load("http://depositfiles.com/de/gold/") +        validuntil = re.search("noch den Gold-Zugriff: <b>(.*?)</b></div>", src).group(1) +         +        validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) +         +        out = Account.getAccountInfo(self, user) +         +        tmp = {"validuntil":validuntil, "trafficleft":-1} +        out.update(tmp) +        return out +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        req.load("http://depositfiles.com/de/gold/payment.php") +        req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]}) diff --git a/core/module/plugins/accounts/FileserveCom.py b/core/module/plugins/accounts/FileserveCom.py new file mode 100644 index 000000000..a9b222a6a --- /dev/null +++ b/core/module/plugins/accounts/FileserveCom.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account +import re +from time import strptime, mktime +import hashlib + +class FileserveCom(Account): +    __name__ = "FileserveCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """fileserve.com account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        try: +            req = self.core.requestFactory.getRequest(self.__name__, user) +             +            src = req.load("http://fileserve.com/dashboard.php", cookies=True) +             +            out = Account.getAccountInfo(self, user) +             +            m = re.search(r"<td><h4>Premium Until</h4></th> <td><h5>(.*?) E(.)T</h5></td>", src) +            if m: +                zone = -5 if m.group(2) == "S" else -4 +                validuntil = int(mktime(strptime(m.group(1), "%d %B %Y"))) + 24*3600 + (zone*3600) +                tmp = {"validuntil":validuntil, "trafficleft":-1} +            else: +                tmp = {"trafficleft":-1} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(user) +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        req.load("http://fileserve.com/login.php", +                post={"loginUserName": user, "loginUserPassword": data["password"], +                      "autoLogin": "on", "loginFormSubmit": "Login"}, cookies=True) +        req.load("http://fileserve.com/dashboard.php", cookies=True) +         diff --git a/core/module/plugins/accounts/HotfileCom.py b/core/module/plugins/accounts/HotfileCom.py new file mode 100644 index 000000000..e6e8ba517 --- /dev/null +++ b/core/module/plugins/accounts/HotfileCom.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account +import re +from time import strptime, mktime +import hashlib + +class HotfileCom(Account): +    __name__ = "HotfileCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """hotfile.com account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        try: +            req = self.core.requestFactory.getRequest(self.__name__, user) +             +            resp = self.apiCall("getuserinfo", user=user) +            if resp.startswith("."): +                self.core.debug("HotfileCom API Error: %s" % resp) +                raise Exception +            info = {} +            for p in resp.split("&"): +                key, value = p.split("=") +                info[key] = value +                 +            info["premium_until"] = info["premium_until"].replace("T"," ") +            zone = info["premium_until"][19:] +            info["premium_until"] = info["premium_until"][:19] +            zone = int(zone[:3]) +             +            validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) +            out = Account.getAccountInfo(self, user) +            tmp = {"validuntil":validuntil, "trafficleft":-1} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(user) +     +    def apiCall(self, method, post={}, user=None): +        if user: +            data = None +            for account in self.accounts.items(): +                if account[0] == user: +                    data = account[1] +        else: +            user, data = self.accounts.items()[0] +         +        req = self.core.requestFactory.getRequest(self.__name__, user) +     +        digest = req.load("http://api.hotfile.com/", post={"action":"getdigest"}) +        h = hashlib.md5() +        h.update(data["password"]) +        hp = h.hexdigest() +        h = hashlib.md5() +        h.update(hp) +        h.update(digest) +        pwhash = h.hexdigest() +         +        post.update({"action": method}) +        post.update({"username":user, "passwordmd5dig":pwhash, "digest":digest}) +        return req.load("http://api.hotfile.com/", post=post) +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        cj = self.core.requestFactory.getCookieJar(self.__name__, user) +        cj.setCookie("hotfile.com", "lang", "en") +        req.load("http://hotfile.com/", cookies=True) +        req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, cookies=True) diff --git a/core/module/plugins/accounts/NetloadIn.py b/core/module/plugins/accounts/NetloadIn.py new file mode 100644 index 000000000..5743c7835 --- /dev/null +++ b/core/module/plugins/accounts/NetloadIn.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account + +class NetloadIn(Account): +    __name__ = "NetloadIn" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """netload.in account plugin""" +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.org") +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) +             diff --git a/core/module/plugins/accounts/RapidshareCom.py b/core/module/plugins/accounts/RapidshareCom.py new file mode 100644 index 000000000..c9766cd57 --- /dev/null +++ b/core/module/plugins/accounts/RapidshareCom.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account + +class RapidshareCom(Account): +    __name__ = "RapidshareCom" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """Rapidshare.com account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        try: +            data = None +            for account in self.accounts.items(): +                if account[0] == user: +                    data = account[1] +            if not data: +                raise Exception +            req = self.core.requestFactory.getRequest(self.__name__, user) +            api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" +            api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1} +            src = req.load(api_url_base, cookies=False, get=api_param_prem) +            if src.startswith("ERROR"): +                raise Exception +            fields = src.split("\n") +            info = {} +            for t in fields: +                if not t.strip(): +                    continue +                k, v = t.split("=") +                info[k] = v +                 +            out = Account.getAccountInfo(self, user) +            restkb = int(info["tskb"]) +            maxtraffic = int(info["rapids"])/14 * (5*1024*1024) + restkb +            tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":maxtraffic if int(info["autorefill"]) else restkb, "maxtraffic":maxtraffic} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(self, user) +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" +        api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1} +        src = req.load(api_url_base, cookies=False, get=api_param_prem) +        if src.startswith("ERROR"): +            return +        fields = src.split("\n") +        info = {} +        for t in fields: +            if not t.strip(): +                continue +            k, v = t.split("=") +            info[k] = v +        cj = self.core.requestFactory.getCookieJar(self.__name__, user) +        cj.setCookie("rapidshare.com", "enc", info["cookie"]) +             + diff --git a/core/module/plugins/accounts/ShareonlineBiz.py b/core/module/plugins/accounts/ShareonlineBiz.py new file mode 100644 index 000000000..611fa759d --- /dev/null +++ b/core/module/plugins/accounts/ShareonlineBiz.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account +from time import strptime, mktime +import re + +class ShareonlineBiz(Account): +    __name__ = "ShareonlineBiz" +    __version__ = "0.2" +    __type__ = "account" +    __description__ = """share-online.biz account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        src = req.load("https://www.share-online.biz/alpha/user/profile") +         +        validuntil = re.search(r"Account gÃŒltig bis:.*?<span class='.*?'>(.*?)</span>", src).group(1) +        validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y, %I:%M:%S %p"))) +         +        out = Account.getAccountInfo(self, user) +        tmp = {"validuntil":validuntil, "trafficleft":-1} +        out.update(tmp) +        return out +     +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        post_vars = {"user": user, +                        "pass": data["password"], +                        "l_rememberme":"1"} +        req.lastURL = "http://www.share-online.biz/alpha/" +        req.load("https://www.share-online.biz/alpha/user/login", cookies=True, post=post_vars) diff --git a/core/module/plugins/accounts/UploadedTo.py b/core/module/plugins/accounts/UploadedTo.py new file mode 100644 index 000000000..1311ee809 --- /dev/null +++ b/core/module/plugins/accounts/UploadedTo.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Account import Account +import re +from time import strptime, mktime + +class UploadedTo(Account): +    __name__ = "UploadedTo" +    __version__ = "0.1" +    __type__ = "account" +    __description__ = """ul.to account plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def getAccountInfo(self, user): +        try: +            data = None +            for account in self.accounts.items(): +                if account[0] == user: +                    data = account[1] +            if not data: +                raise Exception +            req = self.core.requestFactory.getRequest(self.__name__, user) +            html = req.load("http://uploaded.to/", cookies=True) +            raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) +            raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1) +            traffic = int(self.parseTraffic(raw_traffic)) +            validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M"))) +            out = Account.getAccountInfo(self, user) +            tmp =  {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":100*1024*1024} +            out.update(tmp) +            return out +        except: +            return Account.getAccountInfo(self, user) +         +    def login(self, user, data): +        req = self.core.requestFactory.getRequest(self.__name__, user) +        req.load("http://uploaded.to/login", None, { "email" : user, "password" : data["password"]}, cookies=True) diff --git a/core/module/plugins/accounts/__init__.py b/core/module/plugins/accounts/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/accounts/__init__.py diff --git a/core/module/plugins/captcha/GigasizeCom.py b/core/module/plugins/captcha/GigasizeCom.py new file mode 100644 index 000000000..d31742eb5 --- /dev/null +++ b/core/module/plugins/captcha/GigasizeCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from captcha import OCR + +class GigasizeCom(OCR): +    def __init__(self): +        OCR.__init__(self) +         +    def get_captcha(self, image): +        self.load_image(image) +        self.threshold(2.8) +        self.run_tesser(True, False, False, True) +        return self.result_captcha + +if __name__ == '__main__': +    ocr = GigasizeCom() +    import urllib +    urllib.urlretrieve('http://www.gigasize.com/randomImage.php', "gigasize_tmp.jpg") +     +    print ocr.get_captcha('gigasize_tmp.jpg') diff --git a/core/module/plugins/captcha/LinksaveIn.py b/core/module/plugins/captcha/LinksaveIn.py new file mode 100644 index 000000000..3ad7b265a --- /dev/null +++ b/core/module/plugins/captcha/LinksaveIn.py @@ -0,0 +1,147 @@ +from captcha import OCR +import Image +from os import sep +from os.path import dirname +from os.path import abspath +from glob import glob + + +class LinksaveIn(OCR): +    __name__ = "LinksaveIn" +    def __init__(self): +        OCR.__init__(self) +        self.data_dir = dirname(abspath(__file__)) + sep + "LinksaveIn" + sep +     +    def load_image(self, image): +        im = Image.open(image) +        frame_nr = 0 + +        lut = im.resize((256, 1)) +        lut.putdata(range(256)) +        lut = list(lut.convert("RGB").getdata()) + +        new = Image.new("RGB", im.size) +        npix = new.load() +        while True: +            try: +                im.seek(frame_nr) +            except EOFError: +                break +            frame = im.copy() +            pix = frame.load() +            for x in range(frame.size[0]): +                for y in range(frame.size[1]): +                    if lut[pix[x, y]] != (0,0,0): +                        npix[x, y] = lut[pix[x, y]] +            frame_nr += 1 +        new.save(self.data_dir+"unblacked.png") +        self.image = new.copy() +        self.pixels = self.image.load() +        self.result_captcha = '' +     +    def get_bg(self): +        stat = {} +        cstat = {} +        img = self.image.convert("P") +        for bgpath in glob(self.data_dir+"bg/*.gif"): +            stat[bgpath] = 0 +            bg = Image.open(bgpath) +             +            bglut = bg.resize((256, 1)) +            bglut.putdata(range(256)) +            bglut = list(bglut.convert("RGB").getdata()) +             +            lut = img.resize((256, 1)) +            lut.putdata(range(256)) +            lut = list(lut.convert("RGB").getdata()) +             +            bgpix = bg.load() +            pix = img.load() +            for x in range(bg.size[0]): +                for y in range(bg.size[1]): +                    rgb_bg = bglut[bgpix[x, y]] +                    rgb_c = lut[pix[x, y]] +                    try: +                        cstat[rgb_c] += 1 +                    except: +                        cstat[rgb_c] = 1 +                    if rgb_bg == rgb_c: +                        stat[bgpath] += 1 +        max_p = 0 +        bg = "" +        for bgpath, value in stat.items(): +            if max_p < value: +                bg = bgpath +                max_p = value +        return bg +     +    def substract_bg(self, bgpath): +        bg = Image.open(bgpath) +        img = self.image.convert("P") +         +        bglut = bg.resize((256, 1)) +        bglut.putdata(range(256)) +        bglut = list(bglut.convert("RGB").getdata()) +         +        lut = img.resize((256, 1)) +        lut.putdata(range(256)) +        lut = list(lut.convert("RGB").getdata()) +         +        bgpix = bg.load() +        pix = img.load() +        orgpix = self.image.load() +        for x in range(bg.size[0]): +            for y in range(bg.size[1]): +                rgb_bg = bglut[bgpix[x, y]] +                rgb_c = lut[pix[x, y]] +                if rgb_c == rgb_bg: +                    orgpix[x, y] = (255,255,255) +     +    def eval_black_white(self): +        new = Image.new("RGB", (140, 75)) +        pix = new.load() +        orgpix = self.image.load() +        thresh = 4 +        for x in range(new.size[0]): +            for y in range(new.size[1]): +                rgb = orgpix[x, y] +                r, g, b = rgb +                pix[x, y] = (255,255,255) +                if r > max(b, g)+thresh: +                    pix[x, y] = (0,0,0) +                if g < min(r, b): +                    pix[x, y] = (0,0,0) +                if g > max(r, b)+thresh: +                    pix[x, y] = (0,0,0) +                if b > max(r, g)+thresh: +                    pix[x, y] = (0,0,0) +        self.image = new +        self.pixels = self.image.load() +     +    def get_captcha(self, image): +        self.load_image(image) +        bg = self.get_bg() +        self.substract_bg(bg) +        self.eval_black_white() +        self.to_greyscale() +        self.image.save(self.data_dir+"cleaned_pass1.png") +        self.clean(4) +        self.clean(4) +        self.image.save(self.data_dir+"cleaned_pass2.png") +        letters = self.split_captcha_letters() +        final = "" +        for n, letter in enumerate(letters): +            self.image = letter +            self.image.save(ocr.data_dir+"letter%d.png" % n) +            self.run_tesser(True, True, False, False) +            final += self.result_captcha +         +        return final + +if __name__ == '__main__': +    import urllib +    ocr = LinksaveIn() +    testurl = "http://linksave.in/captcha/cap.php?hsh=2229185&code=ZzHdhl3UffV3lXTH5U4b7nShXj%2Bwma1vyoNBcbc6lcc%3D" +    urllib.urlretrieve(testurl, ocr.data_dir+"captcha.gif") +     +    print ocr.get_captcha(ocr.data_dir+'captcha.gif') diff --git a/core/module/plugins/captcha/MegauploadCom.py b/core/module/plugins/captcha/MegauploadCom.py new file mode 100644 index 000000000..469ee4094 --- /dev/null +++ b/core/module/plugins/captcha/MegauploadCom.py @@ -0,0 +1,14 @@ +from captcha import OCR + +class MegauploadCom(OCR): +    __name__ = "MegauploadCom" +    def __init__(self): +        OCR.__init__(self) +         +    def get_captcha(self, image): +        self.load_image(image) +        self.run_tesser(True, True, False, True) +        return self.result_captcha + +if __name__ == '__main__': +    ocr = MegauploadCom() diff --git a/core/module/plugins/captcha/NetloadIn.py b/core/module/plugins/captcha/NetloadIn.py new file mode 100644 index 000000000..7f2e6a8d1 --- /dev/null +++ b/core/module/plugins/captcha/NetloadIn.py @@ -0,0 +1,24 @@ +from captcha import OCR + +class NetloadIn(OCR): +    __name__ = "NetloadIn" +    def __init__(self): +        OCR.__init__(self) + +    def get_captcha(self, image): +        self.load_image(image) +        self.to_greyscale() +        self.clean(3) +        self.clean(3) +        self.run_tesser(True, True, False, False) +         +        self.result_captcha = self.result_captcha.replace(" ", "")[:4] # cut to 4 numbers +         +        return self.result_captcha + +if __name__ == '__main__': +    import urllib +    ocr = NetloadIn() +    urllib.urlretrieve("http://netload.in/share/includes/captcha.php", "captcha.png") + +    print  ocr.get_captcha('captcha.png') diff --git a/core/module/plugins/captcha/ShareonlineBiz.py b/core/module/plugins/captcha/ShareonlineBiz.py new file mode 100644 index 000000000..b07fb9b0f --- /dev/null +++ b/core/module/plugins/captcha/ShareonlineBiz.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +#Copyright (C) 2009 kingzero, RaNaN +# +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3 of the License, +#or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#See the GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +### +from captcha import OCR + +class ShareonlineBiz(OCR): +    __name__ = "ShareonlineBiz" +     +    def __init__(self): +        OCR.__init__(self) +         +    def get_captcha(self, image):  +        self.load_image(image) +        self.to_greyscale() +        self.image = self.image.resize((160, 50)) +        self.pixels = self.image.load() +        self.threshold(1.85) +        #self.eval_black_white(240) +        #self.derotate_by_average() + +        letters = self.split_captcha_letters() +         +        final = "" +        for letter in letters: +            self.image = letter +            self.run_tesser(True, True, False, False) +            final += self.result_captcha + +        return final + +        #tesseract at 60% + +if __name__ == '__main__': +    import urllib +    ocr = ShareonlineBiz() +    urllib.urlretrieve("http://www.share-online.biz/captcha.php", "captcha.jpeg") +    print  ocr.get_captcha('captcha.jpeg') diff --git a/core/module/plugins/captcha/__init__.py b/core/module/plugins/captcha/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/captcha/__init__.py diff --git a/core/module/plugins/captcha/captcha.py b/core/module/plugins/captcha/captcha.py new file mode 100644 index 000000000..d8c2aa38d --- /dev/null +++ b/core/module/plugins/captcha/captcha.py @@ -0,0 +1,313 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +#Copyright (C) 2009 kingzero, RaNaN +# +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3 of the License, +#or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#See the GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +### +from __future__ import with_statement +import os +from os.path import join +from os.path import abspath +import logging +import subprocess +#import tempfile +import threading + +import Image +import TiffImagePlugin +import PngImagePlugin +import GifImagePlugin +import JpegImagePlugin + +from module.web.ServerThread import Output + +class OCR(object): +     +    __name__ = "OCR" +     +    def __init__(self): +        self.logger = logging.getLogger("log") + +    def load_image(self, image): +        self.image = Image.open(image) +        self.pixels = self.image.load() +        self.result_captcha = '' + +    def unload(self): +        """delete all tmp images""" +        pass + +    def threshold(self, value): +        self.image = self.image.point(lambda a: a * value + 10) + +    def run(self, command, inputdata=None): +        """Run a command""" +             +        popen = subprocess.Popen(command, bufsize = -1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +        popen.wait() + +    def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): +        #self.logger.debug("create tmp tif") +         +         +        #tmp = tempfile.NamedTemporaryFile(suffix=".tif") +        tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") +        tmp.close() +        #self.logger.debug("create tmp txt") +        #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") +        tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") +        tmpTxt.close() +         +        self.logger.debug("save tiff") +        self.image.save(tmp.name, 'TIFF') + +        if os.name == "nt": +            tessparams = [join(pypath,"tesseract","tesseract.exe")] +        else: +            tessparams = ['tesseract'] +         +        tessparams.extend( [abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")] ) + +        if subset and (digits or lowercase or uppercase): +            #self.logger.debug("create temp subset config") +            #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") +            tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") +            tmpSub.write("tessedit_char_whitelist ") +            if digits: +                tmpSub.write("0123456789") +            if lowercase: +                tmpSub.write("abcdefghijklmnopqrstuvwxyz") +            if uppercase: +                tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") +            tmpSub.write("\n") +            tessparams.append("nobatch") +            tessparams.append(abspath(tmpSub.name)) +            tmpSub.close() +             +        self.logger.debug("run tesseract") +        self.run(tessparams) +        self.logger.debug("read txt") + +        with open(tmpTxt.name, 'r') as f: +            self.result_captcha = f.read().replace("\n", "") + +        self.logger.debug(self.result_captcha) +         +        try: +            os.remove(tmp.name) +            os.remove(tmpTxt.name) +            if subset and (digits or lowercase or uppercase): +                os.remove(tmpSub.name) +        except: +            pass +         +    def get_captcha(self): +        raise NotImplementedError + +    def to_greyscale(self): +        if self.image.mode != 'L': +            self.image = self.image.convert('L') + +        self.pixels = self.image.load() + +    def eval_black_white(self, limit): +        self.pixels = self.image.load() +        w, h = self.image.size +        for x in xrange(w): +            for y in xrange(h): +                if self.pixels[x, y] > limit: +                    self.pixels[x, y] = 255 +                else: +                    self.pixels[x, y] = 0 + +    def clean(self, allowed): +        pixels = self.pixels + +        w, h = self.image.size + +        for x in xrange(w): +            for y in xrange(h): +                if pixels[x, y] == 255: continue +                # no point in processing white pixels since we only want to remove black pixel +                count = 0 + +                try: +                    if pixels[x-1, y-1] != 255: count += 1 +                    if pixels[x-1, y] != 255: count += 1 +                    if pixels[x-1, y + 1] != 255: count += 1 +                    if pixels[x, y + 1] != 255: count += 1 +                    if pixels[x + 1, y + 1] != 255: count += 1 +                    if pixels[x + 1, y] != 255: count += 1 +                    if pixels[x + 1, y-1] != 255: count += 1 +                    if pixels[x, y-1] != 255: count += 1 +                except: +                    pass + +        # not enough neighbors are dark pixels so mark this pixel +            # to be changed to white +                if count < allowed: +                    pixels[x, y] = 1 + +            # second pass: this time set all 1's to 255 (white) +        for x in xrange(w): +            for y in xrange(h): +                if pixels[x, y] == 1: pixels[x, y] = 255 + +        self.pixels = pixels + +    def derotate_by_average(self): +        """rotate by checking each angle and guess most suitable""" + +        w, h = self.image.size +        pixels = self.pixels + +        for x in xrange(w): +            for y in xrange(h): +                if pixels[x, y] == 0: +                    pixels[x, y] = 155 + +        highest = {} +        counts = {} + +        for angle in range(-45, 45): + +            tmpimage = self.image.rotate(angle) + +            pixels = tmpimage.load() + +            w, h = self.image.size + +            for x in xrange(w): +                for y in xrange(h): +                    if pixels[x, y] == 0: +                        pixels[x, y] = 255 + + +            count = {} + +            for x in xrange(w): +                count[x] = 0 +                for y in xrange(h): +                    if pixels[x, y] == 155: +                        count[x] += 1 + +            sum = 0 +            cnt = 0 + +            for x in count.values(): +                if x != 0: +                    sum += x +                    cnt += 1 + +            avg = sum / cnt +            counts[angle] = cnt +            highest[angle] = 0 +            for x in count.values(): +                if x > highest[angle]: +                    highest[angle] = x + +            highest[angle] = highest[angle] - avg + +        hkey = 0 +        hvalue = 0 + +        for key, value in highest.iteritems(): +            if value > hvalue: +                hkey = key +                hvalue = value + +        self.image = self.image.rotate(hkey) +        pixels = self.image.load() + +        for x in xrange(w): +            for y in xrange(h): +                if pixels[x, y] == 0: +                    pixels[x, y] = 255 + +                if pixels[x, y] == 155: +                    pixels[x, y] = 0 + +        self.pixels = pixels + +    def split_captcha_letters(self): +        captcha = self.image +        started = False +        letters = [] +        width, height = captcha.size +        bottomY, topY = 0, height +        pixels = captcha.load() + +        for x in xrange(width): +            black_pixel_in_col = False +            for y in xrange(height): +                if pixels[x, y] != 255: +                    if started == False: +                        started = True +                        firstX = x +                        lastX = x + +                    if y > bottomY: bottomY = y +                    if y < topY: topY = y +                    if x > lastX: lastX = x + +                    black_pixel_in_col = True + +            if black_pixel_in_col == False and started == True: +                rect = (firstX, topY, lastX, bottomY) +                new_captcha = captcha.crop(rect) + +                w, h = new_captcha.size +                if w > 5 and h > 5: +                    letters.append(new_captcha) + +                started = False +                bottomY, topY = 0, height + +        return letters + +    def correct(self, values, var=None): + +        if var: +            result = var +        else: +            result = self.result_captcha + +        for key, item in values.iteritems(): + +            if key.__class__ == str: +                result = result.replace(key, item) +            else: +                for expr in key: +                    result = result.replace(expr, item) + +        if var: +            return result +        else: +            self.result_captcha = result + + +if __name__ == '__main__': +    ocr = OCR() +    ocr.load_image("B.jpg") +    ocr.to_greyscale() +    ocr.eval_black_white(140) +    ocr.derotate_by_avergage() +    ocr.run_gocr() +    print "GOCR", ocr.result_captcha +    ocr.run_tesser() +    print "Tesseract", ocr.result_captcha +    ocr.image.save("derotated.jpg") +     diff --git a/core/module/plugins/container/CCF.py b/core/module/plugins/container/CCF.py new file mode 100644 index 000000000..8b35589f3 --- /dev/null +++ b/core/module/plugins/container/CCF.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib2 + +from module.plugins.Container import Container +from module.network.MultipartPostHandler import MultipartPostHandler + +from os import makedirs +from os.path import exists, join + +class CCF(Container): +    __name__ = "CCF" +    __version__ = "0.2" +    __pattern__ = r"(?!http://).*\.ccf" +    __description__ = """CCF Container Convert Plugin""" +    __author_name__ = ("Willnix") +    __author_mail__ = ("Willnix@pyload.org") + +    def decrypt(self, pyfile): +     +        infile = pyfile.url.replace("\n", "") + +        opener = urllib2.build_opener(MultipartPostHandler) +        params = {"src": "ccf", +            "filename": "test.ccf", +            "upload": open(infile, "rb")} +        tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read() + +        download_folder = self.config['general']['download_folder'] +        location = download_folder #join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding())) +        if not exists(location):  +            makedirs(location) +             +        tempdlc_name = join(location, "tmp_%s.dlc" % pyfile.name) +        tempdlc = open(tempdlc_name, "w") +        tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.DOTALL).group(1)) +        tempdlc.close() + +        self.packages.append((tempdlc_name, [tempdlc_name], tempdlc_name)) + diff --git a/core/module/plugins/container/DLC_25.pyc b/core/module/plugins/container/DLC_25.pyc Binary files differnew file mode 100644 index 000000000..92c9e41ef --- /dev/null +++ b/core/module/plugins/container/DLC_25.pyc diff --git a/core/module/plugins/container/DLC_26.pyc b/core/module/plugins/container/DLC_26.pyc Binary files differnew file mode 100644 index 000000000..1d38fa1d9 --- /dev/null +++ b/core/module/plugins/container/DLC_26.pyc diff --git a/core/module/plugins/container/LinkList.py b/core/module/plugins/container/LinkList.py new file mode 100644 index 000000000..c9e7a85a3 --- /dev/null +++ b/core/module/plugins/container/LinkList.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +from module.plugins.Container import Container + +class LinkList(Container): +    __name__ = "LinkList" +    __version__ = "0.1" +    __pattern__ = r".*\.txt$" +    __description__ = """Read Link Lists in txt format""" +    __author_name__ = ("spoob", "jeix") +    __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") + + +    def decrypt(self, pyfile): +                 +        txt = open(pyfile.url, 'r') +        links = txt.readlines() +        curPack = "Parsed links %s" % pyfile.name +         +        packages = {curPack:[],} +         +        for link in links: +            link = link.strip() +            if not link: continue +             +            if link.startswith(";"): +                continue +            if link.startswith("[") and link.endswith("]"): +                # new package +                curPack = link[1:-1] +                packages[curPack] = [] +                continue +            packages[curPack].append(link.replace("\n", "")) +        txt.close() +         +        # empty packages fix + +        delete = [] +         +        for key,value in packages.iteritems(): +            if not value: +                delete.append(key) +                 +        for key in delete: +            del packages[key] + +        if not self.core.debug: +            txt = open(linkList, 'w') +            txt.write("") +            txt.close() +            #@TODO: maybe delete read txt file? +         +        for name, links in packages.iteritems(): +            self.packages.append((name, links, name)) diff --git a/core/module/plugins/container/RSDF.py b/core/module/plugins/container/RSDF.py new file mode 100644 index 000000000..de2ff9048 --- /dev/null +++ b/core/module/plugins/container/RSDF.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import base64 +import binascii + +from module.plugins.Container import Container + +class RSDF(Container): +    __name__ = "RSDF" +    __version__ = "0.2" +    __pattern__ = r"(?!http://).*\.rsdf" +    __description__ = """RSDF Container Decode Plugin""" +    __author_name__ = ("RaNaN", "spoob") +    __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") + +     +    def decrypt(self, pyfile): +     +        from Crypto.Cipher import AES + +        infile = pyfile.url.replace("\n", "") +        Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000') + +        IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF') +        IV_Cipher = AES.new(Key, AES.MODE_ECB) +        IV = IV_Cipher.encrypt(IV) + +        obj = AES.new(Key, AES.MODE_CFB, IV) + +        rsdf = open(infile, 'r') + +        data = rsdf.read() +        data = binascii.unhexlify(''.join(data.split())) +        data = data.splitlines() + +        links = [] +        for link in data: +            link = base64.b64decode(link) +            link = obj.decrypt(link) +            decryptedUrl = link.replace('CCF: ', '') +            links.append(decryptedUrl) + +        rsdf.close() +         +        self.packages.append((pyfile.name, links, pyfile.name)) diff --git a/core/module/plugins/container/__init__.py b/core/module/plugins/container/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/container/__init__.py diff --git a/core/module/plugins/crypter/CryptItCom.py b/core/module/plugins/crypter/CryptItCom.py new file mode 100644 index 000000000..4dff06b21 --- /dev/null +++ b/core/module/plugins/crypter/CryptItCom.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +import tempfile +import re +from os import remove +import os.path + +from time import time +from module.plugins.Crypter import Crypter + + +class CryptItCom(Crypter): +    __name__ = "CryptItCom" +    __type__ = "container" +    __pattern__ = r"http://[\w\.]*?crypt-it\.com/(s|e|d|c)/[\w]+" +    __version__ = "0.1" +    __description__ = """Crypt.It.com Container Plugin""" +    __author_name__ = ("jeix") +    __author_mail__ = ("jeix@hasnomail.de") +         +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +     +    def file_exists(self): +        html = self.load(self.parent.url) +        if r'<div class="folder">Was ist Crypt-It</div>' in html: +            return False +        return True         +     +    def proceed(self, url, location): +        repl_pattern = r"/(s|e|d|c)/" +        url = re.sub(repl_pattern, r"/d/", url) +         +        # download ccf +        file_name = os.path.join(tempfile.gettempdir(), "pyload_tmp_%d.ccf"%time()) +        file_name = self.req.download(url, file_name) +        if file_name == "redir.ccf": +            remove(file_name) +            raise Exception, _("File not found") + +        # and it to package +        self.links = [file_name] +        
\ No newline at end of file diff --git a/core/module/plugins/crypter/DDLMusicOrg.py b/core/module/plugins/crypter/DDLMusicOrg.py new file mode 100644 index 000000000..a82fa5a1c --- /dev/null +++ b/core/module/plugins/crypter/DDLMusicOrg.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import sleep + +from module.plugins.Crypter import Crypter + +class DDLMusicOrg(Crypter): +    __name__ = "DDLMusicOrg" +    __type__ = "container" +    __pattern__ = r"http://[\w\.]*?ddl-music\.org/captcha/ddlm_cr\d\.php\?\d+\?\d+" +    __version__ = "0.3" +    __description__ = """ddl-music.org Container Plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") + +    def setup(self): +        self.multiDL = False +     +    def decrypt(self, pyfile): +        html = self.req.load(self.pyfile.url, cookies=True) +         +        if re.search(r"Wer dies nicht rechnen kann", html) != None: +            self.offline() +         +        math = re.search(r"(\d+) ([\+-]) (\d+) =\s+<inp", self.html) +        id = re.search(r"name=\"id\" value=\"(\d+)\"", self.html).group(1) +        linknr = re.search(r"name=\"linknr\" value=\"(\d+)\"", self.html).group(1) +         +        solve = "" +        if math.group(2) == "+": +            solve = int(math.group(1)) + int(math.group(3)) +        else: +            solve = int(math.group(1)) - int(math.group(3)) +        sleep(3) +        htmlwithlink = self.req.load(self.pyfile.url, cookies=True, post={"calc%s" % linknr:solve, "send%s" % linknr:"Send", "id":id, "linknr":linknr}) +        m = re.search(r"<form id=\"ff\" action=\"(.*?)\" method=\"post\">", htmlwithlink) +        if m: +            self.packages.append((self.pyfile.package().name, [m.group(1)], self.pyfile.package().folder)) +        else: +            self.retry() diff --git a/core/module/plugins/crypter/FourChanOrg.py b/core/module/plugins/crypter/FourChanOrg.py new file mode 100644 index 000000000..cbcdd920c --- /dev/null +++ b/core/module/plugins/crypter/FourChanOrg.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class FourChanOrg(Crypter): +    __name__ = "FourChanOrg" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?(img\.)?(zip\.)?4chan.org/\w+/(res/|imgboard\.html)" +    __version__ = "0.1" +    __description__ = """4chan.org Thread Download Plugin""" +    __author_name__ = ("Spoob") +    __author_mail__ = ("Spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        html = self.req.load(url) +        link_pattern = "" +        temp_links = [] +        if "imagebord.html" in url: +            link_pattern = '[<a href="(res/\d*\.html)">Reply</a>]' +            temp_links = re.findall(link_pattern, html) +            for link in re.findall(link_pattern, html): +                temp_links.append(link) +        else: +            temp_links = re.findall('File : <a href="(http://(?:img\.)?(?:zip\.)?4chan\.org/\w{,3}/src/\d*\..{3})"', html) +        self.links = temp_links diff --git a/core/module/plugins/crypter/HoerbuchIn.py b/core/module/plugins/crypter/HoerbuchIn.py new file mode 100644 index 000000000..a40e5104b --- /dev/null +++ b/core/module/plugins/crypter/HoerbuchIn.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class HoerbuchIn(Crypter): +    __name__ = "HoerbuchIn" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?hoerbuch\.in/(blog\.php\?id=|download_(.*)\.html)" +    __version__ = "0.4" +    __description__ = """Hoerbuch.in Container Plugin""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def download_html(self): +        url = self.parent.url +        self.html = self.req.load(url) + +    def file_exists(self): +        """ returns True or False +        """ +        self.download_html() +        if re.search(r"Download", self.html) != None: +            return True +        return False + +    def proceed(self, url, location): +        temp_links = [] +        download_container = ("Download", "Mirror #1", "Mirror #2", "Mirror #3") +        for container in download_container: +            download_content = re.search("<BR><B>" + container + ":</B>(.*?)<BR><B>", self.html).group(1) +            tmp = re.findall('<A HREF="http://www.hoerbuch.in/cj/out.php\?pct=\d+&url=(http://rs\.hoerbuch\.in/.+?)" TARGET="_blank">Part \d+</A>', download_content) +            if tmp == []: continue +            for link in tmp: +                link_html = self.req.load(link, cookies=True) +                temp_links.append(re.search('<FORM ACTION="(http://.*?)" METHOD="post"', link_html).group(1)) +            break + +        self.links = temp_links diff --git a/core/module/plugins/crypter/LixIn.py b/core/module/plugins/crypter/LixIn.py new file mode 100644 index 000000000..168be2c27 --- /dev/null +++ b/core/module/plugins/crypter/LixIn.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class LixIn(Crypter): +    __name__ = "LixIn" +    __type__ = "container" +    __pattern__ = r"http://(www.)?lix.in/" +    __version__ = "0.1" +    __description__ = """Lix.in Container Plugin""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        new_link = "" +        if not re.search("captcha_img.php", self.html): +            new_link = re.search(r".*<iframe  name=\"ifram\" src=\"(.*)\" marginwidth=\"0\".*", self.req.load(url, post={"submit" : "continue"})).group(1) + +        self.links = [new_link] diff --git a/core/module/plugins/crypter/LofCc.py b/core/module/plugins/crypter/LofCc.py new file mode 100644 index 000000000..cd3a6fe4d --- /dev/null +++ b/core/module/plugins/crypter/LofCc.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import sleep +from os.path import join + +from module.plugins.Crypter import Crypter +from module.plugins.ReCaptcha import ReCaptcha + +class LofCc(Crypter): +    __name__ = "LofCc" +    __type__ = "container" +    __pattern__ = r"http://lof.cc/(.*)" +    __version__ = "0.1" +    __description__ = """lof.cc Plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") + +    def setup(self): +        self.multiDL = False +     +    def decrypt(self, pyfile): +        html = self.req.load(self.pyfile.url, cookies=True) +         +        m = re.search(r"src=\"http://api.recaptcha.net/challenge\?k=(.*?)\"></script>", html) +        if not m: +            self.offline() +         +        recaptcha = ReCaptcha(self) +        challenge, code = recaptcha.challenge(m.group(1)) +         +        resultHTML = self.req.load(self.pyfile.url, post={"recaptcha_challenge_field":challenge, "recaptcha_response_field":code}, cookies=True) +         +        if re.search("class=\"error\"", resultHTML): +            self.retry() +         +        dlc = self.req.load(self.pyfile.url+"/dlc", cookies=True) +         +        name = re.search(self.__pattern__, self.pyfile.url).group(1)+".dlc" +         +        dlcFile = join(self.config["general"]["download_folder"], name) +        f = open(dlcFile, "wb") +        f.write(dlc) +        f.close() +         +        self.packages.append((self.pyfile.package().name, [dlcFile], self.pyfile.package().folder)) diff --git a/core/module/plugins/crypter/OneKhDe.py b/core/module/plugins/crypter/OneKhDe.py new file mode 100644 index 000000000..c77203187 --- /dev/null +++ b/core/module/plugins/crypter/OneKhDe.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.unescape import unescape +from module.plugins.Crypter import Crypter + +class OneKhDe(Crypter): +    __name__ = "OneKhDe" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?1kh.de/f/" +    __version__ = "0.1" +    __description__ = """1kh.de Container Plugin""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        temp_links = [] +        link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html) +        for id in link_ids: +            new_link = unescape(re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.req.load("http://1kh.de/l/" + id)).group(1)) +            temp_links.append(new_link) +        self.links = temp_links diff --git a/core/module/plugins/crypter/RSLayerCom.py b/core/module/plugins/crypter/RSLayerCom.py new file mode 100644 index 000000000..9ce211aa1 --- /dev/null +++ b/core/module/plugins/crypter/RSLayerCom.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.unescape import unescape +from module.plugins.Crypter import Crypter + +class RSLayerCom(Crypter): +    __name__ = "RSLayerCom" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?rs-layer.com/directory-" +    __version__ = "0.1" +    __description__ = """RS-Layer.com Container Plugin""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url) +        temp_links = []   +        link_ids = re.findall(r"onclick=\"getFile\(\'([0-9]{7}-.{8})\'\);changeBackgroundColor", self.html) +        for id in link_ids: +            new_link = unescape(re.search(r"name=\"file\" src=\"(.*)\"></frame>", self.req.load("http://rs-layer.com/link-" + id + ".html")).group(1)) +            print new_link +            temp_links.append(new_link) +        self.links = temp_links diff --git a/core/module/plugins/crypter/RelinkUs.py b/core/module/plugins/crypter/RelinkUs.py new file mode 100644 index 000000000..e043e65a9 --- /dev/null +++ b/core/module/plugins/crypter/RelinkUs.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.Crypter import Crypter + +class RelinkUs(Crypter): +    __name__ = "RelinkUs" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?relink.us/(f|((view|go).php))" +    __version__ = "1.0" +    __description__ = """Relink.us Container Plugin""" +    __author_name__ = ("Sleeper-", "spoob") +    __author_mail__ = ("@nonymous", "spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None +        self.multi_dl = False + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        container_id = self.parent.url.split("/")[-1].split("id=")[-1] +        url = "http://relink.us/view.php?id="+container_id +        self.html = self.req.load(url, cookies=True) +        temp_links = [] + +        # Download Ad-Frames, otherwise we aren't enabled for download +        iframes = re.findall("src=['\"]([^'\"]*)['\"](.*)></iframe>", self.html) +        for iframe in iframes: +            self.req.load("http://relink.us/"+iframe[0], cookies=True) + +        link_strings = re.findall(r"onclick=\"getFile\(\'([^)]*)\'\);changeBackgroundColor", self.html) + +        for link_string in link_strings: +            self.req.lastURL = url + +            # Set Download File +            framereq = self.req.load("http://relink.us/frame.php?"+link_string, cookies=True) + +            new_link = self.req.lastEffectiveURL + +            if re.match(r"http://(www\.)?relink.us/",new_link): +                # Find iframe +                new_link = re.search("src=['\"]([^'\"]*)['\"](.*)></iframe>", framereq).group(1) +                # Wait some secs for relink.us server... +                time.sleep(5) + +            temp_links.append(new_link) + +        self.links = temp_links diff --git a/core/module/plugins/crypter/SecuredIn.py b/core/module/plugins/crypter/SecuredIn.py new file mode 100644 index 000000000..5a246075f --- /dev/null +++ b/core/module/plugins/crypter/SecuredIn.py @@ -0,0 +1,334 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter +from module.BeautifulSoup import BeautifulSoup + +from math import ceil + +class SecuredIn(Crypter): +    __name__ = "SecuredIn" +    __type__ = "container" +    __pattern__ = r"http://[\w\.]*?secured\.in/download-[\d]+-[\w]{8}\.html" +    __version__ = "0.1" +    __description__ = """secured.in Container Plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +         +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None +        self.multi_dl = False +     +    def file_exists(self): +        return True +     +    def proceed(self, url, location): +        links = [] +        ajaxUrl = "http://secured.in/ajax-handler.php" +        src = self.req.load(url, cookies=True) +        soup = BeautifulSoup(src) +        img = soup.find("img", attrs={"id":"captcha_img"}) +        for i in range(3): +            form = soup.find("form", attrs={"id":"frm_captcha"}) +            captchaHash = form.find("input", attrs={"id":"captcha_hash"})["value"] +            captchaUrl = "http://secured.in/%s" % img["src"] +            captchaData = self.req.load(str(captchaUrl), cookies=True) +            result = self.waitForCaptcha(captchaData, "jpg") +            src = self.req.load(url, cookies=True, post={"captcha_key":result, "captcha_hash":captchaHash}) +            soup = BeautifulSoup(src) +            img = soup.find("img", attrs={"id":"captcha_img"}) +            if not img: +                files = soup.findAll("tr", attrs={"id":re.compile("file-\d+")}) +                dlIDPattern = re.compile("accessDownload\(\d, \d+, '(.*?)', \d\)") +                cypher = self.Cypher() +                for cfile in files: +                    m = dlIDPattern.search(cfile["onclick"]) +                    if m: +                        crypted = self.req.load(ajaxUrl, cookies=True, post={"cmd":"download", "download_id":m.group(1)}) +                        cypher.reset() +                        link = cypher.cypher(crypted) +                        links.append(link) +                break +        self.links = links + +    class Cypher(): +        def __init__(self): +            self.reset() +         +        def reset(self): +            self.iatwbfrd = [ +                0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x0801f2e2, +                0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, +                0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, +                0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, +                0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, +                0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, +                0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, +                0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, +                0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, +                0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x075372c9, 0x80991b7b, +                0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, +                0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, +                0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, +                0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, +                0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, +                0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, +                0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, +                0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, +                0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, +                0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, +                0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, +                0x02e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, +                0x2b60a476, 0x81e67400, 0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, +                0xa99f8fa1, 0x08ba4799, 0x6e85076a +            ]
 +
 +            self.olkemfjq = [ +                0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, +                0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b +            ]
 +
 +            self.oqlaoymh = 0 +            self.oqmykrna = 0 +            self.pqmyzkid = 0 +            self.pldmjnde = 0 +            self.ldiwkqly = 0
 +
 +            self.plkodnyq = [ +                0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, +                0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, +                0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, +                0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, +                0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, +                0x022b8b51, 0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, +                0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, +                0x88f46dba, 0x03a16125, 0x0564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, +                0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, +                0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, +                0x69852dfd, 0x09072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, +                0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, +                0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84, 0xe1b00428, 0x95983a1d, 0x06b89fb4, +                0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, +                0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x0339c32a, +                0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525, +                0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, +                0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, +                0xe60b6f47, 0x0fe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, +                0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, +                0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, +                0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, +                0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, +                0xce77e25b, 0x578fdfe3, 0x3ac372e6 +            ]
 +
 +            self.pnjzokye = None
 +
 +            self.thdlpsmy = [ +                0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, +                0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x03bd9785, +                0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb, 0x68dc1462, +                0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, +                0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, +                0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, +                0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3, 0x95c11548, +                0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, +                0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, +                0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, +                0xc39dfd27, 0xf33e8d1e, 0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, +                0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, +                0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, +                0x782ef11c, 0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0x0a121386, +                0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, +                0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, +                0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, +                0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, +                0x662d09a1, 0xc4324633, 0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, +                0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, +                0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, +                0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x08fca5b5, +                0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, +                0x92638212, 0x670efa8e, 0x406000e0 +            ]
 +
 +            self.ybghjtik = [ +                0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, +                0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, +                0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e, 0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, +                0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff, +                0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, +                0x9af3dda7, 0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, +                0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, +                0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, +                0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, +                0x5f11199b, 0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, +                0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, +                0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, +                0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, +                0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, +                0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, +                0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, +                0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, +                0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, +                0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, +                0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00, +                0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, +                0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, +                0xfdd56705, 0x0e1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, +                0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7 +            ] +         +        def cypher(self, code):
 +            return self.lskdqpyr(code, "")
 +
 +        def lskdqpyr(self, alokfmth, yoaksjdh): +            if self.pnjzokye == None or self.pnjzokye.lower() == yoaksjdh:
 +                self.yoliukev(yoaksjdh)
 +                self.pnjzokye = yoaksjdh
 +            alokfmth = self.plaomtje(alokfmth)
 +            ykaiumgp = ""
 +            alokijuh = len(alokfmth)
 +            lokimyas = self.ylomiktb(alokfmth[0:8])
 +            palsiuzt = lokimyas[0]
 +            tzghbndf = lokimyas[1]
 +            awsedrft = [None, None]
 +            for kiujzhqa in range(8, alokijuh, 8):
 +                lokimyas = self.ylomiktb(alokfmth[kiujzhqa:kiujzhqa+8])
 +                awsedrft[0] = lokimyas[0]
 +                awsedrft[1] = lokimyas[1]
 +                lokimyas = self.okaqnhlp(lokimyas[0], lokimyas[1])
 +                lokimyas[0] ^= palsiuzt
 +                lokimyas[1] ^= tzghbndf
 +                palsiuzt = awsedrft[0]
 +                tzghbndf = awsedrft[1]
 +                ykaiumgp += self.ykijmtkd(lokimyas)
 +            return ykaiumgp
 +
 +        def okaqnhlp(self, lahgrnvp, trenlpys): +            ujhaqylw = 0
 +            for yalmhopr in range(17, 1, -1):
 +                lahgrnvp ^= self.ldiwkqly[yalmhopr]
 +                trenlpys ^= (self.oqlaoymh[lahgrnvp >> 24 & 0xff] + self.oqmykrna[lahgrnvp >> 16 & 0xff] ^ self.pqmyzkid[lahgrnvp >> 8 & 0xff]) + self.pldmjnde[lahgrnvp & 0xff]
 +                ujhaqylw = lahgrnvp
 +                lahgrnvp = trenlpys
 +                trenlpys = ujhaqylw
 +            ujhaqylw = lahgrnvp
 +            lahgrnvp = trenlpys
 +            trenlpys = ujhaqylw
 +            trenlpys ^= self.ldiwkqly[1]
 +            lahgrnvp ^= self.ldiwkqly[0]
 +            return [lahgrnvp, trenlpys]
 +
 +        def plaomtje(self, yoiumqpy): +            qkailkzt = ""
 +            xoliuzem = 0
 +            lyomiujt = 0
 +            yploemju = -1
 +            for i in range(0, len(yoiumqpy)):
 +                yploamzu = ord(yoiumqpy[i])
 +                if ord('A') <= yploamzu and yploamzu <= ord('Z'):
 +                    xoliuzem = ord(yoiumqpy[i]) - 65
 +                elif ord('a') <= yploamzu and yploamzu <= ord('z'):
 +                    xoliuzem = ord(yoiumqpy[i]) - 97 + 26
 +                elif ord('0') <= yploamzu and yploamzu <= ord('9'):
 +                    xoliuzem = ord(yoiumqpy[i]) - 48 + 52
 +                elif yploamzu == ord('+'):
 +                    xoliuzem = 62
 +                elif yploamzu == ord('/'):
 +                    xoliuzem = 63
 +                else:
 +                    continue
 +                yploemju += 1
 +
 +                lxkdmizj = 0
 +                switch = yploemju % 4
 +                if switch == 0:
 +                    lyomiujt = xoliuzem
 +                    continue
 +                elif switch == 1:
 +                    lxkdmizj = lyomiujt << 2 | xoliuzem >> 4
 +                    lyomiujt = xoliuzem & 0x0F
 +                elif switch == 2:
 +                    lxkdmizj = lyomiujt << 4 | xoliuzem >> 2
 +                    lyomiujt = xoliuzem & 0x03
 +                elif switch == 3:
 +                    lxkdmizj = lyomiujt << 6 | xoliuzem >> 0
 +                    lyomiujt = xoliuzem & 0x00
 +                qkailkzt += unichr(lxkdmizj)
 +            return qkailkzt
 +
 +        def qmyjuila(self, oqlamykt, yalkionj): +            dolizmvw = 0
 +            for iumswkya in range(0, 16):
 +                oqlamykt ^= self.ldiwkqly[iumswkya]
 +                yalkionj ^= (self.oqlaoymh[oqlamykt >> 24 & 0xff] + self.oqmykrna[oqlamykt >> 16 & 0xff] ^ self.pqmyzkid[oqlamykt >> 8 & 0xff]) + self.pldmjnde[oqlamykt & 0xff]
 +                dolizmvw = oqlamykt
 +                oqlamykt = yalkionj
 +                yalkionj = dolizmvw
 +            dolizmvw = oqlamykt
 +            oqlamykt = yalkionj
 +            yalkionj = dolizmvw
 +            yalkionj ^= self.ldiwkqly[16]
 +            oqlamykt ^= self.ldiwkqly[17]
 +            return [oqlamykt, yalkionj]
 +
 +        def ykijmtkd(self, yoirlkqw): +            loipamyu = len(yoirlkqw)
 +            yoirlkqwchar = []
 +            for ymujtnbq in range(0, loipamyu):
 +                yoir = [yoirlkqw[ymujtnbq] >> 24 & 0xff, yoirlkqw[ymujtnbq] >> 16 & 0xff, yoirlkqw[ymujtnbq] >> 8 & 0xff, yoirlkqw[ymujtnbq] & 0xff]
 +                for c in yoir:
 +                    yoirlkqwchar.append(chr(c))
 +            return "".join(yoirlkqwchar)
 +
 +        def ylomiktb(self, lofiuzmq): +            plokimqw = int(ceil(len(lofiuzmq) / 4.0))
 +            lopkisdq = [] +            for ypoqlktz in range(0, plokimqw):
 +                lopkisdq.append(ord(lofiuzmq[(ypoqlktz << 2) + 3]) + (ord(lofiuzmq[(ypoqlktz << 2) + 2]) << 8) + (ord(lofiuzmq[(ypoqlktz << 2) + 1]) << 16) + (ord(lofiuzmq[(ypoqlktz << 2)]) << 24)) +            return lopkisdq
 +
 +        def yoliukev(self, kaiumylq): +            self.oqlaoymh = self.iatwbfrd
 +            self.oqmykrna = self.ybghjtik
 +            self.pqmyzkid = self.thdlpsmy
 +            self.pldmjnde = self.plkodnyq
 +
 +            yaqpolft = [0 for i in range(len(kaiumylq))]
 +
 +            yaqwsedr = 0 +            btzqwsay = 0
 +            while yaqwsedr < len(kaiumylq):
 +                wlqoakmy = 0
 +                for lopiuztr in range(0, 4):
 +                    wlqoakmy = wlqoakmy << 8 | ord(kaiumylq[yaqwsedr % len(kaiumylq)])
 +                    yaqwsedr += 1
 +                yaqpolft[btzqwsay] = wlqoakmy +                btzqwsay += 1
 +            self.ldiwkqly = []
 +            for btzqwsay in range(0, 18):
 +                self.ldiwkqly.append(self.olkemfjq[btzqwsay])
 +            yalopiuq = [0, 0]
 +            for btzqwsay in range(0, 18, 2):
 +                yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1])
 +                self.ldiwkqly[btzqwsay] = yalopiuq[0]
 +                self.ldiwkqly[btzqwsay + 1] = yalopiuq[1]
 +            for btzqwsay in range(0, 256, 2):
 +                yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1])
 +                self.oqlaoymh[btzqwsay] = yalopiuq[0]
 +                self.oqlaoymh[btzqwsay + 1] = yalopiuq[1]
 +            for btzqwsay in range(0, 256, 2):
 +                yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1])
 +                self.oqmykrna[btzqwsay] = yalopiuq[0]
 +                self.oqmykrna[btzqwsay + 1] = yalopiuq[1]
 +            for btzqwsay in range(0, 256, 2):
 +                yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1])
 +                self.pqmyzkid[btzqwsay] = yalopiuq[0]
 +                self.pqmyzkid[btzqwsay + 1] = yalopiuq[1]
 +            for btzqwsay in range(0, 256, 2):
 +                yalopiuq = self.qmyjuila(yalopiuq[0], yalopiuq[1])
 +                self.pldmjnde[btzqwsay] = yalopiuq[0]
 +                self.pldmjnde[btzqwsay + 1] = yalopiuq[1] + diff --git a/core/module/plugins/crypter/SerienjunkiesOrg.py b/core/module/plugins/crypter/SerienjunkiesOrg.py new file mode 100644 index 000000000..6a7d976ab --- /dev/null +++ b/core/module/plugins/crypter/SerienjunkiesOrg.py @@ -0,0 +1,169 @@ +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter +from module.BeautifulSoup import BeautifulSoup +from module.unescape import unescape +from module.plugins.Plugin import Fail + +class SerienjunkiesOrg(Crypter): +    __name__ = "SerienjunkiesOrg" +    __type__ = "container" +    __pattern__ = r"http://.*?serienjunkies.org/.*?" +    __version__ = "0.2" +    __config__ = [ ("preferredHoster", "str", "preferred hoster" , "RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,RapidshareDe") ] +    __description__ = """serienjunkies.org Container Plugin""" +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +         +    def setup(self): +        self.hosterMap = { +            "rc": "RapidshareCom", +            "ff": "FilefactoryCom", +            "ut": "UploadedTo", +            "ul": "UploadedTo", +            "nl": "NetloadIn", +            "rs": "RapidshareDe" +        } +        self.hosterMapReverse = dict((v,k) for k, v in self.hosterMap.iteritems()) +     +    def getSJSrc(self, url): +        src = self.req.load(str(url)) +        if not src.find("Enter Serienjunkies") == -1: +            src = self.req.load(str(url)) +        return src +     +    def handleSeason(self, url): +        src = self.getSJSrc(url) +        soup = BeautifulSoup(src) +        post = soup.find("div", attrs={"class": "post-content"}) +        ps = post.findAll("p") +        hosterPattern = re.compile("^http://download\.serienjunkies\.org/f-.*?/([rcfultns]{2})_.*?\.html$") +        preferredHoster = self.getConfig("preferredHoster").split(",") +        self.log.debug("Preferred hoster: %s" % ", ".join(preferredHoster)) +        groups = {} +        gid = -1 +        seasonName = unescape(soup.find("a", attrs={"rel":"bookmark"}).string) +        for p in ps: +            if re.search("<strong>Dauer|<strong>Sprache|<strong>Format", str(p)): +                var = p.findAll("strong") +                opts = {"Dauer": "", "Uploader": "", "Sprache": "", "Format": "", u"GröÃe": ""} +                for v in var: +                    n = unescape(v.string) +                    n = n.strip() +                    n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n) +                    if not opts.has_key(n.strip()): +                        continue +                    val = v.nextSibling +                    if not val: +                        continue +                    print type(val), val +                    val = val.encode("utf-8") +                    val = unescape(val) +                    val = val.replace("|", "").strip() +                    val = val.strip() +                    val = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', val) +                    opts[n.strip()] = val.strip() +                gid += 1 +                groups[gid] = {} +                groups[gid]["ep"] = [] +                groups[gid]["opts"] = opts +            elif re.search("<strong>Download:", str(p)): +                links1 = p.findAll("a", attrs={"href": hosterPattern}) +                links2 = p.findAll("a", attrs={"href": re.compile("^http://serienjunkies.org/safe/.*$")}) +                for link in links1 + links2: +                    groups[gid]["ep"].append(link["href"]) +        for g in groups.values(): +            links = [] +            linklist = g["ep"] +            package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"]) +            linkgroups = {} +            for link in linklist: +                key = re.sub("^http://download\.serienjunkies\.org/f-.*?/(.{2})_", "", link) +                if not linkgroups.has_key(key): +                    linkgroups[key] = [] +                linkgroups[key].append(link) +            for group in linkgroups.values(): +                for pHoster in preferredHoster: +                    hmatch = False +                    for link in group: +                        m = hosterPattern.match(link) +                        if m: +                            if pHoster == self.hosterMap[m.group(1)]: +                                links.append(link) +                                hmatch = True +                                break +                    if hmatch: +                        break +            self.packages.append((package, links, package)) +     +    def handleEpisode(self, url): +        src = self.getSJSrc(url) +        if not src.find("Du hast das Download-Limit überschritten! Bitte versuche es später nocheinmal.") == -1: +            self.fail(_("Downloadlimit reached")) +        else: +            soup = BeautifulSoup(src) +            form = soup.find("form") +            packageName = soup.find("h1", attrs={"class":"wrap"}).text +            captchaTag = soup.find(attrs={"src":re.compile("^/secure/")}) +            if not captchaTag: +                self.retry() +             +            captchaUrl = "http://download.serienjunkies.org"+captchaTag["src"] +            result = self.decryptCaptcha(str(captchaUrl)) +            sinp = form.find(attrs={"name":"s"}) +             +            self.req.lastUrl = url +            sj = self.req.load(str(url), post={'s': sinp["value"], 'c': result, 'action': "Download"}) +             +            soup = BeautifulSoup(sj) +            rawLinks = soup.findAll(attrs={"action": re.compile("^http://download.serienjunkies.org/")}) +             +            if not len(rawLinks) > 0: +                self.retry() +             +            links = [] +            for link in rawLinks: +                frameUrl = link["action"].replace("/go-", "/frame/go-") +                links.append(self.handleFrame(frameUrl)) +            self.packages.append((packageName, links, packageName)) +     +    def handleOldStyleLink(self, url): +        sj = self.req.load(str(url)) +        soup = BeautifulSoup(sj) +        form = soup.find("form", attrs={"action":re.compile("^http://serienjunkies.org")}) +        captchaTag = form.find(attrs={"src":re.compile("^/safe/secure/")}) +        captchaUrl = "http://serienjunkies.org"+captchaTag["src"] +        captchaData = self.req.load(str(captchaUrl)) +        result = self.waitForCaptcha(captchaData, "png") +        url = form["action"] +        sinp = form.find(attrs={"name":"s"}) +         +        self.req.load(str(url), post={'s': sinp["value"], 'c': result, 'dl.start': "Download"}, cookies=False, just_header=True) +        decrypted = self.req.lastEffectiveURL +        if decrypted == str(url): +            self.retry() +        self.packages.append((self.pyfile.package().name, [decrypted], self.pyfile.package().folder)) +     +    def handleFrame(self, url): +        self.req.load(str(url), cookies=False, just_header=True) +        return self.req.lastEffectiveURL +     +    def decrypt(self, pyfile): +        showPattern = re.compile("^http://serienjunkies.org/serie/(.*)/$") +        seasonPattern = re.compile("^http://serienjunkies.org/.*?/(.*)/$") +        episodePattern = re.compile("^http://download.serienjunkies.org/f-.*?.html$") +        oldStyleLink = re.compile("^http://serienjunkies.org/safe/(.*)$") +        framePattern = re.compile("^http://download.serienjunkies.org/frame/go-.*?/$") +        url = pyfile.url +        if framePattern.match(url): +            self.packages.append((self.pyfile.package().name, [self.handleFrame(url)], self.pyfile.package().name)) +        elif episodePattern.match(url): +            self.handleEpisode(url) +        elif oldStyleLink.match(url): +            self.handleOldStyleLink(url) +        elif showPattern.match(url): +            pass +        elif seasonPattern.match(url): +            self.handleSeason(url) diff --git a/core/module/plugins/crypter/StealthTo.py b/core/module/plugins/crypter/StealthTo.py new file mode 100644 index 000000000..cf7a79e9b --- /dev/null +++ b/core/module/plugins/crypter/StealthTo.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class StealthTo(Crypter): +    __name__ = "StealthTo" +    __type__ = "container" +    __pattern__ = r"http://(www\.)?stealth.to/folder/" +    __version__ = "0.1" +    __description__ = """Stealth.to Container Plugin""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def __init__(self, parent): +        Crypter.__init__(self, parent) +        self.parent = parent +        self.html = None + +    def file_exists(self): +        """ returns True or False +        """ +        return True + +    def proceed(self, url, location): +        url = self.parent.url +        self.html = self.req.load(url, cookies=True) +        temp_links = [] +        ids = [] +        ats = [] # authenticity_token +        inputs = re.findall(r"(<(input|form)[^>]+)", self.html) +        for input in inputs: +            if re.search(r"name=\"authenticity_token\"",input[0]): +                ats.append(re.search(r"value=\"([^\"]+)", input[0]).group(1)) +            if re.search(r"name=\"id\"",input[0]): +                ids.append(re.search(r"value=\"([^\"]+)", input[0]).group(1)) +                 +        for i in range(0, len(ids)): +            self.req.load(url + "/web", post={"authenticity_token": ats[i], "id": str(ids[i]), "link": ("download_" + str(ids[i]))}, cookies=True) +            new_html = self.req.load(url + "/web", post={"authenticity_token": ats[i], "id": str(ids[i]), "link": "1"}, cookies=True) +            temp_links.append(re.search(r"iframe src=\"(.*)\" frameborder", new_html).group(1)) + +        self.links = temp_links diff --git a/core/module/plugins/crypter/YoutubeBatch.py b/core/module/plugins/crypter/YoutubeBatch.py new file mode 100644 index 000000000..b48026654 --- /dev/null +++ b/core/module/plugins/crypter/YoutubeBatch.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Crypter import Crypter + +class YoutubeBatch(Crypter): +    __name__ = "YoutubeBatch" +    __type__ = "container" +    __pattern__ = r"http://(?:www\.)?(?:de\.)?\youtube\.com/(?:user/.*?/user/(?P<g1>.{16})|(?:.*?feature=PlayList\&|view_play_list\?)p=(?P<g2>.{16}))" +    __version__ = "0.9" +    __description__ = """Youtube.com Channel Download Plugin""" +    __author_name__ = ("RaNaN", "Spoob") +    __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org") + +    def setup(self): +        compile_id = re.compile(self.__pattern__) +        match_id = compile_id.match(self.pyfile.url) +        self.playlist = match_id.group(match_id.lastgroup) + +    def file_exists(self): +        if "User not found" in self.req.load("http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist): +            return False +        return True + +    def decrypt(self, pyfile): +        if not self.file_exists(): +            self.offline() +        url = "http://gdata.youtube.com/feeds/api/playlists/%s?v=2" % self.playlist            +        rep = self.load(url) +        new_links = [] +        new_links.extend(re.findall(r"href\='(http:\/\/www.youtube.com\/watch\?v\=[^']+)&", rep)) +        self.packages.append((self.pyfile.package().name, new_links, self.pyfile.package().name)) diff --git a/core/module/plugins/crypter/__init__.py b/core/module/plugins/crypter/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/crypter/__init__.py diff --git a/core/module/plugins/hooks/ClickAndLoad.py b/core/module/plugins/hooks/ClickAndLoad.py new file mode 100644 index 000000000..b9824b863 --- /dev/null +++ b/core/module/plugins/hooks/ClickAndLoad.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: RaNaN +    @interface-version: 0.2 +""" + +import socket +import thread + +from module.plugins.Hook import Hook + +class ClickAndLoad(Hook): +    __name__ = "ClickAndLoad" +    __version__ = "0.2" +    __description__ = """Gives abillity to use jd's click and load. depends on webinterface""" +    __config__ = [ ("activated", "bool", "Activated" , "True"), +                   ("extern", "bool", "Allow external link adding", "False") ] +    __author_name__ = ("RaNaN", "mkaay") +    __author_mail__ = ("RaNaN@pyload.de", "mkaay@mkaay.de") +     +    def coreReady(self): +    	self.port = int(self.core.config['webinterface']['port']) +        if self.core.config['webinterface']['activated']: +            try: +		if self.getConfig("extern"): +		    ip = "0.0.0.0" +		else: +		    ip = "127.0.0.1" +		 +                thread.start_new_thread(proxy, (ip, self.port, 9666)) +            except: +                self.logger.error("ClickAndLoad port already in use.") + + +def proxy(*settings): +    thread.start_new_thread(server, settings) +    lock = thread.allocate_lock() +    lock.acquire() +    lock.acquire() + +def server(*settings): +    try: +        dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +        dock_socket.bind((settings[0], settings[2])) +        dock_socket.listen(5) +        while True: +            client_socket = dock_socket.accept()[0] +            server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +            server_socket.connect(("127.0.0.1", settings[1])) +            thread.start_new_thread(forward, (client_socket, server_socket)) +            thread.start_new_thread(forward, (server_socket, client_socket)) +    except: +        pass +    finally: +        thread.start_new_thread(server, settings) + +def forward(source, destination): +    string = ' ' +    while string: +        string = source.recv(1024) +        if string: +            destination.sendall(string) +        else: +            #source.shutdown(socket.SHUT_RD) +            destination.shutdown(socket.SHUT_WR) diff --git a/core/module/plugins/hooks/ExternalScripts.py b/core/module/plugins/hooks/ExternalScripts.py new file mode 100644 index 000000000..a3ed2f168 --- /dev/null +++ b/core/module/plugins/hooks/ExternalScripts.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: mkaay +    @interface-version: 0.1 +""" + +from module.plugins.Hook import Hook +import subprocess +from os import listdir, sep +from os.path import join +import sys + +class ExternalScripts(Hook): +    __name__ = "ExternalScripts" +    __version__ = "0.1" +    __description__ = """run external scripts""" +    __config__ = [ ("activated", "bool", "Activated" , "True") ] +    __author_name__ = ("mkaay", "RaNaN", "spoob") +    __author_mail__ = ("mkaay@mkaay.de", "ranan@pyload.org", "spoob@pyload.org") + +    def __init__(self, core): +        Hook.__init__(self, core) +        self.scripts = {} + +        script_folders = [join(pypath, 'scripts','download_preparing'), +                          join(pypath,'scripts','download_finished'), +                          join(pypath,'scripts','package_finished'), +                          join(pypath,'scripts','before_reconnect'), +                          join(pypath,'scripts','after_reconnect')] + +        folder = core.path("scripts") + +        self.core.check_file(folder, _("folders for scripts"), True) +        self.core.check_file(script_folders, _("folders for scripts"), True) + +        f = lambda x: False if x.startswith("#") or x.endswith("~") else True +        self.scripts = {} + + +        self.scripts['download_preparing'] = filter(f, listdir(join(folder, 'download_preparing'))) +        self.scripts['download_finished'] = filter(f, listdir(join(folder, 'download_finished'))) +        self.scripts['package_finished'] = filter(f, listdir(join(folder, 'package_finished'))) +        self.scripts['before_reconnect'] = filter(f, listdir(join(folder, 'before_reconnect'))) +        self.scripts['after_reconnect'] = filter(f, listdir(join(folder, 'after_reconnect'))) + +        for script_type, script_name in self.scripts.iteritems(): +            if script_name != []: +                self.log.info("Installed %s Scripts: %s" % (script_type, ", ".join(script_name))) + +        #~ self.core.logger.info("Installed Scripts: %s" % str(self.scripts)) + +        self.folder = folder + +    def downloadStarts(self, pyfile): +        for script in self.scripts['download_preparing']: +            try: +                cmd = [join(self.folder, 'download_preparing', script), pyfile.pluginname, pyfile.url] +                out = subprocess.Popen(cmd, stdout=subprocess.PIPE) +                out.wait() +            except: +                pass + +    def downloadFinished(self, pyfile): +        for script in self.scripts['download_finished']: +            try: +                out = subprocess.Popen([join(self.folder, 'download_finished', script), pyfile.pluginname, pyfile.url, pyfile.name, join(self.core.config['general']['download_folder'], pyfile.package().folder, pyfile.name)], stdout=subprocess.PIPE) +            except: +                pass + +    def packageFinished(self, pypack): +        for script in self.scripts['package_finished']: +            folder = self.core.config['general']['download_folder'] +            if self.core.config.get("general", "folder_per_package"): +                folder = join(folder.decode(sys.getfilesystemencoding()), pypack.folder.decode(sys.getfilesystemencoding())) + +            try: +                out = subprocess.Popen([join(self.folder, 'package_finished', script), pypack.name, folder], stdout=subprocess.PIPE) +            except: +                pass + +    def beforeReconnecting(self, ip): +        for script in self.scripts['before_reconnect']: +            try: +                out = subprocess.Popen([join(self.folder, 'before_reconnect', script), ip], stdout=subprocess.PIPE) +                out.wait() +            except: +                pass + +    def afterReconnecting(self, ip): +        for script in self.scripts['after_reconnect']: +            try: +                out = subprocess.Popen([join(self.folder, 'download_preparing', script), ip], stdout=subprocess.PIPE) +            except: +                pass diff --git a/core/module/plugins/hooks/HotFolder.py b/core/module/plugins/hooks/HotFolder.py new file mode 100644 index 000000000..6c6825954 --- /dev/null +++ b/core/module/plugins/hooks/HotFolder.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: RaNaN +    @interface-version: 0.2 +""" + +from os import makedirs +from os import listdir +from os.path import exists +from os.path import join +from os.path import isfile +from shutil import move +import time + +from module.plugins.Hook import Hook + +class HotFolder(Hook): +    __name__ = "HotFolder" +    __version__ = "0.1" +    __description__ = """observe folder and file for changes and add container and links""" +    __config__ = [ ("activated", "bool", "Activated" , "False"), +                   ("folder", "str", "Folder to observe", "container"), +                   ("watch_file", "bool", "Observe link file", "False"), +                   ("keep", "bool", "Keep added containers", "True"), +                   ("file", "str", "Link file", "links.txt")] +    __threaded__ = [] +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.de") +     +    def setup(self): +        self.interval = 10 +         +    def periodical(self): +         +        if not exists(join(self.getConfig("folder"), "finished")): +            makedirs(join(self.getConfig("folder"), "finished")) +           +        if self.getConfig("watch_file"): + +            if not exists(self.getConfig("file")): +                f = open(self.getConfig("file"), "wb") +                f.close() +             +             +            f = open(self.getConfig("file"), "rb") +            urls = [x.strip() for x in f.readlines() if x.strip()] +            f.close() +            if urls: +                name = "%s @ %s" % (self.getConfig("file"), time.strftime("%H:%M:%S %d%b%Y") ) +                f = open(self.getConfig("file"), "wb") +                f.close() +             +                self.core.server_methods.add_package(f.name, urls, 1) +               +        for f in listdir(self.getConfig("folder")): +            path = join(self.getConfig("folder"), f) +             +            if not isfile(path) or f.endswith("~") or f.startswith("#"): +                continue +             +            newpath = join(self.getConfig("folder"), "finished", f if self.getConfig("keep") else "tmp_"+f) +            move(path, newpath) +             +            self.log.info(_("Added %s from HotFolder") % f) +            self.core.server_methods.add_package(f, [newpath], 1) +             +        
\ No newline at end of file diff --git a/core/module/plugins/hooks/IRCInterface.py b/core/module/plugins/hooks/IRCInterface.py new file mode 100644 index 000000000..e7e1e6797 --- /dev/null +++ b/core/module/plugins/hooks/IRCInterface.py @@ -0,0 +1,364 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: RaNaN +    @author: jeix +    @interface-version: 0.2 +""" + +from select import select +import socket +import sys +from threading import Thread +import time +from time import sleep +from traceback import print_exc + +from module.plugins.Hook import Hook + +class IRCInterface(Thread, Hook): +    __name__ = "IRCInterface" +    __version__ = "0.1" +    __description__ = """connect to irc and let owner perform different tasks""" +    __config__ = [("activated", "bool", "Activated", "False"), +        ("host", "str", "IRC-Server Address", "Enter your server here!"), +        ("port", "int", "IRC-Server Port", "6667"), +        ("ident", "str", "Clients ident", "pyload-irc"), +        ("realname", "str", "Realname", "pyload-irc"), +        ("nick", "str", "Nickname the Client will take", "pyLoad-IRC"), +        ("owner", "str", "Nickname the Client will accept commands from", "Enter your nick here!"), +        ("info_file", "bool", "Inform about every file finished", "False"), +        ("info_pack", "bool", "Inform about every package finished", "True")] +    __author_name__ = ("Jeix") +    __author_mail__ = ("Jeix@hasnomail.com") +     +    def __init__(self, core): +        Thread.__init__(self) +        Hook.__init__(self, core) +        self.setDaemon(True) +        self.sm = core.server_methods +         +    def coreReady(self): +        self.new_package = {} +         +        self.abort = False +         +        self.links_added = 0 +        self.more = [] + +        self.start() +         +         +    def packageFinished(self, pypack): +        try: +            if self.getConfig("info_pack"): +                self.response(_("Package finished: %s") % pypack.name) +        except: +            pass +         +    def downloadFinished(self, pyfile): +        try: +            if self.getConfig("info_file"): +                self.response(_("Download finished: %s @ %s") % (pyfile.name, pyfile.pluginname) ) +        except: +            pass +              +    def run(self): +        # connect to IRC etc. +        self.sock = socket.socket() +        host = self.getConfig("host") +        self.sock.connect((host, self.getConfig("port"))) +        nick = self.getConfig("nick") +        self.sock.send("NICK %s\r\n" % nick) +        self.sock.send("USER %s %s bla :%s\r\n" % (nick, host, nick)) +        for t in self.getConfig("owner").split(): +            if t.strip().startswith("#"): +                self.sock.send("JOIN %s\r\n" % t.strip()) +        self.log.info("pyLoad IRC: Connected to %s!" % host) +        self.log.info("pyLoad IRC: Switching to listening mode!") +        try:         +            self.main_loop() +             +        except IRCError, ex: +            self.sock.send("QUIT :byebye\r\n") +            print_exc() +            self.sock.close() + +             +    def main_loop(self): +        readbuffer = "" +        while True: +            sleep(1) +            fdset = select([self.sock], [], [], 0) +            if self.sock not in fdset[0]: +                continue +             +            if self.abort: +                raise IRCError("quit") +             +            readbuffer += self.sock.recv(1024) +            temp = readbuffer.split("\n") +            readbuffer = temp.pop() + +            for line in temp: +                line  = line.rstrip() +                first = line.split() + +                if(first[0] == "PING"): +                    self.sock.send("PING %s\r\n" % first[1]) +                     +                if first[0] == "ERROR": +                    raise IRCError(line) +                     +                msg = line.split(None, 3) +                if len(msg) < 4: +                    continue +                     +                msg = { +                    "origin":msg[0][1:], +                    "action":msg[1], +                    "target":msg[2], +                    "text":msg[3][1:] +                } +                 +                self.handle_events(msg) +         +         +    def handle_events(self, msg): +        if not msg["origin"].split("!", 1)[0] in self.getConfig("owner").split(): +            return +             +        if msg["target"].split("!", 1)[0] != self.getConfig("nick"): +            return +             +        if msg["action"] != "PRIVMSG": +            return +             +        # HANDLE CTCP ANTI FLOOD/BOT PROTECTION +        if msg["text"] == "\x01VERSION\x01": +            self.log.debug("Sending CTCP VERSION.") +            self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) +            return +        elif msg["text"] == "\x01TIME\x01": +            self.log.debug("Sending CTCP TIME.") +            self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) +            return +        elif msg["text"] == "\x01LAG\x01": +            self.log.debug("Received CTCP LAG.") # don't know how to answer +            return +          +        trigger = "pass" +        args = None +         +        temp = msg["text"].split() +        trigger = temp[0] +        if len(temp) > 1: +            args = temp[1:] +         +        handler = getattr(self, "event_%s" % trigger, self.event_pass) +        try: +            res = handler(args) +            for line in res: +                self.response(line, msg["origin"]) +        except Exception, e: +            self.log.error("pyLoad IRC: "+ repr(e)) +         +         +    def response(self, msg, origin=""): +        if origin == "": +            for t in self.getConfig("owner").split(): +                self.sock.send("PRIVMSG %s :%s\r\n" % (t.strip(), msg)) +        else: +            self.sock.send("PRIVMSG %s :%s\r\n" % (origin.split("!", 1)[0], msg)) +         +         +#### Events +    def event_pass(self, args): +        return [] +         +    def event_status(self, args): +        downloads = self.sm.status_downloads() +        if not downloads: +            return ["INFO: There are no active downloads currently."] +             +        lines = [] +        lines.append("ID - Name - Status - Speed - ETA - Progress") +        for data in downloads: +            lines.append("#%d - %s - %s - %s - %s - %s" % +                     ( +                     data['id'], +                     data['name'], +                     data['statusmsg'], +                     "%.2f kb/s" % data['speed'], +                     "%s" % data['format_eta'], +                     "%d%% (%s)" % (data['percent'], data['format_size']) +                     ) +                     ) +        return lines +             +    def event_queue(self, args): +        ps = self.sm.get_queue() +         +        if not ps: +            return ["INFO: There are no packages in queue."] +         +        lines = [] +        for id, pack in ps.iteritems(): +            lines.append('PACKAGE #%s: "%s" with %d links.' % (id, pack['name'], len(pack['links']) )) +                 +        return lines +         +    def event_collector(self, args): +        ps = self.sm.get_collector() +        if not ps: +            return ["INFO: No packages in collector!"] +         +        lines = [] +        for id, pack in ps.iteritems(): +            lines.append('PACKAGE #%s: "%s" with %d links.' % (id, pack['name'], len(pack['links']) )) +                 +        return lines +             +    def event_info(self, args): +        if not args: +            return ['ERROR: Use info like this: info <id>'] +             +        info = self.sm.get_file_data(int(args[0])) +         +        if not info: +            return ["ERROR: Link doesn't exists."] +         +        id = info.keys()[0] +        data = info[id] +         +        return ['LINK #%s: %s (%s) [%s][%s]' % (id, data['name'], data['format_size'], data['statusmsg'], data['plugin'])] +         +    def event_packinfo(self, args): +        if not args: +            return ['ERROR: Use packinfo like this: packinfo <id>'] +             +        lines = [] +        pack = self.sm.get_package_data(int(args[0])) +         +        if not pack: +            return ["ERROR: Package doesn't exists."] +         +        id = args[0] + +        self.more = [] +         +        lines.append('PACKAGE #%s: "%s" with %d links' % (id, pack['name'], len(pack["links"])) ) +        for id, pyfile in pack["links"].iteritems(): +            self.more.append('LINK #%s: %s (%s) [%s][%s]' % (id, pyfile["name"], pyfile["format_size"], pyfile["statusmsg"], pyfile["plugin"])) + +        if len(self.more) < 6: +            lines.extend(self.more) +            self.more = [] +        else: +            lines.extend(self.more[:6]) +            self.more = self.more[6:] +            lines.append("%d more links do display." % len(self.more)) +             +             +        return lines +     +    def event_more(self, args): +        if not self.more: +            return ["No more information to display."] +         +        lines = self.more[:6] +        self.more = self.more[6:] +        lines.append("%d more links do display." % len(self.more)) +         +        return lines +     +    def event_start(self, args): +         +        self.sm.unpause_server() +        return ["INFO: Starting downloads."] +         +    def event_stop(self, args): +     +        self.sm.pause_server() +        return ["INFO: No new downloads will be started."] +     +     +    def event_add(self, args): +        if len(args) < 2: +            return ['ERROR: Add links like this: "add <packagename|id> links". '\ +                     'This will add the link <link> to to the package <package> / the package with id <id>!'] +             + +             +        pack = args[0].strip() +        links = [x.strip() for x in args[1:]] +         +        count_added = 0 +        count_failed = 0 +        try: +            id = int(pack)  +            pack = self.sm.get_package_data(id) +            if not pack: +                return ["ERROR: Package doesn't exists."] +             +            #add links +             +             +            return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack["name"], id)] +             +        except: +            # create new package +            id = self.sm.add_package(pack, links, 1) +            return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] +              +         +    def event_del(self, args): +        if len(args) < 2: +            return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] +             +        if args[0] == "-p": +            ret = self.sm.del_packages(map(int, args[1:])) +            return ["INFO: Deleted %d packages!" % len(args[1:])] +             +        elif args[0] == "-l": +            ret = self.sm.del_links(map(int, args[1:])) +            return ["INFO: Deleted %d links!" % len(args[1:])] + +        else: +            return ["ERROR: Use del command like this: del <-p|-l> <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] +             +    def event_help(self, args): +        lines = [] +        lines.append("The following commands are available:") +        lines.append("add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)") +        lines.append("queue                       Shows all packages in the queue") +        lines.append("collector                   Shows all packages in collector") +        lines.append("del -p|-l <id> [...]        Deletes all packages|links with the ids specified") +        lines.append("info <id>                   Shows info of the link with id <id>") +        lines.append("packinfo <id>               Shows info of the package with id <id>") +        lines.append("more                        Shows more info when the result was truncated") +        lines.append("start                       Starts all downloads") +        lines.append("stop                        Stops the download (but not abort active downloads)") +        lines.append("status                      Show general download status") +        lines.append("help                        Shows this help message") +        return lines +         +         +class IRCError(Exception): +    def __init__(self, value): +        self.value = value +    def __str__(self): +        return repr(self.value)
\ No newline at end of file diff --git a/core/module/plugins/hooks/MultiHome.py b/core/module/plugins/hooks/MultiHome.py new file mode 100644 index 000000000..3f41938dc --- /dev/null +++ b/core/module/plugins/hooks/MultiHome.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" + +from module.plugins.Hook import Hook +from time import time + +class MultiHome(Hook): +    __name__ = "MultiHome" +    __version__ = "0.1" +    __description__ = """ip address changer""" +    __config__ = [ ("activated", "bool", "Activated" , "False"), +                   ("interfaces", "str", "Interfaces" , "None") ] +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def setup(self): +        self.register = {} +        self.interfaces = [] +        self.parseInterfaces(self.getConfig("interfaces").split(";")) +        if not self.interfaces: +            self.parseInterfaces([self.config["general"]["download_interface"]]) +            self.setConfig("interfaces", self.toConfig()) +     +    def toConfig(self): +        return ";".join([i.adress for i in self.interfaces]) +     +    def parseInterfaces(self, interfaces): +        for interface in interfaces: +            if not interface or str(interface).lower() == "none": +                continue +            self.interfaces.append(Interface(interface)) +     +    def coreReady(self): +    	requestFactory = self.core.requestFactory +    	oldGetRequest = requestFactory.getRequest +        def getRequest(pluginName, account=None, type="HTTP"): +            iface = self.bestInterface(pluginName, account) +            if iface: +                iface.useFor(pluginName, account) +                requestFactory.iface = iface.adress +                self.log.debug("Multihome: using address: "+iface.adress) +            return oldGetRequest(pluginName, account, type) +        requestFactory.getRequest = getRequest +     +    def bestInterface(self, pluginName, account): +        best = None +        for interface in self.interfaces: +            if not best or interface.lastPluginAccess(pluginName, account) < best.lastPluginAccess(pluginName, account): +                best = interface +        return best + +class Interface(object): +    def __init__(self, adress): +        self.adress = adress +        self.history = {} +     +    def lastPluginAccess(self, pluginName, account): +        if self.history.has_key((pluginName, account)): +            return self.history[(pluginName, account)] +        return 0 +     +    def useFor(self, pluginName, account): +        self.history[(pluginName, account)] = time() +     +    def __repr__(self): +        return "<Interface - %s>" % self.adress diff --git a/core/module/plugins/hooks/UnRar.py b/core/module/plugins/hooks/UnRar.py new file mode 100644 index 000000000..faa06d179 --- /dev/null +++ b/core/module/plugins/hooks/UnRar.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay +""" +from __future__ import with_statement + +import sys + +from module.plugins.Hook import Hook +from module.pyunrar import Unrar, WrongPasswordError, CommandError, UnknownError + +from os.path import exists, join +from os import remove +import re + +class UnRar(Hook): +    __name__ = "UnRar" +    __version__ = "0.1" +    __description__ = """unrar""" +    __config__ = [ ("activated", "bool", "Activated", False), +                   ("fullpath", "bool", "extract full path", True), +                   ("overwrite", "bool", "overwrite files", True), +                   ("passwordfile", "str", "unrar passoword file", "unrar_passwords.txt"), +                   ("deletearchive", "bool", "delete archives when done", False) ] +    __threaded__ = ["packageFinished"] +    __author_name__ = ("mkaay") +    __author_mail__ = ("mkaay@mkaay.de") +     +    def setup(self): +        self.comments = ["# one password each line"] +        self.passwords = [] +        if exists(self.getConfig("passwordfile")): +            with open(self.getConfig("passwordfile"), "r") as f: +                for l in f.readlines(): +                    l = l.strip("\n\r") +                    if l and not l.startswith("#"): +                        self.passwords.append(l) +        else: +            with open(self.getConfig("passwordfile"), "w") as f: +                f.writelines(self.comments) +        self.re_splitfile = re.compile("(.*)\.part(\d+)\.rar$") +     +    def addPassword(self, pw): +        if not pw in self.passwords: +            self.passwords.insert(0, pw) +            with open(self.getConfig("passwordfile"), "w") as f: +                f.writelines(self.comments) +                f.writelines(self.passwords) +         +    def removeFiles(self, pack, fname): +        if not self.getConfig("deletearchive"): +            return +        m = self.re_splitfile.search(fname) +                 +        download_folder = self.core.config['general']['download_folder'] +        if self.core.config['general']['folder_per_package']: +            folder = join(download_folder, pack.folder.decode(sys.getfilesystemencoding())) +        else: +            folder = download_folder +        if m: +            nre = re.compile("%s\.part\d+\.rar" % m.group(1)) +            for fid, data in pack.getChildren().iteritems(): +                if nre.match(data["name"]): +                    remove(join(folder, data["name"])) +        elif not m and fname.endswith(".rar"): +            nre = re.compile("^%s\.r..$" % fname.replace(".rar","")) +            for fid, data in pack.getChildren().iteritems(): +                if nre.match(data["name"]): +                    remove(join(folder, data["name"])) +     +    def packageFinished(self, pack): +        if pack.password: +            self.addPassword(pack.password) +        files = [] +        for fid, data in pack.getChildren().iteritems(): +            m = self.re_splitfile.search(data["name"]) +            if m and int(m.group(2)) == 1: +                files.append((fid,m.group(0))) +            elif not m and data["name"].endswith(".rar"): +                files.append((fid,data["name"])) +         +        for fid, fname in files: +            pyfile = self.core.files.getFile(fid) +            pyfile.setStatus("custom") +            def s(p): +                pyfile.alternativePercent = p +                 +            download_folder = self.core.config['general']['download_folder'] +            if self.core.config['general']['folder_per_package']: +                folder = join(download_folder, pack.folder.decode(sys.getfilesystemencoding())) +            else: +                folder = download_folder +             +            u = Unrar(join(folder, fname)) +            try: +                success = u.crackPassword(passwords=self.passwords, statusFunction=s, overwrite=True, destination=folder, fullPath=self.getConfig("fullpath")) +            except WrongPasswordError: +                self.core.log.info("Unrar of %s failed (wrong password)" % fname) +                continue +            except CommandError, e: +                if re.search("Cannot find volume", e.stderr): +                    self.core.log.info("Unrar of %s failed (missing volume)" % fname) +                    continue +                try: +                    if e.getExitCode() == 1 and len(u.listContent(u.getPassword())) == 1: +                        self.core.log.debug("Unrar of %s ok" % fname) +                        self.removeFiles(pack, fname) +                except: +                    self.core.log.info("Unrar of %s failed" % fname) +                    continue +            except UnknownError: +                self.core.log.info("Unrar of %s failed" % fname) +                continue +            else: +                if success: +                    self.core.log.debug("Unrar of %s ok" % fname) +                    self.removeFiles(pack, fname) +                else: +                    self.core.log.info("Unrar of %s failed (wrong password)" % fname) +            finally: +                pyfile.alternativePercent = None +                pyfile.setStatus("finished") + diff --git a/core/module/plugins/hooks/UpdateManager.py b/core/module/plugins/hooks/UpdateManager.py new file mode 100644 index 000000000..2981df9a0 --- /dev/null +++ b/core/module/plugins/hooks/UpdateManager.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: mkaay +    @interface-version: 0.1 +""" + +from module.network.Request import getURL +from module.plugins.Hook import Hook + +class UpdateManager(Hook): +    __name__ = "UpdateManager" +    __version__ = "0.1" +    __description__ = """checks for updates""" +    __config__ = [ ("activated", "bool", "Activated" , "True"), +                   ("interval", "int", "Check interval in minutes" , "180")] +    __author_name__ = ("RaNaN") +    __author_mail__ = ("ranan@pyload.org") + +    def setup(self): +        self.interval = self.getConfig("interval") * 60 +         +    def coreReady(self): +        #@TODO check plugins, restart, and other stuff +        pass +     +    def periodical(self): +        self.checkForUpdate() +         +         +    def checkForUpdate(self): +        """ checks if an update is available""" +         +        try: +            version_check = getURL("http://get.pyload.org/check/%s/" % self.core.server_methods.get_server_version() ) +            if version_check == "": +                self.log.info(_("No Updates for pyLoad")) +                return False +            else: +                self.log.info(_("***  New pyLoad Version %s available  ***") % version_check) +                self.log.info(_("***  Get it here: http://get.pyload.org/get/  ***")) +                return True +        except: +            self.log.error(_("Not able to connect server")) + +        
\ No newline at end of file diff --git a/core/module/plugins/hooks/XMPPInterface.py b/core/module/plugins/hooks/XMPPInterface.py new file mode 100644 index 000000000..67a7f1b77 --- /dev/null +++ b/core/module/plugins/hooks/XMPPInterface.py @@ -0,0 +1,229 @@ +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: RaNaN +    @interface-version: 0.2 +""" + +import socket +import sys +from threading import Thread +import time +from time import sleep +from traceback import print_exc + +from pyxmpp.all import JID,Iq,Presence,Message,StreamError +from pyxmpp.jabber.client import JabberClient +from pyxmpp.interface import implements +from pyxmpp.interfaces import * +from pyxmpp.streamtls import TLSSettings + +from module.plugins.Hook import Hook +from module.plugins.hooks.IRCInterface import IRCInterface + +class XMPPInterface(IRCInterface, JabberClient): +    __name__ = "XMPPInterface" +    __version__ = "0.1" +    __description__ = """connect to jabber and let owner perform different tasks""" +    __config__ = [("activated", "bool", "Activated", "False"), +        ("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), +        ("pw", "str", "Password", ""), +        ("owners", "str", "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), +        ("info_file", "bool", "Inform about every file finished", "False"), +        ("info_pack", "bool", "Inform about every package finished", "True")] +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.org") +         +    implements(IMessageHandlersProvider) +     +    def __init__(self, core): +        IRCInterface.__init__(self, core) +         +        self.jid = JID(self.getConfig("jid")) +        password = self.getConfig("pw") +         +        # if bare JID is provided add a resource -- it is required +        if not self.jid.resource: +            self.jid=JID(self.jid.node, self.jid.domain, "pyLoad") +      +        tls_settings = None + +        # setup client with provided connection information +        # and identity data +        JabberClient.__init__(self, self.jid, password, +                disco_name="pyLoad XMPP Client", disco_type="bot", +                tls_settings = tls_settings) + +        self.interface_providers = [ +            VersionHandler(self), +            self, +        ] +             +    def coreReady(self): +        self.new_package = {} +     +        self.start() +                 +    def packageFinished(self, pypack): +         +        try: +            if self.getConfig("info_pack"): +                self.announce(_("Package finished: %s") % pypack.name) +        except: +            pass +         +    def downloadFinished(self, pyfile): +        try: +            if self.getConfig("info_file"): +                self.announce(_("Download finished: %s @ %s") % (pyfile.name, pyfile.pluginname) ) +        except: +            pass +              +    def run(self): +        # connect to IRC etc. +        self.connect() +        try:         +            self.loop(1) +        except Exception, ex: +            self.core.log.error("pyLoad XMPP: %s" % str(ex)) +             +    def stream_state_changed(self,state,arg): +        """This one is called when the state of stream connecting the component +        to a server changes. This will usually be used to let the user +        know what is going on.""" +        self.log.debug("pyLoad XMPP: *** State changed: %s %r ***" % (state,arg) ) + +    def get_message_handlers(self): +        """Return list of (message_type, message_handler) tuples. + +        The handlers returned will be called when matching message is received +        in a client session.""" +        return [ +            ("normal", self.message), +            ] + +    def message(self,stanza): +        """Message handler for the component.""" +        subject=stanza.get_subject() +        body=stanza.get_body() +        t=stanza.get_type() +        self.log.debug(_(u'pyLoad XMPP: Message from %s received.') % (unicode(stanza.get_from(),))) +        self.log.debug(_(u'pyLoad XMPP: Body: %s') % body) +         +        if stanza.get_type()=="headline": +            # 'headline' messages should never be replied to +            return True +        if subject: +            subject=u"Re: "+subject +             +        to_jid = stanza.get_from() +        from_jid = stanza.get_to() + +        #j = JID() +        to_name = to_jid.as_utf8() +        from_name = from_jid.as_utf8() +         +        names = self.getConfig("owners").split(";") +         +        if to_name in names or to_jid.node+"@"+to_jid.domain in names: +             +            messages = [] +             +            trigger = "pass" +            args = None +             +            temp = body.split() +            trigger = temp[0] +            if len(temp) > 1: +                args = temp[1:] +         +            handler = getattr(self, "event_%s" % trigger, self.event_pass) +            try: +                res = handler(args) +                for line in res: +                    m=Message( +                        to_jid=to_jid, +                        from_jid=from_jid, +                        stanza_type=stanza.get_type(), +                        subject=subject, +                        body=line) +                     +                    messages.append(m) +            except Exception, e: +                    self.log.error("pyLoad XMPP: "+ repr(e)) +             +            return messages +         +        else: +            return True +         +             +    def announce(self, message): +        """ send message to all owners""" +        for user in self.getConfig("owners").split(";"): +             +            self.log.debug(_("pyLoad XMPP: Send message to %s") % user) +             +            to_jid = JID(user) +             +            m = Message(from_jid=self.jid, +                        to_jid=to_jid, +                        stanza_type="chat", +                        body=message) +             +            self.stream.send(m) +         +            +class VersionHandler(object): +    """Provides handler for a version query. +     +    This class will answer version query and announce 'jabber:iq:version' namespace +    in the client's disco#info results.""" +     +    implements(IIqHandlersProvider, IFeaturesProvider) + +    def __init__(self, client): +        """Just remember who created this.""" +        self.client = client + +    def get_features(self): +        """Return namespace which should the client include in its reply to a +        disco#info query.""" +        return ["jabber:iq:version"] + +    def get_iq_get_handlers(self): +        """Return list of tuples (element_name, namespace, handler) describing +        handlers of <iq type='get'/> stanzas""" +        return [ +            ("query", "jabber:iq:version", self.get_version), +            ] + +    def get_iq_set_handlers(self): +        """Return empty list, as this class provides no <iq type='set'/> stanza handler.""" +        return [] + +    def get_version(self,iq): +        """Handler for jabber:iq:version queries. + +        jabber:iq:version queries are not supported directly by PyXMPP, so the +        XML node is accessed directly through the libxml2 API.  This should be +        used very carefully!""" +        iq=iq.make_result_response() +        q=iq.new_query("jabber:iq:version") +        q.newTextChild(q.ns(),"name","Echo component") +        q.newTextChild(q.ns(),"version","1.0") +        return iq +    
\ No newline at end of file diff --git a/core/module/plugins/hooks/__init__.py b/core/module/plugins/hooks/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/hooks/__init__.py diff --git a/core/module/plugins/hoster/BasePlugin.py b/core/module/plugins/hoster/BasePlugin.py new file mode 100644 index 000000000..09545d493 --- /dev/null +++ b/core/module/plugins/hoster/BasePlugin.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class BasePlugin(Hoster): +    __name__ = "BasePlugin" +    __type__ = "hoster" +    __pattern__ = r"^unmatchable$" +    __version__ = "0.1" +    __description__ = """Base Plugin when any other didnt fit""" +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.org") + +    def process(self, pyfile): +        """main function""" +         +        if pyfile.url.startswith("http://"): + +            pyfile.name = re.findall("([^\/=]+)", pyfile.url)[-1] +            self.download(pyfile.url) +             +        else: +            self.fail("No Plugin matched and not a downloadable url.")
\ No newline at end of file diff --git a/core/module/plugins/hoster/DepositfilesCom.py b/core/module/plugins/hoster/DepositfilesCom.py new file mode 100644 index 000000000..c91341887 --- /dev/null +++ b/core/module/plugins/hoster/DepositfilesCom.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib +from module.plugins.Hoster import Hoster + +class DepositfilesCom(Hoster): +    __name__ = "DepositfilesCom" +    __type__ = "hoster" +    __pattern__ = r"http://[\w\.]*?depositfiles\.com(/\w{1,3})?/files/[\w]+" +    __version__ = "0.1" +    __description__ = """Depositfiles.com Download Hoster""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def setup(self): +        self.req.canContinue = self.multiDL = True if self.account else False +         +    def process(self, pyfile): +        self.html = self.load(self.pyfile.url, cookies=False if self.account else False) +         +        if re.search(r"Such file does not exist or it has been removed for infringement of copyrights", self.html): +            self.offline() +         +        if not self.account: +            self.handleFree() +         +        pyfile.name = re.search('File name: <b title="(.*)">', self.html).group(1) +         +        link = urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1)) +        self.download(link) + +    def handleFree(self): +        if re.search(r'File is checked, please try again in a minute.', self.html) != None: +            self.log.info("DepositFiles.com: The file is being checked. Waiting 1 minute.") +            self.setWait(61) +            self.wait() +             +        if re.search(r'Such file does not exist or it has been removed for infringement of copyrights', self.html) != None: +            self.offline() +             +        self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}) +        wait_time = int(re.search(r'<span id="download_waiter_remain">(.*?)</span>', self.html).group(1)) +        self.setWait(wait_time) +        self.log.debug("DepositFiles.com: Waiting %d seconds." % wait_time) diff --git a/core/module/plugins/hoster/FileserveCom.py b/core/module/plugins/hoster/FileserveCom.py new file mode 100644 index 000000000..ff09d9a0a --- /dev/null +++ b/core/module/plugins/hoster/FileserveCom.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.plugins.Hoster import Hoster
 +from module.plugins.ReCaptcha import ReCaptcha + +from module.network.Request import getURL
 + +def getInfo(urls): +    result = [] +     +    for url in urls: +        html = getURL(url)
 +        if re.search(r'<h1>File not available</h1>', html):
 +            result.append((url, 0, 1, url)) +            continue +         +        size = re.search(r"<span><strong>(.*?) MB</strong>", html).group(1)
 +        size = int(float(size)*1024*1024) +        
 +        name = re.search('<h1>(.*?)<br/></h1>', html).group(1) +        result.append((name, size, 2, url)) +         +    yield result +
 +class FileserveCom(Hoster):
 +    __name__ = "FileserveCom"
 +    __type__ = "hoster"
 +    __pattern__ = r"http://(www\.)?fileserve\.com/file/.*?(/.*)?"
 +    __version__ = "0.2"
 +    __description__ = """Fileserve.Com File Download Hoster"""
 +    __author_name__ = ("jeix", "mkaay")
 +    __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de")
 +        
 +    def setup(self):
 +        self.req.canContinue = self.multiDL = True if self.account else False
 +        
 +    def process(self, pyfile):
 +        
 +        self.html = self.load(self.pyfile.url, cookies=False if self.account else True)
 +        if re.search(r'<h1>File not available</h1>', self.html) != None:
 +            self.offline
 +            
 +        self.pyfile.name = re.search('<h1>(.*?)<br/></h1>', self.html).group(1)
 +         +        if self.account: +            self.handlePremium() +        else: +            self.handleFree() +     +    def handlePremium(self): +        self.download(self.pyfile.url, post={"download":"premium"}, cookies=True) +     +    def handleFree(self): +        
 +        if r'<div id="captchaArea" style="display:none;">' in self.html or \
 +           r'/showCaptcha\(\);' in self.html:
 +            # we got a captcha
 +            id = re.search(r"var reCAPTCHA_publickey='(.*?)';", self.html).group(1)
 +            recaptcha = ReCaptcha(self)
 +            challenge, code = recaptcha.challenge(id)
 +            
 +            shortencode = re.search(r'name="recaptcha_shortencode_field" value="(.*?)"', self.html).group(1)
 +
 +            self.html = self.load(r'http://www.fileserve.com/checkReCaptcha.php', post={'recaptcha_challenge_field':challenge,
 +                'recaptcha_response_field':code, 'recaptcha_shortencode_field': shortencode})
 +                
 +            if r'incorrect-captcha-sol' in self.html:
 +                self.retry()
 +
 +        html = self.load(self.pyfile.url, post={"downloadLink":"wait"})
 +       
 +        wait_time = 30
 +        m = re.search(r'<span>(.*?)\sSekunden</span>', html)
 +        if m != None:
 +            wait_time = int( m.group(1).split('.')[0] ) + 1
 +            
 +        m = re.search(r'You need to wait (.*?) seconds to start another download.', html)
 +        if m != None:
 +            wait_time = int( m.group(1) )
 +            self.wantReconnect = True
 +            
 +        if r'Your download link has expired.' in html:
 +            self.retry()
 +       
 +        self.log.debug("%s: Waiting %d seconds." % (self.__name__, wait_time))
 +        self.setWait(wait_time)
 +        self.wait()
 +        
 +        self.load(self.pyfile.url, post={"downloadLink":"show"})
 +        
 +        self.download(self.pyfile.url, post={"download":"normal"})
 diff --git a/core/module/plugins/hoster/FreakshareNet.py b/core/module/plugins/hoster/FreakshareNet.py new file mode 100644 index 000000000..1bb36737e --- /dev/null +++ b/core/module/plugins/hoster/FreakshareNet.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster +from time import time + + +class FreakshareNet(Hoster): +    __name__ = "FreakshareNet" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www\.)?freakshare\.net/files/\S*?/" +    __version__ = "0.2" +    __description__ = """Freakshare.com Download Hoster""" +    __author_name__ = ("sitacuisses","spoob","mkaay") +    __author_mail__ = ("sitacuisses@yahoo.de","spoob@pyload.org","mkaay@mkaay.de") + +    def setup(self): +        self.html = None +        self.wantReconnect = False +        self.multiDL = False +        self.req_opts = [] + +    def process(self, pyfile): +        self.pyfile = pyfile +        self.prepare() +        self.get_file_url() +         +        self.download(self.pyfile.url, post=self.req_opts) +         +     +    def prepare(self): +        pyfile = self.pyfile + +        self.wantReconnect = False +         +        self.download_html() + +        if not self.file_exists(): +            self.offline +             +        self.setWait( self.get_waiting_time() ) + +        pyfile.name = self.get_file_name() +             +        self.wait() + +        return True + +    def download_html(self): +        url = self.pyfile.url +        self.html = self.load(url, cookies=True) + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.html == None: +            self.download_html() +        if not self.wantReconnect: +            self.req_opts = self.get_download_options() # get the Post options for the Request +            #file_url = self.pyfile.url +            #return file_url +        else: +            self.offline() + +    def get_file_name(self): +        if self.html == None: +            self.download_html() +        if not self.wantReconnect: +            file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center\;\">([^ ]+)", self.html).group(1) +            return file_name +        else: +            return self.pyfile.url +     +    def get_waiting_time(self): +        if self.html == None: +            self.download_html() +        timestring = re.search('\s*var\stime\s=\s(\d*?)\.\d*;', self.html).group(1) +        if timestring: +            sec = int(timestring) + 1 #add 1 sec as tenths of seconds are cut off +        else: +            sec = 0 +        return sec + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html == None: +            self.download_html() +        if re.search(r"Sorry, this Download doesnt exist anymore", self.html) != None: +            return False +        else: +            return True + +    def get_download_options(self): +        re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", self.html).group(0) #get the whole request +        to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope) +        request_options = [] +         +        for item in to_sort:       #Name value pairs are output reversed from regex, so we reorder them +            request_options.append((item[1], item[0])) +             +        herewego = self.load(self.pyfile.url, None, request_options, cookies=True) # the actual download-Page +         +        to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) +        request_options = [] +         +        for item in to_sort:       #Same as above +            request_options.append((item[1], item[0])) + +        return request_options
\ No newline at end of file diff --git a/core/module/plugins/hoster/Ftp.py b/core/module/plugins/hoster/Ftp.py new file mode 100644 index 000000000..9303b00c8 --- /dev/null +++ b/core/module/plugins/hoster/Ftp.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*-
 +
 +"""
 +    This program is free software; you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation; either version 3 of the License,
 +    or (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +    See the GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program; if not, see <http://www.gnu.org/licenses/>.
 +    
 +    @author: jeix +    @author: mkaay
 +"""
 +
 +import logging
 +from os.path import exists
 +from os.path import join
 +from os.path import exists
 +from os import makedirs
 +import sys
 +
 +from module.plugins.Hoster import Hoster
 +
 +
 +class Ftp(Hoster):
 +    __name__ = "Ftp"
 +    __version__ = "0.3"
 +    __pattern__ = r'ftp://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file
 +    __type__ = "hoster"
 +    __description__ = """A Plugin that allows you to download from an from an ftp directory"""
 +    __author_name__ = ("jeix", "mkaay")
 +    __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de")
 +    
 +    def process(self, pyfile):
 +        self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="FTP")
 +        pyfile.name = self.pyfile.url.rpartition('/')[2]
 +        
 +        self.doDownload(pyfile.url, pyfile.name)
 +
 +    def doDownload(self, url, filename):
 +        self.pyfile.setStatus("downloading")
 +        
 +        download_folder = self.core.config['general']['download_folder']
 +        location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
 +        if not exists(location): 
 +            makedirs(location)
 +
 +        newname = self.req.download(str(url), join(location, filename.decode(sys.getfilesystemencoding())))
 +        self.pyfile.size = self.req.dl_size
 +
 +        if newname:
 +            self.pyfile.name = newname
 diff --git a/core/module/plugins/hoster/HotfileCom.py b/core/module/plugins/hoster/HotfileCom.py new file mode 100644 index 000000000..8f231fcd5 --- /dev/null +++ b/core/module/plugins/hoster/HotfileCom.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time +from module.plugins.Hoster import Hoster +from module.plugins.ReCaptcha import ReCaptcha + +from module.network.Request import getURL +from module.plugins.Plugin import chunks + +def getInfo(urls): +    api_url_base = "http://api.hotfile.com/" +     +    for chunk in chunks(urls, 90): +        api_param_file = {"action":"checklinks","links": ",".join(chunk),"fields":"id,status,name,size"} #api only supports old style links +        src = getURL(api_url_base, post=api_param_file) +        result = [] +        for i, res in enumerate(src.split("\n")): +            if not res: +                continue +            fields = res.split(",") +             +            if fields[1] in ("1", "2"): +                status = 2 +            elif fields[1]: +                status = 1 +                 +            result.append((fields[2], int(fields[3]), status, chunk[i])) +        yield result + +class HotfileCom(Hoster): +    __name__ = "HotfileCom" +    __type__ = "hoster" +    __pattern__ = r"http://hotfile.com/dl/" +    __version__ = "0.3" +    __description__ = """Hotfile.com Download Hoster""" +    __author_name__ = ("sitacuisses","spoob","mkaay") +    __author_mail__ = ("sitacuisses@yhoo.de","spoob@pyload.org","mkaay@mkaay.de") + +    def setup(self): +        self.html = [None, None] +        self.wantReconnect = False +        self.multiDL = False +        self.htmlwithlink = None +        self.url = None +         +        if self.account: +            self.multiDL = True +            self.req.canContinue = True +     +    def apiCall(self, method, post, login=False): +        if not self.account and login: +            return +        elif self.account and login: +            return self.account.apiCall(method, post) +        post.update({"action": method}) +        return self.load("http://api.hotfile.com/", post=post) +         +    def process(self, pyfile): +        self.wantReconnect = False +         +        args = {"links":self.pyfile.url, "fields":"id,status,name,size,sha1"} +        resp = self.apiCall("checklinks", args) +        self.apiData = {} +        for k, v in zip(args["fields"].split(","), resp.strip().split(",")): +            self.apiData[k] = v +         +        if self.apiData["status"] == "0": +            self.offline() + +        pyfile.name = self.apiData["name"] +         +        if not self.account: +            self.downloadHTML() +                 +            self.setWait(self.getWaitTime()) +            self.wait() +             +            self.freeDownload() +        else: +            dl = self.account.apiCall("getdirectdownloadlink", {"link":self.pyfile.url}) +            self.download(dl) + +    def downloadHTML(self): +        self.html[0] = self.load(self.pyfile.url, get={"lang":"en"}, cookies=True) + +    def freeDownload(self): +         +        form_content = re.search(r"<form style=.*(\n<.*>\s*)*?\n<tr>", self.html[0]).group(0) +        form_posts = re.findall(r"<input\stype=hidden\sname=(\S*)\svalue=(\S*)>", form_content) +         +        self.html[1] = self.load(self.pyfile.url, post=form_posts, cookies=True) +         +        re_captcha = ReCaptcha(self) +         +        challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=([0-9A-Za-z]+)", self.html[1]) +         +        if challenge: +            challenge, result = re_captcha.challenge(challenge.group(1)) +             +            url = re.search(r'<form action="(/dl/[^"]+)', self.html[1] ) +                         +            self.html[1] = self.load("http://hotfile.com"+url.group(1), post={"action": "checkcaptcha", +                                             "recaptcha_challenge_field" : challenge, +                                             "recaptcha_response_field": result}) +             +            if "Wrong Code. Please try again." in self.html[1]: +                self.freeDownload() +                return +         +        file_url = re.search(r'a href="(http://hotfile\.com/get/\S*?)"', self.html[1]).group(1) +        self.download(file_url) +           +    def getWaitTime(self): +        free_limit_pattern = re.compile(r"timerend=d\.getTime\(\)\+(\d+);") +        matches = free_limit_pattern.findall(self.html[0]) +        if matches: +            for match in matches: +                if int(match) == 60000: +                    continue +                if int(match) == 0: +                    continue +                else: +                    self.wantReconnect = True +                    return int(match)/1000 + 65 +            return 65 diff --git a/core/module/plugins/hoster/MegauploadCom.py b/core/module/plugins/hoster/MegauploadCom.py new file mode 100644 index 000000000..a14c2c76f --- /dev/null +++ b/core/module/plugins/hoster/MegauploadCom.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re + +from module.plugins.Hoster import Hoster + +from module.network.Request import getURL + +def getInfo(urls): +    url = "http://megaupload.com/mgr_linkcheck.php" +     +    ids = [x.split("=")[-1] for x in urls] +     +    i = 0 +    post = {} +    for id in ids: +        post["id%i"%i] = id +        i += 1 +         +    api = getURL(url, {}, post) +    api = [x.split("&") for x in re.split(r"&?(?=id[\d]+=)", api)] +     +    result = [] +    i=0 +    for data in api: +        if data[0].startswith("id"): +            tmp = [x.split("=") for x in data] +            if tmp[2][1] == "3": +                status = 3 +            elif tmp[0][1] == "0": +                status = 2 +            elif tmp[0][1] == "1": +                status = 1 +            else: +                status = 3 +             +            name = tmp[3][1] +            size = tmp[1][1] +             +            result.append( (name, size, status, urls[i] ) ) +            i += 1 +     +    yield result + +class MegauploadCom(Hoster): +    __name__ = "MegauploadCom" +    __type__ = "hoster" +    __pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=[0-9A-Za-z]+" +    __version__ = "0.1" +    __description__ = """Megaupload.com Download Hoster""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def setup(self): +        self.html = [None, None] +        self.multiDL = False +         +    def process(self, pyfile): +        self.pyfile = pyfile +        self.download_html() +        if not self.file_exists(): +            self.offline() +             +        self.setWait(45) +        self.wait() +             +        pyfile.name = self.get_file_name() +        self.download(self.get_file_url()) + +    def download_html(self):         +        for i in range(5): +            self.html[0] = self.load(self.pyfile.url) +            try: +                url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1) +            except: +                continue + +            captcha = self.decryptCaptcha(url_captcha_html) +            captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) +            megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) +            self.html[1] = self.load(self.pyfile.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}) +            if re.search(r"Waiting time before each download begins", self.html[1]) != None: +                break + +    def get_file_url(self): +        file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="' +        search = re.search(file_url_pattern, self.html[1]) +        return search.group(1).replace(" ", "%20") + +    def get_file_name(self): +        file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="' +        return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1] + +    def file_exists(self): +        self.download_html() +        if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \ +            re.search(r"Download limit exceeded", self.html[0]): +            return False +        return True diff --git a/core/module/plugins/hoster/MegavideoCom.py b/core/module/plugins/hoster/MegavideoCom.py new file mode 100644 index 000000000..7ea045447 --- /dev/null +++ b/core/module/plugins/hoster/MegavideoCom.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time +from module.plugins.Hoster import Hoster +from module.unescape import unescape + +class MegavideoCom(Hoster): +    __name__ = "MegavideoCom" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?megavideo.com/\?v=.*" +    __version__ = "0.1" +    __description__ = """Megavideo.com Download Hoster""" +    __author_name__ = ("jeix","mkaay") +    __author_mail__ = ("jeix@hasnomail.de","mkaay@mkaay.de") +         +    def __init__(self, parent): +        Hoster.__init__(self, parent) +        self.parent = parent +        self.html = None +         +    def download_html(self): +        url = self.parent.url +        self.html = self.req.load(url) + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.html == None: +            self.download_html() + +        # get id +        id = re.search("previewplayer/\\?v=(.*?)&width", self.html).group(1) +         +        # check for hd link and return if there +        if "flashvars.hd = \"1\";" in self.html: +            content = self.req.load("http://www.megavideo.com/xml/videolink.php?v=%s" % id) +            return unescape(re.search("hd_url=\"(.*?)\"", content).group(1)) +             +        # else get normal link +        s = re.search("flashvars.s = \"(\\d+)\";", self.html).group(1) +        un = re.search("flashvars.un = \"(.*?)\";", self.html).group(1) +        k1 = re.search("flashvars.k1 = \"(\\d+)\";", self.html).group(1) +        k2 = re.search("flashvars.k2 = \"(\\d+)\";", self.html).group(1) +        return "http://www%s.megavideo.com/files/%s/" % (s, self.__decrypt(un, int(k1), int(k2))) +         +    def __decrypt(self, input, k1, k2): +        req1 = [] +        req3 = 0 +        for c in input: +            c = int(c, 16) +            tmp = "".join([str((c >> y) & 1) for y in range(4 -1, -1, -1)]) +            req1.extend([int(x) for x in tmp])             +         +        req6 = [] +        req3 = 0 +        while req3 < 384: +            k1 = (k1 * 11 + 77213) % 81371 +            k2 = (k2 * 17 + 92717) % 192811 +            req6.append((k1 + k2) % 128) +            req3 += 1 +             +        req3 = 256 +        while req3 >= 0: +            req5 = req6[req3] +            req4 = req3 % 128 +            req8 = req1[req5] +            req1[req5] = req1[req4] +            req1[req4] = req8 +            req3 -= 1 +             +        req3 = 0 +        while req3 < 128: +            req1[req3] = req1[req3] ^ (req6[req3+256] & 1) +            req3 += 1 +             +        out = "" +        req3 = 0 +        while req3 < len(req1): +            tmp = req1[req3] * 8 +            tmp += req1[req3+1] * 4 +            tmp += req1[req3+2] * 2 +            tmp += req1[req3+3] +             +            out += "%X" % tmp +             +            req3 += 4 +             +        return out.lower() +     +    def get_file_name(self): +        if self.html == None: +            self.download_html() +             +        name = re.search("flashvars.title = \"(.*?)\";", self.html).group(1) +        name = "%s.flv" % unescape(name.encode("ascii", "ignore")).decode("utf-8").encode("ascii", "ignore").replace("+", " ") +        return name + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html == None: +            self.download_html() +             +        if re.search(r"Dieses Video ist nicht verfÃŒgbar.", self.html) != None or \ +           re.search(r"This video is unavailable.", self.html) != None: +            return False +        else: +            return True +             diff --git a/core/module/plugins/hoster/MyvideoDe.py b/core/module/plugins/hoster/MyvideoDe.py new file mode 100644 index 000000000..f2d2082a7 --- /dev/null +++ b/core/module/plugins/hoster/MyvideoDe.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster +from module.unescape import unescape + +class MyvideoDe(Hoster): +    __name__ = "MyvideoDe" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?myvideo.de/watch/" +    __version__ = "0.9" +    __description__ = """Myvideo.de Video Download Hoster""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") +         +    def setup(self): +        self.html = None +         +    def process(self, pyfile): +        self.pyfile = pyfile +        self.download_html() +        pyfile.name = self.get_file_name() +        self.download(self.get_file_url()) + +    def download_html(self): +        self.html = self.load(self.pyfile.url) + +    def get_file_url(self): +        videoId = re.search(r"addVariable\('_videoid','(.*)'\);p.addParam\('quality'", self.html).group(1) +        videoServer = re.search("rel='image_src' href='(.*)thumbs/.*' />", self.html).group(1) +        file_url = videoServer + videoId + ".flv" +        return file_url + +    def get_file_name(self): +        file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" +        return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + +    def file_exists(self): +        self.download_html() +        self.load(str(self.pyfile.url), cookies=False, just_header=True) +        if self.req.lastEffectiveURL == "http://www.myvideo.de/": +            return False +        return True diff --git a/core/module/plugins/hoster/NetloadIn.py b/core/module/plugins/hoster/NetloadIn.py new file mode 100644 index 000000000..6f0cb9461 --- /dev/null +++ b/core/module/plugins/hoster/NetloadIn.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import sleep + + +from module.plugins.Hoster import Hoster +from module.network.Request import getURL +from module.plugins.Plugin import chunks + + + +def getInfo(urls): + ##  returns list of tupels (name, size (in bytes), status (see FileDatabase), url) + + +    apiurl = "http://api.netload.in/info.php?auth=Zf9SnQh9WiReEsb18akjvQGqT0I830e8&bz=1&md5=1&file_id=" +    id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)") +    urls_per_query = 80 +        +    for chunk in chunks(urls, urls_per_query): +        ids = "" +        for url in chunk: +            match = id_regex.search(url) +            if match: +                ids = ids + match.group(1) +";" + +        api = getURL(apiurl+ids) + +        if api == None or len(api) < 10: +            print "Netload prefetch: failed " +            return +        if api.find("unknown_auth") >= 0: +            print "Netload prefetch: Outdated auth code " +            return + +        result = [] + +        for i, r in enumerate(api.split()): +            try: +                tmp = r.split(";") +                try: +                    size = int(tmp[2]) +                except: +                    size = 0 +                result.append( (tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i] ) ) +            except: +                print "Netload prefetch: Error while processing response: " +                print r + +        yield result + +class NetloadIn(Hoster): +    __name__ = "NetloadIn" +    __type__ = "hoster" +    __pattern__ = r"http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)" +    __version__ = "0.2" +    __description__ = """Netload.in Download Hoster""" +    __config__ = [ ("dumpgen", "bool", "Generate debug page dumps on stdout", "False") ] +    __author_name__ = ("spoob", "RaNaN", "Gregy") +    __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz") + +    def setup(self): +        self.multiDL = False +        if self.account: +            self.multiDL = True +            self.req.canContinue = True +     +    def process(self, pyfile): +        self.url = pyfile.url +        self.prepare() +        self.pyfile.setStatus("downloading") +        self.proceed(self.url) + +    def prepare(self): +        self.download_api_data() + +        if self.api_data and self.api_data["filename"]: +            self.pyfile.name = self.api_data["filename"] + +        if self.account: +            self.log.debug("Netload: Use Premium Account") +            return True + +        if self.download_html(): +            return True +        else: +            self.fail("Failed") +            return False +             +    def download_api_data(self): +        url = self.url +        id_regex = re.compile("http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)") +        match = id_regex.search(url) +        if match: +            apiurl = "http://netload.in/share/fileinfos2.php" +            src = self.load(apiurl, cookies=False, get={"file_id": match.group(1)}) +            self.log.debug("Netload: APIDATA: "+src.strip()) +            self.api_data = {} +            if src == "unknown_server_data": +                self.api_data = False +            elif not src == "unknown file_data": +                 +                lines = src.split(";") +                self.api_data["exists"] = True +                self.api_data["fileid"] = lines[0] +                self.api_data["filename"] = lines[1] +                self.api_data["size"] = lines[2] #@TODO formatting? (ex: '2.07 KB') +                self.api_data["status"] = lines[3] +                if self.api_data["status"] == "online": +                    self.api_data["checksum"] = lines[4].strip() +                else: +                    self.offline(); +            else: +                self.api_data["exists"] = False +        else: +            self.api_data = False +            self.html[0] = self.load(self.url, cookies=False) + +    def final_wait(self, page): +        wait_time = self.get_wait_time(page) +        self.setWait(wait_time) +        self.log.debug(_("Netload: final wait %d seconds" % wait_time)) +        self.wait() +        self.url = self.get_file_url(page) + +    def download_html(self): +        self.log.debug("Netload: Entering download_html") +        page = self.load(self.url, cookies=True) +        captchawaited = False +        for i in range(10): +            self.log.debug(_("Netload: try number %d " % i)) +            if self.getConf('dumpgen'): +                print page + +            if re.search(r"(We will prepare your download..)", page) != None: +                self.log.debug("Netload: We will prepare your download") +                self.final_wait(page); +                return True +            if re.search(r"(We had a reqeust with the IP)", page) != None: +                wait = self.get_wait_time(page); +                if wait == 0: +                    self.log.debug("Netload: Wait was 0 setting 30") +                    wait = 30 +                self.log.info(_("Netload: waiting between downloads %d s." % wait)) +                self.wantReconnect = True +                self.setWait(wait) +                self.wait() + +                link = re.search(r"You can download now your next file. <a href=\"(index.php\?id=10&.*)\" class=\"Orange_Link\">Click here for the download</a>", page) +                if link != None: +                    self.log.debug("Netload: Using new link found on page") +                    page = self.load("http://netload.in/" + link.group(1).replace("amp;", "")) +                else: +                    self.log.debug("Netload: No new link found, using old one") +                    page = self.load(self.url, cookies=True) +                continue + +             +            self.log.debug("Netload: Trying to find captcha") + +            url_captcha_html = "http://netload.in/" + re.search('(index.php\?id=10&.*&captcha=1)', page).group(1).replace("amp;", "") +            page = self.load(url_captcha_html, cookies=True) + +            try: +                captcha_url = "http://netload.in/" + re.search('(share/includes/captcha.php\?t=\d*)', page).group(1) +            except: +                open("dump.html", "w").write(page) +                self.log.debug("Netload: Could not find captcha, try again from begining") +                continue + +            file_id = re.search('<input name="file_id" type="hidden" value="(.*)" />', page).group(1) +            if not captchawaited: +                wait = self.get_wait_time(page); +                self.log.info(_("Netload: waiting for captcha %d s." % wait)) +                self.setWait(wait) +                self.wait() +                captchawaited = True + +            captcha = self.decryptCaptcha(captcha_url) +            sleep(4) +            page = self.load("http://netload.in/index.php?id=10", post={"file_id": file_id, "captcha_check": captcha}, cookies=True) + +        return False +         + +    def get_file_url(self, page): +        try: +            file_url_pattern = r"<a class=\"Orange_Link\" href=\"(http://.+)\" >Click here" +            attempt = re.search(file_url_pattern, page) +            if attempt != None: +                return attempt.group(1) +            else: +                self.log.debug("Netload: Backup try for final link") +                file_url_pattern = r"<a href=\"(.+)\" class=\"Orange_Link\">Click here" +                attempt = re.search(file_url_pattern, page) +                return "http://netload.in/"+attempt.group(1); +        except: +            self.log.debug("Netload: Getting final link failed") +            return None + +    def get_wait_time(self, page): +        wait_seconds = int(re.search(r"countdown\((.+),'change\(\)'\)", page).group(1)) / 100 +        return wait_seconds +         + +    def proceed(self, url): +        self.log.debug("Netload: Downloading..") + +        self.download(url, cookies=True) + diff --git a/core/module/plugins/hoster/PornhostCom.py b/core/module/plugins/hoster/PornhostCom.py new file mode 100644 index 000000000..5dd681b5b --- /dev/null +++ b/core/module/plugins/hoster/PornhostCom.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.plugins.Hoster import Hoster
 +
 +class PornhostCom(Hoster):
 +    __name__ = "PornhostCom"
 +    __type__ = "hoster"
 +    __pattern__ = r'http://[\w\.]*?pornhost\.com/([0-9]+/[0-9]+\.html|[0-9]+)'
 +    __version__ = "0.2"
 +    __description__ = """Pornhost.com Download Hoster"""
 +    __author_name__ = ("jeix")
 +    __author_mail__ = ("jeix@hasnomail.de")
 +        
 +    def process(self, pyfile):
 +        self.download_html()
 +        if not self.file_exists():
 +            offline()
 +            
 +        pyfile.name = self.get_file_name()
 +        self.download(self.get_file_url())
 +        
 +
 +    ###   old interface
 +    def download_html(self):
 +        url = self.pyfile.url
 +        self.html = self.load(url)
 +
 +    def get_file_url(self):
 +        """ returns the absolute downloadable filepath
 +        """
 +        if self.html == None:
 +            self.download_html()
 +
 +        file_url = re.search(r'download this file</label>.*?<a href="(.*?)"', self.html)
 +        if not file_url: 
 +            file_url = re.search(r'"(http://dl[0-9]+\.pornhost\.com/files/.*?/.*?/.*?/.*?/.*?/.*?\..*?)"', self.html)
 +            if not file_url:
 +                file_url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)
 +                if not file_url:
 +                    file_url = re.search(r'"http://file[0-9]+\.pornhost\.com/[0-9]+/.*?"', self.html) # TODO: fix this one since it doesn't match
 +
 +        file_url = file_url.group(1).strip()
 +                    
 +        return file_url
 +    
 +    def get_file_name(self):
 +        if self.html == None:
 +            self.download_html()
 +            
 +        name = re.search(r'<title>pornhost\.com - free file hosting with a twist - gallery(.*?)</title>', self.html)
 +        if not name:
 +            name = re.search(r'id="url" value="http://www\.pornhost\.com/(.*?)/"', self.html)
 +            if not name:
 +                name = re.search(r'<title>pornhost\.com - free file hosting with a twist -(.*?)</title>', self.html)
 +                if not name:
 +                    name = re.search(r'"http://file[0-9]+\.pornhost\.com/.*?/(.*?)"', self.html)
 +       
 +        name = name.group(1).strip() + ".flv"
 +        
 +        return name
 +
 +    def file_exists(self):
 +        """ returns True or False
 +        """
 +        if self.html == None:
 +            self.download_html()
 +        
 +        if re.search(r'gallery not found', self.html) != None \
 +        or re.search(r'You will be redirected to', self.html) != None:
 +            return False
 +        else:
 +            return True
 +            
 +            
 diff --git a/core/module/plugins/hoster/PornhubCom.py b/core/module/plugins/hoster/PornhubCom.py new file mode 100644 index 000000000..ea7e1423c --- /dev/null +++ b/core/module/plugins/hoster/PornhubCom.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.plugins.Hoster import Hoster
 +
 +class PornhubCom(Hoster):
 +    __name__ = "PornhubCom"
 +    __type__ = "hoster"
 +    __pattern__ = r'http://[\w\.]*?pornhub\.com/view_video\.php\?viewkey=[\w\d]+'
 +    __version__ = "0.2"
 +    __description__ = """Pornhub.com Download Hoster"""
 +    __author_name__ = ("jeix")
 +    __author_mail__ = ("jeix@hasnomail.de")
 +        
 +    def process(self, pyfile):
 +        self.download_html()
 +        if not self.file_exists():
 +            offline()
 +            
 +        pyfile.name = self.get_file_name()
 +        self.download(self.get_file_url())
 +        
 +    def download_html(self):
 +        url = self.pyfile.url
 +        self.html = self.load(url)
 +
 +    def get_file_url(self):
 +        """ returns the absolute downloadable filepath
 +        """
 +        if self.html == None:
 +            self.download_html()
 +
 +        url = "http://www.pornhub.com//gateway.php"
 +        video_id = self.pyfile.url.split('=')[-1]
 +        # thanks to jD team for this one  v
 +        post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00"
 +        post_data += chr(len(video_id))
 +        post_data += video_id
 +        post_data += "\x02\x00\x02\x2d\x31\x02\x00\x20"
 +        post_data += "add299463d4410c6d1b1c418868225f7"
 +        
 +        content = self.req.load(url, post=str(post_data), no_post_encode=True)
 +        file_url = re.search(r'flv_url.*(http.*?)\?r=.*', content).group(1)
 +
 +        return file_url
 +    
 +    def get_file_name(self):
 +        if self.html == None:
 +            self.download_html()
 +            
 +        name = re.findall('<h1>(.*?)</h1>', self.html)[1] + ".flv"
 +        
 +        return name
 +
 +    def file_exists(self):
 +        """ returns True or False
 +        """
 +        if self.html == None:
 +            self.download_html()
 +        
 +        if re.search(r'This video is no longer in our database or is in conversion', self.html) != None:
 +            return False
 +        else:
 +            return True
 diff --git a/core/module/plugins/hoster/RapidshareCom.py b/core/module/plugins/hoster/RapidshareCom.py new file mode 100644 index 000000000..fa5f053de --- /dev/null +++ b/core/module/plugins/hoster/RapidshareCom.py @@ -0,0 +1,188 @@ + +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time + +from module.network.Request import getURL +from module.plugins.Hoster import Hoster +import hashlib + +def getInfo(urls): +     +    ids = "" +    names = "" +     +    for url in urls: +        tmp = url.split("/") +        ids+= ","+tmp[-2] +        names+= ","+tmp[-1] +     +    url = "http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files=%s&filenames=%s" % (ids[1:], names[1:]) +     +     +    api = getURL(url) +    result = [] +    i = 0 +    for res in api.split(): +        tmp = res.split(",") +        if tmp[4] in ("0", "4", "5"): status = 1 +        elif tmp[4] == "1": status = 2 +        else: status = 3 +         +        result.append( (tmp[1], tmp[2], status, urls[i]) )  +        i += 1 +         +    yield result + +class RapidshareCom(Hoster): +    __name__ = "RapidshareCom" +    __type__ = "hoster" +    __pattern__ = r"http://[\w\.]*?rapidshare.com/files/(\d*?)/(.*)" +    __version__ = "1.1" +    __description__ = """Rapidshare.com Download Hoster""" +    __config__ = [ ("server", "str", "Preferred Server", "None") ]  +    __author_name__ = ("spoob", "RaNaN", "mkaay") +    __author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "mkaay@mkaay.de") + +    def setup(self): +        self.html = [None, None] +        self.no_slots = True +        self.api_data = None +        self.multiDL = False +        if self.account: +            self.multiDL = True +            self.req.canContinue = True + +    def process(self, pyfile): +        self.url = self.pyfile.url         +        self.prepare() +        self.proceed(self.url) +          +    def prepare(self): +        # self.no_slots = True +        # self.want_reconnect = False + +        self.download_api_data() +        if self.api_data["status"] == "1": +            self.pyfile.name = self.get_file_name() + +            if self.account: +                info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) +                self.log.debug(_("%s: Use Premium Account (%sGB left)") % (self.__name__, info["trafficleft"]/1000/1000)) +                if self.api_data["size"] / 1024 > info["trafficleft"]: +                    self.log.info(_("%s: Not enough traffic left" % self.__name__)) +                    self.resetAcount() +                else: +                    self.url = self.api_data["mirror"] +                    return True + +            self.download_html() +            while self.no_slots: +                self.setWait(self.get_wait_time()) +                self.wait() +                # self.pyfile.status.waituntil = self.time_plus_wait +                # self.pyfile.status.want_reconnect = self.want_reconnect +                # thread.wait(self.pyfile) + +            self.url = self.get_file_url() + +            return True +        elif self.api_data["status"] == "2": +            self.log.info(_("Rapidshare: Traffic Share (direct download)")) +            self.pyfile.name = self.get_file_name() +            # self.pyfile.status.url = self.parent.url +            return True +        else: +            self.fail("Unknown response code.") +             +    def download_api_data(self, force=False): +        """ +        http://images.rapidshare.com/apidoc.txt +        """ +        if self.api_data and not force: +            return +        api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" +        api_param_file = {"sub": "checkfiles_v1", "files": "", "filenames": "", "incmd5": "1"} +        m = re.compile(self.__pattern__).search(self.url) +        if m: +            api_param_file["files"] = m.group(1) +            api_param_file["filenames"] = m.group(2) +            src = self.load(api_url_base, cookies=False, get=api_param_file) +            if src.startswith("ERROR"): +                return +            fields = src.split(",") +            self.api_data = {} +            self.api_data["fileid"] = fields[0] +            self.api_data["filename"] = fields[1] +            self.api_data["size"] = int(fields[2]) # in bytes +            self.api_data["serverid"] = fields[3] +            self.api_data["status"] = fields[4] +            """ +            status codes: +                0=File not found +                1=File OK (Downloading possible without any logging) +                2=File OK (TrafficShare direct download without any logging) +                3=Server down +                4=File marked as illegal +                5=Anonymous file locked, because it has more than 10 downloads already +                6=File OK (TrafficShare direct download with enabled logging) +            """ +            self.api_data["shorthost"] = fields[5] +            self.api_data["checksum"] = fields[6].strip().lower() # md5 +             +            self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + +    def download_html(self): +        """ gets the url from self.parent.url saves html in self.html and parses +        """ +        self.html[0] = self.load(self.url, cookies=False) +         +    def get_wait_time(self): +        """downloads html with the important informations +        """ +        file_server_url = re.search(r"<form action=\"(.*?)\"", self.html[0]).group(1) +        self.html[1] = self.load(file_server_url, cookies=False, post={"dl.start": "Free"}) +         +        if re.search(r"is already downloading", self.html[1]): +            self.log.info(_("Rapidshare: Already downloading, wait 30 minutes")) +            return 30 * 60 +        self.no_slots = False +        try: +            wait_minutes = re.search(r"Or try again in about (\d+) minute", self.html[1]).group(1) +            self.no_slots = True +            self.wantReconnect = True +            return 60 * int(wait_minutes) + 60 +        except: +            if re.search(r"(Currently a lot of users|no more download slots|servers are overloaded)", self.html[1], re.I) != None: +                self.log.info(_("Rapidshare: No free slots!")) +                self.no_slots = True +                return time() + 130 +            self.no_slots = False +            wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1) +            return int(wait_seconds) + 5 + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.getConf('server') == "None": +            file_url_pattern = r".*name=\"dlf\" action=\"(.*)\" method=.*" +        else: +            file_url_pattern = '(http://rs.*)\';" /> %s<br />' % getConf('server') + +        return re.search(file_url_pattern, self.html[1]).group(1) + +    def get_file_name(self): +        if self.api_data["filename"]: +            return self.api_data["filename"] +        elif self.html[0]: +            file_name_pattern = r"<p class=\"downloadlink\">.+/(.+) <font" +            file_name_search = re.search(file_name_pattern, self.html[0]) +            if file_name_search: +                return file_name_search.group(1) +        return self.url.split("/")[-1] + +    def proceed(self, url): +        self.download(url, get={"directstart":1}, cookies=True) + diff --git a/core/module/plugins/hoster/RedtubeCom.py b/core/module/plugins/hoster/RedtubeCom.py new file mode 100644 index 000000000..6a9baffbe --- /dev/null +++ b/core/module/plugins/hoster/RedtubeCom.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.plugins.Hoster import Hoster
 +from module.unescape import unescape
 +
 +class RedtubeCom(Hoster):
 +    __name__ = "RedtubeCom"
 +    __type__ = "hoster"
 +    __pattern__ = r'http://[\w\.]*?redtube\.com/\d+'
 +    __version__ = "0.2"
 +    __description__ = """Redtube.com Download Hoster"""
 +    __author_name__ = ("jeix")
 +    __author_mail__ = ("jeix@hasnomail.de")
 +        
 +    def process(self, pyfile):
 +        self.download_html()
 +        if not self.file_exists():
 +            offline()
 +            
 +        pyfile.name = self.get_file_name()
 +        self.download(self.get_file_url())
 +        
 +    def download_html(self):
 +        url = self.pyfile.url
 +        self.html = self.load(url)
 +
 +    def get_file_url(self):
 +        """ returns the absolute downloadable filepath
 +        """
 +        if self.html == None:
 +            self.download_html()
 +
 +        file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1))
 +
 +        return file_url
 +    
 +    def get_file_name(self):
 +        if self.html == None:
 +            self.download_html()
 +            
 +        name = re.search('<title>(.*?)- RedTube - Free Porn Videos</title>', self.html).group(1).strip() + ".flv"        
 +        return name
 +
 +    def file_exists(self):
 +        """ returns True or False
 +        """
 +        if self.html == None:
 +            self.download_html()
 +        
 +        if re.search(r'This video has been removed.', self.html) != None:
 +            return False
 +        else:
 +            return True
 +            
 diff --git a/core/module/plugins/hoster/ShareCx.py b/core/module/plugins/hoster/ShareCx.py new file mode 100644 index 000000000..e64459754 --- /dev/null +++ b/core/module/plugins/hoster/ShareCx.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python
 +# -*- coding: utf-8 -*-
 +
 +import re
 +from module.plugins.Hoster import Hoster
 +from module.plugins.Plugin import chunks
 +from module.network.Request import getURL
 +#from module.BeautifulSoup import BeautifulSoup
 +
 +def getInfo(urls):
 +    api_url = "http://www.share.cx/uapi?do=check&links="
 +    
 +    for chunk in chunks(urls, 90):
 +        get = ""
 +        for url in chunk:
 +            get += ";"+url
 +            
 +        api = getURL(api_url+get[1:])
 +        result = []
 +        
 +        for i, link in enumerate(api.split()):
 +            url,name,size = link.split(";")
 +            if name and size:
 +                status = 2
 +            else:
 +                status = 1
 +                
 +            if not name: name = chunk[i]
 +            if not size: size = 0
 +                
 +            result.append( (name, size, status, chunk[i]) )
 +        
 +        yield result
 +
 +class ShareCx(Hoster):
 +    __name__ = "ShareCx"
 +    __type__ = "hoster"
 +    __pattern__ = r"http://[\w\.]*?share\.cx/(files|videos)/\d+"
 +    __version__ = "0.1"
 +    __description__ = """Share.cx Download Hoster"""
 +    __author_name__ = ("jeix")
 +    __author_mail__ = ("jeix@hasnomail.de")
 +        
 +        
 +    def setup(self):
 +        self.multiDL = False
 +        
 +        
 +    def process(self, pyfile):
 +        self.pyfile = pyfile
 +        self.download_html()
 +        if not self.file_exists():
 +            offline()
 +            
 +        pyfile.name = self.get_file_name()
 +        self.doDownload()
 +        
 +        
 +    def download_html(self):
 +        self.html = self.load(self.pyfile.url)
 +
 +    def doDownload(self):
 +        """ returns the absolute downloadable filepath
 +        """
 +        if self.html == None:
 +            self.download_html()
 +
 +        op          = re.search(r'name="op" value="(.*?)"', self.html).group(1)
 +        usr_login   = re.search(r'name="usr_login" value="(.*?)"', self.html).group(1)
 +        id          = re.search(r'name="id" value="(.*?)"', self.html).group(1)
 +        fname       = re.search(r'name="fname" value="(.*?)"', self.html).group(1)
 +        referer     = re.search(r'name="referer" value="(.*?)"', self.html).group(1)
 +        method_free = "Datei+herunterladen"
 +        
 +        self.html   = self.load(self.pyfile.url, post={
 +                "op" : op,
 +                "usr_login" : usr_login,
 +                "id" : id,
 +                "fname" : fname,
 +                "referer" : referer,
 +                "method_free" : method_free
 +            })
 +            
 +            
 +        m = re.search(r'startTimer\((\d+)\)', self.html)
 +        if m != None:
 +            wait_time = int(m.group(1))
 +            self.setWait(wait_time)
 +            self.wantReconnect = True
 +            self.log.debug("%s: IP blocked wait %d seconds." % (self.__name__, wait_time))
 +            self.wait()
 +            
 +        m = re.search(r'countdown">.*?(\d+).*?</span>', self.html)
 +        if m == None:
 +            m = re.search(r'id="countdown_str".*?<span id=".*?">.*?(\d+).*?</span', self.html)
 +        if m != None:
 +            wait_time = int(m.group(1))
 +            self.setWait(wait_time)
 +            self.wantReconnect = False
 +            self.log.debug("%s: Waiting %d seconds." % (self.__name__, wait_time))
 +            self.wait()
 +
 +        
 +        op = re.search(r'name="op" value="(.*?)"', self.html).group(1)
 +        id = re.search(r'name="id" value="(.*?)"', self.html).group(1)
 +        rand = re.search(r'name="rand" value="(.*?)"', self.html).group(1)
 +        referer = re.search(r'name="referer" value="(.*?)"', self.html).group(1)
 +        method_free = re.search(r'name="method_free" value="(.*?)"', self.html).group(1)
 +        method_premium = re.search(r'name="method_premium" value="(.*?)"', self.html).group(1)
 +        down_script = re.search(r'name="down_script" value="(.*?)"', self.html).group(1)
 +
 +        data = {
 +            "op" : op,
 +            "id" : id,
 +            "rand" : rand,
 +            "referer" : referer,
 +            "method_free" : method_free,
 +            "method_premium" : method_premium,
 +            "down_script" : down_script
 +        }
 +        
 +        if '/captchas/' in self.html:
 +            captcha_url = re.search(r'(http://(?:[\w\d]+\.)?.*?/captchas/.*?)').group(1)
 +            captcha = self.decryptCaptcha(captcha_url)
 +            data["code"] = captcha
 +            
 +
 +        self.download(self.pyfile.url, post=data)
 +
 +        # soup = BeautifulSoup(html)
 +        # form = soup.find("form")
 +        # postfields = {}
 +        # for input in form,findall("input"):
 +           # postfields[input["name"]] = input["value"]
 +        # postfields["method_free"] = "Datei herunterladen"
 +    
 +    def get_file_name(self):
 +        if self.html == None:
 +            self.download_html()
 +            
 +        name = re.search(r'alt="Download" /></span>(.*?)</h3>', self.html).group(1)
 +        return name
 +
 +    def file_exists(self):
 +        """ returns True or False
 +        """
 +        if self.html == None:
 +            self.download_html()
 +        
 +        if re.search(r'File not found<br>It was deleted due to inactivity or abuse request', self.html) != None:
 +            return False
 +
 +        return True
 +            
 +            
 diff --git a/core/module/plugins/hoster/ShareonlineBiz.py b/core/module/plugins/hoster/ShareonlineBiz.py new file mode 100644 index 000000000..bc1951602 --- /dev/null +++ b/core/module/plugins/hoster/ShareonlineBiz.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import os.path +import re +import tempfile +from time import time +from base64 import b64decode +import hashlib +import random +from time import sleep + +from module.plugins.Hoster import Hoster +from module.network.Request import getURL +from module.plugins.Plugin import chunks + +     +def getInfo(urls): +    api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php" +     +    for chunk in chunks(urls, 90): +        api_param_file = {"links": "\n".join(x.replace("http://www.share-online.biz/dl/","") for x in chunk)} #api only supports old style links +        src = getURL(api_url_base, post=api_param_file) +        result = [] +        for i, res in enumerate(src.split("\n")): +            if not res: +                continue +            fields = res.split(";") +             +            if fields[1] == "OK": +                status = 2 +            elif fields[1] in ("DELETED", "NOT FOUND"): +                status = 1 +            else: +                status = 3 +                 +            result.append((fields[2], int(fields[3]), status, chunk[i])) +        yield result + +class ShareonlineBiz(Hoster): +    __name__ = "ShareonlineBiz" +    __type__ = "hoster" +    __pattern__ = r"(?:http://)?(?:www.)?share-online.biz/(download.php\?id=|dl/)" +    __version__ = "0.2" +    __description__ = """Shareonline.biz Download Hoster""" +    __author_name__ = ("spoob", "mkaay") +    __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de") + +    def setup(self): +        #self.req.canContinue = self.multiDL = True if self.account else False +        # range request not working? +        self.multiDL = True if self.account else False + +    def process(self, pyfile): +        self.convertURL() +        self.downloadAPIData() +        pyfile.name = self.api_data["filename"] +        pyfile.sync() +         +        self.downloadHTML() +         +        self.download(self.getFileUrl(), cookies=True) + +    def downloadAPIData(self): +        api_url_base = "http://www.share-online.biz/linkcheck/linkcheck.php?md5=1" +        api_param_file = {"links": self.pyfile.url.replace("http://www.share-online.biz/dl/","")} #api only supports old style links +        src = self.load(api_url_base, cookies=False, post=api_param_file) +         +        fields = src.split(";") +        self.api_data = {} +        self.api_data["fileid"] = fields[0] +        self.api_data["status"] = fields[1] +        if not self.api_data["status"] == "OK": +            self.offline() +        self.api_data["filename"] = fields[2] +        self.api_data["size"] = fields[3] # in bytes +        self.api_data["checksum"] = fields[4].strip().lower().replace("\n\n", "") # md5 + +    def downloadHTML(self): +        self.html = self.load(self.pyfile.url, cookies=True) +         +        if not self.account: +            html = self.load("%s/free/" % self.pyfile.url, post={"dl_free":"1"}, cookies=True) +            if re.search(r"/failure/full/1", self.req.lastEffectiveURL): +                self.setWait(120) +                self.log.debug("%s: no free slots, waiting 120 seconds" % (self.__name__)) +                self.wait() +                self.retry() +            captcha = self.decryptCaptcha("http://www.share-online.biz/captcha.php", get={"rand":"0.%s" % random.randint(10**15,10**16)}, cookies=True) +                 +            self.log.debug("%s Captcha: %s" % (self.__name__, captcha)) +            sleep(3) +             +            html = self.load(self.pyfile.url, post={"captchacode": captcha}, cookies=True) +            if re.search(r"Der Download ist Ihnen zu langsam", html): +                #m = re.search("var timeout='(\d+)';", self.html[1]) +                #self.waitUntil = time() + int(m.group(1)) if m else 30 +                return True + +            self.retry() +        else: +            return True +     +    def convertURL(self): +        self.pyfile.url = self.pyfile.url.replace("http://www.share-online.biz/download.php?id=", "http://www.share-online.biz/dl/") +     +    def getFileUrl(self): +        """ returns the absolute downloadable filepath +        """ +        if self.account: +            return b64decode(re.search('var dl="(.*?)"', self.html).group(1)) +        file_url_pattern = 'loadfilelink\.decode\("([^"]+)' +        return b64decode(re.search(file_url_pattern, self.html).group(1)) + +    def checksum(self, local_file): +        if self.api_data and self.api_data["checksum"]: +            h = hashlib.md5() +            f = open(local_file, "rb") +            h.update(f.read()) +            f.close() +            hexd = h.hexdigest() +            if hexd == self.api_data["checksum"]: +                return (True, 0) +            else: +                return (False, 1) +        else: +            return (True, 5) diff --git a/core/module/plugins/hoster/ShragleCom.py b/core/module/plugins/hoster/ShragleCom.py new file mode 100644 index 000000000..e634607b0 --- /dev/null +++ b/core/module/plugins/hoster/ShragleCom.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.Hoster import Hoster + +class ShragleCom(Hoster): +    __name__ = "ShragleCom" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www.)?shragle.com/files/" +    __version__ = "0.1" +    __description__ = """Shragle Download PLugin""" +    __author_name__ = ("RaNaN") +    __author_mail__ = ("RaNaN@pyload.org") + +    def __init__(self, parent): +        Hoster.__init__(self, parent) +        self.parent = parent +        self.html = None +        self.multi_dl = False + +    def set_parent_status(self): +        """ sets all available Statusinfos about a File in self.parent.status +        """ +        if self.html == None: +            self.download_html() +        self.parent.status.filename = self.get_file_name() +        self.parent.status.url = self.get_file_url() +        self.parent.status.wait = self.wait_until() + +    def download_html(self): +        url = self.parent.url +        self.html = self.load(url) +        self.time_plus_wait = time.time() + 10 + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.html == None: +            self.download_html() + +        self.fileID = re.search(r"name=\"fileID\" value=\"([^\"]+)", self.html).group(1) +        self.dlSession = re.search(r"name=\"dlSession\" value=\"([^\"]+)", self.html).group(1) +        self.userID = "" +        self.password = "" +        self.lang = "de" +        return "http://srv4.shragle.com/download.php" + +    def get_file_name(self): +        if self.html == None: +            self.download_html() + +        file_name_pattern = r"<\/div><h2>(.+)<\/h2" +        return re.search(file_name_pattern, self.html).group(1) + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html == None: +            self.download_html() + +        if re.search(r"html", self.html) == None: +            return False +        else: +            return True + +    def proceed(self, url, location): +        self.download(url, location, {'fileID': self.fileID, 'dlSession': self.dlSession, 'userID': self.userID, 'password': self.password, 'lang': self.lang}) diff --git a/core/module/plugins/hoster/StorageTo.py b/core/module/plugins/hoster/StorageTo.py new file mode 100644 index 000000000..f0660b40d --- /dev/null +++ b/core/module/plugins/hoster/StorageTo.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from time import time + +from module.plugins.Hoster import Hoster + +class StorageTo(Hoster): +    __name__ = "StorageTo" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www)?\.storage\.to/get/.*" +    __version__ = "0.2" +    __description__ = """Storage.to Download Hoster""" +    __author_name__ = ("mkaay") + +    def setup(self): +        self.wantReconnect = False +        self.api_data = None +        self.html = None +        self.multiDL = False +         +    def process(self, pyfile): +        self.pyfile = pyfile +        self.prepare() +        self.download( self.get_file_url() ) +         +         +         + +    def prepare(self): +        pyfile = self.pyfile +         +        self.req.clear_cookies() + +        self.wantReconnect = False + +        if not self.file_exists(): +            self.offline() + +        pyfile.name = self.get_file_name() +         +        self.setWait( self.get_wait_time() ) + +        while self.wantReconnect: +            self.wait() +            self.download_api_data() +            self.setWait(  self.get_wait_time() ) +         +        return True +     +    def download_html(self): +        url = self.parent.url +        self.html = self.load(url, cookies=True) + +    def download_api_data(self): +        url = self.parent.url +        info_url = url.replace("/get/", "/getlink/") +        src = self.load(info_url, cookies=True) +        pattern = re.compile(r"'(\w+)' : (.*?)[,|\}]") +        self.api_data = {} +        for pair in pattern.findall(src): +            self.api_data[pair[0]] = pair[1].strip("'") +        print self.api_data + +    def get_wait_time(self): +        if not self.api_data: +            self.download_api_data() +        if self.api_data["state"] == "wait": +            self.wantReconnect = True +        else: +            self.wantReconnect = False +             +        return int(self.api_data["countdown"]) + 3 +             +             + +    def file_exists(self): +        """ returns True or False +        """ +        if not self.api_data: +            self.download_api_data() +        if self.api_data["state"] == "failed": +            return False +        else: +            return True + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if not self.api_data: +            self.download_api_data() +        return self.api_data["link"] + +    def get_file_name(self): +        if not self.html: +            self.download_html() +        file_name_pattern = r"<span class=\"orange\">Downloading:</span>(.*?)<span class=\"light\">(.*?)</span>" +        return re.search(file_name_pattern, self.html).group(1).strip() diff --git a/core/module/plugins/hoster/UploadedTo.py b/core/module/plugins/hoster/UploadedTo.py new file mode 100644 index 000000000..b6bd872f1 --- /dev/null +++ b/core/module/plugins/hoster/UploadedTo.py @@ -0,0 +1,151 @@ +# -*- coding: utf-8 -*- + +import re +from time import time +from module.plugins.Hoster import Hoster +from module.network.Request import getURL +import hashlib + +def getInfo(urls): +    for url in urls: +        match = re.compile(UploadedTo.__pattern__).search(url) +        if match: +            src = getURL("http://uploaded.to/api/file", get={"id": match.group(1).split("/")[0]}) +            if src.find("404 Not Found") >= 0: +                result.append((url, 0, 1, url)) +                continue +            lines = src.splitlines() +            result.append((lines[0], int(lines[1]), 2, url)) + +class UploadedTo(Hoster): +    __name__ = "UploadedTo" +    __type__ = "hoster" +    __pattern__ = r"http://(?:www\.)?u(?:p)?l(?:oaded)?\.to/(?:file/|\?id=)?(.+)" +    __version__ = "0.4" +    __description__ = """Uploaded.to Download Hoster""" +    __author_name__ = ("spoob", "mkaay") +    __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de") + +     +    def setup(self): +        self.html = None +        self.api_data = None +        self.multiDL = False +        if self.account: +            self.multiDL = True +            self.req.canContinue = True +         +    def process(self, pyfile): +        self.url = False +        self.pyfile = pyfile +        self.prepare() +        self.proceed() +                 +     +    def getInfo(self): +        self.download_api_data() +        self.pyfile.name = self.api_data["filename"] +        self.pyfile.sync() + +    def prepare(self):         +        tries = 0 + +        while not self.url: +            self.download_html() + +            if not self.file_exists(): +                self.offline() +                 +            self.download_api_data() +             +            # self.pyfile.name = self.get_file_name() +             +            if self.account: +                info = self.account.getAccountInfo(self.account.getAccountData(self)[0]) +                self.log.debug(_("%s: Use Premium Account (%sGB left)") % (self.__name__, info["trafficleft"]/1024/1024)) +                if self.api_data["size"]/1024 > info["trafficleft"]: +                    self.log.info(_("%s: Not enough traffic left" % self.__name__)) +                    self.resetAcount() +                else: +                    self.url = self.get_file_url() +                    self.pyfile.name = self.get_file_name() +                    return True +                 +            self.url = self.get_file_url() +             +            self.setWait(self.get_waiting_time()) +            self.wait() + +            self.pyfile.name = self.get_file_name() + +            tries += 1 +            if tries > 5: +                self.fail("Error while preparing DL") +        return True +         +    def download_api_data(self, force=False): +        if self.api_data and not force: +            return +        match = re.compile(self.__pattern__).search(self.pyfile.url) +        if match: +            src = self.load("http://uploaded.to/api/file", cookies=False, get={"id": match.group(1).split("/")[0]}) +            if not src.find("404 Not Found"): +                return +            self.api_data = {} +            lines = src.splitlines() +            self.api_data["filename"] = lines[0] +            self.api_data["size"] = int(lines[1]) # in bytes +            self.api_data["checksum"] = lines[2] #sha1 + +    def download_html(self): +        self.html = self.load(self.pyfile.url, cookies=False) + +    def get_waiting_time(self): +        try: +            wait_minutes = re.search(r"Or wait ([\d\-]+) minutes", self.html).group(1) +            if int(wait_minutes) < 0: wait_minutes = 1             +            self.wantReconnect = True +            return 60 * int(wait_minutes) +        except: +            return 0 + +    def get_file_url(self): +        if self.account: +            self.start_dl = True +            return self.cleanUrl(self.pyfile.url) +        try: +            file_url_pattern = r".*<form name=\"download_form\" method=\"post\" action=\"(.*)\">" +            return re.search(file_url_pattern, self.html).group(1) +        except: +            return None + +    def get_file_name(self): +        try: +            if self.api_data and self.api_data["filename"]: +                return self.api_data["filename"] +            file_name = re.search(r"<td><b>\s+(.+)\s", self.html).group(1) +            file_suffix = re.search(r"</td><td>(\..+)</td></tr>", self.html) +            if not file_suffix: +                return file_name +            return file_name + file_suffix.group(1) +        except: +            return self.pyfile.url.split('/')[-1] + +    def file_exists(self): +        if re.search(r"(File doesn't exist)", self.html) != None: +            return False +        else: +            return True +     +    def cleanUrl(self, url): +        url = url.replace("ul.to/", "uploaded.to/file/") +        url = url.replace("/?id=", "/file/") +        url = url.replace("?id=", "file/") +        url = re.sub("/\?(.*?)&id=", "/file/", url, 1) +        return url +     +    def proceed(self): +        if self.account: +            self.download(self.url+"?redirect", cookies=True) +        else: +            self.download(self.url, cookies=False, post={"download_submit": "Free Download"}) diff --git a/core/module/plugins/hoster/Xdcc.py b/core/module/plugins/hoster/Xdcc.py new file mode 100644 index 000000000..52ece4ca4 --- /dev/null +++ b/core/module/plugins/hoster/Xdcc.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*-
 +
 +"""
 +    This program is free software; you can redistribute it and/or modify
 +    it under the terms of the GNU General Public License as published by
 +    the Free Software Foundation; either version 3 of the License,
 +    or (at your option) any later version.
 +
 +    This program is distributed in the hope that it will be useful,
 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +    See the GNU General Public License for more details.
 +
 +    You should have received a copy of the GNU General Public License
 +    along with this program; if not, see <http://www.gnu.org/licenses/>.
 +    
 +    @author: jeix
 +"""
 +
 +import logging
 +from os.path import exists
 +from os.path import join
 +from os.path import exists
 +from os import makedirs
 +import re
 +import sys
 +
 +from module.plugins.Hoster import Hoster
 +
 +
 +class Xdcc(Hoster):
 +    __name__ = "Xdcc"
 +    __version__ = "0.2"
 +    __pattern__ = r'xdcc://.*?(/#?.*?)?/.*?/#?\d+/?' # xdcc://irc.Abjects.net/#channel/[XDCC]|Shit/#0004/
 +    __type__ = "hoster"
 +    __config__ = [
 +                    ("nick", "str", "Nickname", "pyload"),
 +                    ("ident", "str", "Ident", "pyloadident"),
 +                    ("realname", "str", "Realname", "pyloadreal")
 +                 ]
 +    __description__ = """A Plugin that allows you to download from an IRC XDCC bot"""
 +    __author_name__ = ("jeix")
 +    __author_mail__ = ("jeix@hasnomail.com")
 +    
 +    def process(self, pyfile):
 +        self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="XDCC")        
 +        self.doDownload(pyfile.url)
 +
 +    def doDownload(self, url):
 +        self.pyfile.setStatus("downloading")
 +
 +        download_folder = self.config['general']['download_folder']
 +        location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding()))
 +        if not exists(location): 
 +            makedirs(location)
 +            
 +        m = re.search(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)
 +        server = m.group(1)
 +        chan   = m.group(2)
 +        bot    = m.group(3)
 +        pack   = m.group(4)
 +        nick   = self.getConf('nick')
 +        ident  = self.getConf('ident')
 +        real   = self.getConf('realname')
 +        
 +        newname = self.req.download(bot, pack, location, nick, ident, real, chan, server)
 +        self.pyfile.size = self.req.dl_size
 +
 +        if newname:
 +            self.pyfile.name = newname
 +        
\ No newline at end of file diff --git a/core/module/plugins/hoster/YoupornCom.py b/core/module/plugins/hoster/YoupornCom.py new file mode 100644 index 000000000..5c07f2c84 --- /dev/null +++ b/core/module/plugins/hoster/YoupornCom.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class YoupornCom(Hoster): +    __name__ = "YoupornCom" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?youporn\.com/watch/.+" +    __version__ = "0.1" +    __description__ = """Youporn.com Video Download Hoster""" +    __author_name__ = ("willnix") +    __author_mail__ = ("willnix@pyload.org") + +    def __init__(self, parent): +        Hoster.__init__(self, parent) +        self.parent = parent +        self.html = None +        self.html_old = None         #time() where loaded the HTML +        self.time_plus_wait = None   #time() + wait in seconds + +    def set_parent_status(self): +        """ sets all available Statusinfos about a File in self.parent.status +        """ +        if self.html == None: +            self.download_html() +        self.parent.status.filename = self.get_file_name() +        self.parent.status.url = self.get_file_url() +        self.parent.status.wait = self.wait_until() + +    def download_html(self): +        url = self.parent.url +        self.html = self.load(url, post={"user_choice":"Enter"}, cookies=False) + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        if self.html == None: +            self.download_html() + +        file_url = re.search(r'(http://download.youporn.com/download/\d*/.*\?download=1&ll=1&t=dd)">', self.html).group(1) +        return file_url + +    def get_file_name(self): +        if self.html == None: +            self.download_html() + +        file_name_pattern = r".*<title>(.*) - Free Porn Videos - YouPorn.com Lite \(BETA\)</title>.*" +        return re.search(file_name_pattern, self.html).group(1).replace("&", "&").replace("/","") + '.flv' + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html == None: +            self.download_html() +        if re.search(r"(.*invalid video_id.*)", self.html) != None: +            return False +        else: +            return True diff --git a/core/module/plugins/hoster/YoutubeCom.py b/core/module/plugins/hoster/YoutubeCom.py new file mode 100644 index 000000000..79c359ad7 --- /dev/null +++ b/core/module/plugins/hoster/YoutubeCom.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +from module.plugins.Hoster import Hoster + +class YoutubeCom(Hoster): +    __name__ = "YoutubeCom" +    __type__ = "hoster" +    __pattern__ = r"http://(www\.)?(de\.)?\youtube\.com/watch\?v=.*" +    __version__ = "0.2" +    __config__ = [ ("quality", "str" , "Quality Setting", "hd") ] +    __description__ = """Youtube.com Video Download Hoster""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") +     +    def process(self, pyfile): +        html = self.load(pyfile.url) +                         +        if re.search(r"(.*eine fehlerhafte Video-ID\.)", html) != None: +            self.offline() +         +        videoId = pyfile.url.split("v=")[1].split("&")[0] +        videoHash = re.search(r'&t=(.+?)&', html).group(1) +         +         +        file_name_pattern = '<meta name="title" content="(.+?)">' +        is_hd_pattern = r"'IS_HD_AVAILABLE': (false|true)" +        file_suffix = ".flv" +        is_hd = re.search(is_hd_pattern, html).group(1) +        hd_available = (is_hd == "true") +         +        if self.getConf("quality") == "hd" or self.getConf("quality") == "hq": +            file_suffix = ".mp4" + +        name = (re.search(file_name_pattern, html).group(1).replace("/", "") + file_suffix).decode("utf8") +        pyfile.name = name #.replace("&", "&").replace("ö", "oe").replace("À", "ae").replace("Ì", "ue")         + +        if self.getConf("quality") == "sd": +            quality = "&fmt=6" +        elif self.getConf("quality") == "hd" and hd_available: +            quality = "&fmt=22" +        else: +            quality = "&fmt=18" +             +        file_url = 'http://youtube.com/get_video?video_id=' + videoId + '&t=' + videoHash + quality + "&asv=2" + +        self.download(file_url) diff --git a/core/module/plugins/hoster/ZippyshareCom.py b/core/module/plugins/hoster/ZippyshareCom.py new file mode 100644 index 000000000..3740f8c14 --- /dev/null +++ b/core/module/plugins/hoster/ZippyshareCom.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import re +import urllib +from module.plugins.Hoster import Hoster + +class ZippyshareCom(Hoster): +    __name__ = "ZippyshareCom" +    __type__ = "hoster" +    __pattern__ = r"(http://)?www?\d{0,2}\.zippyshare.com/v/" +    __version__ = "0.2" +    __description__ = """Zippyshare.com Download Hoster""" +    __author_name__ = ("spoob") +    __author_mail__ = ("spoob@pyload.org") + +    def setup(self): +        self.html = None +        self.wantReconnect = False +        self.multiDL = False +     +    def process(self, pyfile): +        self.pyfile = pyfile +        self.download_html() +        if not self.file_exists(): +            self.offline() +             +        pyfile.name = self.get_file_name() +        self.download(self.get_file_url()) + +    def download_html(self): +        url = self.pyfile.url +        self.html = self.load(url, cookies=True) + +    def get_file_url(self): +        """ returns the absolute downloadable filepath +        """ +        file_url_pattern = r"var \w* = '(http%.*?)';" +        file_url_search = re.search(file_url_pattern, self.html).group(1) +        file_url = urllib.unquote(file_url_search.replace("nnn", "aaa").replace("unlg", "v").replace("serwus", "zippyshare")) +        return file_url +         +    def get_file_name(self): +        if self.html == None: +            self.download_html() +        if not self.wantReconnect: +            file_name = re.search(r'Name: </font> <font.*>(.*?)</font>', self.html).group(1) +            return file_name +        else: +            return self.pyfile.url + +    def file_exists(self): +        """ returns True or False +        """ +        if self.html == None: +            self.download_html() +        if re.search(r'File does not exist on this server', self.html) != None: +            return False +        else: +            return True diff --git a/core/module/plugins/hoster/__init__.py b/core/module/plugins/hoster/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/plugins/hoster/__init__.py diff --git a/core/module/pyunrar.py b/core/module/pyunrar.py new file mode 100644 index 000000000..1d17486a4 --- /dev/null +++ b/core/module/pyunrar.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: mkaay <mkaay@mkaay.de> +""" + +from subprocess import Popen, PIPE +import re +from time import sleep +from tempfile import mkdtemp +from shutil import rmtree, move +from shutil import Error as FileError +from os.path import join, abspath, basename, dirname +from os import remove, makedirs + +EXITMAP = { +    255: ("USER BREAK 	User stopped the process"), +    9: ("CREATE ERROR", "Create file error"), +    8: ("MEMORY ERROR", "Not enough memory for operation"), +    7: ("USER ERROR", "Command line option error"), +    6: ("OPEN ERROR", "Open file error"), +    5: ("WRITE ERROR", "Write to disk error"), +    4: ("LOCKED ARCHIVE", "Attempt to modify an archive previously locked by the 'k' command"), +    3: ("CRC ERROR", "A CRC error occurred when unpacking"), +    2: ("FATAL ERROR", "A fatal error occurred"), +    1: ("WARNING", "Non fatal error(s) occurred"), +    0: ("SUCCESS", "Successful operation (User exit)"), +} + +class UnknownError(Exception): +    pass + +class NoFilesError(Exception): +    pass + +class WrongPasswordError(Exception): +    pass + +class CommandError(Exception): +    def __init__(self, ret=None, stdout=None, stderr=None): +        self.ret = ret +        self.stdout = stdout +        self.stderr = stderr +     +    def __str__(self): +        return "%s %s %s" % (EXITMAP[self.ret], self.stdout, self.stderr) +     +    def __repr__(self): +        try: +            return "<CommandError %s (%s)>" % (EXITMAP[self.ret][0], EXITMAP[self.ret][1]) +        except: +            return "<CommandError>" +     +    def getExitCode(self): +        return self.ret +     +    def getMappedExitCode(self): +        return EXITMAP[self.ret] + +class Unrar(): +    def __init__(self, archive): +        """ +            archive should be be first or only part +        """ +        self.archive = archive +        self.pattern = None +        m = re.match("^(.*).part(\d+).rar$", archive) +        if m: +            self.pattern = "%s.part*.rar" % m.group(1) +        else: #old style +            self.pattern = "%s.r*" % archive.replace(".rar", "") +        self.cmd = "unrar" +        self.encrypted = None +        self.headerEncrypted = None +        self.smallestFiles = None +        self.password = None +     +    def listContent(self, password=None): +        """ +            returns a list with all infos to the files in the archive +            dict keys: name, version, method, crc, attributes, time, date, ratio, size_packed, size +            @return list(dict, dict, ...) +        """ +        f = self.archive +        if self.pattern: +            f = self.pattern +        args = [self.cmd, "v"] +        if password: +            args.append("-p%s" % password) +        else: +            args.append("-p-") +        args.append(f) +        p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) +        ret = p.wait() +        if ret == 3: +            self.headerEncrypted = True +            raise WrongPasswordError() +        elif ret == 0 and password: +            self.headerEncrypted = False +        o = p.stdout.read() +        inList = False +        infos = {} +        nameLine = False +        name = "" +        for line in o.split("\n"): +            if line == "-"*79: +                inList = not inList +                continue +            if inList: +                nameLine = not nameLine +                if nameLine: +                    name = line +                    if name[0] == "*": #check for pw indicator +                        name = name[1:] +                        self.encrypted = True +                    name = name.strip() +                    continue +                s = line.split(" ") +                s = [e for e in s if e] +                s.reverse() +                d = {} +                for k, v in zip(["version", "method", "crc", "attributes", "time", "date", "ratio", "size_packed", "size"], s[0:9]): +                    d[k] = v +                #if d["crc"] == "00000000" and len(d["method"]) == 2: +                if re.search("d", d["attributes"].lower()): #directory +                    continue +                d["name"] = name +                d["size_packed"] = int(d["size_packed"]) +                d["size"] = int(d["size"]) +                if infos.has_key(name): +                    infos[name]["size_packed"] = infos[name]["size_packed"] + d["size_packed"] +                    infos[name]["crc"].append(d["crc"]) +                else: +                    infos[name] = d +                    infos[name]["crc"] = [d["crc"]] +        infos = infos.values() +        return infos +     +    def listSimple(self, password=None): +        """ +            return a list with full path to all files +            @return list +        """ +        l = self.listContent(password=password) +        return [e["name"] for e in l] +     +    def getSmallestFile(self, password=None): +        """ +            return the file info for the smallest file +            @return dict +        """ +        files = self.listContent(password=password) +        smallest = (-1, -1) +        for i, f in enumerate(files): +            if f["size"] < smallest[1] or smallest[1] == -1: +                smallest = (i, f["size"]) +        if smallest[0] == -1: +            raise UnknownError() +        self.smallestFiles = files[smallest[0]] +        return files[smallest[0]] +     +    def needPassword(self): +        """ +            do we need a password? +            @return bool +        """ +        if not self.smallestFiles: +            try: +                self.getSmallestFile() +            except WrongPasswordError: +                return True +        return self.headerEncrypted or self.encrypted +     +    def checkPassword(self, password, statusFunction=None): +        """ +            check if password is okay +            @return bool +        """ +        if not self.needPassword(): +            return True +        f = self.archive +        if self.pattern: +            f = self.pattern +        args = [self.cmd, "t", "-p%s" % password, f] +        try: +            args.append(self.getSmallestFile(password)["name"]) +        except WrongPasswordError: +            return False +        p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) +        (ret, out) = self.processOutput(p, statusFunction) +        if ret == 3: +            raise False +        elif ret == 0: +            return True +        else: +            raise UnknownError() +     +    def extract(self, password=None, fullPath=True, files=[], exclude=[], destination=None, overwrite=False, statusFunction=None): +        """ +            extract the archive +            @return bool: extract okay? +            raises WrongPasswordError or CommandError +        """ +        f = self.archive +        if self.pattern: +            f = self.pattern +        args = [self.cmd] +        if fullPath: +            args.append("x") +        else: +            args.append("e") +        if not password: +            password = "-" +        if overwrite: +            args.append("-o+") +        else: +            args.append("-o-") +        args.append("-p%s" % password) +        args.append(f) +        if files: +            args.extend([e for e in files]) +        if exclude: +            args.extend(["-x%s" % e for e in exclude]) +        if destination: +            args.append(destination) +        p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) +        (ret, out) = self.processOutput(p, statusFunction) +        if ret == 3: +            raise WrongPasswordError() +        elif ret == 0: +            return True +        else: +            raise CommandError(ret=ret, stdout=out, stderr=p.stderr.read()) +     +    def crackPassword(self, passwords=[], fullPath=True, destination=None, overwrite=False, statusFunction=None, exclude=[]): +        """ +            check password list until the right one is found and extract the archive +            @return bool: password found? +        """ +        correctPassword = None +        if self.needPassword(): +            for password in passwords: +                sf = [] +                try: +                    sf.append(self.getSmallestFile(password)["name"]) +                except WrongPasswordError: +                    continue +                tdir = mkdtemp(prefix="rar") +                try: +                    self.extract(password=password, fullPath=fullPath, destination=tdir, overwrite=overwrite, statusFunction=statusFunction, files=sf) +                except WrongPasswordError: +                    continue +                else: +                    if not destination: +                        destination = "." +                    if overwrite: +                        try: +                            remove(abspath(join(destination, sf[0]))) +                        except OSError, e: +                            if not e.errno == 2: +                                raise e +                    f = sf[0] +                    d = destination +                    if fullPath: +                        try: +                            makedirs(dirname(join(abspath(destination), sf[0]))) +                        except OSError, e: +                            if not e.errno == 17: +                                raise e +                        d = join(destination, dirname(f)) +                    else: +                        f = basename(f) +                    try: +                        move(join(tdir, f), abspath(d)) +                    except FileError: +                        pass +                    exclude.append(sf[0]) +                    correctPassword = password +                    break +                finally: +                    rmtree(tdir) +                    pass +        try: +            self.extract(password=correctPassword, fullPath=fullPath, destination=destination, overwrite=overwrite, statusFunction=statusFunction, exclude=exclude) +            self.password = correctPassword +            return True +        except WrongPasswordError: +            return False +     +    def processOutput(self, p, statusFunction=None): +        """ +            internal method +            parse the progress output of the rar/unrar command +            @return int: exitcode +                    string: command output +        """ +        ret = None +        out = "" +        tmp = None +        count = 0 +        perc = 0 +        tperc = "0" +        last = None +        digits = "1 2 3 4 5 6 7 8 9 0".split(" ") +        if not statusFunction: +            statusFunction = lambda p: None +        statusFunction(0) +        while ret == None or tmp: +            tmp = p.stdout.read(1) +            if tmp: +                out += tmp +                if tmp == chr(8): +                    if last == tmp: +                        count += 1 +                        tperc = "0" +                    else: +                        count = 0 +                        if perc < int(tperc): +                            perc = int(tperc) +                            statusFunction(perc) +                elif count >= 3: +                    if tmp == "\n": +                        count = 0 +                    elif tmp in digits: +                        tperc += tmp +                last = tmp +            else: +                sleep(0.01) +            ret = p.poll() +        statusFunction(100) +        return ret, out +     +    def getPassword(self): +        """ +            return the correct password +            works only in conjunction with 'crackPassword' +            @return string: password +        """ +        return self.password + +if __name__ == "__main__": +    from pprint import pprint +    u = Unrar("archive.part1.rar", multi=True) +    u = Unrar("parchive.part1.rar", multi=True) +    pprint(u.listContent()) +    u = Unrar("pharchive.part1.rar", multi=True) +    pprint(u.listContent(password="test")) +    u = Unrar("bigarchive.rar") +    pprint(u.listContent()) +    print u.getSmallestFile() +    try: +        def s(p): +            print p +        print u.crackPassword(passwords=["test1", "ggfd", "423r", "test"], destination=".", statusFunction=s, overwrite=True) +    except CommandError, e: +        print e diff --git a/core/module/remote/SecureXMLRPCServer.py b/core/module/remote/SecureXMLRPCServer.py new file mode 100644 index 000000000..7a60f6c90 --- /dev/null +++ b/core/module/remote/SecureXMLRPCServer.py @@ -0,0 +1,130 @@ +# Source: http://sources.gentoo.org/viewcvs.py/gimli/server/SecureXMLRPCServer.py?view=markup +#         which seems to be based on http://www.sabren.net/code/python/SecureXMLRPCServer.py +# +# Changes: +#     2007-01-06 Christian Hoffmann <ch@hoffie.info> +#         * Bugfix: replaced getattr by hasattr in the conditional +#           (lead to an error otherwise) +#         * SecureXMLRPCServer: added self.instance = None, otherwise a "wrong" +#           exception is raised when calling unknown methods via xmlrpc +#         * Added HTTP Basic authentication support +#  +# Modified for the Sceradon project +# +# This code is in the public domain +# and is provided AS-IS WITH NO WARRANTY WHATSOEVER. +# $Id: SecureXMLRPCServer.py 5 2007-01-06 17:54:13Z hoffie $ + +from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler +import SocketServer +import socket +import base64 + + +class SecureSocketConnection: +    def __init__(self, connection): +        self.__dict__["connection"] = connection +     +    def __getattr__(self, name): +        return getattr(self.__dict__["connection"], name) +     +    def __setattr__(self, name, value): +        setattr(self.__dict__["connection"], name, value) +     +    def shutdown(self, how=1): +        self.__dict__["connection"].shutdown() +     +    def accept(self): +        connection, address = self.__dict__["connection"].accept() +        return (SecureSocketConnection(connection), address) + +class SecureSocketServer(SocketServer.TCPServer, SocketServer.ThreadingMixIn): +    def __init__(self, addr, cert, key, requestHandler, verify_cert_func=None): +        SSL = __import__("OpenSSL", globals(), locals(), "SSL", -1).SSL +        SocketServer.TCPServer.__init__(self, addr, requestHandler) +        ctx = SSL.Context(SSL.SSLv23_METHOD) +        if not verify_cert_func and hasattr(self, 'verify_client_cert'): +            verify_cert_func = getattr(self, 'verify_client_cert') +        if verify_cert_func: +            ctx.set_verify(SSL.VERIFY_PEER|SSL.VERIFY_FAIL_IF_NO_PEER_CERT, verify_cert_func) +        ctx.use_privatekey_file(key) +        ctx.use_certificate_file(cert) +         +        tmpConnection = SSL.Connection(ctx, socket.socket(socket.AF_INET, socket.SOCK_STREAM)) +        self.socket = SecureSocketConnection(tmpConnection) +         +        self.server_bind() +        self.server_activate() + +    def finish_request(self, request, client_address): +        """Finish one request by instantiating RequestHandlerClass.""" +        self.RequestHandlerClass(request, client_address, self) +         +####################################### +########### Request Handler ########### +####################################### + +class AuthXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): +    def __init__(self, request, client_address, server): +        self.authMap = server.getAuthenticationMap() +        SimpleXMLRPCRequestHandler.__init__(self, request, client_address, server) +     +    def setup(self): +        self.connection = self.request +        self.rfile = socket._fileobject(self.request, "rb", self.rbufsize) +        self.wfile = socket._fileobject(self.request, "wb", self.wbufsize) +     +    def do_POST(self): +        # authentication +        if self.authMap != None: # explicit None! +            if self.headers.has_key('authorization') and self.headers['authorization'].startswith('Basic '): +                authenticationString = base64.b64decode(self.headers['authorization'].split(' ')[1]) +                if authenticationString.find(':') != -1: +                    username, password = authenticationString.split(':', 1) +                    if self.authMap.has_key(username) and self.verifyPassword(username, password): +                        return SimpleXMLRPCRequestHandler.do_POST(self) +            self.send_response(401) +            self.end_headers() +            return False +        return SimpleXMLRPCRequestHandler.do_POST(self) +     +    def verifyPassword(self, username, givenPassword): +        return self.authMap[username] == givenPassword + + +class SecureXMLRPCRequestHandler(AuthXMLRPCRequestHandler): +    def __init__(self, request, client_address, server, client_digest=None): +        self.authMap = server.getAuthenticationMap() +        SimpleXMLRPCRequestHandler.__init__(self, request, client_address, server) +        self.client_digest = client_digest + +##################################### +########### XMLRPC Server ########### +##################################### + +class AuthXMLRPCServer(SimpleXMLRPCServer): +    def __init__(self, address, authenticationMap = None, handler=AuthXMLRPCRequestHandler): +        SimpleXMLRPCServer.__init__(self, address, requestHandler=handler) +        self.logRequests = False +        self._send_traceback_header = False +        self.encoding = "utf-8" +        self.allow_none = True +        self.authenticationMap = authenticationMap +     +    def getAuthenticationMap(self): +        return self.authenticationMap + +class SecureXMLRPCServer(AuthXMLRPCServer, SecureSocketServer): +    def __init__(self, address, cert, key, authenticationMap = None, handler=SecureXMLRPCRequestHandler, verify_cert_func=None): +        self.logRequests = False +        self._send_traceback_header = False +        self.encoding = "utf-8" +        self.allow_none = True +        SecureSocketServer.__init__(self, address, cert, key, handler, verify_cert_func) +        # This comes from SimpleXMLRPCServer.__init__()->SimpleXMLRPCDispatcher.__init__() +        self.funcs = {} +        self.instance = None +        self.authenticationMap = authenticationMap +     +    def getAuthenticationMap(self): +        return self.authenticationMap diff --git a/core/module/remote/__init__.py b/core/module/remote/__init__.py new file mode 100644 index 000000000..8d1c8b69c --- /dev/null +++ b/core/module/remote/__init__.py @@ -0,0 +1 @@ +  diff --git a/core/module/setup.py b/core/module/setup.py new file mode 100644 index 000000000..c1f449be4 --- /dev/null +++ b/core/module/setup.py @@ -0,0 +1,448 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. +     +    @author: RaNaN +""" +from getpass import getpass +import gettext +from hashlib import sha1 +import os +from os import remove +from os import makedirs +from os.path import abspath +from os.path import dirname +from os.path import exists +from os.path import isfile +from os.path import join +import random +import re +from subprocess import PIPE +from subprocess import call +import sys +from sys import exit + +class Setup(): +    """ +    pyLoads initial setup configuration assistent +    """ +    def __init__(self, path, config): + +        self.path = path +        self.config = config + + +    def start(self): +         +        lang = self.ask("Choose your Language / WÀhle deine Sprache", "en", ["en", "de"]) +        translation = gettext.translation("setup", join(self.path, "locale"), languages=[lang]) +        translation.install(unicode=(True if  sys.getfilesystemencoding().startswith("utf") else False)) + +        print "" +        print _("Welcome to the pyLoad Configuration Assistent.") +        print _("It will check your system and make a basic setup in order to run pyLoad.") +        print "" +        print _("The value in brackets [] always is the default value,") +        print _("in case you don't want to change it or you are unsure what to choose, just hit enter.") +        print _("Don't forget: You can always rerun this assistent with --setup or -s parameter, when you start pyLoadCore.") +        print _("If you have any problems with this assistent hit STRG-C,") +        print _("to abort and don't let him start with pyLoadCore automatically anymore.") +        print "" +        print _("When you are ready for system check, hit enter.") +        raw_input() +         +        basic, ssl, captcha, gui, web = self.system_check() +        print "" + +        if not basic: +            print _("You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad.") +            print _("Please correct this and re-run pyLoad.") +            print _("Setup will now close.") +            raw_input() +            return False + +        raw_input(_("System check finished, hit enter to see your status report.")) +        print "" +        print _("## Status ##") +        print "" +         +         +        avail = [] +        if self.check_module("Crypto"): avail.append(_("container decrypting")) +        if ssl: avail.append(_("ssl connection")) +        if captcha: avail.append(_("automatic captcha decryption")) +        if gui: avail.append(_("GUI")) +        if web: avail.append(_("Webinterface")) +  +        string = "" +         +        for av in avail: +            string += ", "+av + +        print _("Features available:") + string[1:] +        print "" +         +        if len(avail) < 5: +            print _("Featues missing: ") +            print +             +            if not self.check_module("Crypto"): +                print _("no py-crypto available") +                print _("You need this if you want to decrypt container files.") +                print "" +             +            if not ssl: +                print _("no SSL available") +                print _("This is needed if you want to establish a secure connection to core or webinterface.") +                print _("If you only want to access locally to pyLoad ssl is not usefull.") +                print "" +             +            if not captcha: +                print _("no Captcha Recognition available") +                print _("Only needed for some hosters and as freeuser.") +                print "" +             +            if not gui: +                print _("Gui not available") +                print _("The Graphical User Interface.") +                print "" +                 +            if not web: +                print _("no Webinterface available") +                print _("Gives abillity to control pyLoad with your webbrowser.") +                print "" +             +            print _("You can abort the setup now and fix some dependicies if you want.") + +        con = self.ask(_("Continue with setup?"), "y", bool=True) + +        if not con: +            return False + +        print "" +        print _("Do you want to change the config path? Current is %s" % abspath("")) +        print _("If you use pyLoad on a server or the home partition lives on an iternal flash it may be a good idea to change it.") +        path = self.ask(_("Change config path?"), "n", bool=True) +        if path: +            self.conf_path() +            #calls exit when changed +         +         +        print "" +        print _("Do you want to configure basic settings?") +        print _("This is recommend for first run.") +        con = self.ask(_("Make basic setup?"), "y", bool=True) + +        if con: +            self.conf_basic() + +        if ssl: +            print "" +            print _("Do you want to configure ssl?") +            ssl = self.ask(_("Configure ssl?"), "n", bool=True) +            if ssl: +                self.conf_ssl() + +        if web: +            print "" +            print _("Do you want to configure webinterface?") +            web = self.ask(_("Configure webinterface?"), "y", bool=True) +            if web: +                self.conf_web() + +        print "" +        print _("Setup finished successfully.") +        print _("Hit enter to exit and restart pyLoad") +        raw_input() +        return True + +    def system_check(self): +        """ make a systemcheck and return the results""" +        print _("## System Check ##") + +        python = False + +        if sys.version_info > (2, 7): +            print _("Your python version is to new, Please use Python 2.6/2.7") +            python = False +        elif sys.version_info < (2, 5): +            print _("Your python version is to old, Please use at least Python 2.5") +            python = False +        else: +            print _("Python Version: OK") +            python = True + + +        curl = self.check_module("pycurl") +        self.print_dep("pycurl", curl) + +        sqlite = self.check_module("sqlite3") +        self.print_dep("sqlite3", sqlite) + +        basic = python and curl and sqlite + +        print "" +         +        crypto = self.check_module("Crypto") +        self.print_dep("pycrypto", crypto) +         +        ssl = self.check_module("OpenSSL") +        self.print_dep("OpenSSL", ssl) + +        print "" + +        pil = self.check_module("Image") +        self.print_dep("py-imaging", pil) +         +        if os.name == "nt": +            tesser = self.check_prog([join(pypath, "tesseract", "tesseract.exe"), "-v"]) +        else: +            tesser = self.check_prog(["tesseract", "-v"]) +         +        self.print_dep("tesseract", tesser) + +        captcha = pil and tesser + +        print "" + +        gui = self.check_module("PyQt4") +        self.print_dep("PyQt4", gui) + +        print "" + +        web = self.check_module("django") +         + +        try: +            import django + +            if django.VERSION < (1, 1): +                print _("Your django version is to old, please upgrade to django 1.1") +                web = False +            elif django.VERSION > (1, 3): +                print _("Your django version is to new, please use django 1.2") +                web = False +        except: +            web = False + +        self.print_dep("django", web) +        web = web and sqlite + +        return (basic, ssl, captcha, gui, web) + +    def conf_basic(self): +        print "" +        print _("## Basic Setup ##") + +        print "" +        print _("The following logindata are only valid for CLI and GUI, but NOT for webinterface.") +        self.config.username = self.ask(_("Username"), "User") +        self.config.password = self.ask("", "", password=True) + +        print "" +        self.config["general"]["language"] = self.ask(_("Language"), "en", ["en", "de", "fr", "nl", "pl"]) +        self.config["general"]["download_folder"] = self.ask(_("Downloadfolder"), "Downloads") +        self.config["general"]["max_downloads"] = self.ask(_("Max parallel downloads"), "3") +        print _("You should disable checksum proofing, if you have low hardware requirements.") +        self.config["general"]["checksum"] = self.ask(_("Proof checksum?"), "y", bool=True) + +        reconnect = self.ask(_("Use Reconnect?"), "n", bool=True) +        self.config["reconnect"]["activated"] = reconnect +        if reconnect: +            self.config["reconnect"]["method"] = self.ask(_("Reconnect script location"), "./reconnect.sh") + + +    def conf_web(self): +        print "" +        print _("## Webinterface Setup ##") + +        db_path = "pyload.db" +        is_db = isfile(db_path) +        db_setup = True + +        if is_db: +            print _("You already have a database for the webinterface.") +            db_setup = self.ask(_("Do you want to delete it and make a new one?"), "n", bool=True) + +        if db_setup: +            if is_db: remove(db_path) +            from django import VERSION +            import sqlite3 +             +            if VERSION[:2] < (1,2): +                from module.web import syncdb_django11 as syncdb +            else: +                from module.web import syncdb +                 +            from module.web import createsuperuser +             +             +            print "" +            syncdb.handle_noargs() +            print _("If you see no errors, your db should be fine and we're adding an user now.") +            username = self.ask(_("Username"), "User") +            createsuperuser.handle(username, "email@trash-mail.com") +             +            password = self.ask("", "", password=True) +            salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)]) +            hash = sha1(salt + password) +            password = "sha1$%s$%s" % (salt, hash.hexdigest()) + +            conn = sqlite3.connect(db_path) +            c = conn.cursor() +            c.execute('UPDATE "main"."auth_user" SET "password"=? WHERE "username"=?', (password, username)) + +            conn.commit() +            c.close() + +        print "" +        self.config["webinterface"]["activated"] = self.ask(_("Activate webinterface?"), "y", bool=True) +        print "" +        print _("Listen address, if you use 127.0.0.1 or localhost, the webinterface will only accessible locally.") +        self.config["webinterface"]["host"] = self.ask(_("Address"), "0.0.0.0") +        self.config["webinterface"]["port"] = self.ask(_("Port"), "8000") +        #@TODO setup for additional webservers + +    def conf_ssl(self): +        print "" +        print _("## SSL Setup ##") +        print "" +        print _("Execute these commands from pyLoad folder to make ssl certificates:") +        print "" +        print "openssl genrsa - 1024 > ssl.key" +        print "openssl req -new -key ssl.key -out ssl.csr" +        print "openssl req -days 36500 -x509 -key ssl.key -in ssl.csr > ssl.crt " +        print "" +        print _("If you're done and everything went fine, you can activate ssl now.") + +        self.config["ssl"]["activated"] = self.ask(_("Activate SSL?"), "y", bool=True) + +    def set_user(self): + +        translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"]]) +        translation.install(unicode=(True if  sys.getfilesystemencoding().startswith("utf") else False)) +        print _("Setting new username and password") +        print "" +        self.config.username = self.ask(_("Username"), "User") +        self.config.password = self.ask("", "", password=True) +        self.config.save() + +    def conf_path(self, trans=False): +        if trans: +            translation = gettext.translation("setup", join(self.path, "locale"), languages=[self.config["general"]["language"]]) +            translation.install(unicode=(True if  sys.getfilesystemencoding().startswith("utf") else False)) +         +        print _("Setting new configpath, current configuration will not be transfered!") +        path = self.ask(_("Configpath"), abspath("")) +        try: +            path = join(pypath, path) +            if not exists(path): +                makedirs(path) +            f = open(join(pypath, "module","config", "configdir"), "wb") +            f.write(path) +            f.close() +            print _("Configpath changed, setup will now close, please restart to go on.") +            print _("Press Enter to exit.") +            raw_input() +            exit() +        except Exception, e: +            print _("Setting config path failed: %s") % str(e) +         +    def print_dep(self, name, value): +        """Print Status of dependency""" +        if value: +            print _("%s: OK") % name +        else: +            print _("%s: missing") % name + + +    def check_module(self, module): +        try: +            __import__(module) +            return True +        except: +            return False + +    def check_prog(self, command): +        pipe = PIPE +        try: +            call(command, stdout=pipe, stderr=pipe) +            return True +        except: +            return False + +    def ask(self, qst, default, answers=[], bool=False, password=False): +        """produce one line to asking for input""" +        if answers: +            info = "(" + +            for i, answer in enumerate(answers): +                info += (", " if i != 0 else "") + str((answer == default and "[%s]" % answer) or answer) + +            info += ")" +        elif bool: +            if default == "y": +                info = "([y]/n)" +            else: +                info = "(y/[n])" +        else: +            info = "[%s]" % default + +        if password: +            p1 = True +            p2 = False +            while p1 != p2: +                p1 = getpass(_("Password: ")) + +                if len(p1) < 4: +                    print _("Password to short. Use at least 4 symbols.") +                    continue + +                p2 = getpass(_("Password (again): ")) + +                if p1 == p2: +                    return p1 +                else: +                    print _("Passwords did not match.") + +        while True: +            input = raw_input(qst + " %s: " % info) + +            if input.strip() == "": +                input = default + +            if bool: +                if re.match(r"(y|yes|j|ja|true)", input.lower().strip()): +                    return True +                elif re.match(r"(n|no|nein|false)", input.lower().strip()): +                    return False +                else: +                    print _("Invalid Input") +                    continue + + +            if not answers: +                return input + +            else: +                if input in answers: +                    return input +                else: +                    print _("Invalid Input") + + +if __name__ == "__main__": +    test = Setup(join(abspath(dirname(__file__)), ".."), None) +    test.start() diff --git a/core/module/unescape.py b/core/module/unescape.py new file mode 100644 index 000000000..41a23be5b --- /dev/null +++ b/core/module/unescape.py @@ -0,0 +1,54 @@ +from htmlentitydefs import name2codepoint as n2cp +from urllib import unquote +import re + +def substitute_entity(match): +    ent = match.group(2) +    if match.group(1) == "#": +        return unichr(int(ent)) +    else: +        cp = n2cp.get(ent) +        if cp: +            return unichr(cp) +        else: +            return match.group() + +def unescape(string): +    entity_re = re.compile("&(#?)(\d{1,5}|\w{1,8});") +    return entity_re.subn(substitute_entity, unquote(string))[0] + + +""" +import re + +def unescape(text): +   def fixup(m): +      text = m.group(0) +      if text[:2] == "&#": +         # character reference +         try: +            if text[:3] == "&#x": +               return unichr(int(text[3:-1], 16)) +            else: +               return unichr(int(text[2:-1])) +         except ValueError: +            print "erreur de valeur" +            pass +      else: +         # named entity +         try: +            if text[1:-1] == "amp": +               text = "&amp;" +            elif text[1:-1] == "gt": +               text = "&gt;" +            elif text[1:-1] == "lt": +               text = "&lt;" +            else: +               print text[1:-1] +               text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]) +         except KeyError: +            print "keyerror" +            pass +      return text # leave as is +   return re.sub("&#?\w+;", fixup, text) +""" diff --git a/core/module/web/ServerThread.py b/core/module/web/ServerThread.py new file mode 100644 index 000000000..c07364243 --- /dev/null +++ b/core/module/web/ServerThread.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python +from __future__ import with_statement +from os.path import exists +from os.path import join +from os.path import abspath +from os import makedirs +from subprocess import PIPE +from subprocess import Popen +from subprocess import call +from sys import version_info +from cStringIO import StringIO +import threading +import sys +import logging + +core = None +log = logging.getLogger("log") + +class WebServer(threading.Thread): +    def __init__(self, pycore): +        global core +        threading.Thread.__init__(self) +        self.core = pycore +        core = pycore +        self.running = True +        self.server = pycore.config['webinterface']['server'] +        self.https = pycore.config['webinterface']['https'] +        self.setDaemon(True) +          +    def run(self): +        sys.path.append(join(pypath, "module", "web")) +        avail = ["builtin"] +        host = self.core.config['webinterface']['host'] +        port = self.core.config['webinterface']['port'] +        serverpath = join(pypath, "module", "web") +        path = join(abspath(""), "servers") +        out = StringIO() +         +        if not exists("pyload.db"): +            #print "########## IMPORTANT ###########" +            #print "###        Database for Webinterface does not exitst, it will not be available." +            #print "###        Please run: python %s syncdb" % join(self.pycore.path, "module", "web", "manage.py") +            #print "###        You have to add at least one User, to gain access to webinterface: python %s createsuperuser" % join(self.pycore.path, "module", "web", "manage.py") +            #print "###        Dont forget to restart pyLoad if you are done." +            log.warning(_("Database for Webinterface does not exitst, it will not be available.")) +            log.warning(_("Please run: python pyLoadCore.py -s")) +            log.warning(_("Go through the setup and create a database and add an user to gain access.")) +            return None + +        try: +            import flup +            avail.append("fastcgi") +        except: +            pass + +        try: +            call(["lighttpd", "-v"], stdout=PIPE, stderr=PIPE) +            import flup +            avail.append("lighttpd") + +        except: +            pass + +        try: +            call(["nginx", "-v"], stdout=PIPE, stderr=PIPE) +            import flup +            avail.append("nginx") +        except: +            pass + + +        try: +            if self.https: +                if exists(self.core.config["ssl"]["cert"]) and exists(self.core.config["ssl"]["key"]): +                    if not exists("ssl.pem"): +                        key = file(self.core.config["ssl"]["key"], "rb") +                        cert = file(self.core.config["ssl"]["cert"], "rb") +     +                        pem = file("ssl.pem", "wb") +                        pem.writelines(key.readlines()) +                        pem.writelines(cert.readlines()) +     +                        key.close() +                        cert.close() +                        pem.close() +     +                else: +                    log.warning(_("SSL certificates not found.")) +                    self.https = False +            else: +                pass +        except: +            self.https = False + + +        if not self.server in avail: +            self.server = "builtin" +            log.warning(_("Can't use %(server)s, either python-flup or %(server)s is not installed!") % {"server": self.server}) + + +        if self.server == "nginx": + +            if not exists(join(path, "nginx")): +                makedirs(join(path, "nginx")) +             +            config = file(join(serverpath, "servers", "nginx_default.conf"), "rb") +            content = config.read() +            config.close() + +            content = content.replace("%(path)", join(path, "nginx")) +            content = content.replace("%(host)", host) +            content = content.replace("%(port)", str(port)) +            content = content.replace("%(media)", join(serverpath, "media")) +            content = content.replace("%(version)", ".".join(map(str, version_info[0:2]))) + +            if self.https: +                content = content.replace("%(ssl)", """ +            ssl    on; +            ssl_certificate    %s; +            ssl_certificate_key    %s; +            """ % (abspath(self.core.config["ssl"]["cert"]), abspath(self.core.config["ssl"]["key"]) )) +            else: +                content = content.replace("%(ssl)", "") +             +            new_config = file(join(path, "nginx.conf"), "wb") +            new_config.write(content) +            new_config.close() + +            command = ['nginx', '-c', join(path, "nginx.conf")] +            self.p = Popen(command, stderr=PIPE, stdin=PIPE, stdout=Output(out)) + +            log.info(_("Starting nginx Webserver: %s:%s") % (host, port)) +            import run_fcgi +            run_fcgi.handle("daemonize=false", "method=threaded", "host=127.0.0.1", "port=9295") + + +        elif self.server == "lighttpd": +             +            if not exists(join(path, "lighttpd")): +                makedirs(join(path, "lighttpd")) +             +             +            config = file(join(serverpath, "servers", "lighttpd_default.conf"), "rb") +            content = config.readlines() +            config.close() +            content = "".join(content) + +            content = content.replace("%(path)", join("servers", "lighttpd")) +            content = content.replace("%(host)", host) +            content = content.replace("%(port)", str(port)) +            content = content.replace("%(media)", join(serverpath, "media")) +            content = content.replace("%(version)", ".".join(map(str, version_info[0:2]))) + +            if self.https: +                content = content.replace("%(ssl)", """ +            ssl.engine = "enable" +            ssl.pemfile = "%s" +            ssl.ca-file = "%s" +            """ % ("ssl.pem" , self.core.config["ssl"]["cert"]) ) +            else: +                content = content.replace("%(ssl)", "") +            new_config = file(join("servers", "lighttpd.conf"), "wb") +            new_config.write(content) +            new_config.close() + +            command = ['lighttpd', '-D', '-f', join(path, "lighttpd.conf")] +            self.p = Popen(command, stderr=PIPE, stdin=PIPE, stdout=Output(out)) + +            log.info(_("Starting lighttpd Webserver: %s:%s") % (host, port)) +            import run_fcgi +            run_fcgi.handle("daemonize=false", "method=threaded", "host=127.0.0.1", "port=9295") + +          +        elif self.server == "fastcgi": +            #run fastcgi on port +            import run_fcgi +            run_fcgi.handle("daemonize=false", "method=threaded", "host=127.0.0.1", "port=%s" % str(port)) +        else: +            self.core.log.info(_("Starting django builtin Webserver: %s:%s") % (host, port)) +            import run_server +            run_server.handle(host, port) + +    def quit(self): + +        try: +            if self.server == "lighttpd" or self.server == "nginx": +                self.p.kill() +                #self.p2.kill() +                return True + +            else: +                #self.p.kill() +                return True +        except: +            pass + +         +        self.running = False + +class Output: +    def __init__(self, stream): +        self.stream = stream + +    def fileno(self): +        return 1 + +    def write(self, data): # Do nothing +        return None +         #self.stream.write(data) +         #self.stream.flush() +    def __getattr__(self, attr): +        return getattr(self.stream, attr) diff --git a/core/module/web/__init__.py b/core/module/web/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/web/__init__.py diff --git a/core/module/web/ajax/__init__.py b/core/module/web/ajax/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/web/ajax/__init__.py diff --git a/core/module/web/ajax/models.py b/core/module/web/ajax/models.py new file mode 100644 index 000000000..35e0d6486 --- /dev/null +++ b/core/module/web/ajax/models.py @@ -0,0 +1,2 @@ + +# Create your models here. diff --git a/core/module/web/ajax/tests.py b/core/module/web/ajax/tests.py new file mode 100644 index 000000000..2247054b3 --- /dev/null +++ b/core/module/web/ajax/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): +    def test_basic_addition(self): +        """ +        Tests that 1 + 1 always equals 2. +        """ +        self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/core/module/web/ajax/urls.py b/core/module/web/ajax/urls.py new file mode 100644 index 000000000..a32a00d89 --- /dev/null +++ b/core/module/web/ajax/urls.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from django.conf.urls.defaults import * + + +urlpatterns = patterns('ajax', +                       # Example: +                       # (r'^pyload/', include('pyload.foo.urls')), + +                       # Uncomment the admin/doc line below and add 'django.contrib.admindocs' +                       # to INSTALLED_APPS to enable admin documentation: +                       # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + +                       # Uncomment the next line to enable the admin: +                        (r'^add_package$', 'views.add_package'), +                        (r'^abort_link/(\d+)$', 'views.abort_link'), +                        (r'^status$', 'views.status'), +                        (r'^links$', 'views.links'), #currently active links +                       (r'^queue$', 'views.queue'), +                         (r'^pause$', 'views.pause'), +                        (r'^unpause$', 'views.unpause'), +                        (r'^cancel$', 'views.cancel'), +                        (r'^packages$', 'views.packages'), +                        (r'^package/(\d+)$', 'views.package'), +                        (r'^link/(\d+)$', 'views.link'), +                        (r'^remove_package/(\d+)$', 'views.remove_package'), +                        (r'^restart_package/(\d+)$', 'views.restart_package'), +                        (r'^remove_link/(\d+)$', 'views.remove_link'), +                        (r'^restart_link/(\d+)$', 'views.restart_link'), +                        (r'^push_to_queue/(\d+)$', 'views.push_to_queue'), +                        (r'^set_captcha$', 'views.set_captcha'), +                       )
\ No newline at end of file diff --git a/core/module/web/ajax/views.py b/core/module/web/ajax/views.py new file mode 100644 index 000000000..82e478af3 --- /dev/null +++ b/core/module/web/ajax/views.py @@ -0,0 +1,256 @@ +# Create your views here. +from os.path import join +import time + +from django.conf import settings +from django.core.serializers import json +from django.http import HttpResponse +from django.http import HttpResponseForbidden +from django.http import HttpResponseServerError +from django.utils import simplejson +from django.utils.translation import ugettext as _ +import base64 + +from traceback import print_exc + +def format_time(seconds): +    seconds = int(seconds) + +    hours, seconds = divmod(seconds, 3600) +    minutes, seconds = divmod(seconds, 60) +    return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) + + +def permission(perm): +    def _dec(view_func): +        def _view(request, * args, ** kwargs): +            if request.user.has_perm(perm) and request.user.is_authenticated(): +                return view_func(request, * args, ** kwargs) +            else: +                return HttpResponseForbidden() +         +        _view.__name__ = view_func.__name__ +        _view.__dict__ = view_func.__dict__ +        _view.__doc__ = view_func.__doc__ + +        return _view + +    return _dec + +class JsonResponse(HttpResponse): +    def __init__(self, object): +        content = simplejson.dumps( +                                   object, indent=2, cls=json.DjangoJSONEncoder, +                                   ensure_ascii=False) +        super(JsonResponse, self).__init__( +                                           content)#, content_type='application/json') #@TODO uncomment +        self['Cache-Control'] = 'no-cache, must-revalidate' + + +@permission('pyload.can_add') +def add_package(request): +     +    name = request.POST['add_name'] + +    queue = int(request.POST['add_dest']) + +    links = request.POST['add_links'].replace(" ", "\n").split("\n") +     +    try: +        f = request.FILES['add_file'] +         +        if name == None or name == "": +            name = f.name +             +        fpath = join(settings.PYLOAD.get_conf_val("general","download_folder"), "tmp_"+ f.name) +        destination = open(fpath, 'wb') +        for chunk in f.chunks(): +            destination.write(chunk) +        destination.close() +        links.insert(0, fpath) +    except: +        pass +     +    if name == None or name == "": +        return HttpResponseServerError() +     +    links = map(lambda x: x.strip(), links) +    links = filter(lambda x: x != "", links) +     +     +    settings.PYLOAD.add_package(name, links, queue) +         +    return JsonResponse("success") + +@permission('pyload.can_add') +def remove_link(request, id): +    try: +        settings.PYLOAD.del_links([int(id)]) +        return JsonResponse("sucess") +    except Exception, e: +        return HttpResponseServerError() + +@permission('pyload.can_see_dl')     +def status(request): +    try: +        status = settings.PYLOAD.status_server() +        status['captcha'] = settings.PYLOAD.is_captcha_waiting() +        return JsonResponse(status) +    except: +        return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def links(request): +    try: +        links = settings.PYLOAD.status_downloads() +        ids = [] +        for link in links: +            ids.append(link['id']) + +            if link['status'] == 12: +                link['info'] = "%s @ %s kb/s" % (link['format_eta'], round(link['speed'], 2)) +            elif link['status'] == 5: +                link['percent'] = 0 +                link['size'] = 0 +                link['kbleft'] = 0 +                link['info'] = _("waiting %s") % link['format_wait'] +            else: +                link['info'] = "" + + +        data = {} +        data['links'] = links +        data['ids'] = ids +        return JsonResponse(data) +    except Exception, e: +        return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def queue(request): +    try: +        return JsonResponse(settings.PYLOAD.get_queue()) +         +    except: +        return HttpResponseServerError() +         +         +@permission('pyload.can_change_satus') +def pause(request): +    try: +        return JsonResponse(settings.PYLOAD.pause_server()) +         +    except: +        return HttpResponseServerError() + + +@permission('pyload.can_change_status') +def unpause(request): +    try: +        return JsonResponse(settings.PYLOAD.unpause_server()) +         +    except: +        return HttpResponseServerError() +         + +@permission('pyload.can_change_status') +def cancel(request): +    try: +        return JsonResponse(settings.PYLOAD.stop_downloads()) +    except: +        return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def packages(request): +    try: +        data = settings.PYLOAD.get_queue() +         +        for package in data: +            package['links'] = [] +            for file in settings.PYLOAD.get_package_files(package['id']): +                package['links'].append(settings.PYLOAD.get_file_info(file)) +         +        return JsonResponse(data) +         +    except: +        return HttpResponseServerError() + +@permission('pyload.can_see_dl') +def package(request, id): +    try: +        data = settings.PYLOAD.get_package_data(int(id)) +        data['links'] = [] +        for file in settings.PYLOAD.get_package_files(data['id']): +            data['links'].append(settings.PYLOAD.get_file_info(file)) + +        return JsonResponse(data) +         +    except: +        return HttpResponseServerError() +         +@permission('pyload.can_see_dl') +def link(request, id): +    try: +        data = settings.PYLOAD.get_file_info(int(id)) +        return JsonResponse(data) +         +    except: +        return HttpResponseServerError() + +@permission('pyload.can_add_dl') +def remove_package(request, id): +    try: +        settings.PYLOAD.del_packages([int(id)]) +        return JsonResponse("sucess") +    except Exception, e: +        print_exc() +        return HttpResponseServerError() + +@permission('pyload.can_add_dl') +def restart_package(request, id): +    try: +        settings.PYLOAD.restart_package(int(id)) +        return JsonResponse("sucess") +    except Exception: +        return HttpResponseServerError() + +@permission('pyload.can_add_dl') +def restart_link(request, id): +    try: +        settings.PYLOAD.restart_file(int(id)) +        return JsonResponse("sucess") +    except Exception: +        return HttpResponseServerError() +         +@permission('pyload.can_add_dl') +def abort_link(request, id): +    try: +        settings.PYLOAD.stop_download("link", int(id)) +        return JsonResponse("sucess") +    except: +        return HttpResponseServerError() +         +@permission('pyload.can_add_dl') +def push_to_queue(request, id): +    try: +        settings.PYLOAD.push_package_to_queue(int(id)) +        return JsonResponse("sucess") +    except: +        return HttpResponseServerError() + +@permission('pyload.can_add_dl') +def set_captcha(request): +    if request.META['REQUEST_METHOD'] == "POST": +        try: +            settings.PYLOAD.set_captcha_result(request.POST["cap_id"], request.POST["cap_text"]) +        except: +            pass + +    id, binary, typ = settings.PYLOAD.get_captcha_task() + +    if id: +        binary = base64.standard_b64encode(str(binary)) +        src = "data:image/%s;base64,%s" % (typ, binary) + +        return JsonResponse({'captcha': True, 'src': src, 'id': id}) +    else: +        return JsonResponse({'captcha': False}) diff --git a/core/module/web/cnl/__init__.py b/core/module/web/cnl/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/web/cnl/__init__.py diff --git a/core/module/web/cnl/models.py b/core/module/web/cnl/models.py new file mode 100644 index 000000000..71a836239 --- /dev/null +++ b/core/module/web/cnl/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/core/module/web/cnl/tests.py b/core/module/web/cnl/tests.py new file mode 100644 index 000000000..2247054b3 --- /dev/null +++ b/core/module/web/cnl/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): +    def test_basic_addition(self): +        """ +        Tests that 1 + 1 always equals 2. +        """ +        self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/core/module/web/cnl/urls.py b/core/module/web/cnl/urls.py new file mode 100644 index 000000000..7887953b7 --- /dev/null +++ b/core/module/web/cnl/urls.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from django.conf.urls.defaults import * + + +urlpatterns = patterns('cnl', +                       # Example: +                       # (r'^pyload/', include('pyload.foo.urls')), + +                       # Uncomment the admin/doc line below and add 'django.contrib.admindocs' +                       # to INSTALLED_APPS to enable admin documentation: +                       # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + +                       # Uncomment the next line to enable the admin: +                        (r'^add$', 'views.add'), +                        (r'^addcrypted$', 'views.addcrypted'), +                        (r'^addcrypted2$', 'views.addcrypted2'), +                        (r'^crossdomain\.xml', 'views.crossdomain'), +                        (r'^jdcheck\.js', 'views.jdcheck'), +                        (r'', 'views.flash') +                       ) diff --git a/core/module/web/cnl/views.py b/core/module/web/cnl/views.py new file mode 100644 index 000000000..7bc2ae6d4 --- /dev/null +++ b/core/module/web/cnl/views.py @@ -0,0 +1,156 @@ +# Create your views here. + + +import base64 +import binascii +from os.path import join +import re +from urllib import unquote + +from django.conf import settings +from django.http import HttpResponse +from django.http import HttpResponseServerError + +from django.core.serializers import json +from django.utils import simplejson + +try: +    from Crypto.Cipher import AES +except: +    pass + +def local_check(function): +    def _dec(view_func): +        def _view(request, * args, ** kwargs): +            if request.META.get('REMOTE_ADDR', "0") in ('127.0.0.1','localhost') or request.META.get('HTTP_HOST','0') == '127.0.0.1:9666': +                return view_func(request, * args, ** kwargs) +            else: +                return HttpResponseServerError() + +        _view.__name__ = view_func.__name__ +        _view.__dict__ = view_func.__dict__ +        _view.__doc__ = view_func.__doc__ + +        return _view + +    if function is None: +        return _dec +    else: +        return _dec(function) + +class JsonResponse(HttpResponse): +    def __init__(self, obj, request): +        cb = request.GET.get("callback") +        if cb: +            obj = {"content": obj} +            content = simplejson.dumps(obj, indent=2, cls=json.DjangoJSONEncoder, ensure_ascii=False) +            content = "%s(%s)\r\n" % (cb, content) +            HttpResponse.__init__(self, content, content_type="application/json") +        else: +            content = "%s\r\n" % obj +            HttpResponse.__init__(self, content, content_type="text/html") +        self["Cache-Control"] = "no-cache, must-revalidate" + +@local_check +def flash(request): +    return HttpResponse("JDownloader") + +@local_check +def add(request): +    package = request.POST.get('referer', 'ClickAndLoad Package') +    urls = filter(lambda x: x != "", request.POST['urls'].split("\n")) +     +    settings.PYLOAD.add_package(package, urls, False) +     +    return HttpResponse() + +@local_check +def addcrypted(request): +     +    package = request.POST.get('referer', 'ClickAndLoad Package') +    dlc = request.POST['crypted'].replace(" ", "+") +     +    dlc_path = join(settings.DL_ROOT, package.replace("/", "").replace("\\", "").replace(":", "") + ".dlc") +    dlc_file = file(dlc_path, "wb") +    dlc_file.write(dlc) +    dlc_file.close() +     +    try: +        settings.PYLOAD.add_package(package, [dlc_path], False) +    except: +        return JsonResponse("", request) +    else: +        return JsonResponse("success", request) + +@local_check +def addcrypted2(request): + +    package = request.POST.get("source", "ClickAndLoad Package") +    crypted = request.POST["crypted"] +    jk = request.POST["jk"] +     +    crypted = base64.standard_b64decode(unquote(crypted.replace(" ", "+"))) +     +    try: +        import spidermonkey +    except: +        try: +            jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1] +        except: +            ## Test for some known js functions to decode +            if jk.find("dec") > -1 and jk.find("org") > -1: +                org = re.findall(r"var org = ('|\")([^\"']+)", jk)[0][1] +                jk = list(org) +                jk.reverse() +                jk = "".join(jk) +            else: +                print "Could not decrypt key, please install py-spidermonkey" +    else: +        rt = spidermonkey.Runtime() +        cx = rt.new_context() +        jk = cx.execute("%s f()" % jk) +         + +    Key = binascii.unhexlify(jk) +    IV = Key +     +    obj = AES.new(Key, AES.MODE_CBC, IV) +    result = obj.decrypt(crypted).replace("\x00", "").replace("\r","").split("\n") + +    result = filter(lambda x: x != "", result) + +    try: +        settings.PYLOAD.add_package(package, result, False) +    except: +        return JsonResponse("failed can't add", request) +    else: +        return JsonResponse("success", request) + +@local_check +def flashgot(request): +    if request.META['HTTP_REFERER'] != "http://localhost:9666/flashgot" and request.META['HTTP_REFERER'] != "http://127.0.0.1:9666/flashgot": +        return HttpResponseServerError() +     +    autostart = int(request.POST.get('autostart', 0)) +    package = request.POST.get('package', "FlashGot") +    urls = urls = filter(lambda x: x != "", request.POST['urls'].split("\n")) +    folder = request.POST.get('dir', None) + +    settings.PYLOAD.add_package(package, urls, autostart) +     +    return HttpResponse("") + +@local_check +def crossdomain(request): +    rep = "<?xml version=\"1.0\"?>\n" +    rep += "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\n" +    rep += "<cross-domain-policy>\n" +    rep += "<allow-access-from domain=\"*\" />\n" +    rep += "</cross-domain-policy>" +    return HttpResponse(rep) + +@local_check +def jdcheck(request): +    rep = "jdownloader=true;\n" +    rep += "var version='10629';\n" +    return HttpResponse(rep) diff --git a/core/module/web/createsuperuser.py b/core/module/web/createsuperuser.py new file mode 100644 index 000000000..0ff1d15b8 --- /dev/null +++ b/core/module/web/createsuperuser.py @@ -0,0 +1,43 @@ +""" +Management utility to create superusers. +""" + +import os +import sys + +os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' +sys.path.append(os.path.join(pypath, "module", "web")) + +import getpass +import re +from optparse import make_option +from django.contrib.auth.models import User +from django.core import exceptions +from django.core.management.base import BaseCommand, CommandError +from django.utils.translation import ugettext as _ + +RE_VALID_USERNAME = re.compile('[\w.@+-]+$') + + +def handle(username, email): +    #username = options.get('username', None) +    #email = options.get('email', None) +    interactive = False +     +    # Do quick and dirty validation if --noinput +    if not interactive: +        if not username or not email: +            raise CommandError("You must use --username and --email with --noinput.") +        if not RE_VALID_USERNAME.match(username): +            raise CommandError("Invalid username. Use only letters, digits, and underscores") + +    password = '' +    default_username = '' +     +    User.objects.create_superuser(username, email, password) +    print "Superuser created successfully." + +if __name__ == "__main__": +    username = sys.argv[1] +    email = sys.argv[2] +    handle(username, email)
\ No newline at end of file diff --git a/core/module/web/locale/de/LC_MESSAGES/django.mo b/core/module/web/locale/de/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..1bbe278a9 --- /dev/null +++ b/core/module/web/locale/de/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/de/LC_MESSAGES/django.po b/core/module/web/locale/de/LC_MESSAGES/django.po new file mode 100644 index 000000000..a6140b513 --- /dev/null +++ b/core/module/web/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,292 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:16+0000\n" +"PO-Revision-Date: 2010-03-24 15:25+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" + +#: pyload/views.py:26 +msgid "Can't connect to pyLoad. Please check your configuration and make sure pyLoad is running." +msgstr "Kann Verbindung zu pyLoad. Bitte ÃŒberprÃŒfe die Einstellungen und den Core." + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "Du hast keine Rechte um diese Seite zu betrachten." + +#: pyload/views.py:88 +msgid "Download directory not found." +msgstr "Downloadordner nicht gefunden." + +#: templates/default/base.html:21 +#: templates/default/base.html.py:184 +msgid "Webinterface" +msgstr "WeboberflÀche" + +#: templates/default/base.html:126 +msgid "Logout" +msgstr "Abmelden" + +#: templates/default/base.html:128 +msgid "Administrate" +msgstr "Administrieren" + +#: templates/default/base.html:134 +msgid "Please Login!" +msgstr "Bitte anmelden!" + +#: templates/default/base.html:146 +#: templates/default/queue.html:78 +msgid "Home" +msgstr "Start" + +#: templates/default/base.html:149 +#: templates/default/queue.html:75 +#: templates/default/queue.html.py:79 +msgid "Queue" +msgstr "Warteschlange" + +#: templates/default/base.html:151 +#: templates/default/downloads.html:20 +#: templates/default/queue.html:80 +msgid "Downloads" +msgstr "Downloads" + +#: templates/default/base.html:153 +#: templates/default/logs.html:4 +#: templates/default/queue.html:81 +msgid "Logs" +msgstr "Log" + +#: templates/default/base.html:165 +msgid "Play" +msgstr "Start" + +#: templates/default/base.html:166 +msgid "Cancel" +msgstr "Abbrechen" + +#: templates/default/base.html:167 +msgid "Stop" +msgstr "Stoppen" + +#: templates/default/base.html:168 +msgid "Add" +msgstr "HinzufÃŒgen" + +#: templates/default/base.html:174 +msgid "Speed:" +msgstr "Geschwindigkeit:" + +#: templates/default/base.html:175 +msgid "Active:" +msgstr "Aktiv:" + +#: templates/default/base.html:176 +msgid "Reload page" +msgstr "Aktualisieren" + +#: templates/default/base.html:204 +msgid "© 2008-2010 the pyLoad Team" +msgstr "© 2008-2010 das pyLoad Team" + +#: templates/default/base.html:206 +msgid "Back to top" +msgstr "Nach oben" + +#: templates/default/downloads.html:25 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "Wir empfehlen keine Dateien die gröÃer als 10MB sind von hier herunterzuladen." + +#: templates/default/home.html:198 +msgid "Active Downloads" +msgstr "Aktiv" + +#: templates/default/home.html:205 +#: templates/default/window.html:11 +msgid "Name" +msgstr "Name" + +#: templates/default/home.html:206 +msgid "Status" +msgstr "Status" + +#: templates/default/home.html:208 +msgid "Size" +msgstr "GröÃe" + +#: templates/default/home.html:209 +msgid "Progress" +msgstr "Fortschritt" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "Anmelden" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "Benutzername" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "Passwort" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "Anmeldeinformation falsch. Bitte noch einmal versuchen." + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "Du wurdest erfolgreich abgemeldet." + +#: templates/default/queue.html:105 +msgid "Folder:" +msgstr "Ordner:" + +#: templates/default/window.html:9 +#: templates/default/window.html.py:26 +msgid "Add Package" +msgstr "Paket hinzufÃŒgen" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "Links einfÃŒgen oder Container hochladen." + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "Name des neuen Pakets." + +#: templates/default/window.html:16 +msgid "Links" +msgstr "Links" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "Links hier einfÃŒgen" + +#: templates/default/window.html:21 +msgid "File" +msgstr "Datei" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "Container hochladen." + +#: templates/default/window.html:27 +msgid "Reset" +msgstr "ZurÃŒcksetzen" + +#: templates/default/collector.html:114 +#: templates/default/queue.html:104 +msgid "Delete Package" +msgstr "Paket löschen" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "Paket in Warteschlange verschieben" + +#: templates/default/collector.html:133 +#: templates/default/queue.html:121 +msgid "Delete Link" +msgstr "Link löschen" + +#: templates/default/collector.html:135 +#: templates/default/queue.html:123 +msgid "Restart Link" +msgstr "Link neustarten" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "Paket zurÃŒcksetzen" + +#: templates/default/base.html:31 +msgid "Please Enter a packagename." +msgstr "Bitte gib einen Paketnamen ein." + +#: templates/default/logs.html:34 +msgid "next" +msgstr "weiter" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "Starten" + +#: templates/default/base.html:153 +#: templates/default/collector.html:85 +#: templates/default/collector.html:86 +#: templates/default/collector.html:96 +#: templates/default/downloads.html:14 +#: templates/default/logs.html:15 +#: templates/default/queue.html:86 +#: templates/default/settings.html:15 +msgid "Collector" +msgstr "Linksammler" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "Paket neustarten" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "zurÃŒck" + +#: templates/default/base.html:162 +#: templates/default/collector.html:105 +#: templates/default/downloads.html:23 +#: templates/default/logs.html:24 +#: templates/default/queue.html:95 +#: templates/default/settings.html:4 +#: templates/default/settings.html.py:5 +#: templates/default/settings.html:24 +msgid "Config" +msgstr "Einstellungen" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "Information" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "Download:" + +#: templates/default/base.html:89 +#: templates/default/base.html.py:98 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "off" +msgstr "aus" + +#: templates/default/base.html:85 +#: templates/default/base.html.py:94 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "on" +msgstr "an" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "Zielort:" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "Reconnect:" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "warte %s" + +#~ msgid "Infos" +#~ msgstr "Infos" + diff --git a/core/module/web/locale/en/LC_MESSAGES/django.mo b/core/module/web/locale/en/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/en/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/en/LC_MESSAGES/django.po b/core/module/web/locale/en/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/en/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/es/LC_MESSAGES/django.mo b/core/module/web/locale/es/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/es/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/es/LC_MESSAGES/django.po b/core/module/web/locale/es/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/es/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/fi/LC_MESSAGES/django.mo b/core/module/web/locale/fi/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/fi/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/fi/LC_MESSAGES/django.po b/core/module/web/locale/fi/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/fi/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/fr/LC_MESSAGES/django.mo b/core/module/web/locale/fr/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/fr/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/fr/LC_MESSAGES/django.po b/core/module/web/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/fr/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/it/LC_MESSAGES/django.mo b/core/module/web/locale/it/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/it/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/it/LC_MESSAGES/django.po b/core/module/web/locale/it/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/it/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/nl/LC_MESSAGES/django.mo b/core/module/web/locale/nl/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..26edb6ad6 --- /dev/null +++ b/core/module/web/locale/nl/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/nl/LC_MESSAGES/django.po b/core/module/web/locale/nl/LC_MESSAGES/django.po new file mode 100755 index 000000000..9f6541fb9 --- /dev/null +++ b/core/module/web/locale/nl/LC_MESSAGES/django.po @@ -0,0 +1,293 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:16+0000\n" +"PO-Revision-Date: 2010-03-24 15:27+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 2.0.0\n" + +#: pyload/views.py:26 +msgid "Can't connect to pyLoad. Please check your configuration and make sure pyLoad is running." +msgstr "Kon niet verbinden met pyLoad. Kijk de configuratie na en wees zeker dat pyLoad is gestart." + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "Je hebt geen rechten om deze pagina te zien." + +#: pyload/views.py:88 +msgid "Download directory not found." +msgstr "Download map niet gevonden." + +#: templates/default/base.html:21 +#: templates/default/base.html.py:184 +msgid "Webinterface" +msgstr "Webinterface" + +#: templates/default/base.html:126 +msgid "Logout" +msgstr "Log uit" + +#: templates/default/base.html:128 +msgid "Administrate" +msgstr "Administratie" + +#: templates/default/base.html:134 +msgid "Please Login!" +msgstr "Log in alsjeblieft!" + +#: templates/default/base.html:146 +#: templates/default/queue.html:78 +msgid "Home" +msgstr "Home" + +#: templates/default/base.html:149 +#: templates/default/queue.html:75 +#: templates/default/queue.html.py:79 +msgid "Queue" +msgstr "Wachtrij" + +#: templates/default/base.html:151 +#: templates/default/downloads.html:20 +#: templates/default/queue.html:80 +msgid "Downloads" +msgstr "Downloads" + +#: templates/default/base.html:153 +#: templates/default/logs.html:4 +#: templates/default/queue.html:81 +msgid "Logs" +msgstr "Logboek" + +#: templates/default/base.html:165 +msgid "Play" +msgstr "Start" + +#: templates/default/base.html:166 +msgid "Cancel" +msgstr "Annuleer" + +#: templates/default/base.html:167 +msgid "Stop" +msgstr "Stop" + +#: templates/default/base.html:168 +msgid "Add" +msgstr "Toevoegen" + +#: templates/default/base.html:174 +msgid "Speed:" +msgstr "Snelheid:" + +#: templates/default/base.html:175 +msgid "Active:" +msgstr "Actief:" + +#: templates/default/base.html:176 +msgid "Reload page" +msgstr "Herlaad pagina" + +#: templates/default/base.html:204 +msgid "© 2008-2010 the pyLoad Team" +msgstr "© 2008-2010 the pyLoad Team" + +#: templates/default/base.html:206 +msgid "Back to top" +msgstr "Naar top" + +#: templates/default/downloads.html:25 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "Het is niet aangeraden bestanden te downloaden die groter zijn dan 10MB van uit hier." + +#: templates/default/home.html:198 +msgid "Active Downloads" +msgstr "Actieve downloads" + +#: templates/default/home.html:205 +#: templates/default/window.html:11 +msgid "Name" +msgstr "Naam" + +#: templates/default/home.html:206 +msgid "Status" +msgstr "Status" + +#: templates/default/home.html:208 +msgid "Size" +msgstr "Grote" + +#: templates/default/home.html:209 +msgid "Progress" +msgstr "Vooruitgang" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "Log in" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "Gebruikersnaam" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "Wachtwoord" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "Je gebruikersnaam en wachtwoord komen niet overeen, probeer het nog een keer." + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "Je bent succesvol uitgelogd." + +#: templates/default/queue.html:105 +msgid "Folder:" +msgstr "Map:" + +#: templates/default/window.html:9 +#: templates/default/window.html.py:26 +msgid "Add Package" +msgstr "Toevoegen Pakket" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "Plak je links of upload een DLC bestand." + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "De naam of het nieuwe pakket." + +#: templates/default/window.html:16 +msgid "Links" +msgstr "Links" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "Plak je links hier" + +#: templates/default/window.html:21 +msgid "File" +msgstr "Bestand" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "Upload een container" + +#: templates/default/window.html:27 +msgid "Reset" +msgstr "Herstart" + +#: templates/default/collector.html:114 +#: templates/default/queue.html:104 +msgid "Delete Package" +msgstr "Delete pakket" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "Stuur het pakket naar de wachtrij" + +#: templates/default/collector.html:133 +#: templates/default/queue.html:121 +msgid "Delete Link" +msgstr "Verwijder Link" + +#: templates/default/collector.html:135 +#: templates/default/queue.html:123 +msgid "Restart Link" +msgstr "Herstart Link" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "Herstart Pakket" + +#: templates/default/base.html:31 +msgid "Please Enter a packagename." +msgstr "Enter een pakketnaam." + +#: templates/default/logs.html:34 +msgid "next" +msgstr "Volgende" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "Start" + +#: templates/default/base.html:153 +#: templates/default/collector.html:85 +#: templates/default/collector.html:86 +#: templates/default/collector.html:96 +#: templates/default/downloads.html:14 +#: templates/default/logs.html:15 +#: templates/default/queue.html:86 +#: templates/default/settings.html:15 +msgid "Collector" +msgstr "Verzamelaar" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "Herstart Pakket" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "Vorige" + +#: templates/default/base.html:162 +#: templates/default/collector.html:105 +#: templates/default/downloads.html:23 +#: templates/default/logs.html:24 +#: templates/default/queue.html:95 +#: templates/default/settings.html:4 +#: templates/default/settings.html.py:5 +#: templates/default/settings.html:24 +msgid "Config" +msgstr "Configuratie" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/base.html:205 +#, fuzzy +msgid "Download:" +msgstr "Downloads" + +#: templates/default/base.html:89 +#: templates/default/base.html.py:98 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:85 +#: templates/default/base.html.py:94 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#~ msgid "Infos" +#~ msgstr "Informatie" + diff --git a/core/module/web/locale/pl/LC_MESSAGES/django.mo b/core/module/web/locale/pl/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..803ca8a68 --- /dev/null +++ b/core/module/web/locale/pl/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/pl/LC_MESSAGES/django.po b/core/module/web/locale/pl/LC_MESSAGES/django.po new file mode 100755 index 000000000..64f29d66b --- /dev/null +++ b/core/module/web/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,293 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:16+0000\n" +"PO-Revision-Date: 2010-03-24 15:27+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: pl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Pootle 2.0.0\n" + +#: pyload/views.py:26 +msgid "Can't connect to pyLoad. Please check your configuration and make sure pyLoad is running." +msgstr "Nie moÅŒna poÅÄ
czyÄ siÄ z pyLoad. ProszÄ sprawdziÄ konfiguracjÄ i upewniÄ siÄ, ÅŒe pyLoad dziaÅa." + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "Nie masz uprawnieÅ aby oglÄ
daÄ tÄ stronÄ." + +#: pyload/views.py:88 +msgid "Download directory not found." +msgstr "Katalog na pobrane pliki nie istnieje." + +#: templates/default/base.html:21 +#: templates/default/base.html.py:184 +msgid "Webinterface" +msgstr "Interfejs WWW" + +#: templates/default/base.html:126 +msgid "Logout" +msgstr "Wyloguj" + +#: templates/default/base.html:128 +msgid "Administrate" +msgstr "ZarzÄ
dzaj" + +#: templates/default/base.html:134 +msgid "Please Login!" +msgstr "ProszÄ siÄ zalogowaÄ!" + +#: templates/default/base.html:146 +#: templates/default/queue.html:78 +msgid "Home" +msgstr "Home" + +#: templates/default/base.html:149 +#: templates/default/queue.html:75 +#: templates/default/queue.html.py:79 +msgid "Queue" +msgstr "Kolejka" + +#: templates/default/base.html:151 +#: templates/default/downloads.html:20 +#: templates/default/queue.html:80 +msgid "Downloads" +msgstr "Pobrane" + +#: templates/default/base.html:153 +#: templates/default/logs.html:4 +#: templates/default/queue.html:81 +msgid "Logs" +msgstr "Logi" + +#: templates/default/base.html:165 +msgid "Play" +msgstr "Start" + +#: templates/default/base.html:166 +msgid "Cancel" +msgstr "Anuluj" + +#: templates/default/base.html:167 +msgid "Stop" +msgstr "Zatrzymaj" + +#: templates/default/base.html:168 +msgid "Add" +msgstr "Dodaj" + +#: templates/default/base.html:174 +msgid "Speed:" +msgstr "PrÄdkoÅÄ:" + +#: templates/default/base.html:175 +msgid "Active:" +msgstr "Aktywny:" + +#: templates/default/base.html:176 +msgid "Reload page" +msgstr "OdÅwieÅŒ stronÄ" + +#: templates/default/base.html:204 +msgid "© 2008-2010 the pyLoad Team" +msgstr "© 2008-2010 ZespóŠpyLoad" + +#: templates/default/base.html:206 +msgid "Back to top" +msgstr "PoczÄ
tek strony" + +#: templates/default/downloads.html:25 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "Nie zaleca siÄ pobierania stÄ
d plików wiÄkszych niÅŒ 10MB." + +#: templates/default/home.html:198 +msgid "Active Downloads" +msgstr "Obecnie pobierane" + +#: templates/default/home.html:205 +#: templates/default/window.html:11 +msgid "Name" +msgstr "Nazwa" + +#: templates/default/home.html:206 +msgid "Status" +msgstr "Stan" + +#: templates/default/home.html:208 +msgid "Size" +msgstr "Rozmiar" + +#: templates/default/home.html:209 +msgid "Progress" +msgstr "PostÄp" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "Zaloguj" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "UÅŒytkownik" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "HasÅo" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "NieprawidÅowy uÅŒytkownik lub hasÅo. ProszÄ spróbowaÄ ponownie." + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "Wylogowano pomyÅlnie." + +#: templates/default/queue.html:105 +msgid "Folder:" +msgstr "Katalog:" + +#: templates/default/window.html:9 +#: templates/default/window.html.py:26 +msgid "Add Package" +msgstr "Dodaj paczkÄ" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "Wklej linki lub zaÅaduj kontener." + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "Nazwa paczki." + +#: templates/default/window.html:16 +msgid "Links" +msgstr "Linki" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "Tutaj wklej swoje linki" + +#: templates/default/window.html:21 +msgid "File" +msgstr "Plik" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "ZaÅaduj kontener." + +#: templates/default/window.html:27 +msgid "Reset" +msgstr "WyczyÅÄ" + +#: templates/default/collector.html:114 +#: templates/default/queue.html:104 +msgid "Delete Package" +msgstr "UsuÅ paczkÄ" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "Dodaj paczkÄ do kolejki" + +#: templates/default/collector.html:133 +#: templates/default/queue.html:121 +msgid "Delete Link" +msgstr "UsuÅ link" + +#: templates/default/collector.html:135 +#: templates/default/queue.html:123 +msgid "Restart Link" +msgstr "Zrestartuj link" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "Zresetuj paczkÄ" + +#: templates/default/base.html:31 +msgid "Please Enter a packagename." +msgstr "Podaj nazwÄ paczki" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "nastÄpny" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "Start" + +#: templates/default/base.html:153 +#: templates/default/collector.html:85 +#: templates/default/collector.html:86 +#: templates/default/collector.html:96 +#: templates/default/downloads.html:14 +#: templates/default/logs.html:15 +#: templates/default/queue.html:86 +#: templates/default/settings.html:15 +msgid "Collector" +msgstr "Zbieracz" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "Zrestartuj paczkÄ" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "poprzedni" + +#: templates/default/base.html:162 +#: templates/default/collector.html:105 +#: templates/default/downloads.html:23 +#: templates/default/logs.html:24 +#: templates/default/queue.html:95 +#: templates/default/settings.html:4 +#: templates/default/settings.html.py:5 +#: templates/default/settings.html:24 +msgid "Config" +msgstr "Konfiguracja" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/base.html:205 +#, fuzzy +msgid "Download:" +msgstr "Pobrane" + +#: templates/default/base.html:89 +#: templates/default/base.html.py:98 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:85 +#: templates/default/base.html.py:94 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#~ msgid "Infos" +#~ msgstr "Informacje" + diff --git a/core/module/web/locale/ro/LC_MESSAGES/django.mo b/core/module/web/locale/ro/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/ro/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/ro/LC_MESSAGES/django.po b/core/module/web/locale/ro/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/ro/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/ru/LC_MESSAGES/django.mo b/core/module/web/locale/ru/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..3fb287c3d --- /dev/null +++ b/core/module/web/locale/ru/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/ru/LC_MESSAGES/django.po b/core/module/web/locale/ru/LC_MESSAGES/django.po new file mode 100644 index 000000000..f4f85013b --- /dev/null +++ b/core/module/web/locale/ru/LC_MESSAGES/django.po @@ -0,0 +1,277 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-03-24 13:54+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + +#: pyload/views.py:26 +msgid "" +"Can't connect to pyLoad. Please check your configuration and make sure " +"pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:86 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 templates/default/base.html.py:217 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:33 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/base.html:85 templates/default/base.html.py:94 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/base.html:89 templates/default/base.html.py:98 +#: templates/default/base.html:205 templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:149 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:151 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:157 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:169 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 +msgid "Home" +msgstr "" + +#: templates/default/base.html:172 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 +#: templates/default/window.html:29 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:175 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +#: templates/default/window.html:31 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:178 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:181 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:184 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:196 +msgid "Play" +msgstr "" + +#: templates/default/base.html:197 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:198 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:199 +msgid "Add" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: templates/default/base.html:207 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:208 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:209 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:237 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:239 +msgid "Back to top" +msgstr "" + +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:192 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:199 templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:200 +msgid "Status" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/home.html:202 +msgid "Size" +msgstr "" + +#: templates/default/home.html:203 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/window.html:9 templates/default/window.html.py:35 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/window.html:36 +msgid "Reset" +msgstr "" diff --git a/core/module/web/locale/tr/LC_MESSAGES/django.mo b/core/module/web/locale/tr/LC_MESSAGES/django.mo Binary files differnew file mode 100644 index 000000000..f3f56a4cb --- /dev/null +++ b/core/module/web/locale/tr/LC_MESSAGES/django.mo diff --git a/core/module/web/locale/tr/LC_MESSAGES/django.po b/core/module/web/locale/tr/LC_MESSAGES/django.po new file mode 100755 index 000000000..2c65bd38c --- /dev/null +++ b/core/module/web/locale/tr/LC_MESSAGES/django.po @@ -0,0 +1,287 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2010-02-03 15:16+0000\n" +"PO-Revision-Date: 2010-03-24 15:25+0100\n" +"Last-Translator: bauerj <jhnn.br@gmail.com>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Translate Toolkit 1.5.1\n" + +#: pyload/views.py:26 +msgid "Can't connect to pyLoad. Please check your configuration and make sure pyLoad is running." +msgstr "" + +#: pyload/views.py:47 +msgid "You don't have permission to view this page." +msgstr "" + +#: pyload/views.py:88 +msgid "Download directory not found." +msgstr "" + +#: templates/default/base.html:21 +#: templates/default/base.html.py:184 +msgid "Webinterface" +msgstr "" + +#: templates/default/base.html:126 +msgid "Logout" +msgstr "" + +#: templates/default/base.html:128 +msgid "Administrate" +msgstr "" + +#: templates/default/base.html:134 +msgid "Please Login!" +msgstr "" + +#: templates/default/base.html:146 +#: templates/default/queue.html:78 +msgid "Home" +msgstr "" + +#: templates/default/base.html:149 +#: templates/default/queue.html:75 +#: templates/default/queue.html.py:79 +msgid "Queue" +msgstr "" + +#: templates/default/base.html:151 +#: templates/default/downloads.html:20 +#: templates/default/queue.html:80 +msgid "Downloads" +msgstr "" + +#: templates/default/base.html:153 +#: templates/default/logs.html:4 +#: templates/default/queue.html:81 +msgid "Logs" +msgstr "" + +#: templates/default/base.html:165 +msgid "Play" +msgstr "" + +#: templates/default/base.html:166 +msgid "Cancel" +msgstr "" + +#: templates/default/base.html:167 +msgid "Stop" +msgstr "" + +#: templates/default/base.html:168 +msgid "Add" +msgstr "" + +#: templates/default/base.html:174 +msgid "Speed:" +msgstr "" + +#: templates/default/base.html:175 +msgid "Active:" +msgstr "" + +#: templates/default/base.html:176 +msgid "Reload page" +msgstr "" + +#: templates/default/base.html:204 +msgid "© 2008-2010 the pyLoad Team" +msgstr "" + +#: templates/default/base.html:206 +msgid "Back to top" +msgstr "" + +#: templates/default/downloads.html:25 +msgid "It's recommend not to download Files bigger than ~10MB from here." +msgstr "" + +#: templates/default/home.html:198 +msgid "Active Downloads" +msgstr "" + +#: templates/default/home.html:205 +#: templates/default/window.html:11 +msgid "Name" +msgstr "" + +#: templates/default/home.html:206 +msgid "Status" +msgstr "" + +#: templates/default/home.html:208 +msgid "Size" +msgstr "" + +#: templates/default/home.html:209 +msgid "Progress" +msgstr "" + +#: templates/default/login.html:4 +msgid "Login" +msgstr "" + +#: templates/default/login.html:15 +msgid "Username" +msgstr "" + +#: templates/default/login.html:20 +msgid "Password" +msgstr "" + +#: templates/default/login.html:30 +msgid "Your username and password didn't match. Please try again." +msgstr "" + +#: templates/default/logout.html:9 +msgid "You were successfully logged out." +msgstr "" + +#: templates/default/queue.html:105 +msgid "Folder:" +msgstr "" + +#: templates/default/window.html:9 +#: templates/default/window.html.py:26 +msgid "Add Package" +msgstr "" + +#: templates/default/window.html:10 +msgid "Paste your links or upload a container." +msgstr "" + +#: templates/default/window.html:12 +msgid "The name of the new package." +msgstr "" + +#: templates/default/window.html:16 +msgid "Links" +msgstr "" + +#: templates/default/window.html:17 +msgid "Paste your links here" +msgstr "" + +#: templates/default/window.html:21 +msgid "File" +msgstr "" + +#: templates/default/window.html:22 +msgid "Upload a container." +msgstr "" + +#: templates/default/window.html:27 +msgid "Reset" +msgstr "" + +#: templates/default/collector.html:114 +#: templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:133 +#: templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 +#: templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/base.html:31 +msgid "Please Enter a packagename." +msgstr "" + +#: templates/default/logs.html:34 +msgid "next" +msgstr "" + +#: templates/default/logs.html:34 +msgid "Start" +msgstr "" + +#: templates/default/base.html:153 +#: templates/default/collector.html:85 +#: templates/default/collector.html:86 +#: templates/default/collector.html:96 +#: templates/default/downloads.html:14 +#: templates/default/logs.html:15 +#: templates/default/queue.html:86 +#: templates/default/settings.html:15 +msgid "Collector" +msgstr "" + +#: templates/default/queue.html:106 +msgid "Restart Package" +msgstr "" + +#: templates/default/logs.html:34 +msgid "prev" +msgstr "" + +#: templates/default/base.html:162 +#: templates/default/collector.html:105 +#: templates/default/downloads.html:23 +#: templates/default/logs.html:24 +#: templates/default/queue.html:95 +#: templates/default/settings.html:4 +#: templates/default/settings.html.py:5 +#: templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/home.html:201 +msgid "Information" +msgstr "" + +#: templates/default/base.html:205 +msgid "Download:" +msgstr "" + +#: templates/default/base.html:89 +#: templates/default/base.html.py:98 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "off" +msgstr "" + +#: templates/default/base.html:85 +#: templates/default/base.html.py:94 +#: templates/default/base.html:205 +#: templates/default/base.html.py:206 +msgid "on" +msgstr "" + +#: templates/default/window.html:26 +msgid "Destination" +msgstr "" + +#: templates/default/base.html:206 +msgid "Reconnect:" +msgstr "" + +#: ajax/views.py:110 +#, python-format +msgid "waiting %s" +msgstr "" + diff --git a/core/module/web/manage.py b/core/module/web/manage.py new file mode 100755 index 000000000..34b964ffc --- /dev/null +++ b/core/module/web/manage.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from django.core.management import execute_manager + +try: +    import settings # Assumed to be in the same directory. +except ImportError: +    import sys +    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) +    sys.exit(1) + +if __name__ == "__main__": +    execute_manager(settings)
\ No newline at end of file diff --git a/core/module/web/media/default/css/default.css b/core/module/web/media/default/css/default.css new file mode 100644 index 000000000..9d2ca1a14 --- /dev/null +++ b/core/module/web/media/default/css/default.css @@ -0,0 +1,1683 @@ +div.no {
 +	display:inline;
 +	margin:0;
 +	padding:0;
 +}
 +.hidden {
 +	display:none;
 +}
 +div.error {
 +	background:#fcc url(media/img/default/error.png) 0.5em 0px no-repeat;
 +	color:#000;
 +	border-bottom:1px solid #faa;
 +	font-size:90%;
 +	margin:0;
 +	padding-left:3em;
 +	overflow:hidden;
 +}
 +div.info {
 +	background:#ccf url(static/default/info.png) 0.5em 0px no-repeat;
 +	color:#000;
 +	border-bottom:1px solid #aaf;
 +	font-size:90%;
 +	margin:0;
 +	padding-left:3em;
 +	overflow:hidden;
 +}
 +div.success {
 +	background:#cfc url(static/default/success.png) 0.5em 0px no-repeat;
 +	color:#000;
 +	border-bottom:1px solid #afa;
 +	font-size:90%;
 +	margin:0;
 +	padding-left:3em;
 +	overflow:hidden;
 +}
 +div.notify {
 +	background:#ffc url(media/img/default/notify.png) 0.5em 0px no-repeat;
 +	color:#000;
 +	border-bottom:1px solid #ffa;
 +	font-size:90%;
 +	margin:0;
 +	padding-left:3em;
 +	overflow:hidden;
 +}
 +.medialeft {
 +	float:left;
 +}
 +.mediaright {
 +	float:right;
 +}
 +.mediacenter {
 +	display:block;
 +	margin-left:auto;
 +	margin-right:auto;
 +}
 +.leftalign {
 +	text-align:left;
 +}
 +.centeralign {
 +	text-align:center;
 +}
 +.rightalign {
 +	text-align:right;
 +}
 +em.u {
 +	font-style:normal;
 +	text-decoration:underline;
 +}
 +em em.u {
 +	font-style:italic;
 +}
 +.code .br0 {
 +	color:#6c6;
 +}
 +.code .co1 {
 +	color:#808080;
 +	font-style:italic;
 +}
 +.code .co2 {
 +	color:#808080;
 +	font-style:italic;
 +}
 +.code .co3 {
 +	color:#808080;
 +}
 +.code .coMULTI {
 +	color:#808080;
 +	font-style:italic;
 +}
 +.code .es0 {
 +	color:#009;
 +	font-weight:bold;
 +}
 +.code .kw1 {
 +	color:#b1b100;
 +}
 +.code .kw2 {
 +	color:#000;
 +	font-weight:bold;
 +}
 +.code .kw3 {
 +	color:#006;
 +}
 +.code .kw4 {
 +	color:#933;
 +}
 +.code .kw5 {
 +	color:#00f;
 +}
 +.code .me1 {
 +	color:#060;
 +}
 +.code .me2 {
 +	color:#060;
 +}
 +.code .nu0 {
 +	color:#c6c;
 +}
 +.code .re0 {
 +	color:#00f;
 +}
 +.code .re1 {
 +	color:#00f;
 +}
 +.code .re2 {
 +	color:#00f;
 +}
 +.code .re3 {
 +	color:#f33;
 +	font-weight:bold;
 +}
 +.code .re4 {
 +	color:#099;
 +}
 +.code .st0 {
 +	color:#f00;
 +}
 +.code .sy0 {
 +	color:#6c6;
 +}
 +div.dokuwiki table.pagelist, div.dokuwiki table.ul {
 +	border:0;
 +	padding:0;
 +	border-spacing:0;
 +	margin-bottom:1em;
 +	border-collapse:collapse;
 +}
 +div.dokuwiki table.pagelist tr {
 +	border-top:1px solid #8cacbb;
 +	border-bottom:1px solid #8cacbb;
 +}
 +div.dokuwiki table.pagelist th, div.dokuwiki table.pagelist td {
 +	padding:1px 1em 1px 0;
 +}
 +div.dokuwiki table.ul th, div.dokuwiki table.ul td {
 +	padding:0 1em 0 0;
 +}
 +div.dokuwiki table.ul ul {
 +	margin:0 0 0 1.5em;
 +}
 +div.dokuwiki table.pagelist th, div.dokuwiki table.ul th {
 +	background-color:#dee7ec;
 +}
 +div.dokuwiki th.page, div.dokuwiki th.date, div.dokuwiki th.user, div.dokuwiki th.desc, div.dokuwiki th.comments, div.dokuwiki th.linkbacks, div.dokuwiki th.tags, div.dokuwiki td.date, div.dokuwiki td.user, div.dokuwiki td.desc, div.dokuwiki td.comments, div.dokuwiki td.linkbacks, div.dokuwiki td.tags {
 +	color:#666;
 +	font-size:80%;
 +}
 +div.dokuwiki td.date {
 +	text-align:right;
 +}
 +div.dokuwiki div.include div.secedit {
 +	float:right;
 +	margin-left:1em;
 +	margin-top:-18px;
 +}
 +div.dokuwiki div.inclmeta {
 +	border-top:1px dotted #8cacbb;
 +	padding-top:0.2em;
 +	color:#666;
 +	font-size:80%;
 +	line-height:1.25;
 +	margin-top:0.5em;
 +	margin-bottom:2em;
 +}
 +div.dokuwiki div.inclmeta a.permalink {
 +	background:transparent url(media/img/default/link.gif) 0px 1px no-repeat;
 +	padding:1px 0px 1px 16px;
 +}
 +div.dokuwiki div.inclmeta abbr.published {
 +	background:transparent url(media/img/default/date.gif) 0px 1px no-repeat;
 +	padding:1px 0px 1px 16px;
 +	border-bottom:0;
 +}
 +div.dokuwiki div.inclmeta span.author {
 +	background:transparent url(media/img/default/user.gif) 0px 1px no-repeat;
 +	padding:1px 0px 1px 16px;
 +}
 +div.dokuwiki div.inclmeta span.comment {
 +	background:transparent url(media/img/default/comment.gif) 0px 1px no-repeat;
 +	padding:1px 0px 1px 16px;
 +}
 +div.dokuwiki div.inclmeta div.tags {
 +	border-top:0;
 +	font-size:100%;
 +	float:right;
 +	clear:none;
 +}
 +#plugin__manager {
 +}
 +#plugin__manager h2 {
 +	margin-left:0;
 +}
 +#plugin__manager form {
 +	display:block;
 +	margin:0;
 +	padding:0;
 +}
 +#plugin__manager legend {
 +	display:none;
 +}
 +#plugin__manager fieldset {
 +	width:auto;
 +}
 +#plugin__manager .button {
 +	margin:0;
 +}
 +#plugin__manager p, #plugin__manager label {
 +	text-align:left;
 +}
 +#plugin__manager .hidden {
 +	display:none;
 +}
 +#plugin__manager .new {
 +	background:#dee7ec;
 +}
 +#plugin__manager input[disabled] {
 +	color:#ccc;
 +	border-color:#ccc;
 +}
 +#plugin__manager .pm_menu, #plugin__manager .pm_info {
 +	margin-left:0;
 +	text-align:left;
 +}
 +#plugin__manager .pm_menu {
 +	float:left;
 +	width:48%;
 +}
 +#plugin__manager .pm_info {
 +	float:right;
 +	width:50%;
 +}
 +#plugin__manager .common {
 +}
 +#plugin__manager .common form {
 +}
 +#plugin__manager .common fieldset {
 +	margin:0;
 +	padding:0 0 1.0em 0;
 +	text-align:left;
 +	border:none;
 +}
 +#plugin__manager .common label {
 +	padding:0 0 0.5em 0;
 +}
 +#plugin__manager .common input {
 +}
 +#plugin__manager .common input.edit {
 +	width:24em;
 +	margin:0.5em;
 +}
 +#plugin__manager .common .button {
 +}
 +#plugin__manager form.plugins {
 +}
 +#plugin__manager .plugins fieldset {
 +	color:#000;
 +	background:#fff;
 +	text-align:right;
 +	border-top:none;
 +	border-right:none;
 +	border-left:none;
 +}
 +#plugin__manager .plugins fieldset.protected {
 +	background:#fdd;
 +	color:#000;
 +}
 +#plugin__manager .plugins fieldset.disabled {
 +	background:#e0e0e0;
 +	color:#a8a8a8;
 +}
 +#plugin__manager .plugins .legend {
 +	color:#000;
 +	background:inherit;
 +	display:block;
 +	margin:0;
 +	padding:0;
 +	font-size:1em;
 +	line-height:1.4em;
 +	font-weight:normal;
 +	text-align:left;
 +	float:left;
 +	padding:0;
 +	clear:none;
 +}
 +#plugin__manager .plugins .button {
 +	font-size:95%;
 +}
 +#plugin__manager .plugins fieldset.buttons {
 +	border:none;
 +}
 +#plugin__manager .plugins fieldset.buttons .button {
 +	float:left;
 +}
 +#plugin__manager .pm_info h3 {
 +	margin-left:0;
 +}
 +#plugin__manager .pm_info dl {
 +	margin:1em 0;
 +	padding:0;
 +}
 +#plugin__manager .pm_info dt {
 +	width:6em;
 +	float:left;
 +	clear:left;
 +	margin:0;
 +	padding:0;
 +}
 +#plugin__manager .pm_info dd {
 +	margin:0 0 0 7em;
 +	padding:0;
 +	background:none;
 +}
 +#plugin__manager .plugins .enable {
 +	float:left;
 +	width:auto;
 +	margin-right:0.5em;
 +}
 +#config__manager div.success, #config__manager div.error, #config__manager div.info {
 +	background-position:0.5em;
 +	padding:0.5em;
 +	text-align:center;
 +}
 +#config__manager fieldset {
 +	margin:1em;
 +	width:auto;
 +	margin-bottom:2em;
 +	background-color:#dee7ec;
 +	color:#000;
 +	padding:0 1em;
 +}
 +#config__manager legend {
 +	font-size:1.25em;
 +}
 +#config__manager form {
 +}
 +#config__manager table {
 +	margin:1em 0;
 +	width:100%;
 +}
 +#config__manager fieldset td {
 +	text-align:left;
 +}
 +#config__manager fieldset td.value {
 +	width:31em;
 +}
 +#config__manager td.label {
 +	padding:0.8em 0 0.6em 1em;
 +	vertical-align:top;
 +}
 +#config__manager td.label label {
 +	clear:left;
 +	display:block;
 +}
 +#config__manager td.label img {
 +	padding:0 10px;
 +	vertical-align:middle;
 +	float:right;
 +}
 +#config__manager td.label span.outkey {
 +	font-size:70%;
 +	margin-top:-1.7em;
 +	margin-left:-1em;
 +	display:block;
 +	background-color:#fff;
 +	color:#666;
 +	float:left;
 +	padding:0 0.1em;
 +	position:relative;
 +	z-index:1;
 +}
 +#config__manager td input.edit {
 +	width:30em;
 +}
 +#config__manager td .input {
 +	width:30.8em;
 +}
 +#config__manager td select.edit {
 +}
 +#config__manager td textarea.edit {
 +	width:27.5em;
 +	height:4em;
 +}
 +#config__manager tr .input, #config__manager tr input, #config__manager tr textarea, #config__manager tr select {
 +	background-color:#fff;
 +	color:#000;
 +}
 +#config__manager tr.default .input, #config__manager tr.default input, #config__manager tr.default textarea, #config__manager tr.default select, #config__manager .selectiondefault {
 +	background-color:#cdf;
 +	color:#000;
 +}
 +#config__manager tr.protected .input, #config__manager tr.protected input, #config__manager tr.protected textarea, #config__manager tr.protected select, #config__manager tr.protected .selection {
 +	background-color:#fcc!important;
 +	color:#000 !important;
 +}
 +#config__manager td.error {
 +	background-color:red;
 +	color:#000;
 +}
 +#config__manager .selection {
 +	width:14.8em;
 +	float:left;
 +	margin:0 0.3em 2px 0;
 +}
 +#config__manager .selection label {
 +	float:right;
 +	width:14em;
 +	font-size:90%;
 +}
 +* html #config__manager .selection label {
 +	padding-top:2px;
 +}
 +#config__manager .selection input.checkbox {
 +	padding-left:0.7em;
 +}
 +#config__manager .other {
 +	clear:both;
 +	padding-top:0.5em;
 +}
 +#config__manager .other label {
 +	padding-left:2px;
 +	font-size:90%;
 +}
 +.dokuwiki div.plugin_translation {
 +	float:right;
 +	font-size:95%;
 +}
 +.dokuwiki div.plugin_translation ul {
 +	display:inline;
 +	padding:0;
 +	margin:0;
 +}
 +.dokuwiki div.plugin_translation ul li {
 +	float:left;
 +	list-style-type:none;
 +	padding:0;
 +	margin:0;
 +}
 +.dokuwiki div.plugin_translation ul li a.wikilink1:link, .dokuwiki div.plugin_translation ul li a.wikilink1:hover, .dokuwiki div.plugin_translation ul li a.wikilink1:active, .dokuwiki div.plugin_translation ul li a.wikilink1:visited {
 +	background-color:#000080;
 +	color:#fff !important;
 +	text-decoration:none;
 +	padding:0 0.2em;
 +	margin:0.1em 0.2em;
 +	border:none !important;
 +}
 +.dokuwiki div.plugin_translation ul li a.wikilink2:link, .dokuwiki div.plugin_translation ul li a.wikilink2:hover, .dokuwiki div.plugin_translation ul li a.wikilink2:active, .dokuwiki div.plugin_translation ul li a.wikilink2:visited {
 +	background-color:#808080;
 +	color:#fff !important;
 +	text-decoration:none;
 +	padding:0 0.2em;
 +	margin:0.1em 0.2em;
 +	border:none !important;
 +}
 +.dokuwiki div.plugin_translation ul li a img {
 +	opacity:0.5;
 +	border:0;
 +}
 +.dokuwiki div.plugin_translation ul li a.wikilink2 img {
 +}
 +.dokuwiki div.plugin_translation span.curid a img {
 +	opacity:1.0;
 +	height:15px;
 +}
 +.dokuwiki div.plugin_translation ul li a:hover img {
 +	opacity:1.0;
 +	height:15px;
 +}
 +#user__manager tr.disabled {
 +	color:#6f6f6f;
 +	background:#e4e4e4;
 +}
 +#user__manager tr.user_info {
 +	vertical-align:top;
 +}
 +#user__manager div.edit_user {
 +	width:46%;
 +	float:left;
 +}
 +#user__manager table {
 +	margin-bottom:1em;
 +}
 +#user__manager input.button[disabled] {
 +	color:#ccc!important;
 +	border-color:#ccc!important;
 +}
 +div.dokuwiki div.newentry_form {
 +	clear:both;
 +	text-align:center;
 +	margin-bottom:1em;
 +}
 +div.dokuwiki #blog__newentry_form input.edit {
 +	width:95%;
 +}
 +div.dokuwiki tr.draft, div.dokuwiki div.draft {
 +	opacity:0.5;
 +}
 +div.dokuwiki div.autoarchive_selector ul {
 +	list-style-type:none;
 +	clear:left;
 +	margin:0 0.5em 0 0;
 +}
 +div.dokuwiki div.autoarchive_selector ul div.li {
 +	float:left;
 +	margin:0 1em 0 0;
 +}
 +div.dokuwiki div.autoarchive_selector ul ul {
 +	float:left;
 +	clear:none;
 +}
 +div.dokuwiki div.autoarchive_selector ul ul div.li {
 +	margin:0;
 +}
 +div#acl_manager div#acl__tree {
 +	font-size:90%;
 +	width:25%;
 +	height:300px;
 +	float:left;
 +	overflow:auto;
 +	border:1px solid #8cacbb;
 +	text-align:left;
 +}
 +div#acl_manager div#acl__tree a.cur {
 +	background-color:#ff9;
 +	font-weight:bold;
 +}
 +div#acl_manager div#acl__tree ul {
 +	list-style-type:none;
 +	margin:0;
 +	padding:0;
 +}
 +div#acl_manager div#acl__tree li {
 +	padding-left:1em;
 +}
 +div#acl_manager div#acl__tree ul img {
 +	margin-right:0.25em;
 +	cursor:pointer;
 +}
 +div#acl_manager div#acl__detail {
 +	width:73%;
 +	height:300px;
 +	float:right;
 +	overflow:auto;
 +}
 +div#acl_manager div#acl__detail fieldset {
 +	width:90%;
 +}
 +div#acl_manager div#acl__detail div#acl__user {
 +	border:1px solid #8cacbb;
 +	padding:0.5em;
 +	margin-bottom:0.6em;
 +}
 +div#acl_manager table.inline {
 +	width:100%;
 +	margin:0;
 +}
 +div#acl_manager .aclgroup {
 +	background:transparent url(media/img/default/group.png) 0px 1px no-repeat;
 +	padding:1px 0px 1px 18px;
 +}
 +div#acl_manager .acluser {
 +	background:transparent url(media/img/default/user.png) 0px 1px no-repeat;
 +	padding:1px 0px 1px 18px;
 +}
 +div#acl_manager .aclpage {
 +	background:transparent url(media/img/default/page.png) 0px 1px no-repeat;
 +	padding:1px 0px 1px 18px;
 +}
 +div#acl_manager .aclns {
 +	background:transparent url(media/img/default/ns.png) 0px 1px no-repeat;
 +	padding:1px 0px 1px 18px;
 +}
 +div#acl_manager label.disabled {
 +	color:#666!important;
 +}
 +#acl_manager label {
 +	text-align:left;
 +	font-weight:normal;
 +	display:inline;
 +}
 +#acl_manager table {
 +	margin-left:10%;
 +	width:80%;
 +}
 +#acl_manager table tr {
 +	background-color:inherit;
 +}
 +#acl_manager table tr:hover {
 +	background-color:#dee7ec;
 +}
 +a.interwiki {
 +	background:transparent url(/lib/images/interwiki.png) 0px 1px no-repeat;
 +	padding-left:16px;
 +}
 +a.iw_wp {
 +	background-image:url(/media/default/img/wp.gif)
 +}
 +a.iw_wpde {
 +	background-image:url(/media/default/img/wpde.gif)
 +}
 +a.iw_wpmeta {
 +	background-image:url(/media/default/img/wpmeta.gif)
 +}
 +a.iw_doku {
 +	background-image:url(/media/default/img/doku.gif)
 +}
 +a.iw_dokubug {
 +	background-image:url(/media/default/img/dokubug.gif)
 +}
 +a.iw_amazon {
 +	background-image:url(/media/default/img/amazon.gif)
 +}
 +a.iw_amazon_de {
 +	background-image:url(/media/default/img/amazon.de.gif)
 +}
 +a.iw_amazon_uk {
 +	background-image:url(/media/default/img/amazon.uk.gif)
 +}
 +a.iw_phpfn {
 +	background-image:url(/media/default/img/phpfn.gif)
 +}
 +a.iw_coral {
 +	background-image:url(/media/default/img/coral.gif)
 +}
 +a.iw_sb {
 +	background-image:url(/media/default/img/sb.gif)
 +}
 +a.iw_google {
 +	background-image:url(/media/default/img/google.gif)
 +}
 +a.iw_meatball {
 +	background-image:url(/media/default/img/meatball.gif)
 +}
 +a.iw_wiki {
 +	background-image:url(/media/default/img/wiki.gif)
 +}
 +a.mediafile {
 +	background:transparent url(/media/default/img/file.png) 0px 1px no-repeat;
 +	padding-left:18px;
 +	padding-bottom:1px;
 +}
 +a.mf_jpg {
 +	background-image:url(/media/default/img/jpg.png)
 +}
 +a.mf_jpeg {
 +	background-image:url(/media/default/img/jpeg.png)
 +}
 +a.mf_gif {
 +	background-image:url(/media/default/img/gif.png)
 +}
 +a.mf_png {
 +	background-image:url(/media/default/img/png.png)
 +}
 +a.mf_tgz {
 +	background-image:url(/media/default/img/tgz.png)
 +}
 +a.mf_tar {
 +	background-image:url(/media/default/img/tar.png)
 +}
 +a.mf_gz {
 +	background-image:url(/media/default/img/gz.png)
 +}
 +a.mf_bz2 {
 +	background-image:url(/media/default/img/bz2.png)
 +}
 +a.mf_zip {
 +	background-image:url(/media/default/img/zip.png)
 +}
 +a.mf_rar {
 +	background-image:url(/media/default/img/rar.png)
 +}
 +a.mf_pdf {
 +	background-image:url(/media/default/img/pdf.png)
 +}
 +a.mf_ps {
 +	background-image:url(/media/default/img/ps.png)
 +}
 +a.mf_doc {
 +	background-image:url(/media/default/img/doc.png)
 +}
 +a.mf_xls {
 +	background-image:url(/media/default/img/xls.png)
 +}
 +a.mf_ppt {
 +	background-image:url(/media/default/img/ppt.png)
 +}
 +a.mf_rtf {
 +	background-image:url(/media/default/img/rtf.png)
 +}
 +a.mf_swf {
 +	background-image:url(/media/default/img/swf.png)
 +}
 +a.mf_rpm {
 +	background-image:url(/media/default/img/rpm.png)
 +}
 +a.mf_deb {
 +	background-image:url(/media/default/img/deb.png)
 +}
 +a.mf_sxw {
 +	background-image:url(/media/default/img/sxw.png)
 +}
 +a.mf_sxc {
 +	background-image:url(/media/default/img/sxc.png)
 +}
 +a.mf_sxi {
 +	background-image:url(/media/default/img/sxi.png)
 +}
 +a.mf_sxd {
 +	background-image:url(/media/default/img/sxd.png)
 +}
 +a.mf_odc {
 +	background-image:url(/media/default/img/odc.png)
 +}
 +a.mf_odf {
 +	background-image:url(/media/default/img/odf.png)
 +}
 +a.mf_odg {
 +	background-image:url(/media/default/img/odg.png)
 +}
 +a.mf_odi {
 +	background-image:url(/media/default/img/odi.png)
 +}
 +a.mf_odp {
 +	background-image:url(/media/default/img/odp.png)
 +}
 +a.mf_ods {
 +	background-image:url(/media/default/img/ods.png)
 +}
 +a.mf_odt {
 +	background-image:url(/media/default/img/odt.png)
 +}
 +body {
 +	margin:0px;
 +	padding:0px;
 +	background-color:white;
 +	color:black;
 +	font-size:12px;
 +	font-family:Verdana, Helvetica, "Lucida Grande", Lucida, Arial, sans-serif;
 +	font-family:sans-serif;
 +	font-size:99, 96%;
 +	font-size-adjust:none;
 +	font-style:normal;
 +	font-variant:normal;
 +	font-weight:normal;
 +	line-height:normal;
 +}
 +hr {
 +	border-width:0px;
 +	border-bottom:1px #aaa dotted;
 +}
 +img {
 +	border:none;
 +}
 +form {
 +	margin:0px;
 +	padding:0px;
 +	border:none;
 +	display:inline;
 +	background:transparent;
 +}
 +ul li {
 +	margin:5px;
 +}
 +textarea {
 +	font-family:monospace;
 +}
 +table {
 +	margin:0.5em 0;
 +	border-collapse:collapse;
 +}
 +td {
 +	padding:0.25em;
 +	border:1pt solid #ADB9CC;
 +}
 +a {
 +	color:#3465a4;
 +	text-decoration:none;
 +}
 +a:hover {
 +	text-decoration:underline;
 +}
 +a.wikilink2 {
 +	color:#a40000 !important;
 +}
 +.dokuwiki h1 a, .dokuwiki h2 a, .dokuwiki h3 a, .dokuwiki h4 a, .dokuwiki h5 a, .dokuwiki a.nolink {
 +	color:#000 !important;
 +	text-decoration:none !important;
 +}
 +option {
 +	border:0px none #fff;
 +}
 +strong.highlight {
 +	background-color:#fc9;
 +	padding:1pt;
 +}
 +#pagebottom {
 +	clear:both;
 +}
 +hr {
 +	height:1px;
 +	color:#c0c0c0;
 +	background-color:#c0c0c0;
 +	border:none;
 +	margin:.2em 0 .2em 0;
 +}
 +pre {
 +	padding:0.5em;
 +	font-family:courier, monospace;
 +	border:1px solid #c0c0c0;
 +	background:#F0ECE6;
 +	white-space:pre;
 +	white-space:pre-wrap;
 +	word-wrap:break-word;
 +	white-space:-moz-pre-wrap;
 +	white-space:-pre-wrap;
 +	white-space:-o-pre-wrap;
 +}
 +.invisible {
 +	margin:0px;
 +	border:0px;
 +	padding:0px;
 +	height:0px;
 +	visibility:hidden;
 +}
 +.left {
 +	float:left !important;
 +}
 +.right {
 +	float:right !important;
 +}
 +.center {
 +	text-align:center;
 +}
 +div#body-wrapper {
 +	padding:40px 40px 10px 40px;
 +	font-size:127%;
 +}
 +div#content {
 +	margin-top:-20px;
 +	padding:0;
 +	font-size:14px;
 +	color:black;
 +	line-height:1.5em;
 +}
 +h1, h2, h3, h4, h5, h6 {
 +	background:transparent none repeat scroll 0 0;
 +	border-bottom:1px solid #aaa;
 +	color:black;
 +	font-weight:normal;
 +	margin:0;
 +	padding:0;
 +	padding-bottom:0.17em;
 +	padding-top:0.5em;
 +}
 +h1 {
 +	font-size:188%;
 +	line-height:1.2em;
 +	margin-bottom:0.1em;
 +	padding-bottom:0;
 +}
 +h2 {
 +	font-size:150%;
 +}
 +h3, h4, h5, h6 {
 +	border-bottom:none;
 +	font-weight:bold;
 +}
 +h3 {
 +	font-size:132%;
 +}
 +h4 {
 +	font-size:116%;
 +}
 +h5 {
 +	font-size:100%;
 +}
 +h6 {
 +	font-size:80%;
 +}
 +ul#page-actions {
 +	float:right;
 +	margin:10px 10px 0 10px;
 +	padding:6px;
 +	color:black;
 +	background-color:#ececec;
 +	list-style-type:none;
 +	white-space: nowrap;
 +	border-radius:5px;
 +	-moz-border-radius:5px;
 +}
 +ul#user-actions {
 +	padding:5px;
 +	margin:0;
 +	display:inline;
 +	color:black;
 +	background-color:#ececec;
 +	list-style-type:none;
 +	-moz-border-radius:3px;
 +	border-radius:3px;
 +}
 +ul#page-actions li, ul#user-actions li {
 +	display:inline;
 +}
 +ul#page-actions a, ul#user-actions a {
 +	text-decoration:none;
 +	color:black;
 +	display:inline;
 +	margin:0 3px;
 +	padding:2px 0px 2px 18px;
 +}
 +ul#page-actions a:hover, ul#page-actions a:focus, ul#user-actions a:hover, ul#user-actions a:focus {
 +	/*text-decoration:underline;*/
 +}
 +/***************************/
 +ul#page-actions2 {
 +	float:left;
 +	margin:10px 10px 0 10px;
 +	padding:6px;
 +	color:black;
 +	background-color:#ececec;
 +	list-style-type:none;
 +	border-radius:5px;
 +	-moz-border-radius:5px;
 +}
 +ul#user-actions2 {
 +	padding:5px;
 +	margin:0;
 +	display:inline;
 +	color:black;
 +	background-color:#ececec;
 +	list-style-type:none;
 +	border-radius:3px;
 +	-moz-border-radius:3px;
 +}
 +ul#page-actions2 li, ul#user-actions2 li {
 +	display:inline;
 +}
 +ul#page-actions2 a, ul#user-actions2 a {
 +	text-decoration:none;
 +	color:black;
 +	display:inline;
 +	margin:0 3px;
 +	padding:2px 0px 2px 18px;
 +}
 +ul#page-actions2 a:hover, ul#page-actions2 a:focus, ul#user-actions2 a:hover, ul#user-actions2 a:focus {
 +	color: #4e7bb4;
 +}
 +/****************************/
 +.hidden {
 +	display:none;
 +}
 +a.urlextern {
 +	color:#36B;
 +	background:transparent url(/media/default/img/external-10.2.png) no-repeat scroll right center;
 +	padding:0 13px 0 0;
 +}
 +a[href="http://www.pyload.org"]:after, a.noextlink:after {
 +background:none;
 +padding:0;
 +}
 +a.action.index {
 +	background:transparent url(/media/default/img/wiki-tools-index.png) 0px 1px no-repeat;
 +}
 +a.action.recent {
 +	background:transparent url(/media/default/img/wiki-tools-recent.png) 0px 1px no-repeat;
 +}
 +a.logout {
 +	background:transparent url(/media/default/img/user-actions-logout.png) 0px 1px no-repeat;
 +}
 +a.admin {
 +	background:transparent url(/media/default/img/user-actions-admin.png) 0px 1px no-repeat;
 +}
 +a.profile {
 +	background:transparent url(/media/default/img/user-actions-profile.png) 0px 1px no-repeat;
 +}
 +a.create, a.edit {
 +	background:transparent url(/media/default/img/page-tools-edit.png) 0px 1px no-repeat;
 +}
 +a.source, a.show {
 +	background:transparent url(/media/default/img/page-tools-source.png) 0px 1px no-repeat;
 +}
 +a.revisions {
 +	background:transparent url(/media/default/img/page-tools-revisions.png) 0px 1px no-repeat;
 +}
 +a.subscribe, a.unsubscribe {
 +	background:transparent url(/media/default/img/page-tools-subscribe.png) 0px 1px no-repeat;
 +}
 +a.backlink {
 +	background:transparent url(/media/default/img/page-tools-backlinks.png) 0px 1px no-repeat;
 +}
 +a.play {
 +	background:transparent url(/media/default/img/control_play.png) 0px 1px no-repeat;
 +}
 +.time {
 +	background:transparent url(/media/default/img/status_None.png) 0px 1px no-repeat;
 +        padding: 2px 0px 2px 18px;
 +        margin: 0px 3px;
 +}
 +.reconnect {
 +	background:transparent url(/media/default/img/reconnect.png) 0px 1px no-repeat;
 +        padding: 2px 0px 2px 18px;
 +        margin: 0px 3px;
 +}
 +a.play:hover {
 +	background:transparent url(/media/default/img/control_play_blue.png) 0px 1px no-repeat;
 +}
 +a.cancel {
 +	background:transparent url(/media/default/img/control_cancel.png) 0px 1px no-repeat;
 +}
 +a.cancel:hover {
 +	background:transparent url(/media/default/img/control_cancel_blue.png) 0px 1px no-repeat;
 +}
 +a.pause {
 +	background:transparent url(/media/default/img/control_pause.png) 0px 1px no-repeat;
 +}
 +a.pause:hover {
 +	background:transparent url(/media/default/img/control_pause_blue.png) 0px 1px no-repeat;
 +	font-weight: bold;
 +}
 +a.stop {
 +	background:transparent url(/media/default/img/control_stop.png) 0px 1px no-repeat;
 +}
 +a.stop:hover {
 +	background:transparent url(/media/default/img/control_stop_blue.png) 0px 1px no-repeat;
 +}
 +a.add {
 +	background:transparent url(/media/default/img/control_add.png) 0px 1px no-repeat;
 +}
 +a.add:hover {
 +	background:transparent url(/media/default/img/control_add_blue.png) 0px 1px no-repeat;
 +}
 +a.cog {
 +	background:transparent url(/media/default/img/cog.png) 0px 1px no-repeat;
 +}
 +#head-panel {
 +	background:#525252 url(/media/default/img/head_bg1.png) bottom left repeat-x;
 +}
 +#head-panel h1 {
 +	display:none;
 +	margin:0;
 +	text-decoration:none;
 +	padding-top:0.8em;
 +	padding-left:3.3em;
 +	font-size:2.6em;
 +	color:#eeeeec;
 +}
 +#head-panel #head-logo {
 +	float:left;
 +	margin:5px 0 -15px 5px;
 +	padding:0;
 +	overflow:visible;
 +}
 +#head-menu {
 +	background:transparent url(/media/default/img/tabs-border-bottom.png) 0 100% repeat-x;
 +	width:100%;
 +	float:left;
 +	margin:0;
 +	padding:0;
 +	padding-top:0.8em;
 +}
 +#head-menu ul {
 +	list-style:none;
 +	margin:0 1em 0 2em;
 +}
 +#head-menu ul li {
 +	float:left;
 +	margin:0;
 +	margin-left:0.3em;
 +	font-size:14px;
 +	margin-bottom:4px;
 +}
 +#head-menu ul li.selected, #head-menu ul li:hover {
 +	margin-bottom:0px;
 +}
 +#head-menu ul li a img {
 +	height:22px;
 +	width:22px;
 +	vertical-align:middle;
 +}
 +#head-menu ul li a, #head-menu ul li a:link {
 +	float:left;
 +	text-decoration:none;
 +	color:#555;
 +	background:#eaeaea url(/media/default/img/tab-background.png) 0 100% repeat-x;
 +	padding:3px 7px 3px 7px;
 +	border:2px solid #ccc;
 +	border-bottom:0px solid transparent;
 +	padding-bottom:3px;
 +	-moz-border-radius:5px;
 +	border-radius:5px;
 +}
 +#head-menu ul li a:hover, #head-menu ul li a:focus {
 +	color:#111;
 +	padding-bottom:7px;
 +	border-bottom:0px none transparent;
 +	outline:none;
 +	border-bottom-left-radius: 0px;
 +	border-bottom-right-radius: 0px;
 +	-moz-border-radius-bottomright:0px;
 +	-moz-border-radius-bottomleft:0px;
 +}
 +#head-menu ul li a:focus {
 +	margin-bottom:-4px;
 +}
 +#head-menu ul li.selected a {
 +	color:#3566A5;
 +	background:#fff;
 +	padding-bottom:7px;
 +	border-bottom:0px none transparent;
 +	border-bottom-left-radius: 0px;
 +	border-bottom-right-radius: 0px;
 +	-moz-border-radius-bottomright:0px;
 +	-moz-border-radius-bottomleft:0px;
 +}
 +#head-menu ul li.selected a:hover, #head-menu ul li.selected a:focus {
 +	color:#111;
 +}
 +div#head-search-and-login {
 +	float:right;
 +	margin:0 1em 0 0;
 +	background-color:#222;
 +	padding:7px 7px 5px 5px;
 +	color:white;
 +	white-space: nowrap;
 +	border-bottom-left-radius: 6px;
 +	border-bottom-right-radius: 6px;
 +	-moz-border-radius-bottomright:6px;
 +	-moz-border-radius-bottomleft:6px;
 +}
 +div#head-search-and-login form {
 +	display:inline;
 +	padding:0 3px;
 +}
 +div#head-search-and-login form input {
 +	border:2px solid #888;
 +	background:#eee;
 +	font-size:14px;
 +	padding:2px;
 +	border-radius:3px;
 +	-moz-border-radius:3px;
 +}
 +div#head-search-and-login form input:focus {
 +	background:#fff;
 +}
 +#head-search {
 +	font-size:14px;
 +}
 +#head-username, #head-password {
 +	width:80px;
 +	font-size:14px;
 +}
 +#pageinfo {
 +	clear:both;
 +	color:#888;
 +	padding:0.6em 0;
 +	margin:0;
 +}
 +#foot {
 +	font-style:normal;
 +	color:#888;
 +	text-align:center;
 +}
 +#foot a {
 +	color:#aaf;
 +}
 +#foot img {
 +	vertical-align:middle;
 +}
 +ul.toc {
 +	padding:0;
 +	padding-left:20px;
 +	margin-left:0;
 +	margin-right:10px;
 +	list-style:none;
 +}
 +ul.toc li {
 +	list-style:circle;
 +}
 +ul.toc li a {
 +	text-decoration:none;
 +	color:black;
 +}
 +ul.toc li a:hover {
 +	text-decoration:underline;
 +}
 +div.toc {
 +	border:1px dotted #888;
 +	background:#f0f0f0;
 +	margin:1em 0 1em 1em;
 +	float:right;
 +	font-size:95%;
 +}
 +div.toc .tocheader {
 +	font-weight:bold;
 +	margin:0.5em 1em;
 +}
 +div.toc ol {
 +	margin:1em 0.5em 1em 1em;
 +	padding:0;
 +}
 +div.toc ol li {
 +	margin:0;
 +	padding:0;
 +	margin-left:1em;
 +}
 +div.toc ol ol {
 +	margin:0.5em 0.5em 0.5em 1em;
 +	padding:0;
 +}
 +div.recentchanges table {
 +	clear:both;
 +}
 +div#editor-help {
 +	font-size:90%;
 +	border:1px dotted #888;
 +	padding:0ex 1ex 1ex 1ex;
 +	background:#f7f6f2;
 +}
 +div#preview {
 +	margin-top:1em;
 +}
 +label.block {
 +	display:block;
 +	text-align:right;
 +	font-weight:bold;
 +}
 +label.simple {
 +	display:block;
 +	text-align:left;
 +	font-weight:normal;
 +}
 +label.block input.edit {
 +	width:50%;
 +}
 +/*fieldset {
 +	width:300px;
 +	text-align:center;
 +	padding:0.5em;
 +	margin:auto;
 +}
 +*/
 +div.editor {
 +	margin:0 0 0 0;
 +}
 +table {
 +	margin:0.5em 0;
 +	border-collapse:collapse;
 +}
 +td {
 +	padding:0.25em;
 +	border:1pt solid #ADB9CC;
 +}
 +td p {
 +	margin:0;
 +	padding:0;
 +}
 +.u {
 +	text-decoration:underline;
 +}
 +.footnotes ul {
 +	padding:0 2em;
 +	margin:0 0 1em;
 +}
 +.footnotes li {
 +	list-style:none;
 +}
 +.recentchanges p {
 +	margin:0.25em;
 +}
 +.recentchanges td {
 +	vertical-align:top;
 +	border:none;
 +	border-bottom:1pt solid #F0ECE6;
 +	background:#F7F6F2;
 +}
 +.rcdaybreak td {
 +	background:#729fcf;
 +	border:none;
 +}
 +.rcdaybreak td a {
 +	font-size:0.88em;
 +}
 +.rcicon1, .rcicon2 {
 +	text-align:center;
 +}
 +.rcpagelink {
 +	width:33%;
 +}
 +.rctime {
 +	font-size:0.88em;
 +	white-space:nowrap;
 +}
 +.rceditor {
 +	white-space:nowrap;
 +	font-size:0.88em;
 +}
 +.rccomment {
 +	width:66%;
 +	color:gray;
 +	font-size:0.88em;
 +}
 +.rcrss {
 +	float:right;
 +}
 +.recentchanges[dir="rtl"] .rcrss {
 +	float:left;
 +}
 +.userpref table, .userpref td {
 +	border:none;
 +}
 +div.codearea {
 +	margin:0.5em 0;
 +	padding:0;
 +	border:1pt solid #AEBDCC;
 +	background-color:#F3F5F7;
 +	color:black;
 +}
 +div.codearea pre {
 +	margin:0;
 +	padding:10pt;
 +	border:none;
 +}
 +a.codenumbers {
 +	margin:0 10pt;
 +	font-size:0.85em;
 +	color:gray;
 +}
 +div.codearea pre span.LineNumber {
 +	color:gray;
 +}
 +div.codearea pre span.ID {
 +	color:#000;
 +}
 +div.codearea pre span.Operator {
 +	color:#0000c0;
 +}
 +div.codearea pre span.Char {
 +	color:#004080;
 +}
 +div.codearea pre span.Comment {
 +	color:#008000;
 +}
 +div.codearea pre span.Number {
 +	color:#0080c0;
 +}
 +div.codearea pre span.String {
 +	color:#004080;
 +}
 +div.codearea pre span.SPChar {
 +	color:#0000c0;
 +}
 +div.codearea pre span.ResWord {
 +	color:#a00000;
 +}
 +div.codearea pre span.ConsWord {
 +	color:#008080;
 +	font-weight:bold;
 +}
 +div.codearea pre span.Error {
 +	color:#ff8080;
 +	border:solid 1.5pt #f00;
 +}
 +div.codearea pre span.ResWord2 {
 +	color:#0080ff;
 +	font-weight:bold;
 +}
 +div.codearea pre span.Special {
 +	color:#00f;
 +}
 +div.codearea pre span.Preprc {
 +	color:#803999;
 +}
 +#message {
 +	clear:both;
 +	padding:5px 10px;
 +	background-color:#eee;
 +	border-bottom:2px solid #ccc;
 +}
 +#message p {
 +	margin:5px 0;
 +	padding:0;
 +	font-weight:bold;
 +}
 +#message div.buttons {
 +	font-weight:normal;
 +}
 +.diff {
 +	width:99%;
 +}
 +.diff-title {
 +	background-color:#C0C0C0;
 +}
 +.searchresult dd span {
 +	font-weight:bold;
 +}
 +.diff {
 +	width:100%;
 +	border:none;
 +}
 +.diff-blockheader {
 +	font-weight:bold;
 +	background:#e5e5e5;
 +	font-size:1.2em;
 +	border-top:2px solid #444;
 +	padding:5px;
 +}
 +.diff th {
 +	font-size:120%;
 +	width:50%;
 +	font-weight:normal;
 +	text-align:left;
 +	padding-bottom:3px;
 +}
 +.diff td {
 +	font-family:monospace;
 +	font-size:100%;
 +	border:none;
 +}
 +.diff-addedline {
 +	background-color:#dfd;
 +}
 +.diff-deletedline {
 +	background-color:#ffb;
 +}
 +.diff-context {
 +	color:#888;
 +}
 +.diff-addedline {
 +	background-color:#E0FFE0;
 +	vertical-align:sub;
 +}
 +.diff-deletedline {
 +	background-color:#FFFFE0;
 +	background-color:#f4cece;
 +	vertical-align:sub;
 +}
 +.diff-addedline strong {
 +	background-color:#80FF80;
 +	background-color:#8ae234;
 +}
 +.diff-deletedline strong {
 +	background-color:#FFFF80;
 +	background-color:#ef2929;
 +	background-color:#d78383;
 +}
 +.box {
 +	background:url(/media/default/img/progress-bar-back.gif) right center no-repeat;
 +	width:200px;
 +	height:20px;
 +	float:left;
 +}
 +.perc {
 +	background:url(/media/default/img/progress-bar.gif) right center no-repeat;
 +	height:20px;
 +}
 +.boxtext {
 +	font-family:tahoma, arial, sans-serif;
 +	font-size:11px;
 +	color:#000;
 +	float:none;
 +	padding:3px 0 0 10px;
 +}
 +.statusbutton {
 +	width:32px;
 +	height:32px;
 +	float:left;
 +	margin-left:-32px;
 +	margin-right:5px;
 +	opacity:0;
 +	cursor:pointer
 +}
 +.dlsize {
 +	float:left;
 +	padding-right: 8px;
 +}
 +.dlspeed {
 +	float:left;
 +	padding-right: 8px;
 +}
 +.package {
 +	margin-bottom: 10px;
 +}
 +.packagename {
 +	background: url(/media/default/img/folder.png) no-repeat;
 +	padding-left: 20px;
 +	font-weight: bold;
 +	text-transform: uppercase;
 +}
 +.child {
 +	margin-left: 20px;
 +}
 +.child_status {
 +	margin-right: 10px;
 +}
 +.child_secrow {
 +	font-size: 10px;
 +}
 +
 +.header, .header th {
 +	text-align: left;
 +	font-weight: normal;
 +	background-color:#ececec;
 +	-moz-border-radius:5px;
 +	border-radius:5px;
 +}
 +.progress_bar {
 +	background: #0C0;
 +	height: 5px;
 +	
 +}
 +
 +.queue {
 +	border: none
 +}
 +
 +.queue tr td {
 +	border: none
 +}
 +
 +.header, .header th{
 +	text-align: left;
 +	font-weight: normal;
 +}
 +
 +
 +.clearer
 +{
 +	clear: both;
 +	height: 1px;
 +}
 +
 +.left
 +{
 +	float: left;
 +}
 +
 +.right
 +{
 +	float: right;
 +}
 +
 +
 +.setfield
 +{
 +    display: table-cell;
 +}
 +
 +#toptabs li a
 +{
 +   padding: 5px 16px 4px 15px;
 +   border: none;
 +   font-weight: bold;
 +
 +   border-radius: 0px;
 +   -moz-border-radius: 0px;
 +
 +    border-top-right-radius: 5px;
 +    border-top-left-radius: 5px;
 +   -moz-border-radius-topright: 5px;
 +   -moz-border-radius-topleft: 5px;
 +}
 +
 +
 +#toptabs li a.selected
 +{
 +   background-color: #525252;
 +   padding-bottom: 5px;
 +
 +}
 +
 +#tabs span
 +{
 +    display: none;
 +}
 +
 +#tabs span.selected
 +{
 +    display: inline;
 +}
 +
 +#tabsback
 +{
 +    background-color: #525252;
 +    margin: 0px;
 +    margin-top: 2px;
 +    padding: 6px 4px 1px 4px;
 +
 +    border-top-right-radius: 30px;
 +    border-top-left-radius: 3px;
 +    -moz-border-radius-topright: 30px;
 +    -moz-border-radius-topleft: 3px;
 +}
 +ul.tabs
 +{
 +    list-style-type: none;
 +    margin:0px;
 +    padding: 0px 40px 0px 0px;
 +}
 +ul.tabs li
 +{
 +    display: inline;
 +    margin-left: 8px;
 +}
 +ul.tabs li a
 +{
 +    color: #42454a;
 +    background-color: #eaeaea;
 +    border: 1px solid #c9c3ba;
 +    border-bottom: none;
 +    padding: 2px 4px 2px 4px;
 +    margin: 0px;
 +    text-decoration: none;
 +
 +    outline: 0;
 +    border-radius: 4px;
 +    -moz-border-radius: 4px;
 +}
 +
 +ul.tabs li a.selected, ul.tabs li a:hover
 +{
 +    color: #000;
 +    background-color: white;
 +    padding: 2px 4px 6px 4px;
 +
 +    border-bottom-right-radius: 0px;
 +    border-bottom-left-radius: 0px;
 +    -moz-border-radius-bottomright: 0px;
 +    -moz-border-radius-bottomleft: 0px;
 +}
 +
 +ul.tabs li a:hover
 +{
 +    background-color: #f1f4ee;
 +}
 +
 +ul.tabs li a.selected
 +{
 +    font-weight: bold;
 +}
 +
 +div.tabContent
 +{
 +    border: 2px solid #525252;
 +    margin: 0px 0px 0px 0px;
 +    padding: 0px;
 +
 +}
 +.hide
 +{
 +    display: none;
 +}
 +
 +.settable
 +{
 +    margin: 20px;
 +    border: none;
 +}
 +.settable td
 +{
 +    border: none;
 +    margin: 0px;
 +    padding: 5px;
 +}
 +
 diff --git a/core/module/web/media/default/css/log.css b/core/module/web/media/default/css/log.css new file mode 100644 index 000000000..73786bfb4 --- /dev/null +++ b/core/module/web/media/default/css/log.css @@ -0,0 +1,72 @@ + +html, body, #content +{ +    height: 100%; +} +#body-wrapper +{ +    height: 70%; +} +.logdiv +{ +    height: 90%; +    width: 100%; +    overflow: auto; +    border: 2px solid #CCC; +    outline: 1px solid #666; +    background-color: #FFE; +    margin-right: auto; +    margin-left: auto; +} +.logform +{ +    display: table; +    margin: 0 auto 0 auto; +    padding-top: 5px; +} +.logtable +{ +     +    margin: 0px; +} +.logtable td +{ +    border: none; +    white-space: nowrap; + +     +    font-family: monospace; +    font-size: 16px; +    margin: 0px; +    padding: 0px 10px 0px 10px; +    line-height: 110%; +} +td.logline +{ +    background-color: #EEE; +    text-align:right; +    padding: 0px 5px 0px 5px; +} +td.loglevel +{ +    text-align:right; +} +.logperpage +{ +    float: right; +    padding-bottom: 8px; +} +.logpaginator +{ +    float: left; +    padding-top: 5px; +} +.logpaginator a +{ +    padding: 0px 8px 0px 8px; +} +.logwarn +{ +    text-align: center; +    color: red; +}
\ No newline at end of file diff --git a/core/module/web/media/default/css/window.css b/core/module/web/media/default/css/window.css new file mode 100644 index 000000000..606913be6 --- /dev/null +++ b/core/module/web/media/default/css/window.css @@ -0,0 +1,86 @@ +/* ----------- My Form ----------- */
 +.myform{
 +    margin:0 auto;
 +    width:600px;
 +    padding:14px;
 +
 +    left:50%;
 +    top:150px;
 +    margin-left: -350px;
 +    position: absolute;
 +    background: #FFF;
 +    display:none;
 +}
 +
 +/* ----------- stylized ----------- */
 +#add_box, #cap_box{
 +    border:solid 2px #b7ddf2;
 +    background:#ebf4fb;
 +}
 +#add_box h1, #cap_box h1 {
 +    font-size:14px;
 +    font-weight:bold;
 +    margin-bottom:8px;
 +}
 +#add_box p, #cap_box p{
 +    font-size:11px;
 +    color:#666666;
 +    margin-bottom:20px;
 +    border-bottom:solid 1px #b7ddf2;
 +    padding-bottom:10px;
 +}
 +#add_box label, #cap_box label{
 +    display:block;
 +    font-weight:bold;
 +    text-align:right;
 +    width:240px;
 +    float:left;
 +}
 +#add_box .small, #cap_box .small{
 +    color:#666666;
 +    display:block;
 +    font-size:11px;
 +    font-weight:normal;
 +    text-align:right;
 +    width:240px;
 +}
 +#add_box input, #cap_box input{
 +    float:left;
 +    font-size:12px;
 +    padding:4px 2px;
 +    border:solid 1px #aacfe4;
 +    width:300px;
 +    margin:2px 0 20px 10px;
 +}
 +#add_box .cont, #cap_box .cont{
 +    float:left;
 +    font-size:12px;
 +    padding: 0px 10px 15px 0px;
 +    width:300px;
 +    margin:0px 0px 0px 10px;
 +}
 +#add_box .cont input, #cap_box .cont input{
 +    float: none;
 +    margin: 0px 15px 0px 1px;
 +}
 +#add_box textarea{
 +    float:left;
 +    font-size:12px;
 +    padding:4px 2px;
 +    border:solid 1px #aacfe4;
 +    width:300px;
 +    margin:2px 0 20px 10px;
 +}
 +#add_box button, #cap_box button{
 +    clear:both;
 +    margin-left:150px;
 +    width:125px;
 +    height:31px;
 +    background:#666666 url(../img/button.png) no-repeat;
 +    text-align:center;
 +    line-height:31px;
 +    color:#FFFFFF;
 +    font-size:11px;
 +    font-weight:bold;
 +    border: 0px;
 +}
\ No newline at end of file diff --git a/core/module/web/media/default/img/arrow_refresh.png b/core/module/web/media/default/img/arrow_refresh.png Binary files differnew file mode 100644 index 000000000..0de26566d --- /dev/null +++ b/core/module/web/media/default/img/arrow_refresh.png diff --git a/core/module/web/media/default/img/big_button.gif b/core/module/web/media/default/img/big_button.gif Binary files differnew file mode 100644 index 000000000..7680490ea --- /dev/null +++ b/core/module/web/media/default/img/big_button.gif diff --git a/core/module/web/media/default/img/big_button_over.gif b/core/module/web/media/default/img/big_button_over.gif Binary files differnew file mode 100644 index 000000000..2e3ee10d2 --- /dev/null +++ b/core/module/web/media/default/img/big_button_over.gif diff --git a/core/module/web/media/default/img/body.png b/core/module/web/media/default/img/body.png Binary files differnew file mode 100644 index 000000000..7ff1043e0 --- /dev/null +++ b/core/module/web/media/default/img/body.png diff --git a/core/module/web/media/default/img/button.png b/core/module/web/media/default/img/button.png Binary files differnew file mode 100644 index 000000000..890160614 --- /dev/null +++ b/core/module/web/media/default/img/button.png diff --git a/core/module/web/media/default/img/closebtn.gif b/core/module/web/media/default/img/closebtn.gif Binary files differnew file mode 100644 index 000000000..3e27e6030 --- /dev/null +++ b/core/module/web/media/default/img/closebtn.gif diff --git a/core/module/web/media/default/img/cog.png b/core/module/web/media/default/img/cog.png Binary files differnew file mode 100644 index 000000000..67de2c6cc --- /dev/null +++ b/core/module/web/media/default/img/cog.png diff --git a/core/module/web/media/default/img/control_add.png b/core/module/web/media/default/img/control_add.png Binary files differnew file mode 100644 index 000000000..d39886893 --- /dev/null +++ b/core/module/web/media/default/img/control_add.png diff --git a/core/module/web/media/default/img/control_add_blue.png b/core/module/web/media/default/img/control_add_blue.png Binary files differnew file mode 100644 index 000000000..d11b7f41d --- /dev/null +++ b/core/module/web/media/default/img/control_add_blue.png diff --git a/core/module/web/media/default/img/control_cancel.png b/core/module/web/media/default/img/control_cancel.png Binary files differnew file mode 100644 index 000000000..7b9bc3fba --- /dev/null +++ b/core/module/web/media/default/img/control_cancel.png diff --git a/core/module/web/media/default/img/control_cancel_blue.png b/core/module/web/media/default/img/control_cancel_blue.png Binary files differnew file mode 100644 index 000000000..0c5c96ce3 --- /dev/null +++ b/core/module/web/media/default/img/control_cancel_blue.png diff --git a/core/module/web/media/default/img/control_pause.png b/core/module/web/media/default/img/control_pause.png Binary files differnew file mode 100644 index 000000000..2d9ce9c4e --- /dev/null +++ b/core/module/web/media/default/img/control_pause.png diff --git a/core/module/web/media/default/img/control_pause_blue.png b/core/module/web/media/default/img/control_pause_blue.png Binary files differnew file mode 100644 index 000000000..ec61099b0 --- /dev/null +++ b/core/module/web/media/default/img/control_pause_blue.png diff --git a/core/module/web/media/default/img/control_play.png b/core/module/web/media/default/img/control_play.png Binary files differnew file mode 100644 index 000000000..0846555d0 --- /dev/null +++ b/core/module/web/media/default/img/control_play.png diff --git a/core/module/web/media/default/img/control_play_blue.png b/core/module/web/media/default/img/control_play_blue.png Binary files differnew file mode 100644 index 000000000..f8c8ec683 --- /dev/null +++ b/core/module/web/media/default/img/control_play_blue.png diff --git a/core/module/web/media/default/img/control_stop.png b/core/module/web/media/default/img/control_stop.png Binary files differnew file mode 100644 index 000000000..893bb60e5 --- /dev/null +++ b/core/module/web/media/default/img/control_stop.png diff --git a/core/module/web/media/default/img/control_stop_blue.png b/core/module/web/media/default/img/control_stop_blue.png Binary files differnew file mode 100644 index 000000000..e6f75d232 --- /dev/null +++ b/core/module/web/media/default/img/control_stop_blue.png diff --git a/core/module/web/media/default/img/delete.png b/core/module/web/media/default/img/delete.png Binary files differnew file mode 100644 index 000000000..08f249365 --- /dev/null +++ b/core/module/web/media/default/img/delete.png diff --git a/core/module/web/media/default/img/drag_corner.gif b/core/module/web/media/default/img/drag_corner.gif Binary files differnew file mode 100644 index 000000000..befb1adf1 --- /dev/null +++ b/core/module/web/media/default/img/drag_corner.gif diff --git a/core/module/web/media/default/img/folder.png b/core/module/web/media/default/img/folder.png Binary files differnew file mode 100644 index 000000000..784e8fa48 --- /dev/null +++ b/core/module/web/media/default/img/folder.png diff --git a/core/module/web/media/default/img/full.png b/core/module/web/media/default/img/full.png Binary files differnew file mode 100644 index 000000000..fea52af76 --- /dev/null +++ b/core/module/web/media/default/img/full.png diff --git a/core/module/web/media/default/img/head-login.png b/core/module/web/media/default/img/head-login.png Binary files differnew file mode 100644 index 000000000..b59b7cbbf --- /dev/null +++ b/core/module/web/media/default/img/head-login.png diff --git a/core/module/web/media/default/img/head-menu-collector.png b/core/module/web/media/default/img/head-menu-collector.png Binary files differnew file mode 100644 index 000000000..861be40bc --- /dev/null +++ b/core/module/web/media/default/img/head-menu-collector.png diff --git a/core/module/web/media/default/img/head-menu-config.png b/core/module/web/media/default/img/head-menu-config.png Binary files differnew file mode 100644 index 000000000..bbf43d4f3 --- /dev/null +++ b/core/module/web/media/default/img/head-menu-config.png diff --git a/core/module/web/media/default/img/head-menu-development.png b/core/module/web/media/default/img/head-menu-development.png Binary files differnew file mode 100644 index 000000000..fad150fe1 --- /dev/null +++ b/core/module/web/media/default/img/head-menu-development.png diff --git a/core/module/web/media/default/img/head-menu-download.png b/core/module/web/media/default/img/head-menu-download.png Binary files differnew file mode 100644 index 000000000..98c5da9db --- /dev/null +++ b/core/module/web/media/default/img/head-menu-download.png diff --git a/core/module/web/media/default/img/head-menu-home.png b/core/module/web/media/default/img/head-menu-home.png Binary files differnew file mode 100644 index 000000000..9d62109aa --- /dev/null +++ b/core/module/web/media/default/img/head-menu-home.png diff --git a/core/module/web/media/default/img/head-menu-index.png b/core/module/web/media/default/img/head-menu-index.png Binary files differnew file mode 100644 index 000000000..44d631064 --- /dev/null +++ b/core/module/web/media/default/img/head-menu-index.png diff --git a/core/module/web/media/default/img/head-menu-news.png b/core/module/web/media/default/img/head-menu-news.png Binary files differnew file mode 100644 index 000000000..43950ebc9 --- /dev/null +++ b/core/module/web/media/default/img/head-menu-news.png diff --git a/core/module/web/media/default/img/head-menu-queue.png b/core/module/web/media/default/img/head-menu-queue.png Binary files differnew file mode 100644 index 000000000..be98793ce --- /dev/null +++ b/core/module/web/media/default/img/head-menu-queue.png diff --git a/core/module/web/media/default/img/head-menu-recent.png b/core/module/web/media/default/img/head-menu-recent.png Binary files differnew file mode 100644 index 000000000..fc9b0497f --- /dev/null +++ b/core/module/web/media/default/img/head-menu-recent.png diff --git a/core/module/web/media/default/img/head-menu-wiki.png b/core/module/web/media/default/img/head-menu-wiki.png Binary files differnew file mode 100644 index 000000000..07cf0102d --- /dev/null +++ b/core/module/web/media/default/img/head-menu-wiki.png diff --git a/core/module/web/media/default/img/head-search-noshadow.png b/core/module/web/media/default/img/head-search-noshadow.png Binary files differnew file mode 100644 index 000000000..aafdae015 --- /dev/null +++ b/core/module/web/media/default/img/head-search-noshadow.png diff --git a/core/module/web/media/default/img/head_bg1.png b/core/module/web/media/default/img/head_bg1.png Binary files differnew file mode 100644 index 000000000..f2848c3cc --- /dev/null +++ b/core/module/web/media/default/img/head_bg1.png diff --git a/core/module/web/media/default/img/images.png b/core/module/web/media/default/img/images.png Binary files differnew file mode 100644 index 000000000..184860d1e --- /dev/null +++ b/core/module/web/media/default/img/images.png diff --git a/core/module/web/media/default/img/package_go.png b/core/module/web/media/default/img/package_go.png Binary files differnew file mode 100644 index 000000000..aace63ad6 --- /dev/null +++ b/core/module/web/media/default/img/package_go.png diff --git a/core/module/web/media/default/img/page-tools-backlinks.png b/core/module/web/media/default/img/page-tools-backlinks.png Binary files differnew file mode 100644 index 000000000..3eb6a9ce3 --- /dev/null +++ b/core/module/web/media/default/img/page-tools-backlinks.png diff --git a/core/module/web/media/default/img/page-tools-edit.png b/core/module/web/media/default/img/page-tools-edit.png Binary files differnew file mode 100644 index 000000000..188e1c12b --- /dev/null +++ b/core/module/web/media/default/img/page-tools-edit.png diff --git a/core/module/web/media/default/img/page-tools-revisions.png b/core/module/web/media/default/img/page-tools-revisions.png Binary files differnew file mode 100644 index 000000000..5c3b8587f --- /dev/null +++ b/core/module/web/media/default/img/page-tools-revisions.png diff --git a/core/module/web/media/default/img/pyload-logo-edited3.5-new-font-small.png b/core/module/web/media/default/img/pyload-logo-edited3.5-new-font-small.png Binary files differnew file mode 100644 index 000000000..2443cd8b1 --- /dev/null +++ b/core/module/web/media/default/img/pyload-logo-edited3.5-new-font-small.png diff --git a/core/module/web/media/default/img/reconnect.png b/core/module/web/media/default/img/reconnect.png Binary files differnew file mode 100644 index 000000000..49b269145 --- /dev/null +++ b/core/module/web/media/default/img/reconnect.png diff --git a/core/module/web/media/default/img/status_None.png b/core/module/web/media/default/img/status_None.png Binary files differnew file mode 100644 index 000000000..293b13f77 --- /dev/null +++ b/core/module/web/media/default/img/status_None.png diff --git a/core/module/web/media/default/img/status_downloading.png b/core/module/web/media/default/img/status_downloading.png Binary files differnew file mode 100644 index 000000000..fb4ebc850 --- /dev/null +++ b/core/module/web/media/default/img/status_downloading.png diff --git a/core/module/web/media/default/img/status_failed.png b/core/module/web/media/default/img/status_failed.png Binary files differnew file mode 100644 index 000000000..c37bd062e --- /dev/null +++ b/core/module/web/media/default/img/status_failed.png diff --git a/core/module/web/media/default/img/status_finished.png b/core/module/web/media/default/img/status_finished.png Binary files differnew file mode 100644 index 000000000..89c8129a4 --- /dev/null +++ b/core/module/web/media/default/img/status_finished.png diff --git a/core/module/web/media/default/img/status_offline.png b/core/module/web/media/default/img/status_offline.png Binary files differnew file mode 100644 index 000000000..0cfd58596 --- /dev/null +++ b/core/module/web/media/default/img/status_offline.png diff --git a/core/module/web/media/default/img/status_proc.png b/core/module/web/media/default/img/status_proc.png Binary files differnew file mode 100644 index 000000000..67de2c6cc --- /dev/null +++ b/core/module/web/media/default/img/status_proc.png diff --git a/core/module/web/media/default/img/status_queue.png b/core/module/web/media/default/img/status_queue.png Binary files differnew file mode 100644 index 000000000..293b13f77 --- /dev/null +++ b/core/module/web/media/default/img/status_queue.png diff --git a/core/module/web/media/default/img/status_waiting.png b/core/module/web/media/default/img/status_waiting.png Binary files differnew file mode 100644 index 000000000..2842cc338 --- /dev/null +++ b/core/module/web/media/default/img/status_waiting.png diff --git a/core/module/web/media/default/img/tab-background.png b/core/module/web/media/default/img/tab-background.png Binary files differnew file mode 100644 index 000000000..29a5d1991 --- /dev/null +++ b/core/module/web/media/default/img/tab-background.png diff --git a/core/module/web/media/default/img/tabs-border-bottom.png b/core/module/web/media/default/img/tabs-border-bottom.png Binary files differnew file mode 100644 index 000000000..02440f428 --- /dev/null +++ b/core/module/web/media/default/img/tabs-border-bottom.png diff --git a/core/module/web/media/default/img/user-actions-logout.png b/core/module/web/media/default/img/user-actions-logout.png Binary files differnew file mode 100644 index 000000000..0010931e2 --- /dev/null +++ b/core/module/web/media/default/img/user-actions-logout.png diff --git a/core/module/web/media/default/img/user-actions-profile.png b/core/module/web/media/default/img/user-actions-profile.png Binary files differnew file mode 100644 index 000000000..46573fff6 --- /dev/null +++ b/core/module/web/media/default/img/user-actions-profile.png diff --git a/core/module/web/media/default/js/funktions.js b/core/module/web/media/default/js/funktions.js new file mode 100644 index 000000000..4c42ee336 --- /dev/null +++ b/core/module/web/media/default/js/funktions.js @@ -0,0 +1,23 @@ +// JavaScript Document
 +function SecToRightTime(sek)
 +{
 +	vreturn = sek > 86400 ? sprintf('%d Tag%s ', sek / 86400, Math.floor(sek / 86400) != 1 ? 'e':'') : '';
 +	vreturn += sprintf('%02d:%02d:%02d', sek / 3600 % 24, sek / 60 % 60, sek % 60 );
 +	return vreturn;
 +}
 +
 +function HumanFileSize(size)
 +{
 +	var filesizename = new Array("KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
 +	var loga = Math.log(size)/Math.log(1024);
 +	var i = Math.floor(loga);
 +	var a = Math.pow(1024, i);
 +	return (size == 0) ? "0 KB" : (Math.round( size / a , 2) + " " + filesizename[i]);
 +}
 +
 +Array.prototype.remove = function(from, to) {
 +  var rest = this.slice((to || from) + 1 || this.length);
 +  this.length = from < 0 ? this.length + from : from;
 +  if (this.length == 0) return [];
 +  return this.push.apply(this, rest);
 +};
\ No newline at end of file diff --git a/core/module/web/media/default/js/mootools-1.2.4-core.js b/core/module/web/media/default/js/mootools-1.2.4-core.js new file mode 100644 index 000000000..6ea6a530a --- /dev/null +++ b/core/module/web/media/default/js/mootools-1.2.4-core.js @@ -0,0 +1,337 @@ +//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License. + +var MooTools={version:"1.2.4",build:"0d9113241a90b9cd5643b926795852a2026710d4"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; +var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"}; +if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.toLowerCase();d.prototype.$family={name:e};Native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o; +}if(h){Native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p); +}}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l); +}return this;};if(c){d.implement(c);}return d;};Native.genericize=function(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=Array.prototype.slice.call(arguments); +return b.prototype[c].apply(d.shift(),d);};}};Native.implement=function(d,c){for(var b=0,a=d.length;b<a;b++){d[b].implement(c);}};Native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b); +};}};(function(){var a={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var h in a){new Native({name:h,initialize:a[h],protect:true}); +}var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]}; +for(var e in f){for(var b=f[e].length;b--;){Native.genericize(a[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean()); +}for(var b in a){this[b]=a[b];}return this;}});Hash.implement({forEach:function(b,c){for(var a in this){if(this.hasOwnProperty(a)){b.call(c,this[a],a,this); +}}},getClean:function(){var b={};for(var a in this){if(this.hasOwnProperty(a)){b[a]=this[a];}}return b;},getLength:function(){var b=0;for(var a in this){if(this.hasOwnProperty(a)){b++; +}}return b;}});Hash.alias("forEach","each");Array.implement({forEach:function(c,d){for(var b=0,a=this.length;b<a;b++){c.call(d,this[b],b,this);}}});Array.alias("forEach","each"); +function $A(b){if(b.item){var a=b.length,c=new Array(a);while(a--){c[a]=b[a];}return c;}return Array.prototype.slice.call(b);}function $arguments(a){return function(){return arguments[a]; +};}function $chk(a){return !!(a||a===0);}function $clear(a){clearTimeout(a);clearInterval(a);return null;}function $defined(a){return(a!=undefined);}function $each(c,b,d){var a=$type(c); +((a=="arguments"||a=="collection"||a=="array")?Array:Hash).each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c; +}function $H(a){return new Hash(a);}function $lambda(a){return($type(a)=="function")?a:function(){return a;};}function $merge(){var a=Array.slice(arguments); +a.unshift({});return $mixin.apply(null,a);}function $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue; +}for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length; +b<a;b++){if(arguments[b]!=undefined){return arguments[b];}}return null;}function $random(b,a){return Math.floor(Math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b); +return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=Date.now||function(){return +new Date;};function $try(){for(var b=0,a=arguments.length;b<a; +b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isFinite(a))?false:a.$family.name; +}if(a.nodeName){switch(a.nodeType){case 1:return"element";case 3:return(/\S/).test(a.nodeValue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments"; +}else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); +}break;case"hash":b=new Hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var Browser=$merge({Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925)); +},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419); +},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true; +Browser.detect=function(){for(var b in this.Engines){var a=this.Engines[b]();if(a){this.Engine={name:b,version:a};this.Engine[b]=this.Engine[b+a]=true; +break;}}return{name:b,version:a};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP"); +},function(){return new ActiveXObject("Microsoft.XMLHTTP");});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var a=($try(function(){return navigator.plugins["Shockwave Flash"].description; +},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(a[0]||0+"."+a[1],10)||0,build:parseInt(a[2],10)||0}; +})();function $exec(b){if(!b){return b;}if(window.execScript){window.execScript(b);}else{var a=document.createElement("script");a.setAttribute("type","text/javascript"); +a[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=b;document.head.appendChild(a);document.head.removeChild(a);}return b;}Native.UID=1; +var $uid=(Browser.Engine.trident)?function(a){return(a.uid||(a.uid=[Native.UID++]))[0];}:function(a){return a.uid||(a.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(a){$uid(a); +if(!a.Element){a.Element=$empty;if(Browser.Engine.webkit){a.document.createElement("iframe");}a.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{}; +}a.document.window=a;return $extend(a,Window.Prototype);},afterImplement:function(b,a){window[b]=Window.Prototype[b]=a;}});Window.Prototype={$family:{name:"window"}}; +new Window(window);var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(a){$uid(a);a.head=a.getElementsByTagName("head")[0]; +a.html=a.getElementsByTagName("html")[0];if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){a.execCommand("BackgroundImageCache",false,true); +});}if(Browser.Engine.trident){a.window.attachEvent("onunload",function(){a.window.detachEvent("onunload",arguments.callee);a.head=a.html=a.window=null; +});}return $extend(a,Document.Prototype);},afterImplement:function(b,a){document[b]=Document.Prototype[b]=a;}});Document.Prototype={$family:{name:"document"}}; +new Document(document);Array.implement({every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false;}}return true; +},filter:function(d,e){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(e,this[b],b,this)){c.push(this[b]);}}return c;},clean:function(){return this.filter($defined); +},indexOf:function(c,d){var a=this.length;for(var b=(d<0)?Math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b;}}return -1;},map:function(d,e){var c=[]; +for(var b=0,a=this.length;b<a;b++){c[b]=d.call(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true; +}}return false;},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={}; +for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexOf(a,b)!=-1; +},extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null; +},include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this; +},erase:function(b){for(var a=this.length;a--;a){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[]; +for(var b=0,a=this.length;b<a;b++){var c=$type(this[b]);if(!c){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments")?Array.flatten(this[b]):this[b]); +}return d;},hexToRgb:function(b){if(this.length!=3){return null;}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toInt(16);});return(b)?a:"rgb("+a+")"; +},rgbToHex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16); +b.push((c.length==1)?"0"+c:c);}return(d)?b:"#"+b.join("");}});Function.implement({extend:function(a){for(var b in a){this[b]=a[b];}return this;},create:function(b){var a=this; +b=b||{};return function(d){var c=b.arguments;c=(c!=undefined)?$splat(c):Array.slice(arguments,(b.event)?1:0);if(b.event){c=[d||window.event].extend(c); +}var e=function(){return a.apply(b.bind||null,c);};if(b.delay){return setTimeout(e,b.delay);}if(b.periodical){return setInterval(e,b.periodical);}if(b.attempt){return $try(e); +}return e();};},run:function(a,b){return this.apply(b,$splat(a));},pass:function(a,b){return this.create({bind:b,arguments:a});},bind:function(b,a){return this.create({bind:b,arguments:a}); +},bindWithEvent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})(); +},delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})(); +}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a;},times:function(b,c){for(var a=0; +a<this;a++){b.call(c,a,this);}},toFloat:function(){return parseFloat(this);},toInt:function(a){return parseInt(this,a||10);}});Number.alias("times","each"); +(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat($A(arguments)));};}});Number.implement(a); +})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(a,b){return((typeof a=="string")?new RegExp(a,b):a).test(this); +},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim(); +},camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase()); +});},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); +},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); +return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a=""; +var c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); +}}return c;},substitute:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; +});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null; +},hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a||{},function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.each(a||{},function(c,b){Hash.include(this,b,c); +},this);return this;},erase:function(a){if(this.hasOwnProperty(a)){delete this[a];}return this;},get:function(a){return(this.hasOwnProperty(a))?this[a]:null; +},set:function(a,b){if(!this[a]||this.hasOwnProperty(a)){this[a]=b;}return this;},empty:function(){Hash.each(this,function(b,a){delete this[a];},this); +return this;},include:function(a,b){if(this[a]==undefined){this[a]=b;}return this;},map:function(b,c){var a=new Hash;Hash.each(this,function(e,d){a.set(d,b.call(c,e,d,this)); +},this);return a;},filter:function(b,c){var a=new Hash;Hash.each(this,function(e,d){if(b.call(c,e,d,this)){a.set(d,e);}},this);return a;},every:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&!b.call(c,this[a],a)){return false; +}}return true;},some:function(b,c){for(var a in this){if(this.hasOwnProperty(a)&&b.call(c,this[a],a)){return true;}}return false;},getKeys:function(){var a=[]; +Hash.each(this,function(c,b){a.push(b);});return a;},getValues:function(){var a=[];Hash.each(this,function(b){a.push(b);});return a;},toQueryString:function(a){var b=[]; +Hash.each(this,function(f,e){if(a){e=a+"["+e+"]";}var d;switch($type(f)){case"object":d=Hash.toQueryString(f,e);break;case"array":var c={};f.each(function(h,g){c[g]=h; +});d=Hash.toQueryString(c,e);break;default:d=e+"="+encodeURIComponent(f);}if(f!=undefined){b.push(d);}});return b.join("&");}});Hash.alias({keyOf:"indexOf",hasValue:"contains"}); +var Event=new Native({name:"Event",initialize:function(a,f){f=f||window;var k=f.document;a=a||f.event;if(a.$extended){return a;}this.$extended=true;var j=a.type; +var g=a.target||a.srcElement;while(g&&g.nodeType==3){g=g.parentNode;}if(j.test(/key/)){var b=a.which||a.keyCode;var m=Event.Keys.keyOf(b);if(j=="keydown"){var d=b-111; +if(d>0&&d<13){m="f"+d;}}m=m||String.fromCharCode(b).toLowerCase();}else{if(j.match(/(click|mouse|menu)/i)){k=(!k.compatMode||k.compatMode=="CSS1Compat")?k.html:k.body; +var i={x:a.pageX||a.clientX+k.scrollLeft,y:a.pageY||a.clientY+k.scrollTop};var c={x:(a.pageX)?a.pageX-f.pageXOffset:a.clientX,y:(a.pageY)?a.pageY-f.pageYOffset:a.clientY}; +if(j.match(/DOMMouseScroll|mousewheel/)){var h=(a.wheelDelta)?a.wheelDelta/120:-(a.detail||0)/3;}var e=(a.which==3)||(a.button==2);var l=null;if(j.match(/over|out/)){switch(j){case"mouseover":l=a.relatedTarget||a.fromElement; +break;case"mouseout":l=a.relatedTarget||a.toElement;}if(!(function(){while(l&&l.nodeType==3){l=l.parentNode;}return true;}).create({attempt:Browser.Engine.gecko})()){l=false; +}}}}return $extend(this,{event:a,type:j,page:i,client:c,rightClick:e,wheel:h,relatedTarget:l,target:g,code:b,key:m,shift:a.shiftKey,control:a.ctrlKey,alt:a.altKey,meta:a.metaKey}); +}});Event.Keys=new Hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});Event.implement({stop:function(){return this.stopPropagation().preventDefault(); +},stopPropagation:function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;},preventDefault:function(){if(this.event.preventDefault){this.event.preventDefault(); +}else{this.event.returnValue=false;}return this;}});function Class(b){if(b instanceof Function){b={initialize:b};}var a=function(){Object.reset(this);if(a._prototyping){return this; +}this._current=$empty;var c=(this.initialize)?this.initialize.apply(this,arguments):this;delete this._current;delete this.caller;return c;}.extend(this); +a.implement(b);a.constructor=Class;a.prototype.constructor=a;return a;}Function.prototype.protect=function(){this._protected=true;return this;};Object.reset=function(a,c){if(c==null){for(var e in a){Object.reset(a,e); +}return a;}delete a[c];switch($type(a[c])){case"object":var d=function(){};d.prototype=a[c];var b=new d;a[c]=Object.reset(b);break;case"array":a[c]=$unlink(a[c]); +break;}return a;};new Native({name:"Class",initialize:Class}).extend({instantiate:function(b){b._prototyping=true;var a=new b;delete b._prototyping;return a; +},wrap:function(a,b,c){if(c._origin){c=c._origin;}return function(){if(c._protected&&this._current==null){throw new Error('The method "'+b+'" cannot be called.'); +}var e=this.caller,f=this._current;this.caller=f;this._current=arguments.callee;var d=c.apply(this,arguments);this._current=f;this.caller=e;return d;}.extend({_owner:a,_origin:c,_name:b}); +}});Class.implement({implement:function(a,d){if($type(a)=="object"){for(var e in a){this.implement(e,a[e]);}return this;}var f=Class.Mutators[a];if(f){d=f.call(this,d); +if(d==null){return this;}}var c=this.prototype;switch($type(d)){case"function":if(d._hidden){return this;}c[a]=Class.wrap(this,a,d);break;case"object":var b=c[a]; +if($type(b)=="object"){$mixin(b,d);}else{c[a]=$unlink(d);}break;case"array":c[a]=$unlink(d);break;default:c[a]=d;}return this;}});Class.Mutators={Extends:function(a){this.parent=a; +this.prototype=Class.instantiate(a);this.implement("parent",function(){var b=this.caller._name,c=this.caller._owner.parent.prototype[b];if(!c){throw new Error('The method "'+b+'" has no parent.'); +}return c.apply(this,arguments);}.protect());},Implements:function(a){$splat(a).each(function(b){if(b instanceof Function){b=Class.instantiate(b);}this.implement(b); +},this);}};var Chain=new Class({$chain:[],chain:function(){this.$chain.extend(Array.flatten(arguments));return this;},callChain:function(){return(this.$chain.length)?this.$chain.shift().apply(this,arguments):false; +},clearChain:function(){this.$chain.empty();return this;}});var Events=new Class({$events:{},addEvent:function(c,b,a){c=Events.removeOn(c);if(b!=$empty){this.$events[c]=this.$events[c]||[]; +this.$events[c].include(b);if(a){b.internal=true;}}return this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this;},fireEvent:function(c,b,a){c=Events.removeOn(c); +if(!this.$events||!this.$events[c]){return this;}this.$events[c].each(function(d){d.create({bind:this,delay:a,"arguments":b})();},this);return this;},removeEvent:function(b,a){b=Events.removeOn(b); +if(!this.$events[b]){return this;}if(!a.internal){this.$events[b].erase(a);}return this;},removeEvents:function(c){var d;if($type(c)=="object"){for(d in c){this.removeEvent(d,c[d]); +}return this;}if(c){c=Events.removeOn(c);}for(d in this.$events){if(c&&c!=d){continue;}var b=this.$events[d];for(var a=b.length;a--;a){this.removeEvent(d,b[a]); +}}return this;}});Events.removeOn=function(a){return a.replace(/^on([A-Z])/,function(b,c){return c.toLowerCase();});};var Options=new Class({setOptions:function(){this.options=$merge.run([this.options].extend(arguments)); +if(!this.addEvent){return this;}for(var a in this.options){if($type(this.options[a])!="function"||!(/^on[A-Z]/).test(a)){continue;}this.addEvent(a,this.options[a]); +delete this.options[a];}return this;}});var Element=new Native({name:"Element",legacy:window.Element,initialize:function(a,b){var c=Element.Constructors.get(a); +if(c){return c(b);}if(typeof a=="string"){return document.newElement(a,b);}return document.id(a).set(b);},afterImplement:function(a,b){Element.Prototype[a]=b; +if(Array[a]){return;}Elements.implement(a,function(){var c=[],g=true;for(var e=0,d=this.length;e<d;e++){var f=this[e][a].apply(this[e],arguments);c.push(f); +if(g){g=($type(f)=="element");}}return(g)?new Elements(c):c;});}});Element.Prototype={$family:{name:"element"}};Element.Constructors=new Hash;var IFrame=new Native({name:"IFrame",generics:false,initialize:function(){var f=Array.link(arguments,{properties:Object.type,iframe:$defined}); +var d=f.properties||{};var c=document.id(f.iframe);var e=d.onload||$empty;delete d.onload;d.id=d.name=$pick(d.id,d.name,c?(c.id||c.name):"IFrame_"+$time()); +c=new Element(c||"iframe",d);var b=function(){var g=$try(function(){return c.contentWindow.location.host;});if(!g||g==window.location.host){var h=new Window(c.contentWindow); +new Document(c.contentWindow.document);$extend(h.Element.prototype,Element.Prototype);}e.call(c.contentWindow,c.contentWindow.document);};var a=$try(function(){return c.contentWindow; +});((a&&a.document.body)||window.frames[d.id])?b():c.addListener("load",b);return c;}});var Elements=new Native({initialize:function(f,b){b=$extend({ddup:true,cash:true},b); +f=f||[];if(b.ddup||b.cash){var g={},e=[];for(var c=0,a=f.length;c<a;c++){var d=document.id(f[c],!b.cash);if(b.ddup){if(g[d.uid]){continue;}g[d.uid]=true; +}if(d){e.push(d);}}f=e;}return(b.cash)?$extend(f,this):f;}});Elements.implement({filter:function(a,b){if(!a){return this;}return new Elements(Array.filter(this,(typeof a=="string")?function(c){return c.match(a); +}:a,b));}});Document.implement({newElement:function(a,b){if(Browser.Engine.trident&&b){["name","type","checked"].each(function(c){if(!b[c]){return;}a+=" "+c+'="'+b[c]+'"'; +if(c!="checked"){delete b[c];}});a="<"+a+">";}return document.id(this.createElement(a)).set(b);},newTextNode:function(a){return this.createTextNode(a); +},getDocument:function(){return this;},getWindow:function(){return this.window;},id:(function(){var a={string:function(d,c,b){d=b.getElementById(d);return(d)?a.element(d,c):null; +},element:function(b,e){$uid(b);if(!e&&!b.$family&&!(/^object|embed$/i).test(b.tagName)){var c=Element.Prototype;for(var d in c){b[d]=c[d];}}return b;},object:function(c,d,b){if(c.toElement){return a.element(c.toElement(b),d); +}return null;}};a.textnode=a.whitespace=a.window=a.document=$arguments(0);return function(c,e,d){if(c&&c.$family&&c.uid){return c;}var b=$type(c);return(a[b])?a[b](c,e,d||document):null; +};})()});if(window.$==null){Window.implement({$:function(a,b){return document.id(a,b,this.document);}});}Window.implement({$$:function(a){if(arguments.length==1&&typeof a=="string"){return this.document.getElements(a); +}var f=[];var c=Array.flatten(arguments);for(var d=0,b=c.length;d<b;d++){var e=c[d];switch($type(e)){case"element":f.push(e);break;case"string":f.extend(this.document.getElements(e,true)); +}}return new Elements(f);},getDocument:function(){return this.document;},getWindow:function(){return this;}});Native.implement([Element,Document],{getElement:function(a,b){return document.id(this.getElements(a,true)[0]||null,b); +},getElements:function(a,d){a=a.split(",");var c=[];var b=(a.length>1);a.each(function(e){var f=this.getElementsByTagName(e.trim());(b)?c.extend(f):c=f; +},this);return new Elements(c,{ddup:b,cash:!d});}});(function(){var h={},f={};var i={input:"checked",option:"selected",textarea:(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerHTML":"value"}; +var c=function(l){return(f[l]||(f[l]={}));};var g=function(n,l){if(!n){return;}var m=n.uid;if(Browser.Engine.trident){if(n.clearAttributes){var q=l&&n.cloneNode(false); +n.clearAttributes();if(q){n.mergeAttributes(q);}}else{if(n.removeEvents){n.removeEvents();}}if((/object/i).test(n.tagName)){for(var o in n){if(typeof n[o]=="function"){n[o]=$empty; +}}Element.dispose(n);}}if(!m){return;}h[m]=f[m]=null;};var d=function(){Hash.each(h,g);if(Browser.Engine.trident){$A(document.getElementsByTagName("object")).each(g); +}if(window.CollectGarbage){CollectGarbage();}h=f=null;};var j=function(n,l,s,m,p,r){var o=n[s||l];var q=[];while(o){if(o.nodeType==1&&(!m||Element.match(o,m))){if(!p){return document.id(o,r); +}q.push(o);}o=o[l];}return(p)?new Elements(q,{ddup:false,cash:!r}):null;};var e={html:"innerHTML","class":"className","for":"htmlFor",defaultValue:"defaultValue",text:(Browser.Engine.trident||(Browser.Engine.webkit&&Browser.Engine.version<420))?"innerText":"textContent"}; +var b=["compact","nowrap","ismap","declare","noshade","checked","disabled","readonly","multiple","selected","noresize","defer"];var k=["value","type","defaultValue","accessKey","cellPadding","cellSpacing","colSpan","frameBorder","maxLength","readOnly","rowSpan","tabIndex","useMap"]; +b=b.associate(b);Hash.extend(e,b);Hash.extend(e,k.associate(k.map(String.toLowerCase)));var a={before:function(m,l){if(l.parentNode){l.parentNode.insertBefore(m,l); +}},after:function(m,l){if(!l.parentNode){return;}var n=l.nextSibling;(n)?l.parentNode.insertBefore(m,n):l.parentNode.appendChild(m);},bottom:function(m,l){l.appendChild(m); +},top:function(m,l){var n=l.firstChild;(n)?l.insertBefore(m,n):l.appendChild(m);}};a.inside=a.bottom;Hash.each(a,function(l,m){m=m.capitalize();Element.implement("inject"+m,function(n){l(this,document.id(n,true)); +return this;});Element.implement("grab"+m,function(n){l(document.id(n,true),this);return this;});});Element.implement({set:function(o,m){switch($type(o)){case"object":for(var n in o){this.set(n,o[n]); +}break;case"string":var l=Element.Properties.get(o);(l&&l.set)?l.set.apply(this,Array.slice(arguments,1)):this.setProperty(o,m);}return this;},get:function(m){var l=Element.Properties.get(m); +return(l&&l.get)?l.get.apply(this,Array.slice(arguments,1)):this.getProperty(m);},erase:function(m){var l=Element.Properties.get(m);(l&&l.erase)?l.erase.apply(this):this.removeProperty(m); +return this;},setProperty:function(m,n){var l=e[m];if(n==undefined){return this.removeProperty(m);}if(l&&b[m]){n=!!n;}(l)?this[l]=n:this.setAttribute(m,""+n); +return this;},setProperties:function(l){for(var m in l){this.setProperty(m,l[m]);}return this;},getProperty:function(m){var l=e[m];var n=(l)?this[l]:this.getAttribute(m,2); +return(b[m])?!!n:(l)?n:n||null;},getProperties:function(){var l=$A(arguments);return l.map(this.getProperty,this).associate(l);},removeProperty:function(m){var l=e[m]; +(l)?this[l]=(l&&b[m])?false:"":this.removeAttribute(m);return this;},removeProperties:function(){Array.each(arguments,this.removeProperty,this);return this; +},hasClass:function(l){return this.className.contains(l," ");},addClass:function(l){if(!this.hasClass(l)){this.className=(this.className+" "+l).clean(); +}return this;},removeClass:function(l){this.className=this.className.replace(new RegExp("(^|\\s)"+l+"(?:\\s|$)"),"$1");return this;},toggleClass:function(l){return this.hasClass(l)?this.removeClass(l):this.addClass(l); +},adopt:function(){Array.flatten(arguments).each(function(l){l=document.id(l,true);if(l){this.appendChild(l);}},this);return this;},appendText:function(m,l){return this.grab(this.getDocument().newTextNode(m),l); +},grab:function(m,l){a[l||"bottom"](document.id(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,document.id(m,true));return this;},replaces:function(l){l=document.id(l,true); +l.parentNode.replaceChild(this,l);return this;},wraps:function(m,l){m=document.id(m,true);return this.replaces(m).grab(m,l);},getPrevious:function(l,m){return j(this,"previousSibling",null,l,false,m); +},getAllPrevious:function(l,m){return j(this,"previousSibling",null,l,true,m);},getNext:function(l,m){return j(this,"nextSibling",null,l,false,m);},getAllNext:function(l,m){return j(this,"nextSibling",null,l,true,m); +},getFirst:function(l,m){return j(this,"nextSibling","firstChild",l,false,m);},getLast:function(l,m){return j(this,"previousSibling","lastChild",l,false,m); +},getParent:function(l,m){return j(this,"parentNode",null,l,false,m);},getParents:function(l,m){return j(this,"parentNode",null,l,true,m);},getSiblings:function(l,m){return this.getParent().getChildren(l,m).erase(this); +},getChildren:function(l,m){return j(this,"nextSibling","firstChild",l,true,m);},getWindow:function(){return this.ownerDocument.window;},getDocument:function(){return this.ownerDocument; +},getElementById:function(o,n){var m=this.ownerDocument.getElementById(o);if(!m){return null;}for(var l=m.parentNode;l!=this;l=l.parentNode){if(!l){return null; +}}return document.id(m,n);},getSelected:function(){return new Elements($A(this.options).filter(function(l){return l.selected;}));},getComputedStyle:function(m){if(this.currentStyle){return this.currentStyle[m.camelCase()]; +}var l=this.getDocument().defaultView.getComputedStyle(this,null);return(l)?l.getPropertyValue([m.hyphenate()]):null;},toQueryString:function(){var l=[]; +this.getElements("input, select, textarea",true).each(function(m){if(!m.name||m.disabled||m.type=="submit"||m.type=="reset"||m.type=="file"){return;}var n=(m.tagName.toLowerCase()=="select")?Element.getSelected(m).map(function(o){return o.value; +}):((m.type=="radio"||m.type=="checkbox")&&!m.checked)?null:m.value;$splat(n).each(function(o){if(typeof o!="undefined"){l.push(m.name+"="+encodeURIComponent(o)); +}});});return l.join("&");},clone:function(o,l){o=o!==false;var r=this.cloneNode(o);var n=function(v,u){if(!l){v.removeAttribute("id");}if(Browser.Engine.trident){v.clearAttributes(); +v.mergeAttributes(u);v.removeAttribute("uid");if(v.options){var w=v.options,s=u.options;for(var t=w.length;t--;){w[t].selected=s[t].selected;}}}var x=i[u.tagName.toLowerCase()]; +if(x&&u[x]){v[x]=u[x];}};if(o){var p=r.getElementsByTagName("*"),q=this.getElementsByTagName("*");for(var m=p.length;m--;){n(p[m],q[m]);}}n(r,this);return document.id(r); +},destroy:function(){Element.empty(this);Element.dispose(this);g(this,true);return null;},empty:function(){$A(this.childNodes).each(function(l){Element.destroy(l); +});return this;},dispose:function(){return(this.parentNode)?this.parentNode.removeChild(this):this;},hasChild:function(l){l=document.id(l,true);if(!l){return false; +}if(Browser.Engine.webkit&&Browser.Engine.version<420){return $A(this.getElementsByTagName(l.tagName)).contains(l);}return(this.contains)?(this!=l&&this.contains(l)):!!(this.compareDocumentPosition(l)&16); +},match:function(l){return(!l||(l==this)||(Element.get(this,"tag")==l));}});Native.implement([Element,Window,Document],{addListener:function(o,n){if(o=="unload"){var l=n,m=this; +n=function(){m.removeListener("unload",n);l();};}else{h[this.uid]=this;}if(this.addEventListener){this.addEventListener(o,n,false);}else{this.attachEvent("on"+o,n); +}return this;},removeListener:function(m,l){if(this.removeEventListener){this.removeEventListener(m,l,false);}else{this.detachEvent("on"+m,l);}return this; +},retrieve:function(m,l){var o=c(this.uid),n=o[m];if(l!=undefined&&n==undefined){n=o[m]=l;}return $pick(n);},store:function(m,l){var n=c(this.uid);n[m]=l; +return this;},eliminate:function(l){var m=c(this.uid);delete m[l];return this;}});window.addListener("unload",d);})();Element.Properties=new Hash;Element.Properties.style={set:function(a){this.style.cssText=a; +},get:function(){return this.style.cssText;},erase:function(){this.style.cssText="";}};Element.Properties.tag={get:function(){return this.tagName.toLowerCase(); +}};Element.Properties.html=(function(){var c=document.createElement("div");var a={table:[1,"<table>","</table>"],select:[1,"<select>","</select>"],tbody:[2,"<table><tbody>","</tbody></table>"],tr:[3,"<table><tbody><tr>","</tr></tbody></table>"]}; +a.thead=a.tfoot=a.tbody;var b={set:function(){var e=Array.flatten(arguments).join("");var f=Browser.Engine.trident&&a[this.get("tag")];if(f){var g=c;g.innerHTML=f[1]+e+f[2]; +for(var d=f[0];d--;){g=g.firstChild;}this.empty().adopt(g.childNodes);}else{this.innerHTML=e;}}};b.erase=b.set;return b;})();if(Browser.Engine.webkit&&Browser.Engine.version<420){Element.Properties.text={get:function(){if(this.innerText){return this.innerText; +}var a=this.ownerDocument.newElement("div",{html:this.innerHTML}).inject(this.ownerDocument.body);var b=a.innerText;a.destroy();return b;}};}Element.Properties.events={set:function(a){this.addEvents(a); +}};Native.implement([Element,Window,Document],{addEvent:function(e,g){var h=this.retrieve("events",{});h[e]=h[e]||{keys:[],values:[]};if(h[e].keys.contains(g)){return this; +}h[e].keys.push(g);var f=e,a=Element.Events.get(e),c=g,i=this;if(a){if(a.onAdd){a.onAdd.call(this,g);}if(a.condition){c=function(j){if(a.condition.call(this,j)){return g.call(this,j); +}return true;};}f=a.base||f;}var d=function(){return g.call(i);};var b=Element.NativeEvents[f];if(b){if(b==2){d=function(j){j=new Event(j,i.getWindow()); +if(c.call(i,j)===false){j.stop();}};}this.addListener(f,d);}h[e].values.push(d);return this;},removeEvent:function(c,b){var a=this.retrieve("events");if(!a||!a[c]){return this; +}var f=a[c].keys.indexOf(b);if(f==-1){return this;}a[c].keys.splice(f,1);var e=a[c].values.splice(f,1)[0];var d=Element.Events.get(c);if(d){if(d.onRemove){d.onRemove.call(this,b); +}c=d.base||c;}return(Element.NativeEvents[c])?this.removeListener(c,e):this;},addEvents:function(a){for(var b in a){this.addEvent(b,a[b]);}return this; +},removeEvents:function(a){var c;if($type(a)=="object"){for(c in a){this.removeEvent(c,a[c]);}return this;}var b=this.retrieve("events");if(!b){return this; +}if(!a){for(c in b){this.removeEvents(c);}this.eliminate("events");}else{if(b[a]){while(b[a].keys[0]){this.removeEvent(a,b[a].keys[0]);}b[a]=null;}}return this; +},fireEvent:function(d,b,a){var c=this.retrieve("events");if(!c||!c[d]){return this;}c[d].keys.each(function(e){e.create({bind:this,delay:a,"arguments":b})(); +},this);return this;},cloneEvents:function(d,a){d=document.id(d);var c=d.retrieve("events");if(!c){return this;}if(!a){for(var b in c){this.cloneEvents(d,b); +}}else{if(c[a]){c[a].keys.each(function(e){this.addEvent(a,e);},this);}}return this;}});Element.NativeEvents={click:2,dblclick:2,mouseup:2,mousedown:2,contextmenu:2,mousewheel:2,DOMMouseScroll:2,mouseover:2,mouseout:2,mousemove:2,selectstart:2,selectend:2,keydown:2,keypress:2,keyup:2,focus:2,blur:2,change:2,reset:2,select:2,submit:2,load:1,unload:1,beforeunload:2,resize:1,move:1,DOMContentLoaded:1,readystatechange:1,error:1,abort:1,scroll:1}; +(function(){var a=function(b){var c=b.relatedTarget;if(c==undefined){return true;}if(c===false){return false;}return($type(this)!="document"&&c!=this&&c.prefix!="xul"&&!this.hasChild(c)); +};Element.Events=new Hash({mouseenter:{base:"mouseover",condition:a},mouseleave:{base:"mouseout",condition:a},mousewheel:{base:(Browser.Engine.gecko)?"DOMMouseScroll":"mousewheel"}}); +})();Element.Properties.styles={set:function(a){this.setStyles(a);}};Element.Properties.opacity={set:function(a,b){if(!b){if(a==0){if(this.style.visibility!="hidden"){this.style.visibility="hidden"; +}}else{if(this.style.visibility!="visible"){this.style.visibility="visible";}}}if(!this.currentStyle||!this.currentStyle.hasLayout){this.style.zoom=1;}if(Browser.Engine.trident){this.style.filter=(a==1)?"":"alpha(opacity="+a*100+")"; +}this.style.opacity=a;this.store("opacity",a);},get:function(){return this.retrieve("opacity",1);}};Element.implement({setOpacity:function(a){return this.set("opacity",a,true); +},getOpacity:function(){return this.get("opacity");},setStyle:function(b,a){switch(b){case"opacity":return this.set("opacity",parseFloat(a));case"float":b=(Browser.Engine.trident)?"styleFloat":"cssFloat"; +}b=b.camelCase();if($type(a)!="string"){var c=(Element.Styles.get(b)||"@").split(" ");a=$splat(a).map(function(e,d){if(!c[d]){return"";}return($type(e)=="number")?c[d].replace("@",Math.round(e)):e; +}).join(" ");}else{if(a==String(Number(a))){a=Math.round(a);}}this.style[b]=a;return this;},getStyle:function(g){switch(g){case"opacity":return this.get("opacity"); +case"float":g=(Browser.Engine.trident)?"styleFloat":"cssFloat";}g=g.camelCase();var a=this.style[g];if(!$chk(a)){a=[];for(var f in Element.ShortStyles){if(g!=f){continue; +}for(var e in Element.ShortStyles[f]){a.push(this.getStyle(e));}return a.join(" ");}a=this.getComputedStyle(g);}if(a){a=String(a);var c=a.match(/rgba?\([\d\s,]+\)/); +if(c){a=a.replace(c[0],c[0].rgbToHex());}}if(Browser.Engine.presto||(Browser.Engine.trident&&!$chk(parseInt(a,10)))){if(g.test(/^(height|width)$/)){var b=(g=="width")?["left","right"]:["top","bottom"],d=0; +b.each(function(h){d+=this.getStyle("border-"+h+"-width").toInt()+this.getStyle("padding-"+h).toInt();},this);return this["offset"+g.capitalize()]-d+"px"; +}if((Browser.Engine.presto)&&String(a).test("px")){return a;}if(g.test(/(border(.+)Width|margin|padding)/)){return"0px";}}return a;},setStyles:function(b){for(var a in b){this.setStyle(a,b[a]); +}return this;},getStyles:function(){var a={};Array.flatten(arguments).each(function(b){a[b]=this.getStyle(b);},this);return a;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}); +Element.ShortStyles={margin:{},padding:{},border:{},borderWidth:{},borderStyle:{},borderColor:{}};["Top","Right","Bottom","Left"].each(function(g){var f=Element.ShortStyles; +var b=Element.Styles;["margin","padding"].each(function(h){var i=h+g;f[h][i]=b[i]="@px";});var e="border"+g;f.border[e]=b[e]="@px @ rgb(@, @, @)";var d=e+"Width",a=e+"Style",c=e+"Color"; +f[e]={};f.borderWidth[d]=f[e][d]=b[d]="@px";f.borderStyle[a]=f[e][a]=b[a]="@";f.borderColor[c]=f[e][c]=b[c]="rgb(@, @, @)";});(function(){Element.implement({scrollTo:function(h,i){if(b(this)){this.getWindow().scrollTo(h,i); +}else{this.scrollLeft=h;this.scrollTop=i;}return this;},getSize:function(){if(b(this)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight}; +},getScrollSize:function(){if(b(this)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};},getScroll:function(){if(b(this)){return this.getWindow().getScroll(); +}return{x:this.scrollLeft,y:this.scrollTop};},getScrolls:function(){var i=this,h={x:0,y:0};while(i&&!b(i)){h.x+=i.scrollLeft;h.y+=i.scrollTop;i=i.parentNode; +}return h;},getOffsetParent:function(){var h=this;if(b(h)){return null;}if(!Browser.Engine.trident){return h.offsetParent;}while((h=h.parentNode)&&!b(h)){if(d(h,"position")!="static"){return h; +}}return null;},getOffsets:function(){if(this.getBoundingClientRect){var j=this.getBoundingClientRect(),m=document.id(this.getDocument().documentElement),p=m.getScroll(),k=this.getScrolls(),i=this.getScroll(),h=(d(this,"position")=="fixed"); +return{x:j.left.toInt()+k.x-i.x+((h)?0:p.x)-m.clientLeft,y:j.top.toInt()+k.y-i.y+((h)?0:p.y)-m.clientTop};}var l=this,n={x:0,y:0};if(b(this)){return n; +}while(l&&!b(l)){n.x+=l.offsetLeft;n.y+=l.offsetTop;if(Browser.Engine.gecko){if(!f(l)){n.x+=c(l);n.y+=g(l);}var o=l.parentNode;if(o&&d(o,"overflow")!="visible"){n.x+=c(o); +n.y+=g(o);}}else{if(l!=this&&Browser.Engine.webkit){n.x+=c(l);n.y+=g(l);}}l=l.offsetParent;}if(Browser.Engine.gecko&&!f(this)){n.x-=c(this);n.y-=g(this); +}return n;},getPosition:function(k){if(b(this)){return{x:0,y:0};}var l=this.getOffsets(),i=this.getScrolls();var h={x:l.x-i.x,y:l.y-i.y};var j=(k&&(k=document.id(k)))?k.getPosition():{x:0,y:0}; +return{x:h.x-j.x,y:h.y-j.y};},getCoordinates:function(j){if(b(this)){return this.getWindow().getCoordinates();}var h=this.getPosition(j),i=this.getSize(); +var k={left:h.x,top:h.y,width:i.x,height:i.y};k.right=k.left+k.width;k.bottom=k.top+k.height;return k;},computePosition:function(h){return{left:h.x-e(this,"margin-left"),top:h.y-e(this,"margin-top")}; +},setPosition:function(h){return this.setStyles(this.computePosition(h));}});Native.implement([Document,Window],{getSize:function(){if(Browser.Engine.presto||Browser.Engine.webkit){var i=this.getWindow(); +return{x:i.innerWidth,y:i.innerHeight};}var h=a(this);return{x:h.clientWidth,y:h.clientHeight};},getScroll:function(){var i=this.getWindow(),h=a(this); +return{x:i.pageXOffset||h.scrollLeft,y:i.pageYOffset||h.scrollTop};},getScrollSize:function(){var i=a(this),h=this.getSize();return{x:Math.max(i.scrollWidth,h.x),y:Math.max(i.scrollHeight,h.y)}; +},getPosition:function(){return{x:0,y:0};},getCoordinates:function(){var h=this.getSize();return{top:0,left:0,bottom:h.y,right:h.x,height:h.y,width:h.x}; +}});var d=Element.getComputedStyle;function e(h,i){return d(h,i).toInt()||0;}function f(h){return d(h,"-moz-box-sizing")=="border-box";}function g(h){return e(h,"border-top-width"); +}function c(h){return e(h,"border-left-width");}function b(h){return(/^(?:body|html)$/i).test(h.tagName);}function a(h){var i=h.getDocument();return(!i.compatMode||i.compatMode=="CSS1Compat")?i.html:i.body; +}})();Element.alias("setPosition","position");Native.implement([Window,Document,Element],{getHeight:function(){return this.getSize().y;},getWidth:function(){return this.getSize().x; +},getScrollTop:function(){return this.getScroll().y;},getScrollLeft:function(){return this.getScroll().x;},getScrollHeight:function(){return this.getScrollSize().y; +},getScrollWidth:function(){return this.getScrollSize().x;},getTop:function(){return this.getPosition().y;},getLeft:function(){return this.getPosition().x; +}});Native.implement([Document,Element],{getElements:function(h,g){h=h.split(",");var c,e={};for(var d=0,b=h.length;d<b;d++){var a=h[d],f=Selectors.Utils.search(this,a,e); +if(d!=0&&f.item){f=$A(f);}c=(d==0)?f:(c.item)?$A(c).concat(f):c.concat(f);}return new Elements(c,{ddup:(h.length>1),cash:!g});}});Element.implement({match:function(b){if(!b||(b==this)){return true; +}var d=Selectors.Utils.parseTagAndID(b);var a=d[0],e=d[1];if(!Selectors.Filters.byID(this,e)||!Selectors.Filters.byTag(this,a)){return false;}var c=Selectors.Utils.parseSelector(b); +return(c)?Selectors.Utils.filter(this,c,{}):true;}});var Selectors={Cache:{nth:{},parsed:{}}};Selectors.RegExps={id:(/#([\w-]+)/),tag:(/^(\w+|\*)/),quick:(/^(\w+|\*)$/),splitter:(/\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g),combined:(/\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)(["']?)([^\4]*?)\4)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g)}; +Selectors.Utils={chk:function(b,c){if(!c){return true;}var a=$uid(b);if(!c[a]){return c[a]=true;}return false;},parseNthArgument:function(h){if(Selectors.Cache.nth[h]){return Selectors.Cache.nth[h]; +}var e=h.match(/^([+-]?\d*)?([a-z]+)?([+-]?\d*)?$/);if(!e){return false;}var g=parseInt(e[1],10);var d=(g||g===0)?g:1;var f=e[2]||false;var c=parseInt(e[3],10)||0; +if(d!=0){c--;while(c<1){c+=d;}while(c>=d){c-=d;}}else{d=c;f="index";}switch(f){case"n":e={a:d,b:c,special:"n"};break;case"odd":e={a:2,b:0,special:"n"}; +break;case"even":e={a:2,b:1,special:"n"};break;case"first":e={a:0,special:"index"};break;case"last":e={special:"last-child"};break;case"only":e={special:"only-child"}; +break;default:e={a:(d-1),special:"index"};}return Selectors.Cache.nth[h]=e;},parseSelector:function(e){if(Selectors.Cache.parsed[e]){return Selectors.Cache.parsed[e]; +}var d,h={classes:[],pseudos:[],attributes:[]};while((d=Selectors.RegExps.combined.exec(e))){var i=d[1],g=d[2],f=d[3],b=d[5],c=d[6],j=d[7];if(i){h.classes.push(i); +}else{if(c){var a=Selectors.Pseudo.get(c);if(a){h.pseudos.push({parser:a,argument:j});}else{h.attributes.push({name:c,operator:"=",value:j});}}else{if(g){h.attributes.push({name:g,operator:f,value:b}); +}}}}if(!h.classes.length){delete h.classes;}if(!h.attributes.length){delete h.attributes;}if(!h.pseudos.length){delete h.pseudos;}if(!h.classes&&!h.attributes&&!h.pseudos){h=null; +}return Selectors.Cache.parsed[e]=h;},parseTagAndID:function(b){var a=b.match(Selectors.RegExps.tag);var c=b.match(Selectors.RegExps.id);return[(a)?a[1]:"*",(c)?c[1]:false]; +},filter:function(f,c,e){var d;if(c.classes){for(d=c.classes.length;d--;d){var g=c.classes[d];if(!Selectors.Filters.byClass(f,g)){return false;}}}if(c.attributes){for(d=c.attributes.length; +d--;d){var b=c.attributes[d];if(!Selectors.Filters.byAttribute(f,b.name,b.operator,b.value)){return false;}}}if(c.pseudos){for(d=c.pseudos.length;d--;d){var a=c.pseudos[d]; +if(!Selectors.Filters.byPseudo(f,a.parser,a.argument,e)){return false;}}}return true;},getByTagAndID:function(b,a,d){if(d){var c=(b.getElementById)?b.getElementById(d,true):Element.getElementById(b,d,true); +return(c&&Selectors.Filters.byTag(c,a))?[c]:[];}else{return b.getElementsByTagName(a);}},search:function(o,h,t){var b=[];var c=h.trim().replace(Selectors.RegExps.splitter,function(k,j,i){b.push(j); +return":)"+i;}).split(":)");var p,e,A;for(var z=0,v=c.length;z<v;z++){var y=c[z];if(z==0&&Selectors.RegExps.quick.test(y)){p=o.getElementsByTagName(y); +continue;}var a=b[z-1];var q=Selectors.Utils.parseTagAndID(y);var B=q[0],r=q[1];if(z==0){p=Selectors.Utils.getByTagAndID(o,B,r);}else{var d={},g=[];for(var x=0,w=p.length; +x<w;x++){g=Selectors.Getters[a](g,p[x],B,r,d);}p=g;}var f=Selectors.Utils.parseSelector(y);if(f){e=[];for(var u=0,s=p.length;u<s;u++){A=p[u];if(Selectors.Utils.filter(A,f,t)){e.push(A); +}}p=e;}}return p;}};Selectors.Getters={" ":function(h,g,j,a,e){var d=Selectors.Utils.getByTagAndID(g,j,a);for(var c=0,b=d.length;c<b;c++){var f=d[c];if(Selectors.Utils.chk(f,e)){h.push(f); +}}return h;},">":function(h,g,j,a,f){var c=Selectors.Utils.getByTagAndID(g,j,a);for(var e=0,d=c.length;e<d;e++){var b=c[e];if(b.parentNode==g&&Selectors.Utils.chk(b,f)){h.push(b); +}}return h;},"+":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(Selectors.Utils.chk(b,d)&&Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b); +}break;}}return c;},"~":function(c,b,a,e,d){while((b=b.nextSibling)){if(b.nodeType==1){if(!Selectors.Utils.chk(b,d)){break;}if(Selectors.Filters.byTag(b,a)&&Selectors.Filters.byID(b,e)){c.push(b); +}}}return c;}};Selectors.Filters={byTag:function(b,a){return(a=="*"||(b.tagName&&b.tagName.toLowerCase()==a));},byID:function(a,b){return(!b||(a.id&&a.id==b)); +},byClass:function(b,a){return(b.className&&b.className.contains&&b.className.contains(a," "));},byPseudo:function(a,d,c,b){return d.call(a,c,b);},byAttribute:function(c,d,b,e){var a=Element.prototype.getProperty.call(c,d); +if(!a){return(b=="!=");}if(!b||e==undefined){return true;}switch(b){case"=":return(a==e);case"*=":return(a.contains(e));case"^=":return(a.substr(0,e.length)==e); +case"$=":return(a.substr(a.length-e.length)==e);case"!=":return(a!=e);case"~=":return a.contains(e," ");case"|=":return a.contains(e,"-");}return false; +}};Selectors.Pseudo=new Hash({checked:function(){return this.checked;},empty:function(){return !(this.innerText||this.textContent||"").length;},not:function(a){return !Element.match(this,a); +},contains:function(a){return(this.innerText||this.textContent||"").contains(a);},"first-child":function(){return Selectors.Pseudo.index.call(this,0);},"last-child":function(){var a=this; +while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"only-child":function(){var b=this;while((b=b.previousSibling)){if(b.nodeType==1){return false; +}}var a=this;while((a=a.nextSibling)){if(a.nodeType==1){return false;}}return true;},"nth-child":function(g,e){g=(g==undefined)?"n":g;var c=Selectors.Utils.parseNthArgument(g); +if(c.special!="n"){return Selectors.Pseudo[c.special].call(this,c.a,e);}var f=0;e.positions=e.positions||{};var d=$uid(this);if(!e.positions[d]){var b=this; +while((b=b.previousSibling)){if(b.nodeType!=1){continue;}f++;var a=e.positions[$uid(b)];if(a!=undefined){f=a+f;break;}}e.positions[d]=f;}return(e.positions[d]%c.a==c.b); +},index:function(a){var b=this,c=0;while((b=b.previousSibling)){if(b.nodeType==1&&++c>a){return false;}}return(c==a);},even:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n+1",a); +},odd:function(b,a){return Selectors.Pseudo["nth-child"].call(this,"2n",a);},selected:function(){return this.selected;},enabled:function(){return(this.disabled===false); +}});Element.Events.domready={onAdd:function(a){if(Browser.loaded){a.call(this);}}};(function(){var b=function(){if(Browser.loaded){return;}Browser.loaded=true; +window.fireEvent("domready");document.fireEvent("domready");};window.addEvent("load",b);if(Browser.Engine.trident){var a=document.createElement("div"); +(function(){($try(function(){a.doScroll();return document.id(a).inject(document.body).set("html","temp").dispose();}))?b():arguments.callee.delay(50);})(); +}else{if(Browser.Engine.webkit&&Browser.Engine.version<525){(function(){(["loaded","complete"].contains(document.readyState))?b():arguments.callee.delay(50); +})();}else{document.addEvent("DOMContentLoaded",b);}}})();var JSON=new Hash(this.JSON&&{stringify:JSON.stringify,parse:JSON.parse}).extend({$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(a){return JSON.$specialChars[a]||"\\u00"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16); +},encode:function(b){switch($type(b)){case"string":return'"'+b.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(b.map(JSON.encode).clean())+"]"; +case"object":case"hash":var a=[];Hash.each(b,function(e,d){var c=JSON.encode(e);if(c){a.push(JSON.encode(d)+":"+c);}});return"{"+a+"}";case"number":case"boolean":return String(b); +case false:return"null";}return null;},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null; +}return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Fx=new Class({Implements:[Chain,Events,Options],options:{fps:50,unit:false,duration:500,link:"ignore"},initialize:function(a){this.subject=this.subject||this; +this.setOptions(a);this.options.duration=Fx.Durations[this.options.duration]||this.options.duration.toInt();var b=this.options.wait;if(b===false){this.options.link="cancel"; +}},getTransition:function(){return function(a){return -(Math.cos(Math.PI*a)-1)/2;};},step:function(){var a=$time();if(a<this.time+this.options.duration){var b=this.transition((a-this.time)/this.options.duration); +this.set(this.compute(this.from,this.to,b));}else{this.set(this.compute(this.from,this.to,1));this.complete();}},set:function(a){return a;},compute:function(c,b,a){return Fx.compute(c,b,a); +},check:function(){if(!this.timer){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments)); +return false;}return false;},start:function(b,a){if(!this.check(b,a)){return this;}this.from=b;this.to=a;this.time=0;this.transition=this.getTransition(); +this.startTimer();this.onStart();return this;},complete:function(){if(this.stopTimer()){this.onComplete();}return this;},cancel:function(){if(this.stopTimer()){this.onCancel(); +}return this;},onStart:function(){this.fireEvent("start",this.subject);},onComplete:function(){this.fireEvent("complete",this.subject);if(!this.callChain()){this.fireEvent("chainComplete",this.subject); +}},onCancel:function(){this.fireEvent("cancel",this.subject).clearChain();},pause:function(){this.stopTimer();return this;},resume:function(){this.startTimer(); +return this;},stopTimer:function(){if(!this.timer){return false;}this.time=$time()-this.time;this.timer=$clear(this.timer);return true;},startTimer:function(){if(this.timer){return false; +}this.time=$time()-this.time;this.timer=this.step.periodical(Math.round(1000/this.options.fps),this);return true;}});Fx.compute=function(c,b,a){return(b-c)*a+c; +};Fx.Durations={"short":250,normal:500,"long":1000};Fx.CSS=new Class({Extends:Fx,prepare:function(d,e,b){b=$splat(b);var c=b[1];if(!$chk(c)){b[1]=b[0]; +b[0]=d.getStyle(e);}var a=b.map(this.parse);return{from:a[0],to:a[1]};},parse:function(a){a=$lambda(a)();a=(typeof a=="string")?a.split(" "):$splat(a); +return a.map(function(c){c=String(c);var b=false;Fx.CSS.Parsers.each(function(f,e){if(b){return;}var d=f.parse(c);if($chk(d)){b={value:d,parser:f};}}); +b=b||{value:c,parser:Fx.CSS.Parsers.String};return b;});},compute:function(d,c,b){var a=[];(Math.min(d.length,c.length)).times(function(e){a.push({value:d[e].parser.compute(d[e].value,c[e].value,b),parser:d[e].parser}); +});a.$family={name:"fx:css:value"};return a;},serve:function(c,b){if($type(c)!="fx:css:value"){c=this.parse(c);}var a=[];c.each(function(d){a=a.concat(d.parser.serve(d.value,b)); +});return a;},render:function(a,d,c,b){a.setStyle(d,this.serve(c,b));},search:function(a){if(Fx.CSS.Cache[a]){return Fx.CSS.Cache[a];}var b={};Array.each(document.styleSheets,function(e,d){var c=e.href; +if(c&&c.contains("://")&&!c.contains(document.domain)){return;}var f=e.rules||e.cssRules;Array.each(f,function(j,g){if(!j.style){return;}var h=(j.selectorText)?j.selectorText.replace(/^\w+/,function(i){return i.toLowerCase(); +}):null;if(!h||!h.test("^"+a+"$")){return;}Element.Styles.each(function(k,i){if(!j.style[i]||Element.ShortStyles[i]){return;}k=String(j.style[i]);b[i]=(k.test(/^rgb/))?k.rgbToHex():k; +});});});return Fx.CSS.Cache[a]=b;}});Fx.CSS.Cache={};Fx.CSS.Parsers=new Hash({Color:{parse:function(a){if(a.match(/^#[0-9a-f]{3,6}$/i)){return a.hexToRgb(true); +}return((a=a.match(/(\d+),\s*(\d+),\s*(\d+)/)))?[a[1],a[2],a[3]]:false;},compute:function(c,b,a){return c.map(function(e,d){return Math.round(Fx.compute(c[d],b[d],a)); +});},serve:function(a){return a.map(Number);}},Number:{parse:parseFloat,compute:Fx.compute,serve:function(b,a){return(a)?b+a:b;}},String:{parse:$lambda(false),compute:$arguments(1),serve:$arguments(0)}}); +Fx.Tween=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a);},set:function(b,a){if(arguments.length==1){a=b; +b=this.property||this.options.property;}this.render(this.element,b,a,this.options.unit);return this;},start:function(c,e,d){if(!this.check(c,e,d)){return this; +}var b=Array.flatten(arguments);this.property=this.options.property||b.shift();var a=this.prepare(this.element,this.property,b);return this.parent(a.from,a.to); +}});Element.Properties.tween={set:function(a){var b=this.retrieve("tween");if(b){b.cancel();}return this.eliminate("tween").store("tween:options",$extend({link:"cancel"},a)); +},get:function(a){if(a||!this.retrieve("tween")){if(a||!this.retrieve("tween:options")){this.set("tween",a);}this.store("tween",new Fx.Tween(this,this.retrieve("tween:options"))); +}return this.retrieve("tween");}};Element.implement({tween:function(a,c,b){this.get("tween").start(arguments);return this;},fade:function(c){var e=this.get("tween"),d="opacity",a; +c=$pick(c,"toggle");switch(c){case"in":e.start(d,1);break;case"out":e.start(d,0);break;case"show":e.set(d,1);break;case"hide":e.set(d,0);break;case"toggle":var b=this.retrieve("fade:flag",this.get("opacity")==1); +e.start(d,(b)?0:1);this.store("fade:flag",!b);a=true;break;default:e.start(d,arguments);}if(!a){this.eliminate("fade:flag");}return this;},highlight:function(c,a){if(!a){a=this.retrieve("highlight:original",this.getStyle("background-color")); +a=(a=="transparent")?"#fff":a;}var b=this.get("tween");b.start("background-color",c||"#ffff88",a).chain(function(){this.setStyle("background-color",this.retrieve("highlight:original")); +b.callChain();}.bind(this));return this;}});Fx.Morph=new Class({Extends:Fx.CSS,initialize:function(b,a){this.element=this.subject=document.id(b);this.parent(a); +},set:function(a){if(typeof a=="string"){a=this.search(a);}for(var b in a){this.render(this.element,b,a[b],this.options.unit);}return this;},compute:function(e,d,c){var a={}; +for(var b in e){a[b]=this.parent(e[b],d[b],c);}return a;},start:function(b){if(!this.check(b)){return this;}if(typeof b=="string"){b=this.search(b);}var e={},d={}; +for(var c in b){var a=this.prepare(this.element,c,b[c]);e[c]=a.from;d[c]=a.to;}return this.parent(e,d);}});Element.Properties.morph={set:function(a){var b=this.retrieve("morph"); +if(b){b.cancel();}return this.eliminate("morph").store("morph:options",$extend({link:"cancel"},a));},get:function(a){if(a||!this.retrieve("morph")){if(a||!this.retrieve("morph:options")){this.set("morph",a); +}this.store("morph",new Fx.Morph(this,this.retrieve("morph:options")));}return this.retrieve("morph");}};Element.implement({morph:function(a){this.get("morph").start(a); +return this;}});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:true,format:false,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false,noCache:false},initialize:function(a){this.xhr=new Browser.Request(); +this.setOptions(a);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers);},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return; +}this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;}.bind(this));this.xhr.onreadystatechange=$empty;if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML}; +this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}},isSuccess:function(){return((this.status>=200)&&(this.status<300)); +},processScripts:function(a){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(a);}return a.stripScripts(this.options.evalScripts); +},success:function(b,a){this.onSuccess(this.processScripts(b),a);},onSuccess:function(){this.fireEvent("complete",arguments).fireEvent("success",arguments).callChain(); +},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("complete").fireEvent("failure",this.xhr);},setHeader:function(a,b){this.headers.set(a,b); +return this;},getHeader:function(a){return $try(function(){return this.xhr.getResponseHeader(a);}.bind(this));},check:function(){if(!this.running){return true; +}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.caller.bind(this,arguments));return false;}return false;},send:function(k){if(!this.check(k)){return this; +}this.running=true;var i=$type(k);if(i=="string"||i=="element"){k={data:k};}var d=this.options;k=$extend({data:d.data,url:d.url,method:d.method},k);var g=k.data,b=String(k.url),a=k.method.toLowerCase(); +switch($type(g)){case"element":g=document.id(g).toQueryString();break;case"object":case"hash":g=Hash.toQueryString(g);}if(this.options.format){var j="format="+this.options.format; +g=(g)?j+"&"+g:j;}if(this.options.emulation&&!["get","post"].contains(a)){var h="_method="+a;g=(g)?h+"&"+g:h;a="post";}if(this.options.urlEncoded&&a=="post"){var c=(this.options.encoding)?"; charset="+this.options.encoding:""; +this.headers.set("Content-type","application/x-www-form-urlencoded"+c);}if(this.options.noCache){var f="noCache="+new Date().getTime();g=(g)?f+"&"+g:f; +}var e=b.lastIndexOf("/");if(e>-1&&(e=b.indexOf("#"))>-1){b=b.substr(0,e);}if(g&&a=="get"){b=b+(b.contains("?")?"&":"?")+g;g=null;}this.xhr.open(a.toUpperCase(),b,this.options.async); +this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(m,l){try{this.xhr.setRequestHeader(l,m);}catch(n){this.fireEvent("exception",[l,m]); +}},this);this.fireEvent("request");this.xhr.send(g);if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this; +}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=new Browser.Request();this.fireEvent("cancel");return this;}});(function(){var a={}; +["get","post","put","delete","GET","POST","PUT","DELETE"].each(function(b){a[b]=function(){var c=Array.link(arguments,{url:String.type,data:$defined}); +return this.send($extend(c,{method:b}));};});Request.implement(a);})();Element.Properties.send={set:function(a){var b=this.retrieve("send");if(b){b.cancel(); +}return this.eliminate("send").store("send:options",$extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},a));},get:function(a){if(a||!this.retrieve("send")){if(a||!this.retrieve("send:options")){this.set("send",a); +}this.store("send",new Request(this.retrieve("send:options")));}return this.retrieve("send");}};Element.implement({send:function(a){var b=this.get("send"); +b.send({data:this,url:a||b.options.url});return this;}});Request.HTML=new Class({Extends:Request,options:{update:false,append:false,evalScripts:true,filter:false},processHTML:function(c){var b=c.match(/<body[^>]*>([\s\S]*?)<\/body>/i); +c=(b)?b[1]:c;var a=new Element("div");return $try(function(){var d="<root>"+c+"</root>",g;if(Browser.Engine.trident){g=new ActiveXObject("Microsoft.XMLDOM"); +g.async=false;g.loadXML(d);}else{g=new DOMParser().parseFromString(d,"text/xml");}d=g.getElementsByTagName("root")[0];if(!d){return null;}for(var f=0,e=d.childNodes.length; +f<e;f++){var h=Element.clone(d.childNodes[f],true,true);if(h){a.grab(h);}}return a;})||a.set("html",c);},success:function(d){var c=this.options,b=this.response; +b.html=d.stripScripts(function(e){b.javascript=e;});var a=this.processHTML(b.html);b.tree=a.childNodes;b.elements=a.getElements("*");if(c.filter){b.tree=b.elements.filter(c.filter); +}if(c.update){document.id(c.update).empty().set("html",b.html);}else{if(c.append){document.id(c.append).adopt(a.getChildren());}}if(c.evalScripts){$exec(b.javascript); +}this.onSuccess(b.tree,b.elements,b.html,b.javascript);}});Element.Properties.load={set:function(a){var b=this.retrieve("load");if(b){b.cancel();}return this.eliminate("load").store("load:options",$extend({data:this,link:"cancel",update:this,method:"get"},a)); +},get:function(a){if(a||!this.retrieve("load")){if(a||!this.retrieve("load:options")){this.set("load",a);}this.store("load",new Request.HTML(this.retrieve("load:options"))); +}return this.retrieve("load");}};Element.implement({load:function(){this.get("load").send(Array.link(arguments,{data:Object.type,url:String.type}));return this; +}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(a){this.parent(a);this.headers.extend({Accept:"application/json","X-Request":"JSON"}); +},success:function(a){this.response.json=JSON.decode(a,this.options.secure);this.onSuccess(this.response.json,a);}});
\ No newline at end of file diff --git a/core/module/web/media/default/js/mootools-1.2.4.2-more.js b/core/module/web/media/default/js/mootools-1.2.4.2-more.js new file mode 100644 index 000000000..eb04477df --- /dev/null +++ b/core/module/web/media/default/js/mootools-1.2.4.2-more.js @@ -0,0 +1,134 @@ +//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License. + +MooTools.More={version:"1.2.4.2",build:"bd5a93c0913cce25917c48cbdacde568e15e02ef"};Class.refactor=function(b,a){$each(a,function(e,d){var c=b.prototype[d]; +if(c&&(c=c._origin)&&typeof e=="function"){b.implement(d,function(){var f=this.previous;this.previous=c;var g=e.apply(this,arguments);this.previous=f;return g; +});}else{b.implement(d,e);}});return b;};Class.Mutators.Binds=function(a){return a;};Class.Mutators.initialize=function(a){return function(){$splat(this.Binds).each(function(b){var c=this[b]; +if(c){this[b]=c.bind(this);}},this);return a.apply(this,arguments);};};Class.Occlude=new Class({occlude:function(c,b){b=document.id(b||this.element);var a=b.retrieve(c||this.property); +if(a&&!$defined(this.occluded)){return this.occluded=a;}this.occluded=false;b.store(c||this.property,this);return this.occluded;}});String.implement({parseQueryString:function(){var b=this.split(/[&;]/),a={}; +if(b.length){b.each(function(g){var c=g.indexOf("="),d=c<0?[""]:g.substr(0,c).match(/[^\]\[]+/g),e=decodeURIComponent(g.substr(c+1)),f=a;d.each(function(j,h){var k=f[j]; +if(h<d.length-1){f=f[j]=k||{};}else{if($type(k)=="array"){k.push(e);}else{f[j]=$defined(k)?[k,e]:e;}}});});}return a;},cleanQueryString:function(a){return this.split("&").filter(function(e){var b=e.indexOf("="),c=b<0?"":e.substr(0,b),d=e.substr(b+1); +return a?a.run([c,d]):$chk(d);}).join("&");}});Element.implement({measure:function(e){var g=function(h){return !!(!h||h.offsetHeight||h.offsetWidth);}; +if(g(this)){return e.apply(this);}var d=this.getParent(),f=[],b=[];while(!g(d)&&d!=document.body){b.push(d.expose());d=d.getParent();}var c=this.expose(); +var a=e.apply(this);c();b.each(function(h){h();});return a;},expose:function(){if(this.getStyle("display")!="none"){return $empty;}var a=this.style.cssText; +this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=a;}.bind(this);},getDimensions:function(a){a=$merge({computeSize:false},a); +var f={};var d=function(g,e){return(e.computeSize)?g.getComputedSize(e):g.getSize();};var b=this.getParent("body");if(b&&this.getStyle("display")=="none"){f=this.measure(function(){return d(this,a); +});}else{if(b){try{f=d(this,a);}catch(c){}}else{f={x:0,y:0};}}return $chk(f.x)?$extend(f,{width:f.x,height:f.y}):$extend(f,{x:f.width,y:f.height});},getComputedSize:function(a){a=$merge({styles:["padding","border"],plains:{height:["top","bottom"],width:["left","right"]},mode:"both"},a); +var c={width:0,height:0};switch(a.mode){case"vertical":delete c.width;delete a.plains.width;break;case"horizontal":delete c.height;delete a.plains.height; +break;}var b=[];$each(a.plains,function(g,f){g.each(function(h){a.styles.each(function(i){b.push((i=="border")?i+"-"+h+"-width":i+"-"+h);});});});var e={}; +b.each(function(f){e[f]=this.getComputedStyle(f);},this);var d=[];$each(a.plains,function(g,f){var h=f.capitalize();c["total"+h]=c["computed"+h]=0;g.each(function(i){c["computed"+i.capitalize()]=0; +b.each(function(k,j){if(k.test(i)){e[k]=e[k].toInt()||0;c["total"+h]=c["total"+h]+e[k];c["computed"+i.capitalize()]=c["computed"+i.capitalize()]+e[k];}if(k.test(i)&&f!=k&&(k.test("border")||k.test("padding"))&&!d.contains(k)){d.push(k); +c["computed"+h]=c["computed"+h]-e[k];}});});});["Width","Height"].each(function(g){var f=g.toLowerCase();if(!$chk(c[f])){return;}c[f]=c[f]+this["offset"+g]+c["computed"+g]; +c["total"+g]=c[f]+c["total"+g];delete c["computed"+g];},this);return $extend(e,c);}});(function(){var a=Element.prototype.position;Element.implement({position:function(h){if(h&&($defined(h.x)||$defined(h.y))){return a?a.apply(this,arguments):this; +}$each(h||{},function(w,u){if(!$defined(w)){delete h[u];}});h=$merge({relativeTo:document.body,position:{x:"center",y:"center"},edge:false,offset:{x:0,y:0},returnPos:false,relFixedPosition:false,ignoreMargins:false,ignoreScroll:false,allowNegative:false},h); +var s={x:0,y:0},f=false;var c=this.measure(function(){return document.id(this.getOffsetParent());});if(c&&c!=this.getDocument().body){s=c.measure(function(){return this.getPosition(); +});f=c!=document.id(h.relativeTo);h.offset.x=h.offset.x-s.x;h.offset.y=h.offset.y-s.y;}var t=function(u){if($type(u)!="string"){return u;}u=u.toLowerCase(); +var v={};if(u.test("left")){v.x="left";}else{if(u.test("right")){v.x="right";}else{v.x="center";}}if(u.test("upper")||u.test("top")){v.y="top";}else{if(u.test("bottom")){v.y="bottom"; +}else{v.y="center";}}return v;};h.edge=t(h.edge);h.position=t(h.position);if(!h.edge){if(h.position.x=="center"&&h.position.y=="center"){h.edge={x:"center",y:"center"}; +}else{h.edge={x:"left",y:"top"};}}this.setStyle("position","absolute");var g=document.id(h.relativeTo)||document.body,d=g==document.body?window.getScroll():g.getPosition(),n=d.y,i=d.x; +var e=g.getScrolls();n+=e.y;i+=e.x;var o=this.getDimensions({computeSize:true,styles:["padding","border","margin"]});var k={},p=h.offset.y,r=h.offset.x,l=window.getSize(); +switch(h.position.x){case"left":k.x=i+r;break;case"right":k.x=i+r+g.offsetWidth;break;default:k.x=i+((g==document.body?l.x:g.offsetWidth)/2)+r;break;}switch(h.position.y){case"top":k.y=n+p; +break;case"bottom":k.y=n+p+g.offsetHeight;break;default:k.y=n+((g==document.body?l.y:g.offsetHeight)/2)+p;break;}if(h.edge){var b={};switch(h.edge.x){case"left":b.x=0; +break;case"right":b.x=-o.x-o.computedRight-o.computedLeft;break;default:b.x=-(o.totalWidth/2);break;}switch(h.edge.y){case"top":b.y=0;break;case"bottom":b.y=-o.y-o.computedTop-o.computedBottom; +break;default:b.y=-(o.totalHeight/2);break;}k.x+=b.x;k.y+=b.y;}k={left:((k.x>=0||f||h.allowNegative)?k.x:0).toInt(),top:((k.y>=0||f||h.allowNegative)?k.y:0).toInt()}; +var j={left:"x",top:"y"};["minimum","maximum"].each(function(u){["left","top"].each(function(v){var w=h[u]?h[u][j[v]]:null;if(w!=null&&k[v]<w){k[v]=w;}}); +});if(g.getStyle("position")=="fixed"||h.relFixedPosition){var m=window.getScroll();k.top+=m.y;k.left+=m.x;}if(h.ignoreScroll){var q=g.getScroll();k.top-=q.y; +k.left-=q.x;}if(h.ignoreMargins){k.left+=(h.edge.x=="right"?o["margin-right"]:h.edge.x=="center"?-o["margin-left"]+((o["margin-right"]+o["margin-left"])/2):-o["margin-left"]); +k.top+=(h.edge.y=="bottom"?o["margin-bottom"]:h.edge.y=="center"?-o["margin-top"]+((o["margin-bottom"]+o["margin-top"])/2):-o["margin-top"]);}k.left=Math.ceil(k.left); +k.top=Math.ceil(k.top);if(h.returnPos){return k;}else{this.setStyles(k);}return this;}});})();Element.implement({isDisplayed:function(){return this.getStyle("display")!="none"; +},isVisible:function(){var a=this.offsetWidth,b=this.offsetHeight;return(a==0&&b==0)?false:(a>0&&b>0)?true:this.isDisplayed();},toggle:function(){return this[this.isDisplayed()?"hide":"show"](); +},hide:function(){var b;try{if((b=this.getStyle("display"))=="none"){b=null;}}catch(a){}return this.store("originalDisplay",b||"block").setStyle("display","none"); +},show:function(a){return this.setStyle("display",a||this.retrieve("originalDisplay")||"block");},swapClass:function(a,b){return this.removeClass(a).addClass(b); +}});if(!window.Form){window.Form={};}(function(){Form.Request=new Class({Binds:["onSubmit","onFormValidate"],Implements:[Options,Events,Class.Occlude],options:{requestOptions:{evalScripts:true,useSpinner:true,emulation:false,link:"ignore"},extraData:{},resetForm:true},property:"form.request",initialize:function(b,c,a){this.element=document.id(b); +if(this.occlude()){return this.occluded;}this.update=document.id(c);this.setOptions(a);this.makeRequest();if(this.options.resetForm){this.request.addEvent("success",function(){$try(function(){this.element.reset(); +}.bind(this));if(window.OverText){OverText.update();}}.bind(this));}this.attach();},toElement:function(){return this.element;},makeRequest:function(){this.request=new Request.HTML($merge({url:this.element.get("action"),update:this.update,emulation:false,spinnerTarget:this.element,method:this.element.get("method")||"post"},this.options.requestOptions)).addEvents({success:function(b,a){["success","complete"].each(function(c){this.fireEvent(c,[this.update,b,a]); +},this);}.bind(this),failure:function(a){this.fireEvent("failure",a);}.bind(this),exception:function(){this.fireEvent("failure",xhr);}.bind(this)});},attach:function(a){a=$pick(a,true); +method=a?"addEvent":"removeEvent";var b=this.element.retrieve("validator");if(b){b[method]("onFormValidate",this.onFormValidate);}if(!b||!a){this.element[method]("submit",this.onSubmit); +}},detach:function(){this.attach(false);},enable:function(){this.attach();},disable:function(){this.detach();},onFormValidate:function(b,a,c){if(b||!fv.options.stopOnFailure){if(c&&c.stop){c.stop(); +}this.send();}},onSubmit:function(a){if(this.element.retrieve("validator")){this.detach();this.addFormEvent();return;}a.stop();this.send();},send:function(){var b=this.element.toQueryString().trim(); +var a=$H(this.options.extraData).toQueryString();if(b){b+="&"+a;}else{b=a;}this.fireEvent("send",[this.element,b]);this.request.send({data:b});return this; +}});Element.Properties.formRequest={set:function(){var a=Array.link(arguments,{options:Object.type,update:Element.type,updateId:String.type});var c=a.update||a.updateId; +var b=this.retrieve("form.request");if(c){if(b){b.update=document.id(c);}this.store("form.request:update",c);}if(a.options){if(b){b.setOptions(a.options); +}this.store("form.request:options",a.options);}return this;},get:function(){var a=Array.link(arguments,{options:Object.type,update:Element.type,updateId:String.type}); +var b=a.update||a.updateId;if(a.options||b||!this.retrieve("form.request")){if(a.options||!this.retrieve("form.request:options")){this.set("form.request",a.options); +}if(b){this.set("form.request",b);}this.store("form.request",new Form.Request(this,this.retrieve("form.request:update"),this.retrieve("form.request:options"))); +}return this.retrieve("form.request");}};Element.implement({formUpdate:function(b,a){this.get("form.request",b,a).send();return this;}});})();Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.Engine.trident4,mode:"vertical",display:"block",hideInputs:Browser.Engine.trident?"select, input, textarea, object, embed":false},dissolve:function(){try{if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true; +this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); +this.element.setStyle("display","block");if(this.options.transitionOpacity){d.opacity=1;}var b={};$each(d,function(f,e){b[e]=[f,0];},this);this.element.setStyle("overflow","hidden"); +var a=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;this.$chain.unshift(function(){if(this.hidden){this.hiding=false;$each(d,function(f,e){d[e]=f; +},this);this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(a){a.setStyle("visibility","visible");}}this.fireEvent("hide",this.element); +this.callChain();}.bind(this));if(a){a.setStyle("visibility","hidden");}this.start(b);}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element); +this.fireEvent("hide",this.element);}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this));}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel(); +this.dissolve();}}}}catch(c){this.hiding=false;this.element.setStyle("display","none");this.callChain.delay(10,this);this.fireEvent("complete",this.element); +this.fireEvent("hide",this.element);}return this;},reveal:function(){try{if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.showing=true; +this.hiding=this.hidden=false;var d;this.cssText=this.element.style.cssText;this.element.measure(function(){d=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode}); +}.bind(this));$each(d,function(f,e){d[e]=f;});if($chk(this.options.heightOverride)){d.height=this.options.heightOverride.toInt();}if($chk(this.options.widthOverride)){d.width=this.options.widthOverride.toInt(); +}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);d.opacity=1;}var b={height:0,display:this.options.display};$each(d,function(f,e){b[e]=0; +});this.element.setStyles($merge(b,{overflow:"hidden"}));var a=this.options.hideInputs?this.element.getElements(this.options.hideInputs):null;if(a){a.setStyle("visibility","hidden"); +}this.start(d);this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",this.options.display);if(!this.hidden){this.showing=false; +}if(a){a.setStyle("visibility","visible");}this.callChain();this.fireEvent("show",this.element);}.bind(this));}else{this.callChain();this.fireEvent("complete",this.element); +this.fireEvent("show",this.element);}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this));}else{if(this.options.link=="cancel"&&!this.showing){this.cancel(); +this.reveal();}}}}catch(c){this.element.setStyles({display:this.options.display,visiblity:"visible",opacity:1});this.showing=false;this.callChain.delay(10,this); +this.fireEvent("complete",this.element);this.fireEvent("show",this.element);}return this;},toggle:function(){if(this.element.getStyle("display")=="none"||this.element.getStyle("visiblity")=="hidden"||this.element.getStyle("opacity")==0){this.reveal(); +}else{this.dissolve();}return this;},cancel:function(){this.parent.apply(this,arguments);this.element.style.cssText=this.cssText;this.hidding=false;this.showing=false; +}});Element.Properties.reveal={set:function(a){var b=this.retrieve("reveal");if(b){b.cancel();}return this.eliminate("reveal").store("reveal:options",a); +},get:function(a){if(a||!this.retrieve("reveal")){if(a||!this.retrieve("reveal:options")){this.set("reveal",a);}this.store("reveal",new Fx.Reveal(this,this.retrieve("reveal:options"))); +}return this.retrieve("reveal");}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(a){this.get("reveal",a).reveal(); +return this;},dissolve:function(a){this.get("reveal",a).dissolve();return this;},nix:function(){var a=Array.link(arguments,{destroy:Boolean.type,options:Object.type}); +this.get("reveal",a.options).dissolve().chain(function(){this[a.destroy?"destroy":"dispose"]();}.bind(this));return this;},wink:function(){var b=Array.link(arguments,{duration:Number.type,options:Object.type}); +var a=this.get("reveal",b.options);a.reveal().chain(function(){(function(){a.dissolve();}).delay(b.duration||2000);});}});Request.implement({options:{initialDelay:5000,delay:5000,limit:60000},startTimer:function(b){var a=function(){if(!this.running){this.send({data:b}); +}};this.timer=a.delay(this.options.initialDelay,this);this.lastDelay=this.options.initialDelay;this.completeCheck=function(c){$clear(this.timer);this.lastDelay=(c)?this.options.delay:(this.lastDelay+this.options.delay).min(this.options.limit); +this.timer=a.delay(this.lastDelay,this);};return this.addEvent("complete",this.completeCheck);},stopTimer:function(){$clear(this.timer);return this.removeEvent("complete",this.completeCheck); +}});var Color=new Native({initialize:function(b,c){if(arguments.length>=3){c="rgb";b=Array.slice(arguments,0,3);}else{if(typeof b=="string"){if(b.match(/rgb/)){b=b.rgbToHex().hexToRgb(true); +}else{if(b.match(/hsb/)){b=b.hsbToRgb();}else{b=b.hexToRgb(true);}}}}c=c||"rgb";switch(c){case"hsb":var a=b;b=b.hsbToRgb();b.hsb=a;break;case"hex":b=b.hexToRgb(true); +break;}b.rgb=b.slice(0,3);b.hsb=b.hsb||b.rgbToHsb();b.hex=b.rgbToHex();return $extend(b,this);}});Color.implement({mix:function(){var a=Array.slice(arguments); +var c=($type(a.getLast())=="number")?a.pop():50;var b=this.slice();a.each(function(d){d=new Color(d);for(var e=0;e<3;e++){b[e]=Math.round((b[e]/100*(100-c))+(d[e]/100*c)); +}});return new Color(b,"rgb");},invert:function(){return new Color(this.map(function(a){return 255-a;}));},setHue:function(a){return new Color([a,this.hsb[1],this.hsb[2]],"hsb"); +},setSaturation:function(a){return new Color([this.hsb[0],a,this.hsb[2]],"hsb");},setBrightness:function(a){return new Color([this.hsb[0],this.hsb[1],a],"hsb"); +}});var $RGB=function(d,c,a){return new Color([d,c,a],"rgb");};var $HSB=function(d,c,a){return new Color([d,c,a],"hsb");};var $HEX=function(a){return new Color(a,"hex"); +};Array.implement({rgbToHsb:function(){var b=this[0],c=this[1],j=this[2],g=0;var i=Math.max(b,c,j),e=Math.min(b,c,j);var k=i-e;var h=i/255,f=(i!=0)?k/i:0; +if(f!=0){var d=(i-b)/k;var a=(i-c)/k;var l=(i-j)/k;if(b==i){g=l-a;}else{if(c==i){g=2+d-l;}else{g=4+a-d;}}g/=6;if(g<0){g++;}}return[Math.round(g*360),Math.round(f*100),Math.round(h*100)]; +},hsbToRgb:function(){var c=Math.round(this[2]/100*255);if(this[1]==0){return[c,c,c];}else{var a=this[0]%360;var e=a%60;var g=Math.round((this[2]*(100-this[1]))/10000*255); +var d=Math.round((this[2]*(6000-this[1]*e))/600000*255);var b=Math.round((this[2]*(6000-this[1]*(60-e)))/600000*255);switch(Math.floor(a/60)){case 0:return[c,b,g]; +case 1:return[d,c,g];case 2:return[g,c,b];case 3:return[g,d,c];case 4:return[b,g,c];case 5:return[c,g,d];}}return false;}});String.implement({rgbToHsb:function(){var a=this.match(/\d{1,3}/g); +return(a)?a.rgbToHsb():null;},hsbToRgb:function(){var a=this.match(/\d{1,3}/g);return(a)?a.hsbToRgb():null;}});var IframeShim=new Class({Implements:[Options,Events,Class.Occlude],options:{className:"iframeShim",src:'javascript:false;document.write("");',display:false,zIndex:null,margin:0,offset:{x:0,y:0},browsers:(Browser.Engine.trident4||(Browser.Engine.gecko&&!Browser.Engine.gecko19&&Browser.Platform.mac))},property:"IframeShim",initialize:function(b,a){this.element=document.id(b); +if(this.occlude()){return this.occluded;}this.setOptions(a);this.makeShim();return this;},makeShim:function(){if(this.options.browsers){var c=this.element.getStyle("zIndex").toInt(); +if(!c){c=1;var b=this.element.getStyle("position");if(b=="static"||!b){this.element.setStyle("position","relative");}this.element.setStyle("zIndex",c); +}c=($chk(this.options.zIndex)&&c>this.options.zIndex)?this.options.zIndex:c-1;if(c<0){c=1;}this.shim=new Element("iframe",{src:this.options.src,scrolling:"no",frameborder:0,styles:{zIndex:c,position:"absolute",border:"none",filter:"progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"},"class":this.options.className}).store("IframeShim",this); +var a=(function(){this.shim.inject(this.element,"after");this[this.options.display?"show":"hide"]();this.fireEvent("inject");}).bind(this);if(IframeShim.ready){window.addEvent("load",a); +}else{a();}}else{this.position=this.hide=this.show=this.dispose=$lambda(this);}},position:function(){if(!IframeShim.ready||!this.shim){return this;}var a=this.element.measure(function(){return this.getSize(); +});if(this.options.margin!=undefined){a.x=a.x-(this.options.margin*2);a.y=a.y-(this.options.margin*2);this.options.offset.x+=this.options.margin;this.options.offset.y+=this.options.margin; +}this.shim.set({width:a.x,height:a.y}).position({relativeTo:this.element,offset:this.options.offset});return this;},hide:function(){if(this.shim){this.shim.setStyle("display","none"); +}return this;},show:function(){if(this.shim){this.shim.setStyle("display","block");}return this.position();},dispose:function(){if(this.shim){this.shim.dispose(); +}return this;},destroy:function(){if(this.shim){this.shim.destroy();}return this;}});window.addEvent("load",function(){IframeShim.ready=true;});var Mask=new Class({Implements:[Options,Events],Binds:["resize"],options:{style:{},"class":"mask",maskMargins:false,useIframeShim:true},initialize:function(b,a){this.target=document.id(b)||document.body; +this.target.store("mask",this);this.setOptions(a);this.render();this.inject();},render:function(){this.element=new Element("div",{"class":this.options["class"],id:this.options.id||"mask-"+$time(),styles:$merge(this.options.style,{display:"none"}),events:{click:function(){this.fireEvent("click"); +if(this.options.hideOnClick){this.hide();}}.bind(this)}});this.hidden=true;},toElement:function(){return this.element;},inject:function(b,a){a=a||this.options.inject?this.options.inject.where:""||this.target==document.body?"inside":"after"; +b=b||this.options.inject?this.options.inject.target:""||this.target;this.element.inject(b,a);if(this.options.useIframeShim){this.shim=new IframeShim(this.element); +this.addEvents({show:this.shim.show.bind(this.shim),hide:this.shim.hide.bind(this.shim),destroy:this.shim.destroy.bind(this.shim)});}},position:function(){this.resize(this.options.width,this.options.height); +this.element.position({relativeTo:this.target,position:"topLeft",ignoreMargins:!this.options.maskMargins,ignoreScroll:this.target==document.body});return this; +},resize:function(a,e){var b={styles:["padding","border"]};if(this.options.maskMargins){b.styles.push("margin");}var d=this.target.getComputedSize(b);if(this.target==document.body){var c=window.getSize(); +if(d.totalHeight<c.y){d.totalHeight=c.y;}if(d.totalWidth<c.x){d.totalWidth=c.x;}}this.element.setStyles({width:$pick(a,d.totalWidth,d.x),height:$pick(e,d.totalHeight,d.y)}); +return this;},show:function(){if(!this.hidden){return this;}this.target.addEvent("resize",this.resize);if(this.target!=document.body){document.id(document.body).addEvent("resize",this.resize); +}this.position();this.showMask.apply(this,arguments);return this;},showMask:function(){this.element.setStyle("display","block");this.hidden=false;this.fireEvent("show"); +},hide:function(){if(this.hidden){return this;}this.target.removeEvent("resize",this.resize);this.hideMask.apply(this,arguments);if(this.options.destroyOnHide){return this.destroy(); +}return this;},hideMask:function(){this.element.setStyle("display","none");this.hidden=true;this.fireEvent("hide");},toggle:function(){this[this.hidden?"show":"hide"](); +},destroy:function(){this.hide();this.element.destroy();this.fireEvent("destroy");this.target.eliminate("mask");}});Element.Properties.mask={set:function(b){var a=this.retrieve("mask"); +return this.eliminate("mask").store("mask:options",b);},get:function(a){if(a||!this.retrieve("mask")){if(this.retrieve("mask")){this.retrieve("mask").destroy(); +}if(a||!this.retrieve("mask:options")){this.set("mask",a);}this.store("mask",new Mask(this,this.retrieve("mask:options")));}return this.retrieve("mask"); +}};Element.implement({mask:function(a){this.get("mask",a).show();return this;},unmask:function(){this.get("mask").hide();return this;}});var Spinner=new Class({Extends:Mask,options:{"class":"spinner",containerPosition:{},content:{"class":"spinner-content"},messageContainer:{"class":"spinner-msg"},img:{"class":"spinner-img"},fxOptions:{link:"chain"}},initialize:function(){this.parent.apply(this,arguments); +this.target.store("spinner",this);var a=function(){this.active=false;}.bind(this);this.addEvents({hide:a,show:a});},render:function(){this.parent();this.element.set("id",this.options.id||"spinner-"+$time()); +this.content=document.id(this.options.content)||new Element("div",this.options.content);this.content.inject(this.element);if(this.options.message){this.msg=document.id(this.options.message)||new Element("p",this.options.messageContainer).appendText(this.options.message); +this.msg.inject(this.content);}if(this.options.img){this.img=document.id(this.options.img)||new Element("div",this.options.img);this.img.inject(this.content); +}this.element.set("tween",this.options.fxOptions);},show:function(a){if(this.active){return this.chain(this.show.bind(this));}if(!this.hidden){this.callChain.delay(20,this); +return this;}this.active=true;return this.parent(a);},showMask:function(a){var b=function(){this.content.position($merge({relativeTo:this.element},this.options.containerPosition)); +}.bind(this);if(a){this.parent();b();}else{this.element.setStyles({display:"block",opacity:0}).tween("opacity",this.options.style.opacity||0.9);b();this.hidden=false; +this.fireEvent("show");this.callChain();}},hide:function(a){if(this.active){return this.chain(this.hide.bind(this));}if(this.hidden){this.callChain.delay(20,this); +return this;}this.active=true;return this.parent(a);},hideMask:function(a){if(a){return this.parent();}this.element.tween("opacity",0).get("tween").chain(function(){this.element.setStyle("display","none"); +this.hidden=true;this.fireEvent("hide");this.callChain();}.bind(this));},destroy:function(){this.content.destroy();this.parent();this.target.eliminate("spinner"); +}});Spinner.implement(new Chain);if(window.Request){Request=Class.refactor(Request,{options:{useSpinner:false,spinnerOptions:{},spinnerTarget:false},initialize:function(a){this._send=this.send; +this.send=function(c){if(this.spinner){this.spinner.chain(this._send.bind(this,c)).show();}else{this._send(c);}return this;};this.previous(a);var b=document.id(this.options.spinnerTarget)||document.id(this.options.update); +if(this.options.useSpinner&&b){this.spinner=b.get("spinner",this.options.spinnerOptions);["onComplete","onException","onCancel"].each(function(c){this.addEvent(c,this.spinner.hide.bind(this.spinner)); +},this);}},getSpinner:function(){return this.spinner;}});}Element.Properties.spinner={set:function(a){var b=this.retrieve("spinner");return this.eliminate("spinner").store("spinner:options",a); +},get:function(a){if(a||!this.retrieve("spinner")){if(this.retrieve("spinner")){this.retrieve("spinner").destroy();}if(a||!this.retrieve("spinner:options")){this.set("spinner",a); +}new Spinner(this,this.retrieve("spinner:options"));}return this.retrieve("spinner");}};Element.implement({spin:function(a){this.get("spinner",a).show(); +return this;},unspin:function(){var a=Array.link(arguments,{options:Object.type,callback:Function.type});this.get("spinner",a.options).hide(a.callback); +return this;}});
\ No newline at end of file diff --git a/core/module/web/media/default/js/sprintf.js b/core/module/web/media/default/js/sprintf.js new file mode 100644 index 000000000..30d9046de --- /dev/null +++ b/core/module/web/media/default/js/sprintf.js @@ -0,0 +1,123 @@ +// JavaScript Document
 +sprintfWrapper = {
 + 
 +	init : function () {
 + 
 +		if (typeof arguments == "undefined") { return null; }
 +		if (arguments.length < 1) { return null; }
 +		if (typeof arguments[0] != "string") { return null; }
 +		if (typeof RegExp == "undefined") { return null; }
 + 
 +		var string = arguments[0];
 +		var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g);
 +		var matches = new Array();
 +		var strings = new Array();
 +		var convCount = 0;
 +		var stringPosStart = 0;
 +		var stringPosEnd = 0;
 +		var matchPosEnd = 0;
 +		var newString = '';
 +		var match = null;
 + 
 +		while (match = exp.exec(string)) {
 +			if (match[9]) { convCount += 1; }
 + 
 +			stringPosStart = matchPosEnd;
 +			stringPosEnd = exp.lastIndex - match[0].length;
 +			strings[strings.length] = string.substring(stringPosStart, stringPosEnd);
 + 
 +			matchPosEnd = exp.lastIndex;
 +			matches[matches.length] = {
 +				match: match[0],
 +				left: match[3] ? true : false,
 +				sign: match[4] || '',
 +				pad: match[5] || ' ',
 +				min: match[6] || 0,
 +				precision: match[8],
 +				code: match[9] || '%',
 +				negative: parseInt(arguments[convCount]) < 0 ? true : false,
 +				argument: String(arguments[convCount])
 +			};
 +		}
 +		strings[strings.length] = string.substring(matchPosEnd);
 + 
 +		if (matches.length == 0) { return string; }
 +		if ((arguments.length - 1) < convCount) { return null; }
 + 
 +		var code = null;
 +		var match = null;
 +		var i = null;
 + 
 +		for (i=0; i<matches.length; i++) {
 + 
 +			if (matches[i].code == '%') { substitution = '%' }
 +			else if (matches[i].code == 'b') {
 +				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(2));
 +				substitution = sprintfWrapper.convert(matches[i], true);
 +			}
 +			else if (matches[i].code == 'c') {
 +				matches[i].argument = String(String.fromCharCode(parseInt(Math.abs(parseInt(matches[i].argument)))));
 +				substitution = sprintfWrapper.convert(matches[i], true);
 +			}
 +			else if (matches[i].code == 'd') {
 +				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)));
 +				substitution = sprintfWrapper.convert(matches[i]);
 +			}
 +			else if (matches[i].code == 'f') {
 +				matches[i].argument = String(Math.abs(parseFloat(matches[i].argument)).toFixed(matches[i].precision ? matches[i].precision : 6));
 +				substitution = sprintfWrapper.convert(matches[i]);
 +			}
 +			else if (matches[i].code == 'o') {
 +				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(8));
 +				substitution = sprintfWrapper.convert(matches[i]);
 +			}
 +			else if (matches[i].code == 's') {
 +				matches[i].argument = matches[i].argument.substring(0, matches[i].precision ? matches[i].precision : matches[i].argument.length)
 +				substitution = sprintfWrapper.convert(matches[i], true);
 +			}
 +			else if (matches[i].code == 'x') {
 +				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
 +				substitution = sprintfWrapper.convert(matches[i]);
 +			}
 +			else if (matches[i].code == 'X') {
 +				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
 +				substitution = sprintfWrapper.convert(matches[i]).toUpperCase();
 +			}
 +			else {
 +				substitution = matches[i].match;
 +			}
 + 
 +			newString += strings[i];
 +			newString += substitution;
 + 
 +		}
 +		newString += strings[i];
 + 
 +		return newString;
 + 
 +	},
 + 
 +	convert : function(match, nosign){
 +		if (nosign) {
 +			match.sign = '';
 +		} else {
 +			match.sign = match.negative ? '-' : match.sign;
 +		}
 +		var l = match.min - match.argument.length + 1 - match.sign.length;
 +		var pad = new Array(l < 0 ? 0 : l).join(match.pad);
 +		if (!match.left) {
 +			if (match.pad == "0" || nosign) {
 +				return match.sign + pad + match.argument;
 +			} else {
 +				return pad + match.sign + match.argument;
 +			}
 +		} else {
 +			if (match.pad == "0" || nosign) {
 +				return match.sign + match.argument + pad.replace(/0/g, ' ');
 +			} else {
 +				return match.sign + match.argument + pad;
 +			}
 +		}
 +	}
 +}
 +sprintf = sprintfWrapper.init;
\ No newline at end of file diff --git a/core/module/web/media/default/js/status.js b/core/module/web/media/default/js/status.js new file mode 100644 index 000000000..3923e80ca --- /dev/null +++ b/core/module/web/media/default/js/status.js @@ -0,0 +1,100 @@ +/* hover! */ +Element.implement({ +    'hover': function(fn1,fn2) { +        return this.addEvents({ +            'mouseenter': function(e) { +                fn1.attempt(e,this); +            }, +            'mouseleave': function(e) { +                fn2.attempt(e,this); +            } +        }) +    } +}); + +function updateStatus(data){ + +    document.id("status").textContent = "Status: "+ data.status; +    document.id("speed").textContent = "Speed: "+ data.speed +" kb/s"; +    document.id("queue").textContent = "Files in queue: "+ data.queue; + +} + + +status_req = new Request.JSON({ +    onSuccess: updateStatus, +    method: 'get', +    url: '/json/status', +    initialDelay: 0, +    delay: 2000, +    limit: 20000 +}); + +window.addEvent('domready', function(){ + +    status_req.startTimer(); + + +    document.id("btAdd").addEvent("click", function(e){ + +        new Request({ +            method: 'post', +            url: '/json/addpackage', +            onSuccess: function(){ +                document.id('linkarea').value = "" +            } +            }).send('links='+document.id('linkarea').value+"&name="+document.id('pname').value) + + +    }) + +    $$('.statusbutton').each(function(item){ + +        item.hover(function(e){ +            this.tween('opacity',1) +        },function(e){ +            this.tween('opacity',0.01) +        } +        ) +    }) + +    fx_reveal = new Fx.Reveal($('addlinks')); +    //fx_reveal.dissolve() + + +    $$('#addlinks .closeSticky').each(function(el){ + +        el.addEvent('click',function(e){ + +            fx_reveal.dissolve(); + +        }); + +    }); + +    $$('.statusbutton')[2].addEvent('click',function(e){ + +        $('addlinks').setStyle('top', e.page.y + 5) +        $('addlinks').setStyle('left', e.page.x + 5) + +        fx_reveal.reveal() + +    }); + +    $$('.statusbutton')[0].addEvent('click', function(e){ + +        new Request({ +            'url' : '/json/play', +            'method' : 'get' +        }).send() +    }) + +    $$('.statusbutton')[1].addEvent('click', function(e){ + +        new Request({ +            'url' : '/json/pause', +            'method' : 'get' +        }).send() +    }) + +});
\ No newline at end of file diff --git a/core/module/web/media/img/favicon.ico b/core/module/web/media/img/favicon.ico Binary files differnew file mode 100644 index 000000000..58b1f4b89 --- /dev/null +++ b/core/module/web/media/img/favicon.ico diff --git a/core/module/web/pyload/__init__.py b/core/module/web/pyload/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/web/pyload/__init__.py diff --git a/core/module/web/pyload/admin.py b/core/module/web/pyload/admin.py new file mode 100644 index 000000000..99cb28836 --- /dev/null +++ b/core/module/web/pyload/admin.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from django.contrib import admin +from models import Prefs +from django.contrib.auth.models import User +from django.contrib.auth.admin import UserAdmin as RealUserAdmin + + +class UserProfileInline(admin.StackedInline): +    model = Prefs + +class UserAdmin(RealUserAdmin): +    inlines = [ UserProfileInline ] + +admin.site.unregister(User) +admin.site.register(User, UserAdmin)
\ No newline at end of file diff --git a/core/module/web/pyload/models.py b/core/module/web/pyload/models.py new file mode 100644 index 000000000..86962f23c --- /dev/null +++ b/core/module/web/pyload/models.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from django.db import models +from django.contrib.auth.models import User +# Create your models here. + +class Prefs(models.Model): +    """ Permissions setting """ +     +    user = models.ForeignKey(User, unique=True) +    template = models.CharField(max_length=30, default='default', null=False, blank=False) #@TODO: currently unused +         +    class Meta: +        permissions = ( +            ('can_see_dl', 'User can see Downloads'), +            ('can_change_status', 'User can change Status'), +            ('can_download', 'User can download'), +            ('can_add', 'User can add Links'), +            ('can_delete', 'User can delete Links'), +            ('can_see_logs', 'User can see Logs'), +        ) +        verbose_name = "Preferences" +        verbose_name_plural = "Preferences" +     +    def __unicode__(self): +        return "Preferences for %s" % self.user + + +def user_post_save(sender, instance, **kwargs): +    profile, new = Prefs.objects.get_or_create(user=instance) + +models.signals.post_save.connect(user_post_save, User)
\ No newline at end of file diff --git a/core/module/web/pyload/templatetags/__init__.py b/core/module/web/pyload/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/core/module/web/pyload/templatetags/__init__.py diff --git a/core/module/web/pyload/templatetags/contains.py b/core/module/web/pyload/templatetags/contains.py new file mode 100644 index 000000000..ed6225a95 --- /dev/null +++ b/core/module/web/pyload/templatetags/contains.py @@ -0,0 +1,14 @@ +from django import template +register = template.Library() + +@register.filter() +def contains(value, arg): +    """  +      Usage: +        {% if text|contains:" http://"  %} +          This is a link. +    {% else %} +    Not a link. +    {% endif %} +    """  +    return arg in value diff --git a/core/module/web/pyload/templatetags/token.py b/core/module/web/pyload/templatetags/token.py new file mode 100644 index 000000000..e6117b839 --- /dev/null +++ b/core/module/web/pyload/templatetags/token.py @@ -0,0 +1,17 @@ + +from django import VERSION +from django import template +register = template.Library() +     +if VERSION[:3] < (1,1,2): +     +    class TokenNode(template.Node): +        def render(self, content): +            return "" +     +    @register.tag() +    def csrf_token(parser, token): +        """  +        Return nothing, since csrf is deactivated in django 1.1 +        """  +        return TokenNode() diff --git a/core/module/web/pyload/tests.py b/core/module/web/pyload/tests.py new file mode 100644 index 000000000..2247054b3 --- /dev/null +++ b/core/module/web/pyload/tests.py @@ -0,0 +1,23 @@ +""" +This file demonstrates two different styles of tests (one doctest and one +unittest). These will both pass when you run "manage.py test". + +Replace these with more appropriate tests for your application. +""" + +from django.test import TestCase + +class SimpleTest(TestCase): +    def test_basic_addition(self): +        """ +        Tests that 1 + 1 always equals 2. +        """ +        self.failUnlessEqual(1 + 1, 2) + +__test__ = {"doctest": """ +Another way to test that 1 + 1 is equal to 2. + +>>> 1 + 1 == 2 +True +"""} + diff --git a/core/module/web/pyload/urls.py b/core/module/web/pyload/urls.py new file mode 100644 index 000000000..66ea68e39 --- /dev/null +++ b/core/module/web/pyload/urls.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from os.path import join + +from django.conf import settings +from django.conf.urls.defaults import * + + +urlpatterns = patterns('pyload', +                       (r'^home/$', 'views.home'), +                       (r'^downloads/$', 'views.downloads',{},'downloads'), +                       (r'^download/(?P<path>[a-zA-z\.0-9\-/_% "\\]+)$', 'views.download',{},'download'), +                       (r'^queue/$', 'views.queue',{}, 'queue'), +                       (r'^collector/$', 'views.collector',{}, 'collector'), +                       (r'^settings/$', 'views.config',{}, 'config'), +                       (r'^logs/$', 'views.logs',{}, 'logs'), +                       (r'^logs/(?P<item>\d+)$', 'views.logs',{}, 'logs'), +                       (r'^$', 'views.home',{}, 'home'), +                       ) + +urlpatterns += patterns('django.contrib.auth', +                        (r'^login/$', 'views.login', {'template_name': join(settings.TEMPLATE, 'login.html')}), +                        (r'^logout/$', 'views.logout', {'template_name': join(settings.TEMPLATE, 'logout.html')}, 'logout'), +)
\ No newline at end of file diff --git a/core/module/web/pyload/views.py b/core/module/web/pyload/views.py new file mode 100644 index 000000000..615840428 --- /dev/null +++ b/core/module/web/pyload/views.py @@ -0,0 +1,373 @@ +# -*- coding: utf-8 -*- + +# Create your views here. +import mimetypes +from os import listdir +from os import stat +from os.path import isdir +from os.path import isfile +from os.path import join +from urllib import unquote +from itertools import chain +from datetime import datetime + +from django.conf import settings +from django.contrib.auth.decorators import login_required +from django.http import HttpResponse +from django.http import HttpResponseNotFound +from django.shortcuts import render_to_response +from django.template import RequestContext +from django.utils.translation import ugettext as _ + + +def get_sort_key(item): +    return item[1]["order"] + +def check_server(function): +    def _dec(view_func): +        def _view(request, * args, ** kwargs): +            try: +                version = settings.PYLOAD.get_server_version() +            except Exception, e: +                return base(request, messages=[_('Can\'t connect to pyLoad. Please check your configuration and make sure pyLoad is running.'), str(e)]) +            return view_func(request, * args, ** kwargs) +         +        _view.__name__ = view_func.__name__ +        _view.__dict__ = view_func.__dict__ +        _view.__doc__ = view_func.__doc__ + +        return _view + +    if function is None: +        return _dec +    else: +        return _dec(function) +         +         +def permission(perm): +    def _dec(view_func): +        def _view(request, * args, ** kwargs): +            if request.user.has_perm(perm) and request.user.is_authenticated(): +                return view_func(request, * args, ** kwargs) +            else: +                return base(request, messages=[_('You don\'t have permission to view this page.')]) +         +        _view.__name__ = view_func.__name__ +        _view.__dict__ = view_func.__dict__ +        _view.__doc__ = view_func.__doc__ + +        return _view + +    return _dec + + + +def status_proc(request): +    return {'status': settings.PYLOAD.status_server(), 'captcha': settings.PYLOAD.is_captcha_waiting()} + + +def base(request, messages): +    return render_to_response(join(settings.TEMPLATE, 'base.html'), {'messages': messages}, RequestContext(request)) + +@login_required +@permission('pyload.can_see_dl') +@check_server +def home(request): +    res = settings.PYLOAD.status_downloads() + +    for link in res: +        if link["status"] == 12: +            link["information"] = "%s kB @ %s kB/s" %  (link["size"] - link["kbleft"], link["speed"]) +     +    return render_to_response(join(settings.TEMPLATE, 'home.html'), RequestContext(request, {'content': res}, [status_proc])) +     + +@login_required +@permission('pyload.can_see_dl') +@check_server +def queue(request): +    queue = settings.PYLOAD.get_queue() +    for package in queue.itervalues(): +        for pyfile in package["links"].itervalues(): +            if pyfile["status"] == 0: +                pyfile["icon"] = "status_finished.png" +            elif pyfile["status"] in (2,3): +                pyfile["icon"] = "status_queue.png" +            elif pyfile["status"] in (9,1): +                pyfile["icon"] = "status_offline.png" +            elif pyfile["status"] == 5: +                pyfile["icon"] = "status_waiting.png" +            elif pyfile["status"] == 8: +                pyfile["icon"] = "status_failed.png" +            elif pyfile["status"] in (11,13): +                pyfile["icon"] = "status_proc.png" +            else: +                pyfile["icon"] = "status_downloading.png" +     +    data = zip(queue.keys(), queue.values()) +    data.sort(key=get_sort_key) +     +    for id, value in data: +        tmp = zip(value["links"].keys(), value["links"].values()) +        tmp.sort(key=get_sort_key) +        value["links"] = tmp +             +    return render_to_response(join(settings.TEMPLATE, 'queue.html'), RequestContext(request, {'content': data}, [status_proc])) + + +@login_required +@permission('pyload.can_download') +@check_server +def downloads(request): + +    root = settings.PYLOAD.get_conf_val("general", "download_folder") +     +    if not isdir(root): +        return base(request, [_('Download directory not found.')]) +    data = { +        'folder': [], +        'files': [] +    } +     +    for item in listdir(root): +        if isdir(join(root, item)): +            folder = { +                'name': item, +                'path': item, +                'files': [] +            } +            for file in listdir(join(root, item)): +                if isfile(join(root, item, file)): +                    folder['files'].append(file) +             +            data['folder'].append(folder) +        elif isfile(join(root, item)): +            data['files'].append(item) +     +     +    return render_to_response(join(settings.TEMPLATE, 'downloads.html'), RequestContext(request, {'files': data}, [status_proc])) +     +@login_required +@permission('pyload.can_download') +@check_server +def download(request, path): +    path = unquote(path) +    path = path.split("/") +     +    root = settings.PYLOAD.get_conf_val("general", "download_folder") +     +    dir = join(root, path[1].replace('..', '')) +    if isdir(dir) or isfile(dir): +        if isdir(dir): filepath = join(dir, path[2]) +        elif isfile(dir): filepath = dir +         +        if isfile(filepath): +            try: +                type, encoding = mimetypes.guess_type(filepath) +                if type is None: +                    type = 'application/octet-stream' +             +                response = HttpResponse(mimetype=type) +                response['Content-Length'] = str(stat(filepath).st_size) +             +                if encoding is not None: +                    response['Content-Encoding'] = encoding +                      +                response.write(file(filepath, "rb").read()) +                return response +             +            except Exception, e: +                return HttpResponseNotFound("File not Found. %s" % str(e)) +     +    return HttpResponseNotFound("File not Found.") + +@login_required +@permission('pyload.can_see_logs') +@check_server +def logs(request, item=-1): + +    perpage = request.session.get('perpage', 34); +    reversed = request.session.get('reversed', False); + +    warning = "" +    conf = settings.PYLOAD.get_config() +    if not conf['log']['file_log']['value']: +        warning = "Warning: File log is disabled, see settings page." + +    perpage_p = ((20,20), (34, 34), (40, 40), (100, 100), (0,'all')) +    fro = None; + +    if request.method == 'POST': +        try: +            fro = datetime.strptime(request.POST['from'], '%d.%m.%Y %H:%M:%S') +        except: +            pass +        try: +            perpage = int(request.POST['perpage']) +            request.session['perpage'] = perpage + +            reversed = bool(request.POST.get('reversed', False)) +            request.session['reversed'] = reversed +        except: +            pass + +    try: +        item = int(item) +    except: +        pass + +    log = settings.PYLOAD.get_log() +    if perpage == 0: +        item = 0 +     +    if item < 1 or type(item) is not int: +        item =  1 if len(log) - perpage + 1 < 1 else len(log) - perpage + 1 + +    if type(fro) is datetime: # we will search for datetime +        item = -1 +         +    data = [] +    counter = 0 +    perpagecheck = 0 +    for l in log: +        counter = counter+1; +         +        if counter >= item: +            try: +                date,time,level,message = l.split(" ", 3) +                dtime = datetime.strptime(date+' '+time, '%d.%m.%Y %H:%M:%S') +            except: +                dtime = None +                date = '?' +                time = ' ' +                level = '?' +                message = l; +            if item == -1 and dtime != None and fro <= dtime: +                item = counter #found our datetime +            if item >= 0: +                data.append({'line': counter, 'date': date+" "+time, 'level':level, 'message': message}) +                perpagecheck = perpagecheck +1; +                if fro == None and dtime != None: #if fro not set set it to first showed line +                    fro = dtime; +            if perpagecheck >= perpage and perpage > 0: +                break + +    if fro == None: #still not set, empty log? +        fro = datetime.now() +    if reversed: +        data.reverse() +    return render_to_response(join(settings.TEMPLATE, 'logs.html'), RequestContext(request, {'warning': warning, 'log': data, 'from': fro.strftime('%d.%m.%Y %H:%M:%S'), 'reversed': reversed, 'perpage':perpage, 'perpage_p':sorted(perpage_p), 'iprev': 1 if item - perpage < 1 else item - perpage, 'inext': (item + perpage) if item+perpage < len(log) else item}, [status_proc])) + +@login_required +@permission('pyload.can_add_dl') +@check_server +def collector(request): +    queue = settings.PYLOAD.get_collector() +    for package in queue.itervalues(): +        for pyfile in package["links"].itervalues(): +            if pyfile["status"] == 0: +                pyfile["icon"] = "status_finished.png" +            elif pyfile["status"] in (2,3): +                pyfile["icon"] = "status_queue.png" +            elif pyfile["status"] in (9,1): +                pyfile["icon"] = "status_offline.png" +            elif pyfile["status"] == 5: +                pyfile["icon"] = "status_waiting.png" +            elif pyfile["status"] == 8: +                pyfile["icon"] = "status_failed.png" +            elif pyfile["status"] in (11,13): +                pyfile["icon"] = "status_proc.png" +            else: +                pyfile["icon"] = "status_downloading.png" + +    data = zip(queue.keys(), queue.values()) +    data.sort(key=get_sort_key) +     +    for id, value in data: +        tmp = zip(value["links"].keys(), value["links"].values()) +        tmp.sort(key=get_sort_key) +        value["links"] = tmp + +    return render_to_response(join(settings.TEMPLATE, 'collector.html'), RequestContext(request, {'content': data}, [status_proc])) + + +@login_required +@permission('pyload.can_change_status') +@check_server +def config(request): +    conf = settings.PYLOAD.get_config() +    plugin = settings.PYLOAD.get_plugin_config() +    accs = settings.PYLOAD.get_accounts() +    messages = []     +     +    for section in chain(conf.itervalues(), plugin.itervalues()): +        for key, option in section.iteritems(): +            if key == "desc": continue +             +            if ";" in option["type"]: +                option["list"] = option["type"].split(";") +                 +    if request.META.get('REQUEST_METHOD', "GET") == "POST": +         +        errors = [] + +        for key, value in request.POST.iteritems(): +            if not "|" in key: continue +            sec, skey, okey = key.split("|")[:] +             +            if sec == "General": +             +                if conf.has_key(skey): +                    if conf[skey].has_key(okey): +                        try: +                            if str(conf[skey][okey]['value']) != value: +                                settings.PYLOAD.set_conf_val(skey, okey, value) +                        except Exception, e: +                            errors.append("%s | %s : %s" % (skey, okey, e)) +                    else: +                        continue +                else: +                    continue +                 +            elif sec == "Plugin": +                if plugin.has_key(skey): +                    if plugin[skey].has_key(okey): +                        try: +                            if str(plugin[skey][okey]['value']) != value: +                                settings.PYLOAD.set_conf_val(skey, okey, value, "plugin") +                        except Exception, e: +                            errors.append("%s | %s : %s" % (skey, okey, e)) +                    else: +                        continue +                else: +                    continue +            elif sec == "Accounts": +                if ";" in okey: +                    action, name = okey.split(";") +                     +                    if action == "delete": +                        settings.PYLOAD.remove_account(skey, name) +                    elif action == "password": +                         +                        for acc in accs[skey]: +                            if acc["login"] == name and value.strip(): +                                settings.PYLOAD.update_account(skey, name, value) +                     +                elif okey == "newacc" and value: +                    # add account +                     +                    pw = request.POST.get("Accounts|%s|newpw" % skey) +                     +                    settings.PYLOAD.update_account(skey, value, pw) +                 +         +        if errors: +            messages.append(_("Error occured when setting the following options:")) +            messages.append("") +            messages += errors +        else: +            messages.append(_("All options were set correctly.")) +     +    accs = settings.PYLOAD.get_accounts() +             +    return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf, 'Accounts': accs}, 'errors': messages}, [status_proc])) diff --git a/core/module/web/run_fcgi.py b/core/module/web/run_fcgi.py new file mode 100644 index 000000000..8091de5ea --- /dev/null +++ b/core/module/web/run_fcgi.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys + +from flup.server.fcgi_base import BaseFCGIServer +from flup.server.fcgi_base import FCGI_RESPONDER +from flup.server.threadedserver import ThreadedServer + + +os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' + +def handle(*args, **options): +    from django.conf import settings +    from django.utils import translation +    # Activate the current language, because it won't get activated later. +    try: +        translation.activate(settings.LANGUAGE_CODE) +    except AttributeError: +        pass +    #from django.core.servers.fastcgi import runfastcgi +    runfastcgi(args) + + +FASTCGI_OPTIONS = { +    'protocol': 'fcgi', +    'host': None, +    'port': None, +    'socket': None, +    'method': 'fork', +    'daemonize': None, +    'workdir': '/', +    'pidfile': None, +    'maxspare': 5, +    'minspare': 2, +    'maxchildren': 50, +    'maxrequests': 0, +    'debug': None, +    'outlog': None, +    'errlog': None, +    'umask': None, +} + + +def runfastcgi(argset=[], **kwargs): +    options = FASTCGI_OPTIONS.copy() +    options.update(kwargs) +    for x in argset: +        if "=" in x: +            k, v = x.split('=', 1) +        else: +            k, v = x, True +        options[k.lower()] = v + +    try: +        import flup +    except ImportError, e: +        print >> sys.stderr, "ERROR: %s" % e +        print >> sys.stderr, "  Unable to load the flup package.  In order to run django" +        print >> sys.stderr, "  as a FastCGI application, you will need to get flup from" +        print >> sys.stderr, "  http://www.saddi.com/software/flup/   If you've already" +        print >> sys.stderr, "  installed flup, then make sure you have it in your PYTHONPATH." +        return False + +    flup_module = 'server.' + options['protocol'] + +    if options['method'] in ('prefork', 'fork'): +        wsgi_opts = { +            'maxSpare': int(options["maxspare"]), +            'minSpare': int(options["minspare"]), +            'maxChildren': int(options["maxchildren"]), +            'maxRequests': int(options["maxrequests"]), +        } +        flup_module += '_fork' +    elif options['method'] in ('thread', 'threaded'): +        wsgi_opts = { +            'maxSpare': int(options["maxspare"]), +            'minSpare': int(options["minspare"]), +            'maxThreads': int(options["maxchildren"]), +        } +    else: +        print "ERROR: Implementation must be one of prefork or thread." + +    wsgi_opts['debug'] = options['debug'] is not None + +    #try: +    #    module = importlib.import_module('.%s' % flup_module, 'flup') +    #    WSGIServer = module.WSGIServer +    #except: +    #    print "Can't import flup." + flup_module +    #    return False + +    # Prep up and go +    from django.core.handlers.wsgi import WSGIHandler + +    if options["host"] and options["port"] and not options["socket"]: +        wsgi_opts['bindAddress'] = (options["host"], int(options["port"])) +    elif options["socket"] and not options["host"] and not options["port"]: +        wsgi_opts['bindAddress'] = options["socket"] +    elif not options["socket"] and not options["host"] and not options["port"]: +        wsgi_opts['bindAddress'] = None +    else: +        return fastcgi_help("Invalid combination of host, port, socket.") + +    daemon_kwargs = {} +    if options['outlog']: +        daemon_kwargs['out_log'] = options['outlog'] +    if options['errlog']: +        daemon_kwargs['err_log'] = options['errlog'] +    if options['umask']: +        daemon_kwargs['umask'] = int(options['umask']) + +    ownWSGIServer(WSGIHandler(), **wsgi_opts).run() + +class ownThreadedServer(ThreadedServer): +    def _installSignalHandlers(self): +        return + +    def _restoreSignalHandlers(self): +        return + + +class ownWSGIServer(BaseFCGIServer, ownThreadedServer): + +    def __init__(self, application, environ=None, +                 multithreaded=True, multiprocess=False, +                 bindAddress=None, umask=None, multiplexed=False, +                 debug=True, roles=(FCGI_RESPONDER,), forceCGI=False, **kw): +        BaseFCGIServer.__init__(self, application, +                                environ=environ, +                                multithreaded=multithreaded, +                                multiprocess=multiprocess, +                                bindAddress=bindAddress, +                                umask=umask, +                                multiplexed=multiplexed, +                                debug=debug, +                                roles=roles, +                                forceCGI=forceCGI) +        for key in ('jobClass', 'jobArgs'): +            if kw.has_key(key): +                del kw[key] +        ownThreadedServer.__init__(self, jobClass=self._connectionClass, +                                jobArgs=(self,), **kw) + +    def _isClientAllowed(self, addr): +        return self._web_server_addrs is None or \ +               (len(addr) == 2 and addr[0] in self._web_server_addrs) + +    def run(self): +        """ +        The main loop. Exits on SIGHUP, SIGINT, SIGTERM. Returns True if +        SIGHUP was received, False otherwise. +        """ +        self._web_server_addrs = os.environ.get('FCGI_WEB_SERVER_ADDRS') +        if self._web_server_addrs is not None: +            self._web_server_addrs = map(lambda x: x.strip(), +                                         self._web_server_addrs.split(',')) + +        sock = self._setupSocket() + +        ret = ownThreadedServer.run(self, sock) + +        self._cleanupSocket(sock) + +        return ret + +if __name__ == "__main__": +    handle(*sys.argv[1:]) + diff --git a/core/module/web/run_server.py b/core/module/web/run_server.py new file mode 100755 index 000000000..34fca46c8 --- /dev/null +++ b/core/module/web/run_server.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import os +import sys +import django +from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException, WSGIServer, WSGIRequestHandler +from django.core.handlers.wsgi import WSGIHandler + +os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' + +class Output: +	def __init__(self, stream): +		self.stream = stream +	def write(self, data): # Do nothing +		return None +			#self.stream.write(data) +			#self.stream.flush() +	def __getattr__(self, attr): +		return getattr(self.stream, attr) + +#sys.stderr = Output(sys.stderr) +#sys.stdout = Output(sys.stdout) + +def handle(* args): +	try: +		if len(args) == 1: +			try: +				addr, port = args[0].split(":") +			except: +				addr = "127.0.0.1" +				port = args[0] +		else: +			addr = args[0] +			port = args[1] +	except: +		addr = '127.0.0.1' +		port = '8000' + +	#print addr, port + +	admin_media_path = '' +	shutdown_message = '' +	quit_command = (sys.platform == 'win32') and 'CTRL-BREAK' or 'CONTROL-C' + +	from django.conf import settings +	from django.utils import translation + +	#print "Django version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE) +	#print "Development server is running at http://%s:%s/" % (addr, port) +	#print "Quit the server with %s." % quit_command + +	translation.activate(settings.LANGUAGE_CODE) + +	try: +		handler = AdminMediaHandler(WSGIHandler(), admin_media_path) +		run(addr, int(port), handler) + +	except WSGIServerException, e: +		# Use helpful error messages instead of ugly tracebacks. +		ERRORS = { +			13: "You don't have permission to access that port.", +			98: "That port is already in use.", +			99: "That IP address can't be assigned-to.", +		} +		try: +			error_text = ERRORS[e.args[0].args[0]] +		except (AttributeError, KeyError): +			error_text = str(e) +		sys.stderr.write(("Error: %s" % error_text) + '\n') +		# Need to use an OS exit because sys.exit doesn't work in a thread +		#os._exit(1) +	except KeyboardInterrupt: +		if shutdown_message: +			print shutdown_message +		sys.exit(0) + +class ownRequestHandler(WSGIRequestHandler): +	def log_message(self, format, *args): +		return + + +def run(addr, port, wsgi_handler): +	server_address = (addr, port) +	httpd = WSGIServer(server_address, ownRequestHandler) +	httpd.set_app(wsgi_handler) +	httpd.serve_forever() + +if __name__ == "__main__": +	handle(*sys.argv[1:]) diff --git a/core/module/web/servers/lighttpd_default.conf b/core/module/web/servers/lighttpd_default.conf new file mode 100644 index 000000000..e56dda35f --- /dev/null +++ b/core/module/web/servers/lighttpd_default.conf @@ -0,0 +1,153 @@ +# lighttpd configuration file +# +# use it as a base for lighttpd 1.0.0 and above +# +# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $ + +############ Options you really have to take care of #################### + +## modules to load +# at least mod_access and mod_accesslog should be loaded +# all other module should only be loaded if really neccesary +# - saves some time +# - saves memory +server.modules              = ( +				"mod_rewrite", +                                "mod_redirect", +				"mod_alias", +				"mod_access", +#                               "mod_trigger_b4_dl", +#                               "mod_auth", +#                               "mod_status", +#                               "mod_setenv", +				"mod_fastcgi", +#                               "mod_proxy", +#                               "mod_simple_vhost", +#                               "mod_evhost", +#                               "mod_userdir", +#                               "mod_cgi", +#                               "mod_compress", +#                               "mod_ssi", +#                               "mod_usertrack", +#                               "mod_expire", +#                               "mod_secdownload", +#                               "mod_rrdtool", +#                                "mod_accesslog" +				) + +## A static document-root. For virtual hosting take a look at the +## mod_simple_vhost module. +server.document-root        = "%(path)" + +## where to send error-messages to +server.errorlog             = "%(path)/error.log" + +# files to check for if .../ is requested +index-file.names            = ( "index.php", "index.html", +                                "index.htm", "default.htm" ) + +## set the event-handler (read the performance section in the manual) +# server.event-handler = "freebsd-kqueue" # needed on OS X + +# mimetype mapping +mimetype.assign             = ( +  ".pdf"          =>      "application/pdf", +  ".sig"          =>      "application/pgp-signature", +  ".spl"          =>      "application/futuresplash", +  ".class"        =>      "application/octet-stream", +  ".ps"           =>      "application/postscript", +  ".torrent"      =>      "application/x-bittorrent", +  ".dvi"          =>      "application/x-dvi", +  ".gz"           =>      "application/x-gzip", +  ".pac"          =>      "application/x-ns-proxy-autoconfig", +  ".swf"          =>      "application/x-shockwave-flash", +  ".tar.gz"       =>      "application/x-tgz", +  ".tgz"          =>      "application/x-tgz", +  ".tar"          =>      "application/x-tar", +  ".zip"          =>      "application/zip", +  ".mp3"          =>      "audio/mpeg", +  ".m3u"          =>      "audio/x-mpegurl", +  ".wma"          =>      "audio/x-ms-wma", +  ".wax"          =>      "audio/x-ms-wax", +  ".ogg"          =>      "application/ogg", +  ".wav"          =>      "audio/x-wav", +  ".gif"          =>      "image/gif", +  ".jar"          =>      "application/x-java-archive", +  ".jpg"          =>      "image/jpeg", +  ".jpeg"         =>      "image/jpeg", +  ".png"          =>      "image/png", +  ".xbm"          =>      "image/x-xbitmap", +  ".xpm"          =>      "image/x-xpixmap", +  ".xwd"          =>      "image/x-xwindowdump", +  ".css"          =>      "text/css", +  ".html"         =>      "text/html", +  ".htm"          =>      "text/html", +  ".js"           =>      "text/javascript", +  ".asc"          =>      "text/plain", +  ".c"            =>      "text/plain", +  ".cpp"          =>      "text/plain", +  ".log"          =>      "text/plain", +  ".conf"         =>      "text/plain", +  ".text"         =>      "text/plain", +  ".txt"          =>      "text/plain", +  ".dtd"          =>      "text/xml", +  ".xml"          =>      "text/xml", +  ".mpeg"         =>      "video/mpeg", +  ".mpg"          =>      "video/mpeg", +  ".mov"          =>      "video/quicktime", +  ".qt"           =>      "video/quicktime", +  ".avi"          =>      "video/x-msvideo", +  ".asf"          =>      "video/x-ms-asf", +  ".asx"          =>      "video/x-ms-asf", +  ".wmv"          =>      "video/x-ms-wmv", +  ".bz2"          =>      "application/x-bzip", +  ".tbz"          =>      "application/x-bzip-compressed-tar", +  ".tar.bz2"      =>      "application/x-bzip-compressed-tar", +  # default mime type +  ""              =>      "application/octet-stream", + ) + +# Use the "Content-Type" extended attribute to obtain mime type if possible +#mimetype.use-xattr        = "enable" + +#### accesslog module +accesslog.filename          = "%(path)/access.log" + +url.access-deny             = ( "~", ".inc" ) + +$HTTP["url"] =~ "\.pdf$" { +  server.range-requests = "disable" +} +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) + +server.pid-file            = "%(path)/lighttpd.pid" + +server.bind = "%(host)" +server.port = %(port) + +#server.document-root = "/home/user/public_html" +fastcgi.server = ( +    "/pyload.fcgi" => ( +        "main" => ( +            "host" => "127.0.0.1", +            "port" => 9295, +            "check-local" => "disable", +            "docroot" => "/", +        ) +    ), +) + +alias.url = ( +    "/media/" => "%(media)/", +    "/admin/media/" => "/usr/lib/python%(version)/site-packages/django/contrib/admin/media/", +) + +url.rewrite-once = ( +    "^(/media.*)$" => "$1", +    "^(/admin/media.*)$" => "$1", +    "^/favicon\.ico$" => "/media/img/favicon.ico", +    "^(/pyload.fcgi.*)$" => "$1", +    "^(/.*)$" => "/pyload.fcgi$1", +) + +%(ssl)
\ No newline at end of file diff --git a/core/module/web/servers/nginx_default.conf b/core/module/web/servers/nginx_default.conf new file mode 100644 index 000000000..b4ebd1e02 --- /dev/null +++ b/core/module/web/servers/nginx_default.conf @@ -0,0 +1,87 @@ +daemon  off; +pid %(path)/nginx.pid; +worker_processes  2; + +error_log %(path)/error.log info; + +events { +        worker_connections  1024; +        use epoll; +} + +http { +        include         /etc/nginx/conf/mime.types; +        default_type    application/octet-stream; + +        %(ssl) + +        log_format main +                '$remote_addr - $remote_user [$time_local] ' +                '"$request" $status $bytes_sent ' +                '"$http_referer" "$http_user_agent" ' +                '"$gzip_ratio"'; + +        error_log %(path)/error.log info; + +        client_header_timeout   10m; +        client_body_timeout     10m; +        send_timeout            10m; + +        client_body_temp_path %(path)/client_body_temp; +        proxy_temp_path %(path)/proxy_temp; +        fastcgi_temp_path %(path)/fastcgi_temp; + + +        connection_pool_size            256; +        client_header_buffer_size       1k; +        large_client_header_buffers     4 2k; +        request_pool_size               4k; + +        gzip on; +        gzip_min_length 1100; +        gzip_buffers    4 8k; +        gzip_types      text/plain; + +        output_buffers  1 32k; +        postpone_output 1460; + +        sendfile        on; +        tcp_nopush      on; +        tcp_nodelay     on; + +        keepalive_timeout       75 20; + +        ignore_invalid_headers  on; + +        server { +                listen %(port); +                server_name %(host); +                # site_media - folder in uri for static files +                location ^~ /media  { +                        root %(media)/..; +                        } +                location ^~ /admin/media  { +                        root /usr/lib/python%(version)/site-packages/django/contrib; +                        } +location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) { +  access_log   off; +  expires      30d;  +} +                location / { +                        # host and port to fastcgi server +                        fastcgi_pass 127.0.0.1:9295; +                        fastcgi_param PATH_INFO $fastcgi_script_name; +                        fastcgi_param REQUEST_METHOD $request_method; +                        fastcgi_param QUERY_STRING $query_string; +                        fastcgi_param CONTENT_TYPE $content_type; +                        fastcgi_param CONTENT_LENGTH $content_length; +                        fastcgi_param SERVER_NAME $server_name; +                        fastcgi_param SERVER_PORT $server_port; +                        fastcgi_param SERVER_PROTOCOL $server_protocol; +                        fastcgi_pass_header Authorization; +                        fastcgi_intercept_errors off; +                        } +                access_log      %(path)/access.log main; +                error_log       %(path)/error.log; +                } +        } diff --git a/core/module/web/settings.py b/core/module/web/settings.py new file mode 100644 index 000000000..d5a070b69 --- /dev/null +++ b/core/module/web/settings.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*-
 +# Django settings for pyload project.
 +
 +DEBUG = True
 +TEMPLATE_DEBUG = DEBUG
 +
 +import os
 +import sys
 +import django
 +
 +SERVER_VERSION = "0.3.2"
 +
 +PROJECT_DIR = os.path.dirname(__file__)
 +
 +#chdir(dirname(abspath(__file__)) + sep)
 +
 +PYLOAD_DIR = os.path.join(PROJECT_DIR,"..","..")
 +
 +sys.path.append(PYLOAD_DIR)
 +
 +
 +sys.path.append(os.path.join(PYLOAD_DIR, "module"))
 +
 +import InitHomeDir
 +sys.path.append(pypath)
 +
 +
 +from module.ConfigParser import ConfigParser
 +config = ConfigParser()
 +
 +#DEBUG = config.get("general","debug")
 +
 +try:
 +    import module.web.ServerThread
 +    if not module.web.ServerThread.core:
 +        raise Exception
 +    PYLOAD = module.web.ServerThread.core.server_methods
 +except:
 +    import xmlrpclib
 +    ssl = ""
 +
 +    if config.get("ssl", "activated"):
 +        ssl = "s"
 +
 +    server_url = "http%s://%s:%s@%s:%s/" % (
 +                                        ssl,
 +                                        config.username,
 +                                        config.password,
 +                                        config.get("remote", "listenaddr"),
 +                                        config.get("remote", "port")
 +                                        )
 +
 +    PYLOAD = xmlrpclib.ServerProxy(server_url, allow_none=True)
 +
 +
 +TEMPLATE = config.get('webinterface','template')
 +DL_ROOT = os.path.join(PYLOAD_DIR, config.get('general','download_folder'))
 +LOG_ROOT = os.path.join(PYLOAD_DIR, config.get('log','log_folder'))
 +
 +ADMINS = (
 +          # ('Your Name', 'your_email@domain.com'),
 +          )
 +
 +MANAGERS = ADMINS
 +
 +DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
 +#DATABASE_NAME = os.path.join(PROJECT_DIR, 'pyload.db')             # Or path to database file if using sqlite3.
 +DATABASE_NAME = 'pyload.db'        # Or path to database file if using sqlite3.
 +DATABASE_USER = ''             # Not used with sqlite3.
 +DATABASE_PASSWORD = ''         # Not used with sqlite3.
 +DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
 +DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
 +
 +# Local time zone for this installation. Choices can be found here:
 +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 +# although not all choices may be available on all operating systems.
 +# If running in a Windows environment this must be set to the same as your
 +# system time zone.
 +if (django.VERSION[0] > 1 or django.VERSION[1] > 1) and os.name != "nt":
 +    zone = None
 +else:
 +    zone = 'Europe'
 +TIME_ZONE = zone
 +
 +# Language code for this installation. All choices can be found here:
 +# http://www.i18nguy.com/unicode/language-identifiers.html
 +LANGUAGE_CODE = config.get("general","language")
 +
 +SITE_ID = 1
 +
 +# If you set this to False, Django will make some optimizations so as not
 +# to load the internationalization machinery.
 +USE_I18N = True
 +
 +# Absolute path to the directory that holds media.
 +# Example: "/home/media/media.lawrence.com/"
 +MEDIA_ROOT = os.path.join(PROJECT_DIR, "media/")
 +
 +
 +# URL that handles the media served from MEDIA_ROOT. Make sure to use a
 +# trailing slash if there is a path component (optional in other cases).
 +# Examples: "http://media.lawrence.com", "http://example.com/media/"
 +
 +#MEDIA_URL = 'http://localhost:8000/media'
 +MEDIA_URL = '/media/' + config.get('webinterface','template') + '/'
 +#MEDIA_URL = os.path.join(PROJECT_DIR, "media/")
 +
 +LOGIN_REDIRECT_URL = "/"
 +
 +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 +# trailing slash.
 +# Examples: "http://foo.com/media/", "/media/".
 +ADMIN_MEDIA_PREFIX = '/admin/media/'
 +
 +# Make this unique, and don't share it with anybody.
 +SECRET_KEY = '+u%%1t&c7!e$0$*gu%w2$@to)h0!&x-r*9e+-=wa4*zxat%x^t'
 +
 +# List of callables that know how to import templates from various sources.
 +TEMPLATE_LOADERS = (
 +                    'django.template.loaders.filesystem.load_template_source',
 +                    'django.template.loaders.app_directories.load_template_source',
 +                    #     'django.template.loaders.eggs.load_template_source',
 +                    )
 +
 +
 +MIDDLEWARE_CLASSES = (
 +                    'django.middleware.gzip.GZipMiddleware',
 +                    'django.middleware.http.ConditionalGetMiddleware',
 +                    'django.contrib.sessions.middleware.SessionMiddleware',
 +                    'django.middleware.locale.LocaleMiddleware',
 +                    'django.middleware.common.CommonMiddleware',
 +                    'django.contrib.auth.middleware.AuthenticationMiddleware',
 +                    #'django.contrib.csrf.middleware.CsrfViewMiddleware',
 +                    'django.contrib.csrf.middleware.CsrfResponseMiddleware'
 +                      )
 +
 +ROOT_URLCONF = 'urls'
 +
 +TEMPLATE_DIRS = (
 +                 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
 +                 # Always use forward slashes, even on Windows.
 +                 # Don't forget to use absolute paths, not relative paths.
 +                 os.path.join(PROJECT_DIR, "templates"),
 +                 )
 +
 +INSTALLED_APPS = (
 +                  'django.contrib.auth',
 +                  'django.contrib.contenttypes',
 +                  'django.contrib.sessions',
 +                  #'django.contrib.sites',
 +                  'django.contrib.admin',
 +                  'pyload',
 +                  'ajax',
 +                  'cnl',
 +                  )
 +
 +
 +AUTH_PROFILE_MODULE = 'pyload.UserProfile'
 +LOGIN_URL = '/login/'
 diff --git a/core/module/web/syncdb.py b/core/module/web/syncdb.py new file mode 100644 index 000000000..669f22681 --- /dev/null +++ b/core/module/web/syncdb.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys + +os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' +sys.path.append(os.path.join(pypath, "module", "web")) + +from django.conf import settings +from django.core.management.base import NoArgsCommand +from django.core.management.color import no_style +from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal +from django.db import connections, router, transaction, models, DEFAULT_DB_ALIAS +from django.utils.datastructures import SortedDict +from django.utils.importlib import import_module + + + +def handle_noargs(**options): + +    verbosity = int(options.get('verbosity', 1)) +    interactive = False +    show_traceback = options.get('traceback', False) + +    style = no_style() + +    # Import the 'management' module within each installed app, to register +    # dispatcher events. +    for app_name in settings.INSTALLED_APPS: +        try: +            import_module('.management', app_name) +        except ImportError, exc: +            # This is slightly hackish. We want to ignore ImportErrors +            # if the "management" module itself is missing -- but we don't +            # want to ignore the exception if the management module exists +            # but raises an ImportError for some reason. The only way we +            # can do this is to check the text of the exception. Note that +            # we're a bit broad in how we check the text, because different +            # Python implementations may not use the same text. +            # CPython uses the text "No module named management" +            # PyPy uses "No module named myproject.myapp.management" +            msg = exc.args[0] +            if not msg.startswith('No module named') or 'management' not in msg: +                raise + +    db = options.get('database', DEFAULT_DB_ALIAS) +    connection = connections[db] +    cursor = connection.cursor() + +    # Get a list of already installed *models* so that references work right. +    tables = connection.introspection.table_names() +    seen_models = connection.introspection.installed_models(tables) +    created_models = set() +    pending_references = {} + +    # Build the manifest of apps and models that are to be synchronized +    all_models = [ +        (app.__name__.split('.')[-2], +            [m for m in models.get_models(app, include_auto_created=True) +            if router.allow_syncdb(db, m)]) +        for app in models.get_apps() +    ] +    def model_installed(model): +        opts = model._meta +        converter = connection.introspection.table_name_converter +        return not ((converter(opts.db_table) in tables) or +            (opts.auto_created and converter(opts.auto_created._meta.db_table) in tables)) + +    manifest = SortedDict( +        (app_name, filter(model_installed, model_list)) +        for app_name, model_list in all_models +    ) + +    # Create the tables for each model +    for app_name, model_list in manifest.items(): +        for model in model_list: +            # Create the model's database table, if it doesn't already exist. +            if verbosity >= 2: +                print "Processing %s.%s model" % (app_name, model._meta.object_name) +            sql, references = connection.creation.sql_create_model(model, style, seen_models) +            seen_models.add(model) +            created_models.add(model) +            for refto, refs in references.items(): +                pending_references.setdefault(refto, []).extend(refs) +                if refto in seen_models: +                    sql.extend(connection.creation.sql_for_pending_references(refto, style, pending_references)) +            sql.extend(connection.creation.sql_for_pending_references(model, style, pending_references)) +            if verbosity >= 1 and sql: +                print "Creating table %s" % model._meta.db_table +            for statement in sql: +                cursor.execute(statement) +            tables.append(connection.introspection.table_name_converter(model._meta.db_table)) + + +    transaction.commit_unless_managed(using=db) + +    # Send the post_syncdb signal, so individual apps can do whatever they need +    # to do at this point. +    emit_post_sync_signal(created_models, verbosity, interactive, db) + +    # The connection may have been closed by a syncdb handler. +    cursor = connection.cursor() + +    # Install custom SQL for the app (but only if this +    # is a model we've just created) +    for app_name, model_list in manifest.items(): +        for model in model_list: +            if model in created_models: +                custom_sql = custom_sql_for_model(model, style, connection) +                if custom_sql: +                    if verbosity >= 1: +                        print "Installing custom SQL for %s.%s model" % (app_name, model._meta.object_name) +                    try: +                        for sql in custom_sql: +                            cursor.execute(sql) +                    except Exception, e: +                        sys.stderr.write("Failed to install custom SQL for %s.%s model: %s\n" % \ +                                            (app_name, model._meta.object_name, e)) +                        if show_traceback: +                            import traceback +                            traceback.print_exc() +                        transaction.rollback_unless_managed(using=db) +                    else: +                        transaction.commit_unless_managed(using=db) +                else: +                    if verbosity >= 2: +                        print "No custom SQL for %s.%s model" % (app_name, model._meta.object_name) + +    # Install SQL indicies for all newly created models +    for app_name, model_list in manifest.items(): +        for model in model_list: +            if model in created_models: +                index_sql = connection.creation.sql_indexes_for_model(model, style) +                if index_sql: +                    if verbosity >= 1: +                        print "Installing index for %s.%s model" % (app_name, model._meta.object_name) +                    try: +                        for sql in index_sql: +                            cursor.execute(sql) +                    except Exception, e: +                        sys.stderr.write("Failed to install index for %s.%s model: %s\n" % \ +                                            (app_name, model._meta.object_name, e)) +                        transaction.rollback_unless_managed(using=db) +                    else: +                        transaction.commit_unless_managed(using=db) + +    #from django.core.management import call_command +    #call_command('loaddata', 'initial_data', verbosity=verbosity, database=db) + +if __name__ == "__main__": +    handle_noargs()
\ No newline at end of file diff --git a/core/module/web/syncdb_django11.py b/core/module/web/syncdb_django11.py new file mode 100644 index 000000000..c579718e0 --- /dev/null +++ b/core/module/web/syncdb_django11.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import os +import sys + +os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' +sys.path.append(os.path.join(pypath, "module", "web")) + +from django.core.management.base import NoArgsCommand +from django.core.management.color import no_style +from django.utils.importlib import import_module +from optparse import make_option + +try: +    set +except NameError: +    from sets import Set as set   # Python 2.3 fallback + +def handle_noargs(**options): +    from django.db import connection, transaction, models +    from django.conf import settings +    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal + +    verbosity = int(options.get('verbosity', 1)) +    interactive = False +    show_traceback = options.get('traceback', False) + +    style = no_style() + +    # Import the 'management' module within each installed app, to register +    # dispatcher events. +    for app_name in settings.INSTALLED_APPS: +        try: +            import_module('.management', app_name) +        except ImportError, exc: +            # This is slightly hackish. We want to ignore ImportErrors +            # if the "management" module itself is missing -- but we don't +            # want to ignore the exception if the management module exists +            # but raises an ImportError for some reason. The only way we +            # can do this is to check the text of the exception. Note that +            # we're a bit broad in how we check the text, because different +            # Python implementations may not use the same text. +            # CPython uses the text "No module named management" +            # PyPy uses "No module named myproject.myapp.management" +            msg = exc.args[0] +            if not msg.startswith('No module named') or 'management' not in msg: +                raise + +    cursor = connection.cursor() + +    # Get a list of already installed *models* so that references work right. +    tables = connection.introspection.table_names() +    seen_models = connection.introspection.installed_models(tables) +    created_models = set() +    pending_references = {} + +    # Create the tables for each model +    for app in models.get_apps(): +        app_name = app.__name__.split('.')[-2] +        model_list = models.get_models(app) +        for model in model_list: +            # Create the model's database table, if it doesn't already exist. +            if verbosity >= 2: +                print "Processing %s.%s model" % (app_name, model._meta.object_name) +            if connection.introspection.table_name_converter(model._meta.db_table) in tables: +                continue +            sql, references = connection.creation.sql_create_model(model, style, seen_models) +            seen_models.add(model) +            created_models.add(model) +            for refto, refs in references.items(): +                pending_references.setdefault(refto, []).extend(refs) +                if refto in seen_models: +                    sql.extend(connection.creation.sql_for_pending_references(refto, style, pending_references)) +            sql.extend(connection.creation.sql_for_pending_references(model, style, pending_references)) +            if verbosity >= 1 and sql: +                print "Creating table %s" % model._meta.db_table +            for statement in sql: +                cursor.execute(statement) +            tables.append(connection.introspection.table_name_converter(model._meta.db_table)) + +    # Create the m2m tables. This must be done after all tables have been created +    # to ensure that all referred tables will exist. +    for app in models.get_apps(): +        app_name = app.__name__.split('.')[-2] +        model_list = models.get_models(app) +        for model in model_list: +            if model in created_models: +                sql = connection.creation.sql_for_many_to_many(model, style) +                if sql: +                    if verbosity >= 2: +                        print "Creating many-to-many tables for %s.%s model" % (app_name, model._meta.object_name) +                    for statement in sql: +                        cursor.execute(statement) + +    transaction.commit_unless_managed() + +    # Send the post_syncdb signal, so individual apps can do whatever they need +    # to do at this point. +    emit_post_sync_signal(created_models, verbosity, interactive) + +    # The connection may have been closed by a syncdb handler. +    cursor = connection.cursor() + +    # Install custom SQL for the app (but only if this +    # is a model we've just created) +    for app in models.get_apps(): +        app_name = app.__name__.split('.')[-2] +        for model in models.get_models(app): +            if model in created_models: +                custom_sql = custom_sql_for_model(model, style) +                if custom_sql: +                    if verbosity >= 1: +                        print "Installing custom SQL for %s.%s model" % (app_name, model._meta.object_name) +                    try: +                        for sql in custom_sql: +                            cursor.execute(sql) +                    except Exception, e: +                        sys.stderr.write("Failed to install custom SQL for %s.%s model: %s\n" % \ +                                            (app_name, model._meta.object_name, e)) +                        if show_traceback: +                            import traceback +                            traceback.print_exc() +                        transaction.rollback_unless_managed() +                    else: +                        transaction.commit_unless_managed() +                else: +                    if verbosity >= 2: +                        print "No custom SQL for %s.%s model" % (app_name, model._meta.object_name) +    # Install SQL indicies for all newly created models +    for app in models.get_apps(): +        app_name = app.__name__.split('.')[-2] +        for model in models.get_models(app): +            if model in created_models: +                index_sql = connection.creation.sql_indexes_for_model(model, style) +                if index_sql: +                    if verbosity >= 1: +                        print "Installing index for %s.%s model" % (app_name, model._meta.object_name) +                    try: +                        for sql in index_sql: +                            cursor.execute(sql) +                    except Exception, e: +                        sys.stderr.write("Failed to install index for %s.%s model: %s\n" % \ +                                            (app_name, model._meta.object_name, e)) +                        transaction.rollback_unless_managed() +                    else: +                        transaction.commit_unless_managed() + +    # Install the 'initial_data' fixture, using format discovery +    #from django.core.management import call_command +    #call_command('loaddata', 'initial_data', verbosity=verbosity) + +if __name__ == "__main__": +    handle_noargs()
\ No newline at end of file diff --git a/core/module/web/templates/default/base.html b/core/module/web/templates/default/base.html new file mode 100644 index 000000000..fd18aee84 --- /dev/null +++ b/core/module/web/templates/default/base.html @@ -0,0 +1,317 @@ +{% load i18n %}
 +<?xml version="1.0" ?>
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 +    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
 +<head>
 +
 +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 +<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/default.css"/>
 +<!--<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/jquery-ui-1.7.2.custom.css">-->
 +<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/window.css"/>
 +<!--<script src="{{ MEDIA_URL }}js/jquery-1.3.2.min.js"></script>-->
 +<script type="text/javascript" src="{{ MEDIA_URL }}js/sprintf.js"></script>
 +<script type="text/javascript" src="{{ MEDIA_URL }}js/funktions.js"></script>
 +<script type="text/javascript" src="{{ MEDIA_URL }}js/mootools-1.2.4-core.js"></script>
 +<script type="text/javascript" src="{{ MEDIA_URL }}js/mootools-1.2.4.2-more.js"></script>
 +
 +<!--<script src="{{ MEDIA_URL }}js/jquery.progressbar.js"></script>-->
 +<!--<script src="{{ MEDIA_URL }}js/jquery.form.js"></script>-->
 +
 +<title>{% block title %}pyLoad {% trans "Webinterface" %}{% endblock %}</title>
 +
 +<script type="text/javascript">
 +var add_bg, add_box, cap_box, cap_info
 +document.addEvent("domready", function(){
 +
 +	add_bg = new Fx.Tween($('add_bg'));
 +	add_box = new Fx.Tween($('add_box'));
 +        cap_box = new Fx.Tween($('cap_box'))
 +	
 +	$('add_form').onsubmit=function() {
 +            $('add_form').target = 'upload_target';
 +            if ($('add_name').value == "" && $('add_file').value != " "){
 +                alert("{% trans "Please Enter a packagename."  %}");
 +                return false
 +            }else{
 +		out();
 +            }
 +	}
 +
 +	$('add_reset').addEvent('click', function(){
 +		out();
 +	});
 +	
 +	var jsonStatus = new Request.JSON({
 +		url: "/json/status",
 +		onSuccess: LoadJsonToContent,
 +		secure: false,
 +                async: true,
 +		initialDelay: 0,
 +		delay: 4000,
 +		limit: 30000
 +	})
 +	
 +	$('action_play').addEvent('click', function(){
 +		new Request({method: 'get', url: '/json/unpause'}).send();	
 +	});
 +	
 +	
 +	$('action_cancel').addEvent('click', function(){
 +		new Request({method: 'get', url: '/json/cancel'}).send();	
 +	});
 +	
 +	
 +	$('action_stop').addEvent('click', function(){
 +		new Request({method: 'get', url: '/json/pause'}).send();	
 +	});
 +
 +        $('cap_info').addEvent('click', function(){
 +                load_cap("get", "");
 +                show_cap();
 +        });
 +
 +        $('cap_reset').addEvent('click', function(){
 +            hide_cap()
 +        });
 +
 +        $('cap_form').addEvent('submit', function(e){
 +            submit_cap();
 +            e.stop()
 +        });
 +
 +	jsonStatus.startTimer();
 +	
 +});
 +
 +function LoadJsonToContent(data)
 +{
 +	$("speed").set('text', Math.round(data.speed*100)/100);
 +	$("aktiv").set('text', data.activ);
 +	$("aktiv_from").set('text', data.queue);
 +
 +        if (data.captcha){
 +            $("cap_info").setStyle('display', 'inline');
 +        }else{
 +            $("cap_info").setStyle('display', 'none');
 +        }
 +        
 +        if (data.download) {
 +            $("time").set('text', " {% trans "on" %}");
 +            $("time").setStyle('background-color', "#8ffc25");
 +
 +        }else{
 +            $("time").set('text', " {% trans "off" %}");
 +            $("time").setStyle('background-color', "#fc6e26");
 +        }
 +
 +        if (data.reconnect){
 +            $("reconnect").set('text', " {% trans "on" %}");
 +            $("reconnect").setStyle('background-color', "#8ffc25");
 +        }
 +        else{
 +            $("reconnect").set('text', " {% trans "off" %}");
 +            $("reconnect").setStyle('background-color', "#fc6e26");
 +        }
 +}
 +function bg_show(){
 +    	add_bg.set('opacity', 0);
 +	$("add_bg").setStyle('display', 'block');
 +	add_bg.start('opacity',0.8);
 +}
 +
 +function bg_hide(){
 +        add_bg.start('opacity',0).chain(function(){
 +		$('add_bg').setStyle('display', 'none');
 +	});
 +}
 +
 +function show(){
 +        bg_show()
 +	add_box.set('opacity', 0)
 +	$("add_box").setStyle('display', 'block');
 +	add_box.start('opacity',1)
 +}
 +
 +function out(){
 +        bg_hide()
 +	add_box.start('opacity',0).chain(function(){
 +		$('add_box').setStyle('display', 'none');
 +	});
 +}
 +function show_cap(){
 +        bg_show()
 +	cap_box.set('opacity', 0)
 +	$("cap_box").setStyle('display', 'block');
 +	cap_box.start('opacity',1)
 +}
 +
 +function hide_cap(){
 +        bg_hide()
 +	cap_box.start('opacity',0).chain(function(){
 +		$('cap_box').setStyle('display', 'none');
 +	});
 +}
 +
 +function load_cap(method, post){
 +        new Request.JSON({
 +		url: "/json/set_captcha",
 +		onSuccess: function(data){
 +                    if (data.captcha){
 +                        $('cap_img').set('src', data.src);
 +                        $('cap_span').setStyle('display', 'block');
 +                        $$('#cap_form p')[0].set('text', '{% trans "Please read the text on the captcha." %}');
 +                        $('cap_id').set('value', data.id);
 +                    } else{
 +                        $('cap_img').set('src', '');
 +                        $('cap_span').setStyle('display', 'none');
 +                        $$('#cap_form p')[0].set('text', '{% trans "No Captchas to read." %}');
 +                    }
 +                },
 +		secure: false,
 +                async: true,
 +                method: method
 +	}).send(post);
 +}
 +
 +function submit_cap(){
 +        load_cap("post", "cap_id="+ $('cap_id').get('value') +"&cap_text=" + $('cap_text').get('value') );
 +        $('cap_text').set('value', '');
 +        return false;
 +}
 +
 +
 +function AddBox()
 +{
 +	if ($("add_box").getStyle("display") == "hidden" || $("add_box").getStyle("display") == "none" || $("add_box").getStyle("opacity" == 0))
 +	{
 +		show();
 +	}
 +	else
 +	{
 +		out();
 +	}
 +}
 +
 +</script>
 +
 +{% block head %}
 +{% endblock %}
 +</head>
 +    <body>
 +<a class="anchor" name="top" id="top"></a>
 +
 +<div id="head-panel">
 +
 +<div id="head-search-and-login">
 +
 +{% if user.is_authenticated %}
 +
 +<span id="cap_info" style="display: {% if captcha %}inline{%else%}none{% endif %}">
 +<img src="{{ MEDIA_URL }}img/images.png" alt="Captcha:" style="vertical-align:middle; margin:2px" />
 +<font style="font-weight: bold; cursor: pointer; margin-right: 2px;">{% trans "Captcha waiting" %}</font>
 +</span>
 +
 +<img src="{{ MEDIA_URL }}img/head-login.png" alt="User:" style="vertical-align:middle; margin:2px" /><span style="padding-right: 2px;">{{user.username}}</span>
 +	<ul id="user-actions">
 +		<li><a href="/logout"  class="action logout" rel="nofollow">{% trans "Logout" %}</a></li>
 +		{% if user.is_staff %}
 +		<li><a href="/admin" class="action profile" rel="nofollow">{% trans "Administrate" %}</a></li>
 +		{% endif %}
 +
 +	</ul>
 +{% else %}
 +    <span style="padding-right: 2px;">{% trans "Please Login!" %}</span>
 +{% endif %}
 +
 +	</div>
 +
 +	<a href="/"><img id="head-logo" src="{{ MEDIA_URL }}img/pyload-logo-edited3.5-new-font-small.png" alt="pyLoad" /></a>
 +
 +	<div id="head-menu">
 +		<ul>
 +			
 +		{% block menu %}
 +		<li class="selected">
 +		    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
 +		</li>
 +		<li>
 +		    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
 +		</li>
 +		<li>
 +		    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
 +		</li>
 +		<li>
 +		    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
 +		</li>
 +		<li class="right">
 +		    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
 +		</li>
 +		<li class="right">
 +		    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
 +		</li>
 +		{% endblock %}
 +		
 +		</ul>
 +	</div>
 +
 +	<div style="clear:both;"></div>
 +</div>
 +
 +{% if perms.pyload.can_change_status %}
 +<ul id="page-actions2">
 +	<li id="action_play"><a href="#"  class="action play" accesskey="o" rel="nofollow">{% trans "Play" %}</a></li>
 +    <li id="action_cancel"><a href="#"  class="action cancel" accesskey="o" rel="nofollow">{% trans "Cancel" %}</a></li>
 +    <li id="action_stop"><a href="#"  class="action stop" accesskey="o" rel="nofollow">{% trans "Stop" %}</a></li>
 +    <li id="action_add"><a href="javascript:AddBox();"  class="action add" accesskey="o" rel="nofollow" >{% trans "Add" %}</a></li>
 +</ul>
 +{% endif %}
 +
 +{% if perms.pyload.can_see_dl %}
 +<ul id="page-actions">
 +    <li><span class="time">{% trans "Download:" %}</span><a id="time" style=" background-color: {% if status.download %}#8ffc25{% else %} #fc6e26{% endif %}; padding-left: 0cm; padding-right: 0.1cm; "> {% if status.download %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %}</a></li>
 +    <li><span class="reconnect">{% trans "Reconnect:" %}</span><a id="reconnect" style=" background-color: {% if status.reconnect %}#8ffc25{% else %} #fc6e26{% endif %}; padding-left: 0cm; padding-right: 0.1cm; "> {% if status.reconnect %}{% trans "on" %}{% else %}{% trans "off" %}{% endif %}</a></li>
 +    <li><a class="action backlink">{% trans "Speed:" %} <b id="speed">{{ status.speed }}</b> kb/s</a></li>
 +    <li><a class="action cog">{% trans "Active:" %} <b id="aktiv">{{ status.activ }}</b> / <b id="aktiv_from">{{ status.queue }}</b></a></li>
 +    <li><a href=""  class="action revisions" accesskey="o" rel="nofollow">{% trans "Reload page" %}</a></li>
 +</ul><br />
 +{% endif %}
 +
 +<div id="body-wrapper" class="dokuwiki">
 +
 +<div id="content" lang="en" dir="ltr">
 +
 +<h1>{% block subtitle %}pyLoad - {% trans "Webinterface" %}{% endblock %}</h1>
 +
 +{% block statusbar %}
 +{% endblock %}
 +
 +
 +<br/>
 +
 +<div class="level1" style="clear:both">
 +</div>
 +
 +{% for message in messages %}
 +	<b><p>{{message}}</p></b>
 +{% endfor %}
 +
 +{% block content %}
 +{% endblock content %}
 +
 +	<hr style="clear: both;" />
 +
 +<div id="foot">{% trans "© 2008-2010 the pyLoad Team" %}
 +
 +	<a href="#top" class="action top" accesskey="x"><span>{% trans "Back to top" %}</span></a><br />
 +	<!--<div class="breadcrumbs"></div>-->
 +
 +
 +</div>
 +</div>
 +</div>
 +
 +{% include "default/window.html" %}
 +{% include "default/captcha.html" %}
 +</body>
 +</html>
 diff --git a/core/module/web/templates/default/captcha.html b/core/module/web/templates/default/captcha.html new file mode 100644 index 000000000..aa30e365c --- /dev/null +++ b/core/module/web/templates/default/captcha.html @@ -0,0 +1,37 @@ +{% load i18n %}
 +<iframe id="upload_target" name="upload_target" src="" style="display: none; width:0;height:0"></iframe>
 +<div id="add_bg" style="filter:alpha(opacity:80);KHTMLOpacity:0.80;MozOpacity:0.80;opacity:0.80; background:#000; width:100%; height: 100%; position:absolute; top:0px; left:0px; display:none;"> </div>
 +<!--<div id="add_box" style="left:50%; top:200px; margin-left: -450px; width: 900px; position: absolute; background: #FFF; padding: 10px 10px 10px 10px; display:none;">-->
 +  
 +  <!--<div style="width: 900px; text-align: right;"><b onclick="AddBox();">[Close]</b></div>-->
 +<div id="cap_box" class="myform">
 +    <form id="cap_form" action="/json/set_captcha" method="POST" enctype="multipart/form-data" onsubmit="return false;">
 +<h1>{% trans "Captcha reading" %}</h1>
 +<p>{% trans "Please read the text on the captcha." %}</p>
 +
 +<span id="cap_span">
 +
 +<label>{% trans "Captcha" %}
 +<span class="small">{% trans "The captcha." %}</span>
 +</label>
 +<span class="cont">
 +    <img id="cap_img" style="padding: 2px;" src="">
 +</span>
 +
 +<label>{% trans "Text" %}
 +<span class="small">{% trans "Input the text on the captcha." %}</span>
 +</label>
 +<input id="cap_text" name="cap_text" type="text" size="20" />
 +<input type="hidden" value="" name="cap_id" id="cap_id"/>
 +
 +</span>
 +
 +<button id="cap_submit" type="submit">{% trans "Submit" %}</button>
 +<button id="cap_reset" style="margin-left:0px;" type="reset">{% trans "Close" %}</button>
 +
 +<div class="spacer"></div>
 +
 +
 +</form>
 +
 +</div>
\ No newline at end of file diff --git a/core/module/web/templates/default/collector.html b/core/module/web/templates/default/collector.html new file mode 100644 index 000000000..613fb824b --- /dev/null +++ b/core/module/web/templates/default/collector.html @@ -0,0 +1,152 @@ +{% extends 'default/base.html' %}
 +{% load i18n %}
 +
 +{% block head %}
 +<script type="text/javascript">
 +
 +document.addEvent("domready", function(){
 +    $$('.package').each(function(item){
 +        id = item.get('id').match(/[0-9]+/)
 +        
 +        imgs = item.getElements('img');
 +        imgs[0].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/remove_package/'+this,
 +                onSuccess: function(){
 +                    $('package_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +            e.stop();
 +        }.bind(id));
 +        
 +        imgs[1].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/restart_package/'+this,
 +                onSuccess: function(){
 +                    $('package_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +            e.stop();
 +        }.bind(id));
 +        
 +         imgs[2].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/push_to_queue/'+this,
 +                onSuccess: function(){
 +                    $('package_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +            e.stop();
 +        }.bind(id));
 +        
 +        item.getElement('.packagename').addEvent('click', function(){
 +            
 +            child = item.getElement('.children')
 +            if (child.getStyle('display') == "block"){
 +                child.dissolve();
 +            }else{
 +                child.reveal();
 +            }
 +        }.bind(item));
 +        
 +        
 +        item.getElements('.child').each(function(child){
 +            id = child.get('id').match(/[0-9]+/)
 +            imgs = child.getElements('.child_secrow img')
 +                    imgs[0].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/remove_link/'+this,
 +                onSuccess: function(){
 +                    $('file_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +        }.bind(id));
 +        
 +        imgs[1].addEvent('click', function(e){
 +                        new Request({
 +                method: 'get',
 +                url: '/json/restart_link/'+this,
 +                onSuccess: function(){
 +                    $('file_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +        }.bind(id));
 +        });
 +        
 +    })
 +});
 +</script>
 +{% endblock %}
 +
 +{% block title %}{% trans "Collector" %} - {{block.super}} {% endblock %}
 +{% block subtitle %}{% trans "Collector" %}{% endblock %}
 +
 +{% block menu %}
 +<li>
 +    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
 +</li>
 +<li>
 +    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
 +</li>
 +<li class="selected">
 +    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
 +</li>
 +<li>
 +    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
 +</li>
 +<li class="right">
 +    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
 +</li>
 +<li class="right">
 +    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
 +</li>{% endblock %}
 +
 +{% block content %}
 +{% for id,package in content %}
 +<div id="package_{{id}}" class="package">
 +    <div class="packagename" style="cursor: pointer;">
 +        {{ package.name }}
 +          
 +        <img title="{% trans "Delete Package" %}" width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
 +          
 +        <img title="{% trans "Reset Package" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
 +          
 +        <img title="{% trans "Push Package to Queue" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/package_go.png" />
 +    </div>
 +    <div id="children_{{id}}" style="display: none;" class="children">
 +    {% for lid, child in package.links %}
 +    <div class="child" id="file_{{lid}}">
 +        <span class="child_status">
 +            <img src="/media/default/img/{{child.icon}}" style="width: 12px; height:12px;"/>
 +        </span>
 +        <span style="font-size: 15px">{{ child.name }}</span><br />
 +    <div class="child_secrow">
 +        <span class="child_status">{{ child.statusmsg }}</span>{{child.error}} 
 +        <span class="child_status">{{ child.format_size }}</span>
 +        <span class="child_status">{{ child.plugin }}</span>
 +        <span class="child_status">{% trans "Folder:" %} {{child.folder}}</span>
 +          
 +        <img title="{% trans "Delete Link" %}" style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
 +          
 +        <img title="{% trans "Restart Link" %}" style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
 +    </div>
 +    </div>
 +    {% endfor %}
 +    </div>
 +</div>
 +{% endfor %}
 +<!--table >
 +  <tr>
 +    <td colspan="3"><h1>!Paketname!</h1></td>
 +  </tr>
 +  <tr>
 +    <td><h2>test.png</h2></td>
 +    <td>loading</td>
 +    <td><a href="/"><img id="button" src="/img/button-delete.gif" alt="delete" /></a><a href="/"><img id="button" src="/img/button-unpause.gif" alt="unpause" /></a></td>
 +  </tr>
 +</table-->
 +{% endblock %} 
\ No newline at end of file diff --git a/core/module/web/templates/default/downloads.html b/core/module/web/templates/default/downloads.html new file mode 100644 index 000000000..9ab5a2ea4 --- /dev/null +++ b/core/module/web/templates/default/downloads.html @@ -0,0 +1,53 @@ +{% extends 'default/base.html' %} +{% load i18n %} + +{% block title %}Downloads - {{block.super}} {% endblock %} + +{% block menu %} +<li> +    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a> +</li> +<li> +    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a> +</li> +<li> +    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a> +</li> +<li class="selected"> +    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a> +</li> +<li class="right"> +    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a> +</li> +<li class="right"> +    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a> +</li> +{% endblock %} + +{% block subtitle %} +{% trans "Downloads" %} +{% endblock %} + +{% block content %} + +{% trans "It's recommend not to download Files bigger than ~10MB from here." %} + +<ul> +    {% for folder in files.folder %} +    <li> +        {{ folder.name }} +        <ul> +        {% for file in folder.files %} +        <li><a href='{% url download 'get/' %}{{ folder.path|urlencode }}/{{ file|urlencode }}'>{{file}}</a></li> +        {% endfor %} +        </ul> +    </li> +    {% endfor %} +     +    {% for file in files.files %} +    <li> <a href={% url download 'get/' %}{{ file|urlencode }}>{{ file }}</a></li> +    {% endfor %} + +</ul> + +{% endblock %}
\ No newline at end of file diff --git a/core/module/web/templates/default/home.html b/core/module/web/templates/default/home.html new file mode 100644 index 000000000..bbc196fe1 --- /dev/null +++ b/core/module/web/templates/default/home.html @@ -0,0 +1,241 @@ +{% extends 'default/base.html' %}
 +{% load i18n %}
 +
 +{% block head %}
 +
 +<script type="text/javascript">
 +
 +var em;
 +var operafix = (navigator.userAgent.toLowerCase().search("opera") >= 0);
 +
 +document.addEvent("domready", function(){
 +	em = new EntryManager();
 +});
 +
 +var EntryManager = new Class({
 +    initialize: function(){
 +        this.json = new Request.JSON({
 +		url: "json/links",
 +                secure: false,
 +                async: true,
 +		onSuccess: this.update.bind(this),
 +		initialDelay: 0,
 +		delay: 2500,
 +		limit: 30000
 +	});
 +	
 +        this.ids = [{% for link in content %}
 +        {% if forloop.last %}
 +            {{ link.id }}
 +        {% else %}
 +         {{ link.id }},
 +        {% endif %}
 +        {% endfor %}];
 +        
 +        this.entries = [];
 +        this.container = $('LinksAktiv');
 +        
 +        this.parseFromContent();
 +            
 +        this.json.startTimer();
 +    },
 +    parseFromContent: function(){
 +        this.ids.each(function(id,index){
 +            entry = new LinkEntry(id)
 +            entry.parse()
 +            this.entries.push(entry)
 +            }, this);
 +    },
 +    update: function(data){
 +        
 +        try{
 +        this.ids = this.entries.map(function(item){
 +            return item.id
 +            });
 +        
 +        this.ids.filter(function(id){
 +            return !this.ids.contains(id)
 +        },data).each(function(id){
 +            index = this.ids.indexOf(id);
 +            this.entries[index].remove();
 +            this.entries = this.entries.filter(function(item){return item.id != this},id);
 +            this.ids = this.ids.erase(id)
 +            }, this);
 +        
 +        data.links.each(function(link, i){
 +            if (this.ids.contains(link.id)){
 +                
 +                index = this.ids.indexOf(link.id)
 +                this.entries[index].update(link)
 +            
 +            }else{
 +                entry = new LinkEntry(link.id);
 +                entry.insert(link);
 +                this.entries.push(entry);
 +                this.ids.push(link.id);
 +                this.container.adopt(entry.elements.tr,entry.elements.pgbTr);
 +                entry.fade.start('opacity', 1);
 +                entry.fadeBar.start('opacity', 1);
 +                
 +            }
 +            }, this)
 +        }catch(e){}
 +    }
 +})
 +
 +
 +var LinkEntry = new Class({
 +        initialize: function(id){
 +            this.id = id
 +        },
 +        parse: function(){
 +            this.elements = {
 +                tr: $("link_{id}".substitute({id: this.id})),
 +                name: $("link_{id}_name".substitute({id: this.id})),
 +                status: $("link_{id}_status".substitute({id: this.id})),
 +                info: $("link_{id}_info".substitute({id: this.id})),
 +                kbleft: $("link_{id}_kbleft".substitute({id: this.id})),
 +                percent: $("link_{id}_percent".substitute({id: this.id})),
 +                remove: $("link_{id}_remove".substitute({id: this.id})),
 +                pgbTr: $("link_{id}_pgb_tr".substitute({id: this.id})),
 +                pgb: $("link_{id}_pgb".substitute({id: this.id}))
 +            }
 +            this.initEffects();
 +        },
 +        insert: function(item){
 +            try{
 +
 +            this.elements = {
 +                tr: new Element('tr', {
 +                'html': '',
 +                'styles':{
 +                    'opacity': 0
 +                }
 +                }),
 +                name: new Element('td', {
 +                'html': item.name
 +                }),
 +                status: new Element('td', {
 +                'html': item.statusmsg
 +                }),
 +                info: new Element('td', {
 +                'html': item.info
 +                }),
 +                kbleft: new Element('td', {
 +                'html': HumanFileSize(item.size)
 +                }),
 +                percent: new Element('font', {
 +                'html': item.percent+ '% / '+ HumanFileSize(item.size-item.kbleft)
 +                }),
 +                remove: new Element('img',{
 +                'src': 'media/default/img/control_cancel.png',
 +                'styles':{
 +                    'vertical-align': 'middle',
 +                    'margin-right': '-20px',
 +                    'margin-left': '5px',
 +                    'margin-top': '-2px',
 +                    'cursor': 'pointer'
 +                }
 +                }),
 +                pgbTr: new Element('tr', {
 +                'html':''
 +                }),
 +                pgb: new Element('div', {
 +                'html': ' ',
 +                'styles':{
 +                    'height': '4px',
 +                    'width': item.percent+'%',
 +                    'background-color': '#ddd',
 +                }
 +                })
 +            }
 +            
 +            this.elements.tr.adopt(this.elements.name,this.elements.status,this.elements.info,this.elements.kbleft,new Element('td').adopt(this.elements.percent,this.elements.remove));
 +            this.elements.pgbTr.adopt(new Element('td',{'colspan':5}).adopt(this.elements.pgb));
 +            this.initEffects();
 +            }catch(e){
 +                alert(e)
 +            }
 +        },
 +        initEffects: function(){
 +            if(!operafix)
 +                this.bar = new Fx.Morph(this.elements.pgb, {unit: '%', duration: 5000, link: 'link', fps:30});
 +            this.fade = new Fx.Tween(this.elements.tr);
 +            this.fadeBar = new Fx.Tween(this.elements.pgbTr);
 +            
 +            this.elements.remove.addEvent('click', function(){
 +                new Request({method: 'get', url: '/json/abort_link/'+this.id}).send();
 +            }.bind(this));
 +            
 +        },
 +        update: function(item){
 +                this.elements.name.set('text', item.name);
 +                this.elements.status.set('text', item.statusmsg);
 +                this.elements.info.set('text', item.info);
 +                this.elements.kbleft.set('text', item.format_size);
 +                this.elements.percent.set('text', item.percent+ '% / '+ HumanFileSize((item.size-item.kbleft) / (1024)));
 +                if(!operafix)
 +                {
 +                    this.bar.start({
 +                        'width': item.percent,
 +                        'background-color': [Math.round(120/100*item.percent),100,100].hsbToRgb().rgbToHex()
 +                    });
 +                }
 +                else
 +                {
 +                    this.elements.pgb.set(
 +                        'styles', {
 +                            'height': '4px',
 +                            'width': item.percent+'%',
 +                            'background-color': [Math.round(120/100*item.percent),100,100].hsbToRgb().rgbToHex(),
 +                         });
 +                }
 +        },
 +        remove: function(){
 +                this.fade.start('opacity',0).chain(function(){this.elements.tr.dispose();}.bind(this));
 +                this.fadeBar.start('opacity',0).chain(function(){this.elements.pgbTr.dispose();}.bind(this));
 +
 +        }
 +    });
 +</script>
 +
 +{% endblock %}
 +
 +{% block subtitle %}
 +{% trans "Active Downloads" %}
 +{% endblock %}
 +
 +{% block content %}
 +<table width="100%" class="queue">
 +    <thead>
 +  <tr class="header">
 +    <th>{% trans "Name" %}</th>
 +    <th>{% trans "Status" %}</th>
 +    <th>{% trans "Information" %}</th>
 +    <th>{% trans "Size" %}</th>
 +    <th>{% trans "Progress" %}</th>
 +  </tr>
 +    </thead>
 +  <tbody id="LinksAktiv">
 +  
 +  {% for link in content %}
 +  <tr id="link_{{ link.id }}">
 +    <td id="link_{{ link.id }}_name">{{ link.name }}</td>
 +    <td id="link_{{ link.id }}_status">{{ link.status }}</td>
 +    <td id="link_{{ link.id }}_info">{{ link.info }}</td>
 +    <td id="link_{{ link.id }}_kbleft">{{ link.format_size }}</td>
 +    <td>
 +        <font id="link_{{ link.id }}_percent">{{ link.percent }}% /{{ link.kbleft }}</font>
 +        <img id="link_{{ link.id }}_remove" style="vertical-align: middle; margin-right: -20px; margin-left: 5px; margin-top: -2px; cursor:pointer;" src="media/default/img/control_cancel.png"/>
 +    </td>
 +  </tr>
 +  <tr id="link_{{ link.id }}_pgb_tr">
 +    <td colspan="5">
 +        <div id="link_{{ link.id }}_pgb" class="progressBar" style="background-color: green; height:4px; width: {{ link.percent }}%;"> </div>
 +    </td>
 +  </tr>
 +  {% endfor %}
 +  
 +  </tbody>
 +</table>
 +{% endblock %}
\ No newline at end of file diff --git a/core/module/web/templates/default/login.html b/core/module/web/templates/default/login.html new file mode 100644 index 000000000..7ae78183b --- /dev/null +++ b/core/module/web/templates/default/login.html @@ -0,0 +1,38 @@ +{% extends 'default/base.html' %} +{% load i18n %} +{% load token %} + +{% block title %}{% trans "Login" %} - {{block.super}} {% endblock %} + +{% block content %} + +<div class="centeralign"> +<form action="" method="post" accept-charset="utf-8" id="login"> +    {% csrf_token %} +    <div class="no"> +        <input type="hidden" name="do" value="login" /> +        <fieldset> +        <legend>Login</legend> +        <label> +            <span>{% trans "Username" %}</span> +            {{ form.username }} +        </label> +        <br /> +        <label> +            <span>{% trans "Password" %}</span> +            {{ form.password }} +        </label> +        <br /> +        <input type="submit" value="Login" class="button" /> +        </fieldset> +    </div> +</form> + +{% if form.errors %} +<p>{% trans "Your username and password didn't match. Please try again." %}</p> +{% endif %} + +</div> +<br> +     +{% endblock %} diff --git a/core/module/web/templates/default/logout.html b/core/module/web/templates/default/logout.html new file mode 100644 index 000000000..edc30392e --- /dev/null +++ b/core/module/web/templates/default/logout.html @@ -0,0 +1,10 @@ +{% extends 'default/base.html' %} +{% load i18n %} + +{% block head %} +<meta http-equiv="refresh" content="3; url=/"> +{% endblock %} + +{% block content %} +<p><b>{% trans "You were successfully logged out." %}</b></p> +{% endblock %}
\ No newline at end of file diff --git a/core/module/web/templates/default/logs.html b/core/module/web/templates/default/logs.html new file mode 100644 index 000000000..5da99912f --- /dev/null +++ b/core/module/web/templates/default/logs.html @@ -0,0 +1,62 @@ +{% extends 'default/base.html' %} +{% load i18n %} + +{% block title %}{% trans "Logs" %} - {{block.super}} {% endblock %} +{% block subtitle %}{% trans "Logs" %}{% endblock %} +{% block head %} +<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/log.css"/> +{% endblock %} +{% block menu %} +<li> +    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a> +</li> +<li> +    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a> +</li> +<li> +    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a> +</li> +<li> +    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a> +</li> +<li class="right selected"> +    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a> +</li> +<li class="right"> +    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a> +</li> +{% endblock %} + +{% block content %} +<div style="clear: both;"></div> + +<div class="logpaginator"><a href="{% url logs 1%}"><< {% trans "Start" %}</a>  <a href="{% url logs iprev %}">< {% trans "prev" %}</a>  <a href="{% url logs inext %}">{% trans "next" %} ></a> <a href="{% url logs %}">{% trans "End" %} >></a></div> +<div class="logperpage"> +    <form id="logform1" action="" method="POST"> +        <label for="reversed">Reversed:</label> +        <input type="checkbox" name="reversed" onchange="this.form.submit();" {% if reversed %} checked="checked" {% endif %} />  +        <label for="perpage">Lines per page:</label> +        <select name="perpage" onchange="this.form.submit();"> +            {% for value in  perpage_p %} +                <option value="{{value.0}}"{% ifequal value.0 perpage %} selected="selected" {% endifequal %}>{{value.1}}</option> +            {% endfor %} +        </select> +    </form> +</div> +<div class="logwarn">{{warning}}</div> +<div style="clear: both;"></div> +<div class="logdiv"> +    <table class="logtable" cellpadding="0" cellspacing="0"> +    {% for line in log %} +        <tr><td class="logline">{{line.line}}</td><td>{{line.date}}</td><td class="loglevel">{{line.level}}</td><td>{{line.message}}</td></tr> +    {% endfor %} +    </table> +</div> +<div class="logform"> +<form id="logform2" action="" method="POST"> +    <label for="from">Jump to time:</label><input type="text" name="from" size="15" value="{{from}}"/> +    <input type="submit" value="ok" /> +</form> +</div> +<div style="clear: both; height: 10px;">  </div> +{% endblock %}
\ No newline at end of file diff --git a/core/module/web/templates/default/queue.html b/core/module/web/templates/default/queue.html new file mode 100644 index 000000000..0c6c021f5 --- /dev/null +++ b/core/module/web/templates/default/queue.html @@ -0,0 +1,140 @@ +{% extends 'default/base.html' %}
 +{% load i18n %}
 +
 +{% block head %}
 +<script type="text/javascript">
 +
 +document.addEvent("domready", function(){
 +    $$('.package').each(function(item){
 +        id = item.get('id').match(/[0-9]+/)
 +        
 +        imgs = item.getElements('img');
 +        imgs[0].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/remove_package/'+this,
 +                onSuccess: function(){
 +                    $('package_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +            e.stop();
 +        }.bind(id));
 +        
 +        imgs[1].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/restart_package/'+this,
 +                onSuccess: function(){
 +                    $('package_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +            e.stop();
 +        }.bind(id));
 +        
 +        
 +        item.getElement('.packagename').addEvent('click', function(){
 +            
 +            child = item.getElement('.children')
 +            if (child.getStyle('display') == "block"){
 +                child.dissolve();
 +            }else{
 +                child.reveal();
 +            }
 +        }.bind(item));
 +        
 +        
 +        item.getElements('.child').each(function(child){
 +            id = child.get('id').match(/[0-9]+/)
 +            imgs = child.getElements('.child_secrow img')
 +                    imgs[0].addEvent('click', function(e){
 +            new Request({
 +                method: 'get',
 +                url: '/json/remove_link/'+this,
 +                onSuccess: function(){
 +                    $('file_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +        }.bind(id));
 +        
 +        imgs[1].addEvent('click', function(e){
 +                        new Request({
 +                method: 'get',
 +                url: '/json/restart_link/'+this,
 +                onSuccess: function(){
 +                    $('file_'+this).nix()
 +                    }.bind(this)
 +                }).send();
 +        }.bind(id));
 +        });
 +        
 +    })
 +});
 +</script>
 +{% endblock %}
 +
 +{% block title %}{% trans "Queue" %} - {{block.super}} {% endblock %}
 +{% block subtitle %}{% trans "Queue" %}{% endblock %}
 +
 +{% block menu %}
 +<li>
 +    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a>
 +</li>
 +<li class="selected">
 +    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a>
 +</li>
 +<li>
 +    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a>
 +</li>
 +<li>
 +    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a>
 +</li>
 +<li class="right">
 +    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a>
 +</li>
 +<li class="right">
 +    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a>
 +</li>{% endblock %}
 +
 +{% block content %}
 +{% for id, package in content %}
 +<div id="package_{{id}}" class="package">
 +    <div class="packagename" style="cursor: pointer;">
 +        {{ package.name }}
 +          
 +        <img title="{% trans "Delete Package" %}" width="12px" height="12px" src="{{ MEDIA_URL }}img/delete.png" />
 +          
 +        <img title="{% trans "Restart Package" %}" style="margin-left: -10px" height="12px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
 +    </div>
 +    <div id="children_{{id}}" style="display: none;" class="children">
 +    {% for lid, child in package.links %}
 +    <div class="child" id="file_{{lid}}">
 +        <span class="child_status">
 +            <img src="/media/default/img/{{child.icon}}" style="width: 12px; height:12px;"/>
 +        </span>
 +        <span style="font-size: 15px">{{ child.name }}</span><br />
 +    <div class="child_secrow">
 +        <span class="child_status">{{ child.statusmsg }}</span>{{child.error}} 
 +        <span class="child_status">{{ child.format_size }}</span>
 +        <span class="child_status">{{ child.plugin }}</span>
 +        <span class="child_status">{% trans "Folder:" %} {{package.folder}}</span>
 +          
 +        <img title="{% trans "Delete Link" %}" style="cursor: pointer;" width="10px" height="10px" src="{{ MEDIA_URL }}img/delete.png" />
 +          
 +        <img title="{% trans "Restart Link" %}" style="cursor: pointer;margin-left: -4px" width="10px" height="10px" src="{{ MEDIA_URL }}img/arrow_refresh.png" />
 +    </div>
 +    </div>
 +    {% endfor %}
 +    </div>
 +</div>
 +{% endfor %}
 +<!--table >
 +  <tr>
 +    <td colspan="3"><h1>!Paketname!</h1></td>
 +  </tr>
 +  <tr>
 +    <td><h2>test.png</h2></td>
 +    <td>loading</td>
 +    <td><a href="/"><img id="button" src="/img/button-delete.gif" alt="delete" /></a><a href="/"><img id="button" src="/img/button-unpause.gif" alt="unpause" /></a></td>
 +  </tr>
 +</table-->
 +{% endblock %} 
\ No newline at end of file diff --git a/core/module/web/templates/default/settings.html b/core/module/web/templates/default/settings.html new file mode 100644 index 000000000..e9a40ff3a --- /dev/null +++ b/core/module/web/templates/default/settings.html @@ -0,0 +1,180 @@ +{% extends 'default/base.html' %} +{% load i18n %} +{% load contains %} + +{% block title %}{% trans "Config" %} - {{block.super}} {% endblock %} +{% block subtitle %}{% trans "Config" %}{% endblock %} + +{% block head %} +<script type="text/javascript"> +    window.addEvent('domready', function() +    { +        $$('#toptabs a').addEvent('click', function(e) +        { +            $$('#toptabs a').removeProperty('class'); +            e.target.set('class', 'selected'); + +            $$('#tabs span').removeProperty('class'); +            $('g_'+e.target.get('href').substring(1)).set('class', 'selected'); + +            var firstsel = $$('#tabs span.selected a')[0]; +            firstsel.fireEvent('click', {target: firstsel}); +            return false; +        }); + +	$$('#tabs a').addEvent('click', function(e) +        { +            $$('#tabs a').removeProperty('class'); +            e.target.set('class', 'selected'); + +            $$('div.tabContent').set('class', 'tabContent hide'); +            $(e.target.get('href').substring(1)).set('class', 'tabContent'); +            return false; +        }); + +        $$('#toptabs a')[0].set('class', 'selected'); +        $$('#tabs span')[0].set('class', 'selected') + +        var firstsel = $$('#tabs span.selected a')[0]; +        firstsel.fireEvent('click', {target: firstsel}); +    }); + +     +</script> + +{% endblock %} + +{% block menu %} +<li> +    <a href="/" title=""><img src="{{ MEDIA_URL }}img/head-menu-home.png" alt="" /> {% trans "Home" %}</a> +</li> +<li> +    <a href="/queue/" title=""><img src="{{ MEDIA_URL }}img/head-menu-queue.png" alt="" /> {% trans "Queue" %}</a> +</li> +<li> +    <a href="/collector/" title=""><img src="{{ MEDIA_URL }}img/head-menu-collector.png" alt="" /> {% trans "Collector" %}</a> +</li> +<li> +    <a href="/downloads/" title=""><img src="{{ MEDIA_URL }}img/head-menu-development.png" alt="" /> {% trans "Downloads" %}</a> +</li> +<li class="right"> +    <a href="/logs/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-index.png" alt="" />{% trans "Logs" %}</a> +</li> +<li class="right selected"> +    <a href="/settings/"  class="action index" accesskey="x" rel="nofollow"><img src="{{ MEDIA_URL }}img/head-menu-config.png" alt="" />{% trans "Config" %}</a> +</li> +{% endblock %} + +{% block content %} +     +<ul id="toptabs" class="tabs"> +    {% for configname, config in conf.iteritems  %} +        <li><a href="#{{configname}}">{{configname}}</a></li> +    {% endfor %} +</ul> + +<div id="tabsback"> +    <ul id="tabs" class="tabs"> +        {% for configname, config in conf.iteritems  %} +            <span id="g_{{configname}}"> +				{% ifnotequal configname "Accounts" %} +					{% for skey, section in config.iteritems  %} +					    <li><a href="#{{configname}}{{skey}}">{{section.desc}}</a></li> +					{% endfor %} +				{% else %} +					{% for skey, section in config.iteritems  %} +					    <li><a href="#{{configname}}{{skey}}">{{skey}}</a></li> +					{% endfor %} +				{% endifnotequal %} +            </span> +        {% endfor %} +    </ul> +</div> +<form id="horizontalForm" action="" method="POST"> +{% for configname, config in conf.iteritems  %} +	{% ifnotequal configname "Accounts" %} +    {% for skey, section in config.iteritems  %} +        <div class="tabContent" id="{{configname}}{{skey}}"> +            <table class="settable"> +                {% for okey, option in section.items %} +                    {% ifnotequal okey "desc" %} +                        <tr> +                            <td><label for="{{configname}}|{{skey}}|{{okey}}" style="color:#424242;">{{option.desc}}:</label></td> +                            <td> +                                {% ifequal option.type "bool" %} +                                    <select id="{{skey}}|{{okey}}" name="{{configname}}|{{skey}}|{{okey}}"> +                                        <option {% if option.value %} selected="selected" {% endif %}value="True">{% trans "on" %}</option> +                                        <option {% if not option.value %} selected="selected" {% endif %}value="False">{% trans "off" %}</option> +                                    </select> +                                {% else %} +                                    {% if option.type|contains:";" %} +                                        <select id="{{skey}}|{{okey}}" name="{{configname}}|{{skey}}|{{okey}}"> +                                            {% for entry in option.list %} +                                                <option {% ifequal option.value entry %} selected="selected" {% endifequal %}>{{entry}}</option> +                                            {% endfor %} +                                        </select> +                                    {% else %} +                                        <input id="{{skey}}|{{okey}}" name="{{configname}}|{{skey}}|{{okey}}" type="text" value="{{option.value}}"/> +                                    {% endif %} +                                {% endifequal %} +                            </td> +                        </tr> +                    {% endifnotequal %} +                {% endfor %} +            </table> +        </div> +    {% endfor %} +	{% else %} +	<!-- Accounts -->	 +	{% for plugin, accounts in config.iteritems  %} +        <div class="tabContent" id="{{configname}}{{plugin}}"> +            <table class="settable"> +                {% for account in accounts %}          +                        <tr> +                            <td><label for="{{configname}}|{{plugin}}|password;{{account.login}}" style="color:#424242;">{{account.login}}:</label></td> +                            <td> +							<input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|password;{{account.login}}" type="password" value="{{account.password}}"/> +                            </td> +							<td> +							{% trans "Delete? " %} +							<input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|delete;{{account.login}}" type="checkbox" value="True"/> + +							</td> +                        </tr> +												 +                {% endfor %} +				<tr><td> </td></tr> +				 +				<tr> +					<td><label for="{{configname}}|{{plugin}}|{{account.login}}" style="color:#424242;">{% trans "New account:" %}</label></td> +                             +					<td> +						<input id="{{plugin}}|newacc" name="{{configname}}|{{plugin}}|newacc" type="text"/> +					</td> +				</tr> +				<tr> +					<td><label for="{{configname}}|{{plugin}}|{{account.name}}" style="color:#424242;">{% trans "New password:" %}</label></td> +                             +					<td> +						<input id="{{config}}|{{plugin}}" name="{{configname}}|{{plugin}}|newpw" type="password"/> +					</td> +				</tr>	 +				 +            </table> +        </div> +    {% endfor %} +	 +	{% endifnotequal %} +{% endfor %} +{% if conf %} +<input class="submit" type="submit" value="{% trans "Submit" %}" /> +</form> + +<br> +{% for message in errors %} +<b>{{message}}</b><br> +{% endfor %} + +{% endif %} + +{% endblock %} diff --git a/core/module/web/templates/default/window.html b/core/module/web/templates/default/window.html new file mode 100644 index 000000000..01218965e --- /dev/null +++ b/core/module/web/templates/default/window.html @@ -0,0 +1,41 @@ +{% load i18n %}
 +<iframe id="upload_target" name="upload_target" src="" style="display: none; width:0;height:0"></iframe>
 +<div id="add_bg" style="filter:alpha(opacity:80);KHTMLOpacity:0.80;MozOpacity:0.80;opacity:0.80; background:#000; width:100%; height: 100%; position:absolute; top:0px; left:0px; display:none;"> </div>
 +<!--<div id="add_box" style="left:50%; top:200px; margin-left: -450px; width: 900px; position: absolute; background: #FFF; padding: 10px 10px 10px 10px; display:none;">-->
 +  
 +  <!--<div style="width: 900px; text-align: right;"><b onclick="AddBox();">[Close]</b></div>-->
 +<div id="add_box" class="myform">
 +<form id="add_form" action="/json/add_package" method="POST" enctype="multipart/form-data">
 +<h1>{% trans "Add Package" %}</h1>
 +<p>{% trans "Paste your links or upload a container." %}</p>
 +<label>{% trans "Name" %}
 +<span class="small">{% trans "The name of the new package." %}</span>
 +</label>
 +<input id="add_name" name="add_name" type="text" size="20" />
 +
 +<label>{% trans "Links" %}
 +<span class="small">{% trans "Paste your links here" %}</span>
 +</label>
 +<textarea rows="5" name="add_links" id="add_links"></textarea>
 +
 +<label>{% trans "File" %}
 +<span class="small">{% trans "Upload a container." %}</span>
 +</label>
 +<input type="file" name="add_file" id="add_file"/>
 +
 +<label>{% trans "Destination" %}
 +</label>
 +<span class="cont">
 +    {% trans "Queue" %}
 +    <input type="radio" name="add_dest" id="add_dest" value="1" checked="checked"/>
 +    {% trans "Collector" %}
 +    <input type="radio" name="add_dest" id="add_dest2" value="0"/>
 +</span>
 +
 +<button type="submit">{% trans "Add Package" %}</button>
 +<button id="add_reset" style="margin-left:0px;" type="reset">{% trans "Reset" %}</button>
 +<div class="spacer"></div>
 +
 +</form>
 +
 +</div>
\ No newline at end of file diff --git a/core/module/web/urls.py b/core/module/web/urls.py new file mode 100644 index 000000000..9fe11f925 --- /dev/null +++ b/core/module/web/urls.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from django.conf.urls.defaults import * +from django.contrib import admin +from django.conf import settings + + +admin.autodiscover() + +urlpatterns = patterns('', +                       # Example: + +                       # Uncomment the admin/doc line below and add 'django.contrib.admindocs' +                       # to INSTALLED_APPS to enable admin documentation: +                       # (r'^admin/doc/', include('django.contrib.admindocs.urls')), + +                       (r'^admin/', include(admin.site.urls)), # django 1.0 not working +                       (r'^json/', include('ajax.urls')), +                        (r'^flashgot$', 'cnl.views.flashgot'), +                       (r'^flash(got)?/?', include('cnl.urls')), +                       (r'^crossdomain.xml$', 'cnl.views.crossdomain'), +                       (r'^jdcheck.js', 'cnl.views.jdcheck'), +                        (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/img/favicon.ico'}), +                        (r'^media/(?P<path>.*)$', 'django.views.static.serve', +                         {'document_root': settings.MEDIA_ROOT}), +                       (r'^', include('pyload.urls')), +                       ) diff --git a/core/pyLoadCli.py b/core/pyLoadCli.py new file mode 100755 index 000000000..a9731c9b5 --- /dev/null +++ b/core/pyLoadCli.py @@ -0,0 +1,551 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +#Copyright (C) 2010 RaNaN +# +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 3 of the License, +#or (at your option) any later version. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +#See the GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +### +from getopt import GetoptError +from getopt import getopt +import gettext +from itertools import islice +import os +import os.path +from os.path import join +import sys +from sys import exit +import threading +import time +from time import sleep +import xmlrpclib +from traceback import print_exc + +from module import InitHomeDir +from module.ConfigParser import ConfigParser + +import codecs + +sys.stdout = codecs.getwriter("utf8")(sys.stdout, errors = "replace") + +if sys.stdout.encoding.lower().startswith("utf"): +    conv = unicode +else: +    conv = str + +class pyLoadCli: +    def __init__(self, server_url, add=False): +        self.core = xmlrpclib.ServerProxy(server_url, allow_none=True) +        self.getch = _Getch() +        self.input = "" +        self.pos = [0, 0, 0] +        self.inputline = 0 +        self.menuline = 0 + +        self.new_package = {} + +        try: +            self.core.get_server_version() +        except: +            print _("pyLoadCore not running") +            exit() + +        if add: +            self.core.add_package(add, [add]) +            print _("Linklist added") +            exit() + +        self.links_added = 0 + +        os.system("clear") +        self.println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) +        self.println(2, "") + + +        self.file_list = {} + +        self.thread = RefreshThread(self) +        self.thread.start() + +        self.start() + +    def start(self): +        while True: +            #inp = raw_input() +            inp = self.getch.impl() +            if ord(inp) == 3: +                os.system("clear") +                sys.exit() # ctrl + c +            elif ord(inp) == 13: +                try: +                    self.handle_input() +                except Exception, e: +                    self.println(2, red(conv(e))) +                self.input = ""   #enter +                self.print_input() +            elif ord(inp) == 127: +                self.input = self.input[:-1] #backspace +                self.print_input() +            elif ord(inp) == 27: #ugly symbol +                pass +            else: +                self.input += inp +                self.print_input() + +    def format_time(self, seconds): +        seconds = int(seconds) + +        hours, seconds = divmod(seconds, 3600) +        minutes, seconds = divmod(seconds, 60) +        return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) + +    def format_size(self, size): +        return conv(size / 1024 ** 2) + " MiB" + +    def println(self, line, content): +        print "\033[" + conv(line) + ";0H\033[2K" + content + "\033[" + conv((self.inputline if self.inputline > 0 else self.inputline + 1) - 1) + ";0H" + +    def print_input(self): +        self.println(self.inputline, white(" Input: ") + self.input) +        self.println(self.inputline + 1, "") +        self.println(self.inputline + 2, "") +        self.println(self.inputline + 3, "") +        self.println(self.inputline + 4, "") + +    def refresh(self): +        """Handle incoming data""" +        data = self.core.status_downloads() +            #print updated information +        print "\033[J" #clear screen +        self.println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) +        self.println(2, "") +        self.println(3, white(_("%s Downloads:") % (len(data)))) +        line = 4 +        speed = 0 +        for download in data: +            if download["status"] == 12:  # downloading +                percent = download["percent"] +                z = percent / 4 +                speed += download['speed'] +                self.println(line, cyan(download["name"])) +                line += 1 +                self.println(line, blue("[") + yellow(z * "#" + (25-z) * " ") + blue("] ") + green(conv(percent) + "%") + _(" Speed: ") + green(conv(int(download['speed'])) + " kb/s") + _(" Size: ") + green(download['format_size']) + _(" Finished in: ") + green(download['format_eta'])  + _(" ID: ") + green(conv(download['id']))) +                line += 1 +            if download["status"] == 5: +                self.println(line, cyan(download["name"])) +                line += 1 +                self.println(line, _("waiting: ") + green(download["format_wait"]) ) +                line += 1 +        self.println(line, "") +        line += 1 +        status = self.core.status_server() +        if status['pause']: +            self.println(line, _("Status: ") + red("paused") + _(" total Speed: ") + red(conv(int(speed)) + " kb/s") + _(" Files in queue: ") + red(conv(status["queue"]))) +        else: +            self.println(line, _("Status: ") + red("running") + _(" total Speed: ") + red(conv(int(speed)) + " kb/s") + _(" Files in queue: ") + red(conv(status["queue"]))) +        line += 1 +        self.println(line, "") +        line += 1 +        self.menuline = line + +        self.build_menu() +        # +        self.file_list = data + +    def build_menu(self): +        line = self.menuline +        self.println(line, white(_("Menu:"))) +        line += 1  +        if self.pos[0] == 0:# main menu +            self.println(line, "") +            line += 1 +            self.println(line, mag("1.") + _(" Add Links")) +            line += 1 +            self.println(line, mag("2.") + _(" Manage Links")) +            line += 1 +            self.println(line, mag("3.") + _(" (Un)Pause Server")) +            line += 1 +            self.println(line, mag("4.") + _(" Kill Server")) +            line += 1 +            self.println(line, mag("5.") + _(" Quit")) +            line += 1 +            self.println(line, "") +            line += 1 +            self.println(line, "") +        elif self.pos[0] == 1:#add links     + +            if self.pos[1] == 0: +                self.println(line, "") +                line += 1 +                self.println(line, _("Name your package.")) +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, mag("0.") + _(" back to main menu")) +                line += 1 +                self.println(line, "") + +            else: +                self.println(line, _("Package: %s") % self.new_package['name']) +                line += 1 +                self.println(line, _("Parse the links you want to add.")) +                line += 1 +                self.println(line, _("Type %s when done.") % mag("END")) +                line += 1 +                self.println(line, _("Links added: ") + mag(conv(self.links_added))) +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, "") +                line += 1 +                self.println(line, mag("0.") + _(" back to main menu")) +                line += 1 +                self.println(line, "") +        elif self.pos[0] == 2:#remove links +            if self.pos[1] == 0: +                pack = self.core.get_queue() +                self.println(line, _("Type d(number of package) to delete a package, r to restart, or w/o d,r to look into it.")) +                line += 1 +                i = 0 +                for id, value in islice(pack.iteritems(), self.pos[2], self.pos[2] + 5): +                    try:                 +                        self.println(line, mag(conv(id)) + ": " + value['name']) +                        line += 1 +                        i += 1 +                    except Exception, e: +                        pass +                for x in range(5-i): +                    self.println(line, "") +                    line += 1 + +            else: +                links = self.core.get_package_data(self.pos[1]) +                self.println(line, _("Type d(number) of the link you want to delete or r(number) to restart.")) +                line += 1 +                i = 0 +                for id, value in islice(links["links"].iteritems(), self.pos[2], self.pos[2] + 5): +                    try: +                         +                        self.println(line, mag(conv(id)) + ": %s | %s | %s" % (value['name'], value['statusmsg'], value['plugin'])) +                        line += 1 +                        i += 1 + +                    except Exception, e: +                        pass +                for x in range(5-i): +                    self.println(line, "") +                    line += 1 + +            self.println(line, mag("p") + _(" - previous") + " | " + mag("n") + _(" - next")) +            line += 1 +            self.println(line, mag("0.") + _(" back to main menu")) + +        self.inputline = line + 1 +        self.print_input() + +    def handle_input(self): +        inp = self.input.strip() +        if inp == "0": +            self.pos = [0, 0, 0] +            self.build_menu() +            return True + +        if self.pos[0] == 0: +            if inp == "1": +                self.links_added = 0 +                self.pos[0] = 1 +            elif inp == "2": +                self.pos[0] = 2 +                self.pos[1] = 0 +            elif inp == "3": +                self.core.toggle_pause() +            elif inp == "4": +                self.core.kill() +                sys.exit() +            elif inp == "5": +                os.system('clear') +                sys.exit() + +        elif self.pos[0] == 1: #add links +            if self.pos[1] == 0: +                self.new_package['name'] = inp +                self.new_package['links'] = [] +                self.pos[1] = 1 +            else: +                if inp == "END": +                    self.core.add_package(self.new_package['name'], self.new_package['links'], 1) # add package +                    self.pos = [0, 0, 0] +                    self.links_added = 0 +                else: #@TODO validation +                    self.new_package['links'].append(inp) +                    self.links_added += 1 + +        elif self.pos[0] == 2: #remove links +            if self.pos[1] == 0: +                if inp.startswith("d"): +                    if inp.find("-") > -1: +                        self.core.del_packages(range(*map(int, inp[1:].split("-")))) +                    else: +                        self.core.del_packages([int(inp[1:])]) +                if inp.startswith("r"): +                    self.core.restart_package(int(inp[1:])) +                elif inp != "p" and inp != "n": +                    self.pos[1] = int(inp) +                    self.pos[2] = 0 +            elif inp.startswith('r'): +                if inp.find("-") > -1: +                    map(self.core.restart_file, range(*map(int, inp[1:].split("-")))) +                else: +                    self.core.restart_file(int(inp[1:])) +            elif inp.startswith('d') and inp != "p" and inp != "n": +                if inp.find("-") > -1: +                    self.core.del_links(range(*map(int, inp[1:].split("-")))) +                else: +                    self.core.del_links([int(inp[1:])]) +            if inp == "p": +                self.pos[2] -= 5 +            elif inp == "n": +                self.pos[2] += 5 + +        self.build_menu() + +class RefreshThread(threading.Thread): +    def __init__(self, cli): +        threading.Thread.__init__(self) +        self.setDaemon(True) +        self.cli = cli + +    def run(self): +        while True: +            sleep(1) +            try: +                self.cli.refresh() +            except Exception, e: +                self.cli.println(2, red(conv(e))) +                self.cli.pos[1] = 0 +                self.cli.pos[2] = 0 +                print_exc() + + + + +class _Getch: +    """ +    Gets a single character from standard input.  Does not echo to +    the screen. +    """ +    def __init__(self): +        try: +            self.impl = _GetchWindows() +        except ImportError: +            try: +                self.impl = _GetchMacCarbon() +            except(AttributeError, ImportError): +                self.impl = _GetchUnix() + +    def __call__(self): return self.impl() + + +class _GetchUnix: +    def __init__(self): +        import tty +        import sys + +    def __call__(self): +        import sys +        import tty +        import termios + +        fd = sys.stdin.fileno() +        old_settings = termios.tcgetattr(fd) +        try: +            tty.setraw(sys.stdin.fileno()) +            ch = sys.stdin.read(1) +        finally: +            termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) +        return ch + + +class _GetchWindows: +    def __init__(self): +        import msvcrt + +    def __call__(self): +        import msvcrt +        return msvcrt.getch() + +class _GetchMacCarbon: +    """ +    A function which returns the current ASCII key that is down; +    if no ASCII key is down, the null string is returned.  The +    page http://www.mactech.com/macintosh-c/chap02-1.html was +    very helpful in figuring out how to do this. +    """ +    def __init__(self): +        import Carbon +        Carbon.Evt #see if it has this (in Unix, it doesn't) + +    def __call__(self): +        import Carbon +        if Carbon.Evt.EventAvail(0x0008)[0] == 0: # 0x0008 is the keyDownMask +            return '' +        else: +            # +            # The event contains the following info: +            # (what,msg,when,where,mod)=Carbon.Evt.GetNextEvent(0x0008)[1] +            # +            # The message (msg) contains the ASCII char which is +            # extracted with the 0x000000FF charCodeMask; this +            # number is converted to an ASCII character with chr() and +            # returned +            # +            (what, msg, when, where, mod) = Carbon.Evt.GetNextEvent(0x0008)[1] +            return chr(msg) + +def blue(string): +    return "\033[1;34m" + string + "\033[0m" + +def green(string): +    return "\033[1;32m" + string + "\033[0m" + +def yellow(string): +    return "\033[1;33m" + string + "\033[0m" + +def red(string): +    return "\033[1;31m" + string + "\033[0m" + +def cyan(string): +    return "\033[1;36m" + string + "\033[0m" + +def mag(string): +    return "\033[1;35m" + string + "\033[0m" + +def white(string): +    return "\033[1;37m" + string + "\033[0m" + +def print_help(): +    print "" +    print "pyLoadCli Copyright (c) 2008-2010 the pyLoad Team" +    print "" +    print "Usage: [python] pyLoadCli.py [options] [server url]" +    print "" +    print "<server url>" +    print "The server url has this format: http://username:passwort@address:port" +    print "" +    print "<Options>" +    print "  -l, --local", " " * 6, "Use the local settings in config file" +    print "  -u, --username=<username>" +    print " " * 20, "Specify username" +    print "" +    print "  -a, --address=<address>" +    print " " * 20, "Specify address (default=127.0.0.1)" +    print "" +    print "  --linklist=<path>" +    print " " * 20, "Add container to pyLoad" +    print "" +    print "  -p, --port", " " * 7, "Specify port (default=7272)" +    print "  -s, --ssl", " " * 8, "Enable ssl (default=off)" +    print "  -h, --help", " " * 7, "Display this help screen" +    print "" + + + +if __name__ == "__main__": +    config = ConfigParser() +     +    translation = gettext.translation("pyLoadCli", join(pypath, "locale"), languages=[config['general']['language']]) +    translation.install(unicode=(True if sys.stdout.encoding.lower().startswith("utf") else False)) + +    server_url = "" +    username = "" +    password = "" +    addr = "" +    port = "" +    ssl = None + +    add = "" + +    if len(sys.argv) > 1: + + +        addr = "127.0.0.1" +        port = "7272" +        ssl = "" + +        shortOptions = 'lu:a:p:s:h' +        longOptions = ['local', "username=", "address=", "port=", "ssl=", "help", "linklist=", "pw=", "configdir="] + +        try: +            opts, extraparams = getopt(sys.argv[1:], shortOptions, longOptions) +            for option, params in opts: +                if option in ("-l", "--local"): + +                    if config['ssl']['activated']: +                        ssl = "s" + +                    username = config.username +                    password = config.password +                    addr = config['remote']['listenaddr'] +                    port = config['remote']['port'] +                elif option in ("-u", "--username"): +                    username = params +                elif option in ("-a", "--address"): +                    addr = params +                elif option in ("-p", "--port"): +                    port = params +                elif option in ("-s", "--ssl"): +                    if params.lower() == "true": +                        ssl = "s" +                elif option in ("-h", "--help"): +                    print_help() +                    exit() +                elif option in ("--linklist"): +                    add = params +                elif option in ("--pw"): +                    password = params +        except GetoptError: +            print 'Unknown Argument(s) "%s"' % " ".join(sys.argv[1:]) +            print_help() +            exit() + +        if len(extraparams) == 1: +            server_url = sys.argv[1] + +    if not server_url: +        if not username: username = raw_input(_("Username: ")) +        if not addr: addr = raw_input(_("address: ")) +        if ssl == None: +            ssl = raw_input(_("Use SSL? ([y]/n): ")) +            if ssl == "y" or ssl == "": +                ssl = "s" +            else: +                ssl = "" +        if not port: port = raw_input(_("Port: ")) +        if not password: +            from getpass import getpass +            password = getpass(_("Password: ")) + +        server_url = "http%s://%s:%s@%s:%s/" % (ssl, username, password, addr, port) + +    print server_url +    if add: +        cli = pyLoadCli(server_url, add) +    else: +        cli = pyLoadCli(server_url) diff --git a/core/pyLoadCore.py b/core/pyLoadCore.py new file mode 100755 index 000000000..be6d40126 --- /dev/null +++ b/core/pyLoadCore.py @@ -0,0 +1,681 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +    This program is free software; you can redistribute it and/or modify +    it under the terms of the GNU General Public License as published by +    the Free Software Foundation; either version 3 of the License, +    or (at your option) any later version. + +    This program is distributed in the hope that it will be useful, +    but WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +    See the GNU General Public License for more details. + +    You should have received a copy of the GNU General Public License +    along with this program; if not, see <http://www.gnu.org/licenses/>. + +    @author: spoob +    @author: sebnapi +    @author: RaNaN +    @author: mkaay +    @version: v0.4.0 +""" +CURRENT_VERSION = '0.4.1-dev' + +from getopt import GetoptError +from getopt import getopt +import gettext +from imp import find_module +import logging +import logging.handlers +from os import _exit +from os import execv +from os import getcwd +from os import makedirs +from os import name as platform +from os import remove +from os import sep +from os.path import exists +from os.path import join +import signal +import subprocess +import sys +from sys import argv +from sys import executable +from sys import exit +from sys import stdout +import thread +import time +from time import sleep +from traceback import print_exc +from xmlrpclib import Binary + + + +from module import InitHomeDir +from module.AccountManager import AccountManager +from module.CaptchaManager import CaptchaManager +from module.ConfigParser import ConfigParser +from module.FileDatabase import FileHandler +from module.HookManager import HookManager +from module.PluginManager import PluginManager +from module.PullEvents import PullManager +from module.RequestFactory import RequestFactory +from module.ThreadManager import ThreadManager +import module.remote.SecureXMLRPCServer as Server +from module.web.ServerThread import WebServer +from module.FileDatabase import PyFile + + +class Core(object): +    """ pyLoad Core """ + +    def __init__(self): +        self.doDebug = False +        self.arg_links = [] + +        if len(argv) > 1: +            try: +                options, args = getopt(argv[1:], 'vca:hdus', ["version", "clear", "add=", "help", "debug", "user", "setup", "configdir"]) + +                for option, argument in options: +                    if option in ("-v", "--version"): +                        print "pyLoad", CURRENT_VERSION +                        exit() +                    elif option in ("-c", "--clear"): +                        try:  +                            remove("files.db") +                            print "Removed Linklist" +                        except: +                            print "No Linklist found" +                    elif option in ("-a", "--add"): +                        #self.arg_links.append(argument) +                        #@TODO +                        print "Added %s" % argument +                    elif option in ("-h", "--help"): +                        self.print_help() +                        exit() +                    elif option in ("-d", "--debug"): +                        self.doDebug = True +                    elif option in ("-u", "--user"): +                        from module.setup import Setup +                        self.config = ConfigParser() +                        s = Setup(pypath, self.config) +                        s.set_user() +                        exit() +                    elif option in ("-s", "--setup"): +                        from module.setup import Setup +                        self.config = ConfigParser() +                        s = Setup(pypath, self.config) +                        s.start() +                        exit() +                    elif option == "--configdir": +                        from module.setup import Setup +                        self.config = ConfigParser() +                        s = Setup(pypath, self.config) +                        s.conf_path(True) +                        exit() +            except GetoptError: +                print 'Unknown Argument(s) "%s"' % " ".join(argv[1:]) +                self.print_help() +                exit() + +    def print_help(self): +        print "" +        print "pyLoad %s  Copyright (c) 2008-2010 the pyLoad Team" % CURRENT_VERSION +        print "" +        print "Usage: [python] pyLoadCore.py [options]" +        print "" +        print "<Options>" +        print "  -v, --version", " " * 10, "Print version to terminal" +        print "  -c, --clear", " " * 12, "Delete the saved linklist" +        #print "  -a, --add=<link/list>", " " * 2, "Add the specified links" +        print "  -u, --user", " " * 13, "Set new User and password" +        print "  -d, --debug", " " * 12, "Enable debug mode" +        print "  -s, --setup", " " * 12, "Run Setup Assistent" +        print "  --configdir", " " * 12, "Set new config directory" +        print "  -h, --help", " " * 13, "Display this help screen" +        print "" + +    def toggle_pause(self): +        if self.thread_list.pause: +            self.thread_list.pause = False +            return False +        elif not self.thread_list.pause: +            self.thread_list.pause = True +            return True + +    def quit(self, a, b): +        self.shutdown() +        self.log.info(_("Received Quit signal")) +        _exit(1) + +    def start(self): +        """ starts the fun :D """ + +        if not exists("pyload.conf"): +            from module.setup import Setup +            print "This is your first start, running configuration assistent now." +            self.config = ConfigParser() +            s = Setup(pypath, self.config) +            try: +                res = s.start() +            except: +                res = False +                print_exc() +                print "Setup failed" +            if not res: +                remove("pyload.conf") +             +            exit() +         +        try: signal.signal(signal.SIGQUIT, self.quit) +        except: pass +             +        self.config = ConfigParser() +         +        translation = gettext.translation("pyLoad", self.path("locale"), languages=["en", self.config['general']['language']]) +        translation.install(unicode=(True if sys.getfilesystemencoding().lower().startswith("utf") else False)) +         +        self.debug = self.doDebug or self.config['general']['debug_mode'] + +        self.check_file(self.config['log']['log_folder'], _("folder for logs"), True) +         +        if self.debug: +            self.init_logger(logging.DEBUG) # logging level +        else: +            self.init_logger(logging.INFO) # logging level +         +        self.do_kill = False +        self.do_restart = False +         +        self.log.info(_("Using home directory: %s") % getcwd()) +         +        #@TODO refractor +         +        self.check_install("Crypto", _("pycrypto to decode container files")) +        self.check_install("Image", _("Python Image Libary (PIL) for captcha reading")) +        self.check_install("pycurl", _("pycurl to download any files"), True, True) +        self.check_install("django", _("Django for webinterface")) +        self.check_file("tmp", _("folder for temporary files"), True) +        #self.check_install("tesseract", _("tesseract for captcha reading"), False) + +        self.check_file(self.config['general']['download_folder'], _("folder for downloads"), True) + +        if self.config['ssl']['activated']: +            self.check_install("OpenSSL", _("OpenSSL for secure connection"), True) + + +        self.downloadSpeedLimit = int(self.config.get("general", "download_speed_limit")) + +        self.requestFactory = RequestFactory(self) + +        #path.append(self.plugin_folder) + +        self.lastClientConnected = 0 + +        self.server_methods = ServerMethods(self) + +        #hell yeah, so many important managers :D +        self.files = FileHandler(self) +        self.pluginManager = PluginManager(self) +        self.pullManager = PullManager(self) +        self.accountManager = AccountManager(self) +        self.threadManager = ThreadManager(self) +        self.captchaManager = CaptchaManager(self) +        self.hookManager = HookManager(self) + +        self.log.info(_("Downloadtime: %s") % self.server_methods.is_time_download()) + +        self.init_server() +        self.init_webserver() + +        #linkFile = self.config['general']['link_file'] + +        freeSpace = self.freeSpace() +        if freeSpace > 5 * 1024: +            self.log.info(_("Free space: %sGB") % (freeSpace / 1024)) +        else: +            self.log.info(_("Free space: %sMB") % freeSpace) + +        self.threadManager.pause = False +        #self.threadManager.start() + +        self.hookManager.coreReady() + +        self.config.save() #save so config files gets filled +         +        while True: +                         +            sleep(2) +            if self.do_restart: +                self.log.info(_("restarting pyLoad")) +                self.restart() +            if self.do_kill: +                self.shutdown() +                self.log.info(_("pyLoad quits")) +                exit() +                 +            self.threadManager.work() +            self.hookManager.periodical() + +    def init_server(self): +        try: +            server_addr = (self.config['remote']['listenaddr'], int(self.config['remote']['port'])) +            usermap = {self.config.username: self.config.password} +            if self.config['ssl']['activated']: +                if exists(self.config['ssl']['cert']) and exists(self.config['ssl']['key']): +                    self.server = Server.SecureXMLRPCServer(server_addr, self.config['ssl']['cert'], self.config['ssl']['key'], usermap) +                    self.log.info(_("Secure XMLRPC Server Started")) +                else: +                    self.log.warning(_("SSL Certificates not found, fallback to auth XMLRPC server")) +                    self.server = Server.AuthXMLRPCServer(server_addr, usermap) +                    self.log.info(_("Auth XMLRPC Server Started")) +            else: +                self.server = Server.AuthXMLRPCServer(server_addr, usermap) +                self.log.info(_("Auth XMLRPC Server Started")) + +            self.server.register_instance(self.server_methods) + +            thread.start_new_thread(self.server.serve_forever, ()) +        except Exception, e: +            self.log.error(_("Failed starting XMLRPC server CLI and GUI will not be available: %s") % str(e)) +            if self.debug: +                print_exc() + +    def init_webserver(self): +        if self.config['webinterface']['activated']: +            self.webserver = WebServer(self) +            self.webserver.start() + +    def init_logger(self, level): +        console = logging.StreamHandler(stdout) +        frm = logging.Formatter("%(asctime)s %(levelname)-8s  %(message)s", "%d.%m.%Y %H:%M:%S") +        console.setFormatter(frm) +        self.log = logging.getLogger("log") # settable in config + +        if self.config['log']['file_log']: +            file_handler = logging.handlers.RotatingFileHandler(join(self.config['log']['log_folder'], 'log.txt'), maxBytes=102400, backupCount=int(self.config['log']['log_count'])) #100 kib each +            file_handler.setFormatter(frm) +            self.log.addHandler(file_handler) + +        self.log.addHandler(console) #if console logging +        self.log.setLevel(level) + +    def check_install(self, check_name, legend, python=True, essential=False): +        """check wether needed tools are installed""" +        try: +            if python: +                find_module(check_name) +            else: +                pipe = subprocess.PIPE +                subprocess.Popen(check_name, stdout=pipe, stderr=pipe) +        except: +            self.log.info(_("Install %s") % legend) +            if essential: exit() + +    def check_file(self, check_names, description="", folder=False, empty=True, essential=False, quiet=False): +        """check wether needed files exists""" +        tmp_names = [] +        if not type(check_names) == list: +            tmp_names.append(check_names) +        else: +            tmp_names.extend(check_names) +        file_created = True +        file_exists = True +        for tmp_name in tmp_names: +            if not exists(tmp_name): +                file_exists = False +                if empty: +                    try: +                        if folder: +                            tmp_name = tmp_name.replace("/", sep) +                            makedirs(tmp_name) +                        else: +                            open(tmp_name, "w") +                    except: +                        file_created = False +                else: +                    file_created = False +        if not file_exists and not quiet: +            if file_created: +                #self.log.info( _("%s created") % description ) +                pass +            else: +                if not empty: +                    self.log.warning(_("could not find %s: %s") % (description, tmp_name)) +                else: +                    print _("could not create %s: %s") % (description, tmp_name) +                if essential: +                    exit() + +    def isClientConnected(self): +        return (self.lastClientConnected + 30) > time.time() + +    def restart(self): +        self.shutdown() +        execv(executable, [executable, "pyLoadCore.py"]) + +    def compare_time(self, start, end): + +        start = map(int, start) +        end = map(int, end) + +        if start == end: return True + +        now  = list(time.localtime()[3:5]) +        if start < now and end > now: return True +        elif start > end and (now > start or now < end): return True +        elif start < now and end < now and start > end: return True +        else: return False + + +    def shutdown(self): +        self.log.info(_("shutting down...")) +        try: +            if self.config['webinterface']['activated']: +                self.webserver.quit() +                #self.webserver.join() +            for thread in self.threadManager.threads: +                thread.put("quit") +            pyfiles = self.files.cache.values() +             +            for pyfile in pyfiles: +                pyfile.abortDownload() + +        except: +            if self.debug: +                print_exc() +            self.log.info(_("error while shutting down")) + +        finally: +            self.files.syncSave() + + +    def path(self, * args): +        return join(pypath, * args) + +    def freeSpace(self): +        folder = self.config['general']['download_folder'] +        if platform == 'nt': +            import ctypes +            free_bytes = ctypes.c_ulonglong(0) +            ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes)) +            return free_bytes.value / 1024 / 1024 #megabyte +        else: +            from os import statvfs +            s = statvfs(folder) +            return s.f_bsize * s.f_bavail / 1024 / 1024 #megabyte + + +#################################### +    ########## XMLRPC Methods ########## +    #################################### + +class ServerMethods(): +    """ methods that can be used by clients with xmlrpc connection""" +    def __init__(self, core): +        self.core = core + +    def status_downloads(self): +        """ gives status about all files currently processed """ +        downloads = [] +        for pyfile in [x.active for x in self.core.threadManager.threads + self.core.threadManager.localThreads if x.active]: +            if not isinstance(pyfile, PyFile): +                continue +            download = {} +            download['id'] = pyfile.id +            download['name'] = pyfile.name +            download['speed'] = pyfile.getSpeed() +            download['eta'] = pyfile.getETA() +            download['format_eta'] = pyfile.formatETA() +            download['kbleft'] = pyfile.getBytesLeft() #holded for backward comp. +            download['bleft'] = pyfile.getBytesLeft() +            download['size'] = pyfile.getSize() +            download['format_size'] = pyfile.formatSize() +            download['percent'] = pyfile.getPercent() +            download['status'] = pyfile.status +            download['statusmsg'] = pyfile.m.statusMsg[pyfile.status]  +            download['format_wait'] = pyfile.formatWait() +            download['wait_until'] = pyfile.waitUntil +            download['package'] = pyfile.package().name +            downloads.append(download) +        return downloads + +    def get_conf_val(self, cat, var, sec="core"): +        """ get config value """ +        if sec == "core": +            return self.core.config[cat][var] +        elif sec == "plugin": +            return self.core.config.getPlugin(cat, var) + +    def set_conf_val(self, cat, opt, val, sec="core"): +        """ set config value """ +        if sec == "core": +            self.core.config[str(cat)][str(opt)] = val +        elif sec == "plugin": +            self.core.config.setPlugin(cat, opt, val) +         +    def get_config(self): +        """ gets complete config """ +        return self.core.config.config  + +    def get_plugin_config(self): +        """ gets complete plugin config """ +        return self.core.config.plugin + +    def pause_server(self): +        self.core.threadManager.pause = True + +    def unpause_server(self): +        self.core.threadManager.pause = False + +    def toggle_pause(self): +        if self.core.threadManager.pause: +            self.core.threadManager.pause = False +        else: +            self.core.threadManager.pause = True +        return self.core.threadManager.pause + +    def status_server(self): +        """ dict with current server status """ +        status = {} +        status['pause'] = self.core.threadManager.pause +        status['activ'] = len(self.core.threadManager.processingIds()) +        status['queue'] = self.core.files.getFileCount() +        status['total'] = self.core.files.getFileCount() +        status['speed'] = 0 + +        for pyfile in [x.active for x in self.core.threadManager.threads if x.active]: +            status['speed'] += pyfile.getSpeed() + +        status['download'] = not self.core.threadManager.pause and self.is_time_download() +        status['reconnect'] = self.core.config['reconnect']['activated'] and self.is_time_reconnect() + +        return status + +    def get_server_version(self): +        return CURRENT_VERSION + +    def add_package(self, name, links, queue=0): +        #0 is collector +        if self.core.config['general']['folder_per_package']: +            folder = name +        else: +            folder = "" +             +        pid = self.core.files.addPackage(name, folder, queue) + +        self.core.files.addLinks(links, pid) +         +        self.core.log.info(_("Added package %s containing %s links") % (name, len(links))) +         +        self.core.files.save() +         +        return pid + + +    def get_package_data(self, id): +        return self.core.files.getPackageData(int(id)) + +    def get_file_data(self, id): +        info = self.core.files.getFileData(int(id)) +        if not info: +            return None +        info = {str(info.keys()[0]): info[info.keys()[0]]} +        return info + +    def del_links(self, ids): +        for id in ids: +            self.core.files.deleteLink(int(id)) +         +        self.core.files.save() + +    def del_packages(self, ids): +         +        for id in ids: +            self.core.files.deletePackage(int(id)) +         +        self.core.files.save() + +    def kill(self): +        self.core.do_kill = True +        return True + +    def restart(self): +        self.core.do_restart = True + +    def get_queue(self): +        return self.core.files.getCompleteData(1) + +    def get_collector(self): +        return self.core.files.getCompleteData(0) + +    def add_files_to_package(self, pid, urls): +        #@TODO implement +        pass + +    def push_package_to_queue(self, id): +        self.core.files.setPackageLocation(id, 1) + +    def restart_package(self, packid): +        self.core.files.restartPackage(int(packid)) + +    def restart_file(self, fileid): +        self.core.files.restartFile(int(fileid)) + +    def upload_container(self, filename, content): +        th = open(join(self.core.config["general"]["download_folder"], "tmp_" + filename), "wb") +        th.write(str(content)) +        th.close() + +        self.add_package(th.name, [th.name], 1) + +    def get_log(self, offset=0): +        filename = join(self.core.config['log']['log_folder'], 'log.txt') +        try: +            fh = open(filename, "r") +            lines = fh.readlines() +            fh.close() +            if offset >= len(lines): +                return None +            return lines[offset:] +        except: +            return ('No log available', ) + +    def stop_downloads(self): +        pyfiles = self.core.files.cache.values() +             +        for pyfile in pyfiles: +            pyfile.abortDownload() + +    def abort_files(self, fids): +        pyfiles = self.core.files.cache.values() +             +        for pyfile in pyfiles: +            if pyfile.id in fids: +                pyfile.abortDownload() + +    def stop_download(self, type, id): +        if self.core.files.cache.has_key(id): +            self.core.files.cache[id].abortDownload() + + +    def set_package_name(self, pid, name): +        pack = self.core.files.getPackage(pid) +        pack.name = name +        pack.sync() + +    def pull_out_package(self, pid): +        """put package back to collector""" +        self.core.files.setPackageLocation(pid, 0) + +    def is_captcha_waiting(self): +        self.core.lastClientConnected = time.time() +        task = self.core.captchaManager.getTask() +        return not task == None + +    def get_captcha_task(self, exclusive=False): +        self.core.lastClientConnected = time.time() +        task = self.core.captchaManager.getTask() +        if task: +            task.setWatingForUser(exclusive=exclusive) +            c = task.getCaptcha() +            return str(task.getID()), Binary(c[0]), str(c[1]) +        else: +            return None, None, None + +    def get_task_status(self, tid): +        self.core.lastClientConnected = time.time() +        return self.core.captchaManager.getTaskFromID(tid).getStatus() + +    def set_captcha_result(self, tid, result): +        self.core.lastClientConnected = time.time() +        task = self.core.captchaManager.getTaskFromID(tid) +        if task: +            task.setResult(result) +            task.setDone() +            return True +        else: +            return False + +    def get_events(self, uuid): +        return self.core.pullManager.getEvents(uuid) + +    def get_accounts(self): +        plugins = self.core.accountManager.getAccountPlugins() +        data = {} +        for p in plugins: +            data[p.__name__] = p.getAllAccounts() +        return data +     +    def update_account(self, plugin, account, password, options=[]): +        """ create and update account """ +        self.core.accountManager.updateAccount(plugin, account, password, options) +     +    def remove_account(self, plugin, account): +        self.core.accountManager.removeAccount(plugin, account) +     +    def set_priority(self, id, priority): +        p = self.core.files.getPackage(id) +        p.setPriority(priority) +     +    def is_time_download(self): +        start = self.core.config['downloadTime']['start'].split(":") +        end = self.core.config['downloadTime']['end'].split(":") +        return self.core.compare_time(start, end) + +    def is_time_reconnect(self): +        start = self.core.config['reconnect']['startTime'].split(":") +        end = self.core.config['reconnect']['endTime'].split(":") +        return self.core.compare_time(start, end) + +# And so it begins... +if __name__ == "__main__": +    pyload_core = Core() +    try: +        pyload_core.start() +    except KeyboardInterrupt: +        pyload_core.shutdown() +        pyload_core.log.info(_("killed pyLoad from Terminal")) +        _exit(1) diff --git a/core/scripts/Readme.txt b/core/scripts/Readme.txt new file mode 100644 index 000000000..1c326801d --- /dev/null +++ b/core/scripts/Readme.txt @@ -0,0 +1,25 @@ +    ############################# +    ### pyLoad Script Support ### +    ############################# + +pyLoad is able to start any kind of scripts at given events. +Simply put your script in a suitable folder and pyLoad will execute it at the given events and pass some arguments to them. + +-->  Note: Scripts, which starts with # will be ignored! +For Example: #converter.sh will not be executed. + +-->  Note: You have to restart pyload when you change script names or locations. + +Below you see the list of arguments, which are passed to the scripts. + +## Argument list ## + +download_preparing: pluginname url + +download_finished: pluginname url filename filelocation + +package_finshed: packagename packagelocation + +before_reconnect: oldip + +after_reconnect: newip
\ No newline at end of file diff --git a/core/systemCheck.py b/core/systemCheck.py new file mode 100644 index 000000000..85c37873d --- /dev/null +++ b/core/systemCheck.py @@ -0,0 +1,186 @@ +import os +from os.path import dirname +from os.path import exists +from os.path import join +import subprocess +import sys + +from module import InitHomeDir + +def main(): +    print "#####   System Information   #####" +    print "" +    print "Platform:", sys.platform +    print "Operating System:", os.name +    print "Python:", sys.version.replace("\n", "") +    print "" + +    try: +        import pycurl +        print "pycurl:", pycurl.version +    except: +        print "pycurl:", "missing" + +    try: +        import Crypto +        print "py-crypto:", Crypto.__version__ +    except: +        print "py-crypto:", "missing" + + +    try: +        import OpenSSL +        print "OpenSSL:", OpenSSL.version.__version__ +    except: +        print "OpenSSL:", "missing" + +    try: +        import Image +        print "image libary:", Image.VERSION +    except: +        print "image libary:", "missing" + +    try: +        import django +        print "django:", django.get_version() +    except: +        print "django:", "missing" + +    try: +        import PyQt4.QtCore +        print "pyqt:", PyQt4.QtCore.PYQT_VERSION_STR +    except: +        print "pyqt:", "missing" + +    print "" +    print "" +    print "#####   System Status   #####" +    print "" +    print "##  pyLoadCore  ##" + +    core_err = [] +    core_info = [] + +    if sys.version_info > (2, 8): +        core_err.append("Your python version is to new, Please use Python 2.6/2.7") + +    if sys.version_info < (2, 5): +        core_err.append("Your python version is to old, Please use at least Python 2.5") + +    try: +        import pycurl +    except: +        core_err.append("Please install py-curl to use pyLoad.") + + +    try: +        from pycurl import AUTOREFERER +    except: +        core_err.append("Your py-curl version is to old, please upgrade!") + +    try: +        import Image +    except: +        core_err.append("Please install py-imaging/pil to use Hoster, which uses captchas.") + +    pipe = subprocess.PIPE +    try: +        p = subprocess.call(["tesseract"], stdout=pipe, stderr=pipe) +    except: +        core_err.append("Please install tesseract to use Hoster, which uses captchas.") + +    try: +        import OpenSSL +    except: +        core_info.append("Install OpenSSL if you want to create a secure connection to the core.") + +    if core_err: +        print "The system check has detected some errors:" +        print "" +        for err in core_err: +            print err +    else: +        print "No Problems detected, pyLoadCore should work fine." + +    if core_info: +        print "" +        print "Possible improvements for pyload:" +        print "" +        for line in core_info: +            print line + + +    print "" +    print "##  pyLoadGui  ##" + +    gui_err = [] + +    try: +        import PyQt4 +    except: +        gui_err.append("GUI won't work without pyqt4 !!") + +    if gui_err: +        print "The system check has detected some errors:" +        print "" +        for err in gui_err: +            print err +    else: +        print "No Problems detected, pyLoadGui should work fine." + +    print "" +    print "##  Webinterface  ##" + +    web_err = [] +    web_info = [] + +    try: +        import django + +        if django.VERSION < (1, 1): +            web_err.append("Your django version is to old, please upgrade to django 1.1") +        elif django.VERSION > (1, 3): +            web_err.append("Your django version is to new, please use django 1.2") + +    except: +        web_err.append("Webinterface won't work without django !!") + +    if not exists("pyload.db"): +        web_err.append("You dont have created database yet.") +        web_err.append("Please run: python %s syncdb" % join(dirname(__file__), "module", "web", "manage.py")) + +    try: +        import flup +    except: +        web_info.append("Install Flup to use FastCGI or optional webservers.") + +    try: +        p = subprocess.call(["lighttpd", "-v"], stdout=pipe, stderr=pipe) +    except: +        web_info.append("Install lighttpd as optional webserver.") + +    try: +        p = subprocess.call(["nginx", "-v"], stdout=pipe, stderr=pipe) +    except: +        web_info.append("Install nginx as optional webserver.") + +    if web_err: +        print "The system check has detected some errors:" +        print "" +        for err in web_err: +            print err +    else: +        print "No Problems detected, Webinterface should work fine." + +    if web_info: +        print "" +        print "Possible improvements for webinterface:" +        print "" +        for line in web_info: +            print line +         + +if __name__ == "__main__": +    main() + +    raw_input("Press Enter to Exit.")  | 
