gurudesh/pytracebugs huggingface dataset:
# Buggy code
def item_file(item_id):
    item = g.lib.get_item(item_id)
    item_path = util.syspath(item.path) if os.name == "nt" else util.py3_path(item.path)
    response = flask.send_file(
        item_path,
        as_attachment=True,
        attachment_filename=os.path.basename(util.py3_path(item.path)),
    )
    response.headers["Content-Length"] = os.path.getsize(item_path)
    return response


# Traceback (IOError)
[2017-06-14 21:36:27,233] ERROR in app: Exception on /item/52117/file [GET]
Traceback (most recent call last):
File "c:\python\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "c:\python\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "c:\python\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python\lib\site-packages\beetsplug\web\__init__.py", line 209, in item_file
attachment_filename=os.path.basename(util.py3_path(item.path)),
File "c:\python\lib\site-packages\flask\helpers.py", line 549, in send_file
file = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'PATH_REDACTED\\01 Marta Kubis\xcc\x8cova\xcc\x81 - Tak Dej Se K Na\xcc\x81m A Projdem Svet.flac'
127.0.0.1 - - [14/Jun/2017 21:36:27] "GET /item/52117/file HTTP/1.1" 500 -

# Fixed code
def item_file(item_id):
    item = g.lib.get_item(item_id)
    item_path = (
        util.syspath(item.path) if (os.name == "nt") else (util.py3_path(item.path))
    )
    response = flask.send_file(
        item_path,
        as_attachment=True,
        attachment_filename=os.path.basename(util.py3_path(item.path)),
    )
    response.headers["Content-Length"] = os.path.getsize(item_path)
    return response
# Buggy code
def item_file(item_id):
    item = g.lib.get_item(item_id)
    response = flask.send_file(
        util.py3_path(item.path),
        as_attachment=True,
        attachment_filename=os.path.basename(util.py3_path(item.path)),
    )
    response.headers["Content-Length"] = os.path.getsize(item.path)
    return response


# Traceback (IOError)
[2017-06-14 21:36:27,233] ERROR in app: Exception on /item/52117/file [GET]
Traceback (most recent call last):
File "c:\python\lib\site-packages\flask\app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "c:\python\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\python\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "c:\python\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\python\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "c:\python\lib\site-packages\flask\app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\python\lib\site-packages\beetsplug\web\__init__.py", line 209, in item_file
attachment_filename=os.path.basename(util.py3_path(item.path)),
File "c:\python\lib\site-packages\flask\helpers.py", line 549, in send_file
file = open(filename, 'rb')
IOError: [Errno 2] No such file or directory: 'PATH_REDACTED\\01 Marta Kubis\xcc\x8cova\xcc\x81 - Tak Dej Se K Na\xcc\x81m A Projdem Svet.flac'
127.0.0.1 - - [14/Jun/2017 21:36:27] "GET /item/52117/file HTTP/1.1" 500 -

# Fixed code
def item_file(item_id):
    item = g.lib.get_item(item_id)
    item_path = (
        util.syspath(item.path) if (os.name == "nt") else (util.py3_path(item.path))
    )
    response = flask.send_file(
        item_path,
        as_attachment=True,
        attachment_filename=os.path.basename(util.py3_path(item.path)),
    )
    response.headers["Content-Length"] = os.path.getsize(item_path)
    return response
# Buggy code
def match(self, item):
    timestamp = float(item[self.field])
    date = datetime.utcfromtimestamp(timestamp)
    return self.interval.contains(date)


# Traceback (KeyError)
user configuration: ~/.config/beets/config.yaml
data directory: ~/.config/beets
plugin paths: /usr/local/bin/wlg
Sending event: pluginload
inline: adding item field multidisc
artresizer: method is (2, (6, 9, 3))
thumbnails: using IM to write metadata
thumbnails: using GIO to compute URIs
library database: /net/nfs4/server/mediacentre/Music/Catalogs/beets_test.blb
library directory: /net/nfs4/server/mediacentre/Music/Library_test
Sending event: library_opened
Traceback (most recent call last):
File "/usr/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.17', 'console_scripts', 'beet')()
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1236, in main
_raw_main(args)
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1226, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 1068, in list_func
list_items(lib, decargs(args), opts.album)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 1063, in list_items
for item in lib.items(query):
File "/usr/lib/python2.7/site-packages/beets/dbcore/db.py", line 538, in _get_objects
if not self.query or self.query.match(obj):
File "/usr/lib/python2.7/site-packages/beets/dbcore/query.py", line 438, in match
return all([q.match(item) for q in self.subqueries])
File "/usr/lib/python2.7/site-packages/beets/dbcore/query.py", line 629, in match
timestamp = float(item[self.field])
File "/usr/lib/python2.7/site-packages/beets/dbcore/db.py", line 231, in __getitem__
raise KeyError(key)
KeyError: u'last_played'

# Fixed code
def match(self, item):
    if self.field not in item:
        return False
    timestamp = float(item[self.field])
    date = datetime.utcfromtimestamp(timestamp)
    return self.interval.contains(date)
