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. Directory are not handled now
  33. # This is the default so it really doesn't matter that you set it if it is
  34. # /var/lib/mldonkey/incoming/files
  35. mlmanager.files_incoming = "/var/lib/mldonkey/incoming/files"
  36.  
  37. # Our mldonkey supports auto commit so we don't need username and password, but we
  38. # could also use download = mlmanager.Download(username = "user", password = "password")
  39. download = mlmanager.Download()
  40.  
  41. # Start writing an email that will be sent to the right users at the end of
  42. # the script
  43. mail_text = "Download of %s completed.\n\n" % download.get_filename()
  44.  
  45. # Parse download duration. Ignore seconds because nobody cares about it.
  46. hours, minutes, seconds = d.get_duration ()
  47. if hours > 1:
  48. duration = "%s hours and %s minutes" % (hours, minutes)
  49. elif hours == 1:
  50. duration = "one hour and %s minutes" % minutes
  51. else:
  52. duration = "%s minutes" % minutes
  53.  
  54. # And add it to the text of email
  55. mail_text += "Duration of the download: %s.\n\n" % duration
  56.  
  57. # Some users that need to be notified. "owner" means owner of the download
  58. recipients = [ "user1@provider.com", "user2@anotherprovider.org" , "owner" ]
  59.  
  60. # Move download to the right place
  61. if download.get_type() is "video":
  62. download.move("/shared/Films")
  63. mail_text += "The file has been recognized as a film so it has been copied\n"
  64. mail_text += "in /shared/Films.\n"
  65.  
  66. elif download.get_type() is "audio":
  67. download.move("/shared/Musica")
  68. mail_text += "The file has been recognized as music so it has been copied\n"
  69. mail_text += "in /shared/Music.\n"
  70.  
  71. # Our friend likes music, so copy this in his home directory (mldonkey must have
  72. # permission to write there!
  73. download.copy ("/home/friend/")
  74.  
  75. else:
  76. download.move("/shared")
  77. mail_text += "The file has not been automagically recognized, so it is\n"
  78. mail_text += "in /shared waiting for someone to put it in the right place.\n"
  79.  
  80. if download.is_in_group("remote"):
  81. mail_text += "The file will be transfered to a remote server.\n"
  82.  
  83.  
  84. # user2 is not interested in files that need to be transferred
  85. recipients.remove("user2@anotherprovider.org")
  86.  
  87. # Script signature
  88. mail_text += "\n--\nmldonkey <mldonkey@robol.it>\n"
  89.  
  90. # Notify users by mail
  91. download.notify_email(recipients,
  92. "Download of %s completed" % download.get_filename(),
  93. mail_text)
  94.  
  95.  
  96. # Finally transfer the file. This is a blocking call, so leave at the end after
  97. # mail sending.
  98. if download.is_in_group("remote"):
  99. download.rsync("user@remote_server.org:myfolder/downloads/")
  100.