Ejemplo n.º 1
0
	def to(self, target_directory):
		filename = make_valid_filename(self.resource.name)
		filepath = os.path.join(target_directory, filename)

		if os.path.exists(filepath):
			self.skip(filepath)
			return
	
		self.load(filepath)
Ejemplo n.º 2
0
def download(course):
	coursePath = os.path.join('courses', make_valid_filename(course.name))
	createCourseFolder(coursePath)

	page = moodle.material_page_for(course.id)
	for resource in page.resources():
	
		if was_already_downloaded(resource.url):
			continue
		
		remember(resource.url)
			
		print "\t" + resource.name
		if commandLine.do_not_download:
			continue
		Download(resource).to(coursePath)
Ejemplo n.º 3
0
	def test_should_replace_bad_characters(self):
		bad_filename = u"Einführung in die Pädagogische Psychologie - Bachelor WS11/12"
		good_filename = make_valid_filename(bad_filename)
		self.assertEqual(good_filename, u"Einführung in die Pädagogische Psychologie - Bachelor WS11-12")