# Buggy code
def _is_hidden_osx(path):
    """Return whether or not a file is hidden on OS X.

    This uses os.lstat to work out if a file has the "hidden" flag.
    """
    file_stat = os.lstat(path)

    if hasattr(file_stat, "st_flags") and hasattr(stat, "UF_HIDDEN"):
        return bool(file_stat.st_flags & stat.UF_HIDDEN)
    else:
        return False


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "/usr/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1266, in main
_raw_main(args)
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 967, in import_func
import_files(lib, paths, query)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 944, in import_files
session.run()
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 320, in run
pl.run_parallel(QUEUE_SIZE)
File "/usr/lib/python2.7/site-packages/beets/util/pipeline.py", line 251, in run
msg = next(self.coro)
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1202, in read_tasks
for t in task_factory.tasks():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1038, in tasks
for dirs, paths in self.paths():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1090, in paths
for dirs, paths in albums_in_dir(self.toppath):
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1480, in albums_in_dir
logger=log):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 205, in sorted_walk
for res in sorted_walk(cur, ignore, ignore_hidden, logger):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 190, in sorted_walk
if (ignore_hidden and not hidden.is_hidden(cur)) or not ignore_hidden:
File "/usr/lib/python2.7/site-packages/beets/util/hidden.py", line 78, in is_hidden
path = path.decode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 76: invalid start byte

# Fixed code
def _is_hidden_osx(path):
    """Return whether or not a file is hidden on OS X.

    This uses os.lstat to work out if a file has the "hidden" flag.
    """
    file_stat = os.lstat(beets.util.syspath(path))

    if hasattr(file_stat, "st_flags") and hasattr(stat, "UF_HIDDEN"):
        return bool(file_stat.st_flags & stat.UF_HIDDEN)
    else:
        return False
# Buggy code
def _is_hidden_win(path):
    """Return whether or not a file is hidden on Windows.

    This uses GetFileAttributes to work out if a file has the "hidden" flag
    (FILE_ATTRIBUTE_HIDDEN).
    """
    # FILE_ATTRIBUTE_HIDDEN = 2 (0x2) from GetFileAttributes documentation.
    hidden_mask = 2

    # Retrieve the attributes for the file.
    attrs = ctypes.windll.kernel32.GetFileAttributesW(path)

    # Ensure we have valid attribues and compare them against the mask.
    return attrs >= 0 and attrs & hidden_mask


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "/usr/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1266, in main
_raw_main(args)
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 967, in import_func
import_files(lib, paths, query)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 944, in import_files
session.run()
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 320, in run
pl.run_parallel(QUEUE_SIZE)
File "/usr/lib/python2.7/site-packages/beets/util/pipeline.py", line 251, in run
msg = next(self.coro)
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1202, in read_tasks
for t in task_factory.tasks():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1038, in tasks
for dirs, paths in self.paths():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1090, in paths
for dirs, paths in albums_in_dir(self.toppath):
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1480, in albums_in_dir
logger=log):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 205, in sorted_walk
for res in sorted_walk(cur, ignore, ignore_hidden, logger):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 190, in sorted_walk
if (ignore_hidden and not hidden.is_hidden(cur)) or not ignore_hidden:
File "/usr/lib/python2.7/site-packages/beets/util/hidden.py", line 78, in is_hidden
path = path.decode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 76: invalid start byte

# Fixed code
def _is_hidden_win(path):
    """Return whether or not a file is hidden on Windows.

    This uses GetFileAttributes to work out if a file has the "hidden" flag
    (FILE_ATTRIBUTE_HIDDEN).
    """
    # FILE_ATTRIBUTE_HIDDEN = 2 (0x2) from GetFileAttributes documentation.
    hidden_mask = 2

    # Retrieve the attributes for the file.
    attrs = ctypes.windll.kernel32.GetFileAttributesW(beets.util.syspath(path))

    # Ensure we have valid attribues and compare them against the mask.
    return attrs >= 0 and attrs & hidden_mask
# Buggy code
def _is_hidden_dot(path):
    """Return whether or not a file starts with a dot.

    Files starting with a dot are seen as "hidden" files on Unix-based OSes.
    """
    return os.path.basename(path).startswith(".")


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "/usr/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.19', 'console_scripts', 'beet')()
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1266, in main
_raw_main(args)
File "/usr/lib/python2.7/site-packages/beets/ui/__init__.py", line 1253, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 967, in import_func
import_files(lib, paths, query)
File "/usr/lib/python2.7/site-packages/beets/ui/commands.py", line 944, in import_files
session.run()
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 320, in run
pl.run_parallel(QUEUE_SIZE)
File "/usr/lib/python2.7/site-packages/beets/util/pipeline.py", line 251, in run
msg = next(self.coro)
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1202, in read_tasks
for t in task_factory.tasks():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1038, in tasks
for dirs, paths in self.paths():
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1090, in paths
for dirs, paths in albums_in_dir(self.toppath):
File "/usr/lib/python2.7/site-packages/beets/importer.py", line 1480, in albums_in_dir
logger=log):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 205, in sorted_walk
for res in sorted_walk(cur, ignore, ignore_hidden, logger):
File "/usr/lib/python2.7/site-packages/beets/util/__init__.py", line 190, in sorted_walk
if (ignore_hidden and not hidden.is_hidden(cur)) or not ignore_hidden:
File "/usr/lib/python2.7/site-packages/beets/util/hidden.py", line 78, in is_hidden
path = path.decode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 76: invalid start byte

