Example #1
0
	def __move_data_files(self):
		# create cache and data directories
		magnatune_in_progress_path = magnatune_in_progress_dir.get_path()
		magnatune_cache_path = magnatune_cache_dir.get_path()

		# (we know they don't already exist, and we know the parent dirs do)
		os.mkdir(magnatune_in_progress_path, 0700)
		if os.path.exists(magnatune_cache_path) is False:
			os.mkdir(magnatune_cache_path, 0700)

		# move song info to cache dir
		old_magnatune_dir = os.path.join(RB.dot_dir(), 'magnatune')
		if os.path.exists(old_magnatune_dir) is False:
			print "old magnatune directory does not exist"
			return

		old_song_info = os.path.join(old_magnatune_dir, 'song_info.xml')
		if os.path.exists(old_song_info):
			print "moving existing song_info.xml to cache dir"
			os.rename(old_song_info, magnatune_song_info)
		else:
			print "no song_info.xml found (%s)" % old_song_info

		# move in progress downloads to data dir
		otherfiles = os.listdir(old_magnatune_dir)
		for f in otherfiles:
			print "moving file %s to new in-progress dir" % f
			os.rename(os.path.join(old_magnatune_dir, f),
				  os.path.join(magnatune_in_progress_path, f))
Example #2
0
    def __move_data_files(self):
        # create cache and data directories
        magnatune_in_progress_path = magnatune_in_progress_dir.get_path()
        magnatune_cache_path = magnatune_cache_dir.get_path()

        # (we know they don't already exist, and we know the parent dirs do)
        os.mkdir(magnatune_in_progress_path, 0700)
        if os.path.exists(magnatune_cache_path) is False:
            os.mkdir(magnatune_cache_path, 0700)

        # move song info to cache dir
        old_magnatune_dir = os.path.join(RB.dot_dir(), 'magnatune')
        if os.path.exists(old_magnatune_dir) is False:
            print "old magnatune directory does not exist"
            return

        old_song_info = os.path.join(old_magnatune_dir, 'song_info.xml')
        if os.path.exists(old_song_info):
            print "moving existing song_info.xml to cache dir"
            os.rename(old_song_info, magnatune_song_info)
        else:
            print "no song_info.xml found (%s)" % old_song_info

        # move in progress downloads to data dir
        otherfiles = os.listdir(old_magnatune_dir)
        for f in otherfiles:
            print "moving file %s to new in-progress dir" % f
            os.rename(os.path.join(old_magnatune_dir, f),
                      os.path.join(magnatune_in_progress_path, f))