diff options
| author | 2010-06-27 11:35:40 +0200 | |
|---|---|---|
| committer | 2010-06-27 11:35:40 +0200 | |
| commit | 0c28ecf5b370b51874270de1aae52e02576073d3 (patch) | |
| tree | c52b2c9f659e0d90e93a88361cd0553e5768ebe5 | |
| parent | porno update, new plugins: (diff) | |
| download | pyload-0c28ecf5b370b51874270de1aae52e02576073d3.tar.xz | |
youporn fix
and cli config fix
| -rw-r--r-- | module/plugins/hoster/YoupornCom.py | 4 | ||||
| -rwxr-xr-x | pyLoadCli.py | 43 | 
2 files changed, 37 insertions, 10 deletions
diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 31e18821f..220d14a9e 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -31,7 +31,7 @@ class YoupornCom(Hoster):      def download_html(self):          url = self.parent.url -        self.html = self.load(url) +        self.html = self.load(url, post={"user_choice":"Enter"})      def get_file_url(self):          """ returns the absolute downloadable filepath @@ -40,12 +40,12 @@ class YoupornCom(Hoster):              self.download_html()          file_url = re.search(r'(http://download.youporn.com/download/\d*/.*\?download=1&ll=1&t=dd)">', self.html).group(1) -        print file_url          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) + '.flv' diff --git a/pyLoadCli.py b/pyLoadCli.py index e4fb1cd33..a3b9d10a4 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -446,15 +446,15 @@ def print_help():      print "Usage: [python] pyLoadCli.py [options] [server url]"      print ""      print "<server url>" -    print "The server url has this format: http://username:passwort@adress:port" +    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=<adress>" -    print " " * 20, "Specify adress (default=127.0.0.1)" +    print "  -a, --address=<address>" +    print " " * 20, "Specify address (default=127.0.0.1)"      print ""      print "  --linklist=<path>"      print " " * 20, "Add container to pyLoad" @@ -464,10 +464,37 @@ def print_help():      print "  -h, --help", " " * 7, "Display this help screen"      print "" +     +def get_config_path(): +    try: +        from win32com.shell import shellcon, shell +        homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) +    except ImportError: # quick semi-nasty fallback for non-windows/win32com case +        if platform == 'nt': +            import ctypes +            from ctypes import wintypes, windll +            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 = expanduser("~") +             +    if platform == "posix": +        configdir = join(homedir, ".config", "pyload") +    else: +        configdir = join(homedir, "pyLoad") +         +    return join(configdir, "core.xml")  if __name__ == "__main__": - -    xmlconfig = XMLConfigParser(join(abspath(dirname(__file__)), "module", "config", "core.xml")) +    xmlconfig = XMLConfigParser(get_config_path())      config = xmlconfig.getConfig()      translation = gettext.translation("pyLoadCli", join(abspath(dirname(__file__)), "locale"), languages=[config['general']['language']]) @@ -490,7 +517,7 @@ if __name__ == "__main__":          ssl = ""          shortOptions = 'lu:a:p:s:h' -        longOptions = ['local', "username=", "adress=", "port=", "ssl=", "help", "linklist=", "pw="] +        longOptions = ['local', "username=", "address=", "port=", "ssl=", "help", "linklist=", "pw="]          try:              opts, extraparams = getopt(sys.argv[1:], shortOptions, longOptions) @@ -506,7 +533,7 @@ if __name__ == "__main__":                      port = config['remote']['port']                  elif option in ("-u", "--username"):                      username = params -                elif option in ("-a", "--adress"): +                elif option in ("-a", "--address"):                      addr = params                  elif option in ("-p", "--port"):                      port = params @@ -530,7 +557,7 @@ if __name__ == "__main__":      if not server_url:          if not username: username = raw_input(_("Username: ")) -        if not addr: addr = raw_input(_("Adress: ")) +        if not addr: addr = raw_input(_("address: "))          if ssl == None:              ssl = raw_input(_("Use SSL? ([y]/n): "))              if ssl == "y" or ssl == "":  | 