# Fixed code
def _is_hidden_dot(path):
    """Return whether or not a file starts with a dot.

    Files starting with a dot are seen as "hidden" files on Unix-based OSes.
    """
    return os.path.basename(path).startswith(b".")
# Buggy code
def sort(self, objs):
    # TODO: Conversion and null-detection here. In Python 3,
    # comparisons with None fail. We should also support flexible
    # attributes with different types without falling over.

    def key(item):
        field_val = getattr(item, self.field)
        if self.case_insensitive and isinstance(field_val, unicode):
            field_val = field_val.lower()
        return field_val

    return sorted(objs, key=key, reverse=not self.ascending)


# Traceback (AttributeError)
$ beet ls -- --
Traceback (most recent call last):
File "/home/asampson/.local/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.16', 'console_scripts', 'beet')()
File "/home/asampson/beets/beets/ui/__init__.py", line 1207, in main
_raw_main(args)
File "/home/asampson/beets/beets/ui/__init__.py", line 1197, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/home/asampson/beets/beets/ui/commands.py", line 958, in list_func
list_items(lib, decargs(args), opts.album)
File "/home/asampson/beets/beets/ui/commands.py", line 953, in list_items
for item in lib.items(query):
File "/home/asampson/beets/beets/dbcore/db.py", line 545, in __iter__
objects = self.sort.sort(list(self._get_objects()))
File "/home/asampson/beets/beets/dbcore/query.py", line 775, in sort
return sorted(objs, key=key, reverse=not self.ascending)
File "/home/asampson/beets/beets/dbcore/query.py", line 770, in key
field_val = getattr(item, self.field)
File "/home/asampson/beets/beets/dbcore/db.py", line 326, in __getattr__
raise AttributeError('no such field {0!r}'.format(key))
AttributeError: no such field '-'

# Fixed code
def sort(self, objs):
    # TODO: Conversion and null-detection here. In Python 3,
    # comparisons with None fail. We should also support flexible
    # attributes with different types without falling over.

    def key(item):
        field_val = item.get(self.field, "")
        if self.case_insensitive and isinstance(field_val, unicode):
            field_val = field_val.lower()
        return field_val

    return sorted(objs, key=key, reverse=not self.ascending)
# Buggy code
def key(item):
    field_val = getattr(item, self.field)
    if self.case_insensitive and isinstance(field_val, unicode):
        field_val = field_val.lower()
    return field_val


# Traceback (AttributeError)
$ beet ls -- --
Traceback (most recent call last):
File "/home/asampson/.local/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.16', 'console_scripts', 'beet')()
File "/home/asampson/beets/beets/ui/__init__.py", line 1207, in main
_raw_main(args)
File "/home/asampson/beets/beets/ui/__init__.py", line 1197, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/home/asampson/beets/beets/ui/commands.py", line 958, in list_func
list_items(lib, decargs(args), opts.album)
File "/home/asampson/beets/beets/ui/commands.py", line 953, in list_items
for item in lib.items(query):
File "/home/asampson/beets/beets/dbcore/db.py", line 545, in __iter__
objects = self.sort.sort(list(self._get_objects()))
File "/home/asampson/beets/beets/dbcore/query.py", line 775, in sort
return sorted(objs, key=key, reverse=not self.ascending)
File "/home/asampson/beets/beets/dbcore/query.py", line 770, in key
field_val = getattr(item, self.field)
File "/home/asampson/beets/beets/dbcore/db.py", line 326, in __getattr__
raise AttributeError('no such field {0!r}'.format(key))
AttributeError: no such field '-'

# Fixed code
def key(item):
    field_val = item.get(self.field, "")
    if self.case_insensitive and isinstance(field_val, unicode):
        field_val = field_val.lower()
    return field_val
# Buggy code
def _process_item(
    item, lib, copy=False, move=False, delete=False, tag=False, format=""
):
    """Process Item `item` in `lib`."""
    if copy:
        item.move(basedir=copy, copy=True)
        item.store()
    if move:
        item.move(basedir=move, copy=False)
        item.store()
    if delete:
        item.remove(delete=True)
    if tag:
        try:
            k, v = tag.split("=")
        except:
            raise UserError("%s: can't parse k=v tag: %s" % (PLUGIN, tag))
        setattr(k, v)
        item.store()
    print_(format(item, format))


# Traceback (TypeError)
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup

format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable

