def get_recommended_folders(container, names):
 from calibre.ebooks.oeb.polish.utils import guess_type
 counts = defaultdict(Counter)
 for (name, mt) in container.mime_map.iteritems():
  folder = (name.rpartition(u'/')[0] if (u'/' in name) else u'')
  counts[mt_to_category(container, mt)][folder] += 1
 try:
  opf_folder = counts[u'opf'].most_common(1)[0][0]
 except KeyError:
  opf_folder = u''
 recommendations = {category: counter.most_common(1)[0][0] for (category, counter) in counts.iteritems()}
 return {n: recommendations.get(mt_to_category(container, guess_type(os.path.basename(n))), opf_folder) for n in names}

def get_recommended_folders ( container , names ) : from calibre . ebooks . oeb . polish . utils import guess_type counts = defaultdict ( Counter ) for ( name , mt ) in container . mime_map . iteritems ( ) : folder = ( name . rpartition ( u'/' ) [ 0 ] if ( u'/' in name ) else u'' ) counts [ mt_to_category ( container , mt ) ] [ folder ] += 1 try : opf_folder = counts [ u'opf' ] . most_common ( 1 ) [ 0 ] [ 0 ] except KeyError : opf_folder = u'' recommendations = { category : counter . most_common ( 1 ) [ 0 ] [ 0 ] for ( category , counter ) in counts . iteritems ( ) } return { n : recommendations . get ( mt_to_category ( container , guess_type ( os . path . basename ( n ) ) ) , opf_folder ) for n in names }
return the folders that are recommended for the given filenames .