Skip to content

Commit

Permalink
Extensions: Add option to remove all tags (bug 1771)
Browse files Browse the repository at this point in the history
Add a new option to the tagging extension
  • Loading branch information
brot authored and thp committed Feb 16, 2013
1 parent f2a0cdb commit 33bdbe0
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions share/gpodder/extensions/tagging.py
Expand Up @@ -44,6 +44,7 @@
DefaultConfig = {
'strip_album_from_title': True,
'genre_tag': 'Podcast',
'always_remove_tags': False,
}


Expand Down Expand Up @@ -98,24 +99,28 @@ def write_info2file(self, info):
if audio is None:
return

# write title+album information into audio files
if audio.tags is None:
audio.add_tags()

# write album+title
if info['album'] is not None:
audio.tags['album'] = info['album']
if info['title'] is not None:
audio.tags['title'] = info['title']

# write genre tag
if self.container.config.genre_tag is not None:
audio.tags['genre'] = self.container.config.genre_tag
if self.container.config.always_remove_tags:
if audio.tags is not None:
audio.delete()
else:
audio.tags['genre'] = ''

# write pubDate
if info['pubDate'] is not None:
audio.tags['date'] = info['pubDate']
# write title+album information into audio files
if audio.tags is None:
audio.add_tags()

# write album+title
if info['album'] is not None:
audio.tags['album'] = info['album']
if info['title'] is not None:
audio.tags['title'] = info['title']

# write genre tag
if self.container.config.genre_tag is not None:
audio.tags['genre'] = self.container.config.genre_tag
else:
audio.tags['genre'] = ''

# write pubDate
if info['pubDate'] is not None:
audio.tags['date'] = info['pubDate']

audio.save()

0 comments on commit 33bdbe0

Please sign in to comment.