# Fixed code
def _process_item(item, lib, copy=False, move=False, delete=False, tag=False, fmt=""):
    """Process Item `item` in `lib`."""
    if copy:
        item.move(basedir=copy, copy=True)
        item.store()
    if move:
        item.move(basedir=move, copy=False)
        item.store()
    if delete:
        item.remove(delete=True)
    if tag:
        try:
            k, v = tag.split("=")
        except:
            raise UserError("%s: can't parse k=v tag: %s" % (PLUGIN, tag))
        setattr(k, v)
        item.store()
    print_(format(item, fmt))
# Buggy code
def tmpl_time(s, format):
    """Format a time value using `strftime`."""
    cur_fmt = beets.config["time_format"].get(unicode)
    return time.strftime(format, time.strptime(s, cur_fmt))


# Traceback (TypeError)
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup

format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable

# Fixed code
def tmpl_time(s, fmt):
    """Format a time value using `strftime`."""
    cur_fmt = beets.config["time_format"].get(unicode)
    return time.strftime(fmt, time.strptime(s, cur_fmt))
# Buggy code
def get_format(format=None):
    """Return the command tempate and the extension from the config."""
    if not format:
        format = config["convert"]["format"].get(unicode).lower()
    format = ALIASES.get(format, format)

    try:
        format_info = config["convert"]["formats"][format].get(dict)
        command = format_info["command"]
        extension = format_info["extension"]
    except KeyError:
        raise ui.UserError(
            'convert: format {0} needs "command" and "extension" fields'.format(format)
        )
    except ConfigTypeError:
        command = config["convert"]["formats"][format].get(bytes)
        extension = format

    # Convenience and backwards-compatibility shortcuts.
    keys = config["convert"].keys()
    if "command" in keys:
        command = config["convert"]["command"].get(unicode)
    elif "opts" in keys:
        # Undocumented option for backwards compatibility with < 1.3.1.
        command = "ffmpeg -i $source -y {0} $dest".format(
            config["convert"]["opts"].get(unicode)
        )
    if "extension" in keys:
        extension = config["convert"]["extension"].get(unicode)

    return (command.encode("utf8"), extension.encode("utf8"))


# Traceback (TypeError)
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup

format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable

# Fixed code
def get_format(fmt=None):
    """Return the command tempate and the extension from the config."""
    if not fmt:
        fmt = config["convert"]["format"].get(unicode).lower()
    fmt = ALIASES.get(fmt, fmt)

    try:
        format_info = config["convert"]["formats"][fmt].get(dict)
        command = format_info["command"]
        extension = format_info["extension"]
    except KeyError:
        raise ui.UserError(
            'convert: format {0} needs "command" and "extension" fields'.format(fmt)
        )
    except ConfigTypeError:
        command = config["convert"]["formats"][fmt].get(bytes)
        extension = fmt

    # Convenience and backwards-compatibility shortcuts.
    keys = config["convert"].keys()
    if "command" in keys:
        command = config["convert"]["command"].get(unicode)
    elif "opts" in keys:
        # Undocumented option for backwards compatibility with < 1.3.1.
        command = "ffmpeg -i $source -y {0} $dest".format(
            config["convert"]["opts"].get(unicode)
        )
    if "extension" in keys:
        extension = config["convert"]["extension"].get(unicode)

    return (command.encode("utf8"), extension.encode("utf8"))
# Buggy code
def should_transcode(item, format):
    """Determine whether the item should be transcoded as part of
    conversion (i.e., its bitrate is high or it has the wrong format).
    """
    if config["convert"]["never_convert_lossy_files"] and not (
        item.format.lower() in LOSSLESS_FORMATS
    ):
        return False
    maxbr = config["convert"]["max_bitrate"].get(int)
    return format.lower() != item.format.lower() or item.bitrate >= 1000 * maxbr


# Traceback (TypeError)
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup

format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable

# Fixed code
def should_transcode(item, fmt):
    """Determine whether the item should be transcoded as part of
    conversion (i.e., its bitrate is high or it has the wrong format).
    """
    if config["convert"]["never_convert_lossy_files"] and not (
        item.format.lower() in LOSSLESS_FORMATS
    ):
        return False
    maxbr = config["convert"]["max_bitrate"].get(int)
    return fmt.lower() != item.format.lower() or item.bitrate >= 1000 * maxbr
# Buggy code
def convert_on_import(self, lib, item):
    """Transcode a file automatically after it is imported into the
    library.
    """
    format = self.config["format"].get(unicode).lower()
    if should_transcode(item, format):
        command, ext = get_format()
        fd, dest = tempfile.mkstemp("." + ext)
        os.close(fd)
        _temp_files.append(dest)  # Delete the transcode later.
        try:
            self.encode(command, item.path, dest)
        except subprocess.CalledProcessError:
            return
        item.path = dest
        item.write()
        item.read()  # Load new audio information data.
        item.store()


