mirror of
				https://github.com/9001/copyparty.git
				synced 2025-11-03 21:43:12 +00:00 
			
		
		
		
	add ability to forget uploads by deleting the files
This commit is contained in:
		@@ -2975,8 +2975,18 @@ class Up2k(object):
 | 
				
			|||||||
            for x in reg.values()
 | 
					            for x in reg.values()
 | 
				
			||||||
            if x["need"] and now - x["poke"] > self.snap_discard_interval
 | 
					            if x["need"] and now - x["poke"] > self.snap_discard_interval
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
        if rm:
 | 
					
 | 
				
			||||||
            t = "dropping {} abandoned uploads in {}".format(len(rm), ptop)
 | 
					        lost = [
 | 
				
			||||||
 | 
					            x
 | 
				
			||||||
 | 
					            for x in reg.values()
 | 
				
			||||||
 | 
					            if x["need"]
 | 
				
			||||||
 | 
					            and not bos.path.exists(os.path.join(x["ptop"], x["prel"], x["name"]))
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if rm or lost:
 | 
				
			||||||
 | 
					            t = "dropping {} abandoned, {} deleted uploads in {}"
 | 
				
			||||||
 | 
					            t = t.format(len(rm), len(lost), ptop)
 | 
				
			||||||
 | 
					            rm.extend(lost)
 | 
				
			||||||
            vis = [self._vis_job_progress(x) for x in rm]
 | 
					            vis = [self._vis_job_progress(x) for x in rm]
 | 
				
			||||||
            self.log("\n".join([t] + vis))
 | 
					            self.log("\n".join([t] + vis))
 | 
				
			||||||
            for job in rm:
 | 
					            for job in rm:
 | 
				
			||||||
@@ -2986,7 +2996,10 @@ class Up2k(object):
 | 
				
			|||||||
                    path = os.path.join(job["ptop"], job["prel"], job["name"])
 | 
					                    path = os.path.join(job["ptop"], job["prel"], job["name"])
 | 
				
			||||||
                    if bos.path.getsize(path) == 0:
 | 
					                    if bos.path.getsize(path) == 0:
 | 
				
			||||||
                        bos.unlink(path)
 | 
					                        bos.unlink(path)
 | 
				
			||||||
 | 
					                except:
 | 
				
			||||||
 | 
					                    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                try:
 | 
				
			||||||
                    if len(job["hash"]) == len(job["need"]):
 | 
					                    if len(job["hash"]) == len(job["need"]):
 | 
				
			||||||
                        # PARTIAL is empty, delete that too
 | 
					                        # PARTIAL is empty, delete that too
 | 
				
			||||||
                        path = os.path.join(job["ptop"], job["prel"], job["tnam"])
 | 
					                        path = os.path.join(job["ptop"], job["prel"], job["tnam"])
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user