Beispiel #1
0
	def get_number(self, path) :
		count = {'jpg':0, 'video':0}
		tool = FileTools(path) 
		tool.remove_empty()

		for root, dirs, files in os.walk(path) :
			for d in dirs :
				d = os.path.join(root, d)

				if os.path.basename(d) not in ['Video', 'System', 'Other'] :
					print('{0} abnomal folder name'.format(d))
					return None

			for f in files :
				f = os.path.join(root, f)

				basename, ext = os.path.splitext(f)
				if re.match('\.(jpg)', ext.lower()) is not None :
					count['jpg']+= 1
				elif FileTools.is_media(f)
					count['video'] += 1
				elif SevenZ.is_archive(f) :
					os.remove(f)
				elif re.match('.*Thumbs.db', f) is not None :
					os.remove(f)
				else :
					print("{0} abnomal".format(f))
					return None

		return count
Beispiel #2
0
	def is_include(self, raw) :
		return FileTools.is_media(raw)