1

Use censored Names

This commit is contained in:
Kim Wittenburg
2018-09-06 15:41:56 +02:00
parent c29661e6e8
commit 3d0c0b1873

View File

@@ -77,6 +77,7 @@ class iTunesPlugin(BeetsPlugin):
'sanitize_searches': True, # Whether to remove parenthesized and braced text from searches
'artwork': False, # Whether to also download artwork from iTunes. Does not work well with fetchart
'method': 'lookup', # Valid values: 'search', 'lookup', 'both', 'lookup (search fallback)'
'censored_names': False,
})
if self.method in ['lookup', 'lookup (search fallback)', 'both']:
self.register_listener('import_task_start', self.scan_track_ids)
@@ -112,6 +113,10 @@ class iTunesPlugin(BeetsPlugin):
def sanitize_searches(self):
return self.config['sanitize_searches']
@property
def use_censored_names(self):
return self.config['censored_names']
def scan_track_ids(self, session, task):
self._log.debug("Scanning track IDs")
for item in task.items:
@@ -268,7 +273,8 @@ class iTunesPlugin(BeetsPlugin):
year = int(album.release_date[0:4])
month = int(album.release_date[5:7])
day = int(album.release_date[8:10])
info = AlbumInfo(album.collection_name,
collection_name = album.collection_censored_name if self.use_censored_names and hasattr(album, 'collection_censored_name') else album.collection_name
info = AlbumInfo(collection_name,
album.collection_id,
album.artist_name,
album.artist_id,
@@ -296,7 +302,7 @@ class iTunesPlugin(BeetsPlugin):
original_day = day, # See original_year
data_source = "iTunes",
data_url = album.collection_view_url)
info.album_sort = sort_string(album.collection_name)
info.album_sort = sort_string(collection_name)
info.itunes_content_id = album.collection_id
info.itunes_artist_id = album.artist_id
info.genre = album.primary_genre_name
@@ -306,7 +312,9 @@ class iTunesPlugin(BeetsPlugin):
return info
def make_track_info(self, track, index):
info = TrackInfo(track.track_name,
track_name = track.track_censored_name if self.use_censored_names and hasattr(track, 'track_censored_name') else track.track_name
collection_name = track.collection_censored_name if self.use_censored_names and hasattr(track, 'collection_censored_name') else track.collection_name
info = TrackInfo(track_name,
track.track_id,
artist = track.artist_name,
artist_id = track.artist_id,
@@ -326,8 +334,8 @@ class iTunesPlugin(BeetsPlugin):
composer_sort = None,
arranger = None,
track_alt = None)
info.title_sort = sort_string(track.track_name)
info.album_sort = sort_string(track.collection_name)
info.title_sort = sort_string(track_name)
info.album_sort = sort_string(collection_name)
info.itunes_content_id = track.track_id
info.itunes_artist_id = track.artist_id
info.genre = track.primary_genre_name