<commit_before>#!/usr/bin/env python2.7

import ConfigParser
import shutil
import sys

import eyed3

config = ConfigParser.ConfigParser()
config.read('sermon.ini')
metadata = dict(config.items('DEFAULT'))

filename = '{}-{}-{}.mp3'.format(
    metadata['date'],
    metadata['series'],
    metadata['title']
)
shutil.copyfile(sys.argv[1], filename)

sermon = eyed3.load(filename)
sermon.tag.title = unicode('{} ({})'.format(metadata['verse'], metadata['title']))
sermon.tag.setTextFrame('TCOM', unicode(metadata['preacher']))   # composer
sermon.tag.artist = unicode(metadata['church'])
sermon.tag.album = unicode(metadata['series'])
sermon.tag.album_artist = unicode(metadata['church'])
sermon.tag.genre = unicode("Sermon")
# TODO: sermon.tag.recording_date = dateutil.parser.parse(metadata['date'])
sermon.tag.save()<commit_msg>tagmp3 - adding recording year. (#6)<commit_after>#!/usr/bin/env python2.7

import ConfigParser
import shutil
import sys

import eyed3

config = ConfigParser.ConfigParser()
config.read('sermon.ini')
metadata = dict(config.items('DEFAULT'))

filename = '{}-{}-{}.mp3'.format(
    metadata['date'],
    metadata['series'],
    metadata['title']
)
shutil.copyfile(sys.argv[1], filename)

sermon = eyed3.load(filename)
sermon.tag.title = unicode('{} ({})'.format(metadata['verse'], metadata['title']))
sermon.tag.setTextFrame('TCOM', unicode(metadata['preacher']))   # composer
sermon.tag.artist = unicode(metadata['church'])
sermon.tag.album = unicode(metadata['series'])
sermon.tag.album_artist = unicode(metadata['church'])
sermon.tag.genre = unicode("Sermon")
sermon.tag.setTextFrame('TYER', unicode(metadata['date']))      # Recording Year
sermon.tag.save()
{'fraction_non_alphanumeric': 0.1895734597156398, 'fraction_numerical': 0.008293838862559242, 'mean_word_length': 6.440528634361233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '62211', 'n_tokens_mistral': 574, 'n_tokens_neox': 563, 'n_words': 90}