Tribler: SingleDownload prints to a file.
authorAdriana Draghici <adriana008@gmail.com>
Fri, 27 Nov 2009 16:03:24 +0000 (16:03 +0000)
committerAdriana Draghici <adriana008@gmail.com>
Fri, 27 Nov 2009 16:03:24 +0000 (16:03 +0000)
tribler-mod/Tribler/Core/APIImplementation/SingleDownload.py

index d13c6c4..95b81ec 100644 (file)
@@ -31,7 +31,7 @@ DEBUG = True  #False
 
 
 # Transfers' status info is output into status_file.
-FILE_NAME = "status_msg.log" #+ strftime("_%d_%b_%Y_%H_%M_%S", localtime()) + ".log"
+FILE_NAME = "status_msg_single_download.log" #+ strftime("_%d_%b_%Y_%H_%M_%S", localtime()) + ".log"
 status_file = open(FILE_NAME, 'w');
 
 class SingleDownload:
@@ -117,7 +117,7 @@ class SingleDownload:
         """ Return the local filename to which to save the file 'name' in the torrent """
         if DEBUG:
             print >>status_file, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: save_as(",`name`,length,`saveas`,isdir,")"
-           # status_file.close()
+            status_file.close()
         try:
             if not os.access(saveas,os.F_OK):
                 os.mkdir(saveas)
@@ -131,8 +131,7 @@ class SingleDownload:
     def perform_hashcheck(self,complete_callback):
         """ Called by any thread """
         if DEBUG:
-            print >>status_file, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: perform_hashcheck()" # ,self.videoinfo
-            #status_file.close()
+            print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: perform_hashcheck()" # ,self.videoinfo
         try:
             """ Schedules actually hashcheck on network thread """
             self._getstatsfunc = SPECIAL_VALUE # signal we're hashchecking
@@ -149,7 +148,7 @@ class SingleDownload:
             Called by network thread
         """
         if DEBUG:
-            print >>status_file, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: hashcheck_done()"
+            print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: hashcheck_done()"
         try:
             self.dow.startEngine(vodeventfunc = self.lmvodeventcallback)
             self._getstatsfunc = self.dow.startStats() # not possible earlier
@@ -227,8 +226,7 @@ class SingleDownload:
     
     def shutdown(self):
         if DEBUG:
-            print >>status_file, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: shutdown"
-            #status_file.close()
+            print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload: shutdown"
         resumedata = None
         if self.dow is not None:
             self.dldoneflag.set()
@@ -276,8 +274,7 @@ class SingleDownload:
     def finishedfunc(self):
         """ Download is complete """
         if DEBUG:
-            print >>status_file, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload::finishedfunc called: Download is complete *******************************"
-            #status_file.close()
+            print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","SingleDownload::finishedfunc called: Download is complete *******************************"
         pass
 
     def fatalerrorfunc(self,data):