# Traceback (TypeError)
C:\Users\100557855>beet duplicates
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.11', 'console_scripts', 'beet')()
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 953, in main
_raw_main(args)
File "c:\users\100557855\src\beets\beets\ui\__init__.py", line 943, in _raw_ma
in
subcommand.func(lib, suboptions, subargs)
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 232, in _dup

format=fmt.format(obj_count))
File "c:\users\100557855\src\beets\beetsplug\duplicates.py", line 48, in _proc
ess_item
print_(format(item, format))
TypeError: 'unicode' object is not callable

# Fixed code
def convert_on_import(self, lib, item):
    """Transcode a file automatically after it is imported into the
    library.
    """
    fmt = self.config["format"].get(unicode).lower()
    if should_transcode(item, fmt):
        command, ext = get_format()
        fd, dest = tempfile.mkstemp("." + ext)
        os.close(fd)
        _temp_files.append(dest)  # Delete the transcode later.
        try:
            self.encode(command, item.path, dest)
        except subprocess.CalledProcessError:
            return
        item.path = dest
        item.write()
        item.read()  # Load new audio information data.
        item.store()
# Buggy code
def scrub_func(lib, opts, args):
    # This is a little bit hacky, but we set a global flag to
    # avoid autoscrubbing when we're also explicitly scrubbing.
    global scrubbing
    scrubbing = True

    # Walk through matching files and remove tags.
    for item in lib.items(ui.decargs(args)):
        self._log.info("scrubbing: {0}", util.displayable_path(item.path))

        # Get album art if we need to restore it.
        if opts.write:
            mf = mediafile.MediaFile(item.path, config["id3v23"].get(bool))
            art = mf.art

        # Remove all tags.
        self._scrub(item.path)

        # Restore tags, if enabled.
        if opts.write:
            self._log.debug("writing new tags after scrub")
            item.try_write()
            if art:
                self._log.info("restoring art")
                mf = mediafile.MediaFile(item.path)
                mf.art = art
                mf.save()

    scrubbing = False


# Traceback (IOError)
scrubbing: C:\Users\100557855\Desktop\Music\Above &amp; Beyond\TriΓÇÉState\01 TriΓÇÉ
State.mp3
Traceback (most recent call last):
File "C:\Python27\Scripts\beet-script.py", line 9, in <module>
load_entry_point('beets==1.3.10', 'console_scripts', 'beet')()
File "C:\Python27\lib\site-packages\beets\ui\__init__.py", line 945, in main
_raw_main(args)
File "C:\Python27\lib\site-packages\beets\ui\__init__.py", line 935, in _raw_m
ain
subcommand.func(lib, suboptions, subargs)
File "C:\Python27\lib\site-packages\beetsplug\scrub.py", line 73, in scrub_fun
c
config['id3v23'].get(bool))
File "C:\Python27\lib\site-packages\beets\mediafile.py", line 1314, in __init_
_
self.mgfile = mutagen.File(path)
File "C:\Python27\lib\site-packages\mutagen\_file.py", line 221, in File
fileobj = open(filename, "rb")
IOError: [Errno 2] No such file or directory: 'C:\\Users\\100557855\\Desktop\\Mu
sic\\Above &amp; Beyond\\Tri\xe2\x80\x90State\\01 Tri\xe2\x80\x90State.mp3'

# Fixed code
def scrub_func(lib, opts, args):
    # This is a little bit hacky, but we set a global flag to
    # avoid autoscrubbing when we're also explicitly scrubbing.
    global scrubbing
    scrubbing = True

    # Walk through matching files and remove tags.
    for item in lib.items(ui.decargs(args)):
        self._log.info("scrubbing: {0}", util.displayable_path(item.path))

        # Get album art if we need to restore it.
        if opts.write:
            try:
                mf = mediafile.MediaFile(item.path, config["id3v23"].get(bool))
            except IOError as exc:
                self._log.error("scrubbing failed: {0}", exc)
            art = mf.art

        # Remove all tags.
        self._scrub(item.path)

        # Restore tags, if enabled.
        if opts.write:
            self._log.debug("writing new tags after scrub")
            item.try_write()
            if art:
                self._log.info("restoring art")
                mf = mediafile.MediaFile(item.path)
                mf.art = art
                mf.save()

    scrubbing = False
# Buggy code
def parse_query_string(s, model_cls):
    """Given a beets query string, return the `Query` and `Sort` they
    represent.

    The string is split into components using shell-like syntax.
    """
    # A bug in Python < 2.7.3 prevents correct shlex splitting of
    # Unicode strings.
    # http://bugs.python.org/issue6988
    if isinstance(s, unicode):
        s = s.encode("utf8")
    parts = [p.decode("utf8") for p in shlex.split(s)]
    return parse_query_parts(parts, model_cls)


