Exemple #1
0
    def transcode_image(self, source_path):
        dest_rel_path = os.path.relpath(source_path, self.source_dir)
        dest_rel_path = norm_dest_path(os.path.basename(self.torrent_temp_dir), dest_rel_path)
        dest_path = os.path.join(self.torrent_temp_dir, dest_rel_path)

        try:
            os.makedirs(os.path.dirname(dest_path), 0777)
        except OSError:
            pass
        os.chmod(os.path.dirname(dest_path), 0777)

        shutil.copyfile(source_path, dest_path)
        os.chmod(dest_path, 0777)
Exemple #2
0
    def transcode_image(self, source_path):
        dest_rel_path = os.path.relpath(source_path, self.source_dir)
        dest_rel_path = norm_dest_path(os.path.basename(self.torrent_temp_dir), dest_rel_path)
        dest_path = os.path.join(self.torrent_temp_dir, dest_rel_path)

        try:
            os.makedirs(os.path.dirname(dest_path), 0777)
        except OSError:
            pass
        os.chmod(os.path.dirname(dest_path), 0777)

        shutil.copyfile(source_path, dest_path)
        os.chmod(dest_path, 0777)
Exemple #3
0
    def transcode_flac(self, source_path):
        num_channels = get_channels_number(source_path)
        if num_channels == 1:
            if not self.force_warnings:
                raise Exception("Single channel file.")
        elif num_channels > 2:
            raise Exception("Not a 2-channel file.")

        dest_rel_path = os.path.relpath(source_path, self.source_dir)[:-4] + "mp3"
        dest_rel_path = norm_dest_path(os.path.basename(self.torrent_temp_dir), dest_rel_path)
        dest_path = os.path.join(self.torrent_temp_dir, dest_rel_path)
        dest_path = os.path.join(os.path.dirname(dest_path), fix_pathname(os.path.basename(dest_path)))
        print "Transcode"
        print " ", source_path
        print " ", dest_path
        transcode_file(source_path, dest_path, self.what_torrent["torrent"]["media"], self.bitrate)
Exemple #4
0
    def transcode_flac(self, source_path):
        num_channels = get_channels_number(source_path)
        if num_channels == 1:
            if not self.force_warnings:
                raise Exception('Single channel file.')
        elif num_channels > 2:
            raise Exception('Not a 2-channel file.')

        dest_rel_path = os.path.relpath(source_path, self.source_dir)[:-4] + 'mp3'
        dest_rel_path = norm_dest_path(os.path.basename(self.torrent_temp_dir), dest_rel_path)
        dest_path = os.path.join(self.torrent_temp_dir, dest_rel_path)
        dest_path = os.path.join(os.path.dirname(dest_path),
                                 fix_pathname(os.path.basename(dest_path)))
        print 'Transcode'
        print ' ', source_path
        print ' ', dest_path
        transcode_file(source_path, dest_path, self.what_torrent['torrent']['media'], self.bitrate)