PageRenderTime 29ms CodeModel.GetById 21ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/plowshare_duckload.diff

http://gsbabil.googlecode.com/
Unknown | 128 lines | 127 code | 1 blank | 0 comment | 0 complexity | aac28da100a4c3f124db31064ad67546 MD5 | raw file
  1Index: src/core.sh
  2===================================================================
  3--- src/core.sh	(revision 1462)
  4+++ src/core.sh	(working copy)
  5@@ -698,7 +698,9 @@
  6     local TEXT2='Enter captcha response (drop punctuation marks, case insensitive): '
  7 
  8     # X11 server installed ?
  9-    if [ -n "$DISPLAY" ] && check_exec 'display'; then
 10+    if [ -n "$DISPLAY" ] && check_exec 'prompt_captcha.py'; then
 11+	RESPONSE=$(prompt_captcha.py $FILENAME)
 12+    elif [ -n "$DISPLAY" ] && check_exec 'display'; then
 13         display $FILENAME &
 14         PID=$!
 15         log_notice $TEXT1
 16Index: src/modules/duckload.sh
 17===================================================================
 18--- src/modules/duckload.sh	(revision 0)
 19+++ src/modules/duckload.sh	(revision 0)
 20@@ -0,0 +1,96 @@
 21+#!/bin/bash
 22+#
 23+# duckload.com module
 24+# Copyright (c) 2011 Plowshare team
 25+#
 26+# This file is part of Plowshare.
 27+#
 28+# Plowshare is free software: you can redistribute it and/or modify
 29+# it under the terms of the GNU General Public License as published by
 30+# the Free Software Foundation, either version 3 of the License, or
 31+# (at your option) any later version.
 32+#
 33+# Plowshare is distributed in the hope that it will be useful,
 34+# but WITHOUT ANY WARRANTY; without even the implied warranty of
 35+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 36+# GNU General Public License for more details.
 37+#
 38+# You should have received a copy of the GNU General Public License
 39+#
 40+
 41+MODULE_DUCKLOAD_REGEXP_URL="http://\(www\.\)\?duckload\.com/"
 42+MODULE_DUCKLOAD_DOWNLOAD_OPTIONS=""
 43+MODULE_DUCKLOAD_DOWNLOAD_CONTINUE=""
 44+MODULE_DUCKLOAD_UPLOAD_OPTIONS=""
 45+MODULE_DUCKLOAD_DELETE_OPTIONS=""
 46+MODULE_DUCKLOAD_LIST_OPTIONS=""
 47+
 48+# Output DuckLoad download URL
 49+# $1: duckload url
 50+# stdout: real file download link
 51+duckload_download() {
 52+
 53+    URL="$1"
 54+    AGENT="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322)"
 55+    BASE_URL="http://www.duckload.com/jDownloader"
 56+
 57+    URL_checkOnlineStatus="$BASE_URL/checkOnlineStatus.php"
 58+    URL_getFree="$BASE_URL/getFree.php"
 59+    URL_getFreeEncrypt="$BASE_URL/getFreeEncrypt.php"
 60+
 61+    log_debug "[*] checking online status"
 62+    STATUS=$(curl \
 63+            --silent \
 64+            --user-agent "$AGENT" \
 65+            --data-urlencode "isPremium=0" \
 66+            --data-urlencode "list=$URL" "$URL_checkOnlineStatus" \
 67+            --output -)
 68+
 69+    log_debug $STATUS
 70+    if matchi "ERROR;" "$STATUS" || matchi "OFFLINE" "$STATUS"
 71+    then
 72+        if matchi "OFFLINE" "$STATUS"
 73+        then
 74+            log_error "[*] file not currently available"
 75+            return 254
 76+        fi
 77+    fi
 78+
 79+    log_debug "[*] getting free slots"
 80+    STATUS=$(curl \
 81+        --silent \
 82+        --user-agent "$agent" \
 83+        --referer "$URL_checkOnlineStatus" \
 84+        --data-urlencode "link=$URL" "$URL_getFree" \
 85+        --output -)
 86+
 87+    log_debug $STATUS
 88+    if matchi "ERROR;" "$STATUS"
 89+    then
 90+        log_error "[*] error getting free download slot"
 91+        return 3
 92+    fi
 93+
 94+    time=$(echo "$STATUS" | cut -d ";" -f 2 | strip)
 95+    crypt=$(echo "$STATUS" | cut -d ";" -f 3 | strip)
 96+
 97+    log_debug "[*] free user delay "
 98+    wait $time || return 2
 99+
100+    log_debug "[*] getting final url"
101+    STATUS=$(curl \
102+        --silent \
103+        --user-agent "$AGENT" \
104+        --referer "$URL_getFree" \
105+        --data-urlencode "crypt=$crypt" "$URL_getFreeEncrypt" \
106+        --output -)
107+
108+    log_debug $STATUS
109+    if matchi "http" "$STATUS"
110+    then
111+        log_debug "[*] starting download: $STATUS"
112+        echo "$STATUS"
113+    else
114+        return 1
115+    fi
116+}
117Index: src/modules/config
118===================================================================
119--- src/modules/config	(revision 1462)
120+++ src/modules/config	(working copy)
121@@ -9,6 +9,7 @@
122 depositfiles| download |        |        | list |
123 divshare    | download |        |        |      |
124 dl_free_fr  | download | upload |        |      |
125+duckload    | download |        |        |      |
126 euroshare_eu| download |        |        |      |
127 fileserve   | download | upload |        | list |
128 filesonic   | download | upload | delete | list |