# Traceback (ValueError)
Traceback (most recent call last):
File "/usr/local/bin/beet", line 9, in <module>
load_entry_point('beets==1.3.10', 'console_scripts', 'beet')()
File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 945, in main
_raw_main(args)
File "/usr/local/lib/python2.7/dist-packages/beets/ui/__init__.py", line 935, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 873, in import_func
import_files(lib, paths, query)
File "/usr/local/lib/python2.7/dist-packages/beets/ui/commands.py", line 845, in import_files
session.run()
File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 305, in run
pl.run_parallel(QUEUE_SIZE)
File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 345, in run
self.coro.send(msg)
File "/usr/local/lib/python2.7/dist-packages/beets/util/pipeline.py", line 158, in coro
task = func(*(args + (task,)))
File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 1291, in manipulate_files
session=session,
File "/usr/local/lib/python2.7/dist-packages/beets/importer.py", line 635, in manipulate_files
item.move(copy, link)
File "/usr/local/lib/python2.7/dist-packages/beets/library.py", line 611, in move
dest = self.destination(basedir=basedir)
File "/usr/local/lib/python2.7/dist-packages/beets/library.py", line 653, in destination
query, _ = parse_query_string(query, type(self))
File "/usr/local/lib/python2.7/dist-packages/beets/library.py", line 1016, in parse_query_string
parts = [p.decode('utf8') for p in shlex.split(s)]
File "/usr/lib/python2.7/shlex.py", line 279, in split
return list(lex)
File "/usr/lib/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation

# Fixed code
def parse_query_string(s, model_cls):
    """Given a beets query string, return the `Query` and `Sort` they
    represent.

    The string is split into components using shell-like syntax.
    """
    # A bug in Python < 2.7.3 prevents correct shlex splitting of
    # Unicode strings.
    # http://bugs.python.org/issue6988
    if isinstance(s, unicode):
        s = s.encode("utf8")
    try:
        parts = [p.decode("utf8") for p in shlex.split(s)]
    except ValueError as exc:
        raise ValueError("Cannot parse {0!r} (error was: {1})".format(s, exc))
    return parse_query_parts(parts, model_cls)
# Buggy code
def get_lyrics(self, artist, title):
    """Fetch lyrics, trying each source in turn. Return a string or
    None if no lyrics were found.
    """
    for backend in self.backends:
        lyrics = backend(artist, title)
        if lyrics:
            if isinstance(lyrics, str):
                lyrics = lyrics.decode("utf8", "ignore")
            log.debug("got lyrics from backend: {0}".format(backend.__name__))
            return lyrics.strip()


# Traceback (UnicodeEncodeError)
fetching Elephanz Stereo
Traceback (most recent call last):
File "/Users/flap/bin/beet", line 20, in <module>
beets.ui.main()
File "/Users/flap/Dev/beets/beets/ui/__init__.py", line 937, in main
_raw_main(args)
File "/Users/flap/Dev/beets/beets/ui/__init__.py", line 927, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/Users/flap/Dev/beets/beets/ui/commands.py", line 872, in import_func
import_files(lib, paths, query)
File "/Users/flap/Dev/beets/beets/ui/commands.py", line 844, in import_files
session.run()
File "/Users/flap/Dev/beets/beets/importer.py", line 300, in run
pl.run_parallel(QUEUE_SIZE)
File "/Users/flap/Dev/beets/beets/util/pipeline.py", line 299, in run
out = self.coro.send(msg)
File "/Users/flap/Dev/beets/beets/util/pipeline.py", line 181, in coro
func(*(args + (task,)))
File "/Users/flap/Dev/beets/beets/importer.py", line 1263, in plugin_stage
func(session, task)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 457, in imported
False, False)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 473, in fetch_item_lyrics
lyrics = [self.get_lyrics(artist, title) for title in titles]
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 503, in get_lyrics
lyrics = backend(artist, title)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 405, in fetch_google
if is_lyrics(lyrics, artist):
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 302, in is_lyrics
text.decode('utf8')))
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 61: ordinal not in range(128)

# Fixed code
def get_lyrics(self, artist, title):
    """Fetch lyrics, trying each source in turn. Return a string or
    None if no lyrics were found.
    """
    for backend in self.backends:
        lyrics = backend(artist, title)
        if lyrics:
            log.debug("got lyrics from backend: {0}".format(backend.__name__))
            return lyrics.strip()
# Buggy code
def fetch_url(url):
    """Retrieve the content at a given URL, or return None if the source
    is unreachable.
    """
    try:
        return urllib.urlopen(url).read()
    except IOError as exc:
        log.debug("failed to fetch: {0} ({1})".format(url, unicode(exc)))
        return None


