viewgit/index.php:465 Only variables should be passed by reference [2048]

viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. # This is an example script for mldonkey
  5. #
  6. # To use it you must telnet to mldonkey like this:
  7. # telnet localhost 4000
  8. # > auth user password
  9. # > set file_completed_cmd "/path/to/this/script"
  10. # > quit
  11.  
  12. import mlmanager
  13.  
  14. # Adjust some internal variables, for example add a text estension;
  15. # You can also append to
  16. # video_extensions, audio_extensions, cdimage_extensions and archive_extensions
  17. # You can view the default values opening a python shell, improting mlmanager
  18. # and printing mlmanager.****_extensions
  19. mlmanager.text_extensions.append ("djvu")
  20.  
  21. # Change mail addr of the daemon and domain of the server.
  22. mlmanager.domain = "example.org"
  23. mlmanager.from_addr = "mldonkey@%s" % mlmanager.domain
  24.  
  25. # Set SMTP server (this is the default, but you could also use some external smtp
  26. # server if it doesn't need authentication).
  27. mlmanager.mail_server = "localhost"
  28.  
  29. # Users that should be notified on error, default is "owner"
  30. mlmanager.error_recipients = [ "owner", "admin@example.org" ]
  31.  
  32. # Incoming directory for your mldonkey downloads.
  33. # Default is /var/lib/mldonkey/incoming
  34. mlmanager.incoming = "/var/lib/mldonkey/incoming"
  35.  
  36. # Our mldonkey supports auto commit so we don't need username and password,
  37. # but we could also use
  38. # download = mlmanager.Download(username = "user", password = "password")
  39. #
  40. # That will allow to call, for example, download.send_command("bw_toggle")
  41. download = mlmanager.Download()
  42.  
  43. # Start writing an email that will be sent to the right users at the end of
  44. # the script
  45. mail_text = "Download of %s completed.\n\n" % download.get_filename()
  46.  
  47. # Parse download duration. Ignore seconds because nobody cares about it.
  48. hours, minutes, seconds = d.get_duration ()
  49. if hours > 1:
  50. duration = "%s hours and %s minutes" % (hours, minutes)
  51. elif hours == 1:
  52. duration = "one hour and %s minutes" % minutes
  53. else:
  54. duration = "%s minutes" % minutes
  55.  
  56. # And add it to the text of email
  57. mail_text += "Duration of the download: %s.\n\n" % duration
  58.  
  59. # Some users that need to be notified. "owner" means owner of the download
  60. recipients = [ "user1@provider.com", "user2@anotherprovider.org" , "owner" ]
  61.  
  62. # Move download to the right place
  63. if download.get_type() == "video":
  64. download.move("/shared/Films")
  65. mail_text += "The file has been recognized as a film so it has been copied\n"
  66. mail_text += "in /shared/Films.\n"
  67.  
  68. elif download.get_type() == "audio":
  69. download.move("/shared/Musica")
  70. mail_text += "The file has been recognized as music so it has been copied\n"
  71. mail_text += "in /shared/Music.\n"
  72.  
  73. # Our friend likes music, so copy this in his home directory (mldonkey must have
  74. # permission to write there!
  75. download.copy ("/home/friend/")
  76.  
  77. else:
  78. download.move("/shared")
  79. mail_text += "The file has not been automagically recognized, so it is\n"
  80. mail_text += "in /shared waiting for someone to put it in the right place.\n"
  81.  
  82. if download.is_in_group("remote"):
  83. mail_text += "The file will be transfered to a remote server.\n"
  84.  
  85.  
  86. # user2 is not interested in files that need to be transferred
  87. recipients.remove("user2@anotherprovider.org")
  88.  
  89. # Script signature
  90. mail_text += "\n--\nmldonkey <mldonkey@robol.it>\n"
  91.  
  92. # Notify users by mail
  93. download.notify_email(recipients,
  94. "Download of %s completed" % download.get_filename(),
  95. mail_text)
  96.  
  97.  
  98. # Finally transfer the file. This is a blocking call, so leave at the end after
  99. # mail sending.
  100. if download.is_in_group("remote"):
  101. download.rsync("user@remote_server.org:myfolder/downloads/")
  102.