Skip to content

Commit

Permalink
change func name, inline function, fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
alicezou committed Apr 7, 2022
1 parent b609cae commit fa5862d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
17 changes: 5 additions & 12 deletions beets/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,30 +1206,23 @@ def _configure(options):
util.displayable_path(config.config_dir()))
return config

# Check whether parental directories exist.


def database_dir_creation(path):
# Ask the user for a choice.
return input_yn("The database directory {} does not \
exists. Create it (Y/n)?"
.format(util.displayable_path(path)))


def _check_db_directory_exists(path):
def _ensure_db_directory_exists(path):
if path == b':memory:': # in memory db
return
newpath = os.path.dirname(path)
if not os.path.isdir(newpath):
if database_dir_creation(newpath):
if input_yn("The database directory {} does not \
exist. Create it (Y/n)?"
.format(util.displayable_path(newpath))):
os.makedirs(newpath)


def _open_library(config):
"""Create a new library instance from the configuration.
"""
dbpath = util.bytestring_path(config['library'].as_filename())
_check_db_directory_exists(dbpath)
_ensure_db_directory_exists(dbpath)
try:
lib = library.Library(
dbpath,
Expand Down
3 changes: 0 additions & 3 deletions beets/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,9 +1398,6 @@ def show_version(lib, opts, args):
version_cmd.func = show_version
default_commands.append(version_cmd)

# database_location: return true if user
# wants to create the parent directories.


# modify: Declaratively change metadata.

Expand Down

0 comments on commit fa5862d

Please sign in to comment.