# Traceback (UnicodeEncodeError)
fetching Elephanz Stereo
Traceback (most recent call last):
File "/Users/flap/bin/beet", line 20, in <module>
beets.ui.main()
File "/Users/flap/Dev/beets/beets/ui/__init__.py", line 937, in main
_raw_main(args)
File "/Users/flap/Dev/beets/beets/ui/__init__.py", line 927, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/Users/flap/Dev/beets/beets/ui/commands.py", line 872, in import_func
import_files(lib, paths, query)
File "/Users/flap/Dev/beets/beets/ui/commands.py", line 844, in import_files
session.run()
File "/Users/flap/Dev/beets/beets/importer.py", line 300, in run
pl.run_parallel(QUEUE_SIZE)
File "/Users/flap/Dev/beets/beets/util/pipeline.py", line 299, in run
out = self.coro.send(msg)
File "/Users/flap/Dev/beets/beets/util/pipeline.py", line 181, in coro
func(*(args + (task,)))
File "/Users/flap/Dev/beets/beets/importer.py", line 1263, in plugin_stage
func(session, task)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 457, in imported
False, False)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 473, in fetch_item_lyrics
lyrics = [self.get_lyrics(artist, title) for title in titles]
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 503, in get_lyrics
lyrics = backend(artist, title)
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 405, in fetch_google
if is_lyrics(lyrics, artist):
File "/Users/flap/Dev/beets/beetsplug/lyrics.py", line 302, in is_lyrics
text.decode('utf8')))
File "/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 61: ordinal not in range(128)

# Fixed code
def fetch_url(url):
    """Retrieve the content at a given URL, or return None if the source
    is unreachable.
    """
    r = requests.get(url)
    if r.status_code == requests.codes.ok:
        return r.text
    else:
        log.debug("failed to fetch: {0} ({1})".format(url, r.status_code))
    return None
# Buggy code
def write_item_mtime(item, mtime):
    """Write the given mtime to an item's `mtime` field and to the mtime of the
    item's file.
    """
    if mtime is None:
        log.warn(
            "No mtime to be preserved for item {0}".format(
                util.displayable_path(item.path)
            )
        )
        return

    # The file's mtime on disk must be in sync with the item's mtime
    write_file_mtime(util.syspath(item.path), mtime)
    item.mtime = mtime


# Traceback (KeyError)
$ beet import -L

/beets/src/media/library/Younger Brother (2011) - Vaccine (9 items)
Tagging:
Younger Brother - Vaccine
URL:
http://musicbrainz.org/release/7da3a7d8-0240-4ebd-bab6-44a1a72504fe
(Similarity: 100.0%) (CD, 2011, US, SCI Fidelity Records)
Traceback (most recent call last):
File "/beets/bin/beet", line 20, in <module>
beets.ui.main()
File "/beets/src/beets/beets/ui/__init__.py", line 966, in main
_raw_main(args)
File "/beets/src/beets/beets/ui/__init__.py", line 957, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/beets/src/beets/beets/ui/commands.py", line 884, in import_func
import_files(lib, paths, query)
File "/beets/src/beets/beets/ui/commands.py", line 856, in import_files
session.run()
File "/beets/src/beets/beets/importer.py", line 293, in run
pl.run_sequential()
File "/beets/src/beets/beets/util/pipeline.py", line 376, in run_sequential
list(self.pull())
File "/beets/src/beets/beets/util/pipeline.py", line 453, in pull
out = coro.send(msg)
File "/beets/src/beets/beets/util/pipeline.py", line 158, in coro
task = func(*(args + (task,)))
File "/beets/src/beets/beets/importer.py", line 1138, in manipulate_files
task.finalize(session)
File "/beets/src/beets/beets/importer.py", line 470, in finalize
self._emit_imported(session.lib)
File "/beets/src/beets/beets/importer.py", line 502, in _emit_imported
plugins.send('album_imported', lib=lib, album=self.album)
File "/beets/src/beets/beets/plugins.py", line 379, in send
handler(**args)
File "/beets/src/beets/beetsplug/importadded.py", line 77, in update_album_times
mtime = item_mtime[item.path]
KeyError: '/beets/src/media/library/Younger Brother (2011) - Vaccine/Younger Brother - Vaccine - 01 - Crystalline.flac'

# Fixed code
def write_item_mtime(item, mtime):
    """Write the given mtime to an item's `mtime` field and to the mtime of the
    item's file.
    """
    if mtime is None:
        log.warn(
            "No mtime to be preserved for item '{0}'".format(
                util.displayable_path(item.path)
            )
        )
        return

    # The file's mtime on disk must be in sync with the item's mtime
    write_file_mtime(util.syspath(item.path), mtime)
    item.mtime = mtime
# Buggy code
def record_import_mtime(item, source, destination):
    """Record the file mtime of an item's path before import."""
    if source == destination:
        # Re-import of an existing library item?
        return

    mtime = os.stat(util.syspath(source)).st_mtime
    item_mtime[destination] = mtime
    log.debug(
        "Recorded mtime {0} for item '{1}' imported from '{2}'".format(
            mtime, util.displayable_path(destination), util.displayable_path(source)
        )
    )


# Traceback (KeyError)
$ beet import -L

