Exemple #1
0
	def done(self, next_phase, backup) :
		if self.dst is not None and self.isTop :
			# move to top 
			filetools = FileTools(self.dst, self.dst)
			filetools.move_sub_into('folders')
			filetools.remove_empty()

			# rename folder to just number
			count = 1
			for name in os.listdir(self.dst) :
				name = os.path.join(self.dst, name)
				if not os.path.isdir(name) :
					continue

				dst = os.path.join(self.dst, "{0:02d}".format(count))
				while os.path.exists(dst) :
					count += 1
					dst = os.path.join(self.dst, "{0:02d}".format(count))

				os.rename(name, dst)

			# make 'System' and 'Other' folder
			for name in ['System', 'Other'] :
				name = os.path.join(self.dst, name)
				os.mkdir(name)

			# move dst to next 
			filetools = FileTools(self.dst, os.path.join(next_phase, os.path.basename(self.dst)))
			filetools.safe_move()

			# move src to backup
			filetools = FileTools(self.src, os.path.join(backup, os.path.basename(self.src)))
			filetools.safe_move()
Exemple #2
0
	def done(self) :
		for f in os.listdir(self.move_to) :
			path = os.path.join(self.move_to, f)
			if not os.path.isdir(path) :
				continue
			elif f == '#move' :
				self.move_to_av()
			elif f == '#remove' :
				print("REMOVE : {0}".format(path))
				shutil.rmtree(path)
				os.makedirs(path)
			else :
				tool = FileTools(path, self.move_to)
				tool.move_sub_into(pass_func=FileTools.is_media)
				print("REMOVE : {0}".format(path))
				shutil.rmtree(path)

				renamer = AvRenamer(self.cfg)
				renamer.watchs = [self.move_to]
				renamer.start()