Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
0
 def directory_name(self):
     torrent = self.what_torrent
     artists = get_artists(torrent["group"])
     if len(artists) + len(torrent["group"]["name"]) > 80:
         if torrent["group"]["musicInfo"]["artists"]:
             if len(torrent["group"]["musicInfo"]["artists"]) > 1:
                 artists = "Various Artists"
             else:
                 artists = torrent["group"]["musicInfo"]["artists"][0]["name"]
         elif torrent["group"]["musicInfo"]["conductor"]:
             if len(torrent["group"]["musicInfo"]["conductor"]) > 1:
                 artists = "Various Conductors"
             else:
                 artists = torrent["group"]["musicInfo"]["conductor"][0]["name"]
     name = html_unescape(torrent["group"]["name"])
     if len(name) > 70:
         name = name[:67] + "..."
     media = torrent["torrent"]["media"]
     year = torrent["torrent"]["remasterYear"] or torrent["group"]["year"]
     return fix_pathname(
         "{0} - {1} - {2} ({3} - MP3 - {4})".format(artists, name, year, media, self.bitrate.upper())
     )
Esempio n. 4
0
 def directory_name(self):
     torrent = self.what_torrent
     artists = get_artists(torrent['group'])
     if len(artists) + len(torrent['group']['name']) > 80:
         if torrent['group']['musicInfo']['artists']:
             if len(torrent['group']['musicInfo']['artists']) > 1:
                 artists = 'Various Artists'
             else:
                 artists = torrent['group']['musicInfo']['artists'][0]['name']
         elif torrent['group']['musicInfo']['conductor']:
             if len(torrent['group']['musicInfo']['conductor']) > 1:
                 artists = 'Various Conductors'
             else:
                 artists = torrent['group']['musicInfo']['conductor'][0]['name']
     name = html_unescape(torrent['group']['name'])
     if len(name) > 70:
         name = name[:67] + '...'
     media = torrent['torrent']['media']
     year = torrent['torrent']['remasterYear'] or torrent['group']['year']
     return fix_pathname('{0} - {1} - {2} ({3} - MP3 - {4})'.format(
         artists, name, year, media, self.bitrate.upper()
     ))