/beets/src/media/library/Younger Brother (2011) - Vaccine (9 items)
Tagging:
Younger Brother - Vaccine
URL:
http://musicbrainz.org/release/7da3a7d8-0240-4ebd-bab6-44a1a72504fe
(Similarity: 100.0%) (CD, 2011, US, SCI Fidelity Records)
Traceback (most recent call last):
File "/beets/bin/beet", line 20, in <module>
beets.ui.main()
File "/beets/src/beets/beets/ui/__init__.py", line 966, in main
_raw_main(args)
File "/beets/src/beets/beets/ui/__init__.py", line 957, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/beets/src/beets/beets/ui/commands.py", line 884, in import_func
import_files(lib, paths, query)
File "/beets/src/beets/beets/ui/commands.py", line 856, in import_files
session.run()
File "/beets/src/beets/beets/importer.py", line 293, in run
pl.run_sequential()
File "/beets/src/beets/beets/util/pipeline.py", line 376, in run_sequential
list(self.pull())
File "/beets/src/beets/beets/util/pipeline.py", line 453, in pull
out = coro.send(msg)
File "/beets/src/beets/beets/util/pipeline.py", line 158, in coro
task = func(*(args + (task,)))
File "/beets/src/beets/beets/importer.py", line 1138, in manipulate_files
task.finalize(session)
File "/beets/src/beets/beets/importer.py", line 470, in finalize
self._emit_imported(session.lib)
File "/beets/src/beets/beets/importer.py", line 502, in _emit_imported
plugins.send('album_imported', lib=lib, album=self.album)
File "/beets/src/beets/beets/plugins.py", line 379, in send
handler(**args)
File "/beets/src/beets/beetsplug/importadded.py", line 77, in update_album_times
mtime = item_mtime[item.path]
KeyError: '/beets/src/media/library/Younger Brother (2011) - Vaccine/Younger Brother - Vaccine - 01 - Crystalline.flac'

# Fixed code
def record_import_mtime(item, source, destination):
    """Record the file mtime of an item's path before its import."""
    mtime = os.stat(util.syspath(source)).st_mtime
    item_mtime[destination] = mtime
    log.debug(
        "Recorded mtime {0} for item '{1}' imported from '{2}'".format(
            mtime, util.displayable_path(destination), util.displayable_path(source)
        )
    )
# Buggy code
def update_album_times(lib, album):
    album_mtimes = []
    for item in album.items():
        mtime = item_mtime[item.path]
        if mtime is not None:
            album_mtimes.append(mtime)
            if config["importadded"]["preserve_mtimes"].get(bool):
                write_item_mtime(item, mtime)
                item.store()
            del item_mtime[item.path]

    album.added = min(album_mtimes)
    album.store()


# Traceback (KeyError)
$ beet import -L

/beets/src/media/library/Younger Brother (2011) - Vaccine (9 items)
Tagging:
Younger Brother - Vaccine
URL:
http://musicbrainz.org/release/7da3a7d8-0240-4ebd-bab6-44a1a72504fe
(Similarity: 100.0%) (CD, 2011, US, SCI Fidelity Records)
Traceback (most recent call last):
File "/beets/bin/beet", line 20, in <module>
beets.ui.main()
File "/beets/src/beets/beets/ui/__init__.py", line 966, in main
_raw_main(args)
File "/beets/src/beets/beets/ui/__init__.py", line 957, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/beets/src/beets/beets/ui/commands.py", line 884, in import_func
import_files(lib, paths, query)
File "/beets/src/beets/beets/ui/commands.py", line 856, in import_files
session.run()
File "/beets/src/beets/beets/importer.py", line 293, in run
pl.run_sequential()
File "/beets/src/beets/beets/util/pipeline.py", line 376, in run_sequential
list(self.pull())
File "/beets/src/beets/beets/util/pipeline.py", line 453, in pull
out = coro.send(msg)
File "/beets/src/beets/beets/util/pipeline.py", line 158, in coro
task = func(*(args + (task,)))
File "/beets/src/beets/beets/importer.py", line 1138, in manipulate_files
task.finalize(session)
File "/beets/src/beets/beets/importer.py", line 470, in finalize
self._emit_imported(session.lib)
File "/beets/src/beets/beets/importer.py", line 502, in _emit_imported
plugins.send('album_imported', lib=lib, album=self.album)
File "/beets/src/beets/beets/plugins.py", line 379, in send
handler(**args)
File "/beets/src/beets/beetsplug/importadded.py", line 77, in update_album_times
mtime = item_mtime[item.path]
KeyError: '/beets/src/media/library/Younger Brother (2011) - Vaccine/Younger Brother - Vaccine - 01 - Crystalline.flac'

# Fixed code
def update_album_times(lib, album):
    if reimported_album(album):
        log.debug(
            "Album '{0}' is reimported, skipping import of added dates"
            " for the album and its items.".format(util.displayable_path(album.path))
        )
        return

    album_mtimes = []
    for item in album.items():
        mtime = item_mtime.pop(item.path, None)
        if mtime:
            album_mtimes.append(mtime)
            if config["importadded"]["preserve_mtimes"].get(bool):
                write_item_mtime(item, mtime)
                item.store()
    album.added = min(album_mtimes)
    log.debug(
        "Import of album '{0}', selected album.added={1} from item file mtimes.".format(
            album.album, album.added
        )
    )
    album.store()