Skip to content

Commit

Permalink
Fixed wrong interpretation of relative path arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rstemmer committed Apr 25, 2020
1 parent dc8c155 commit 99dc258
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
5.2.2 - [artwork] Fixed wrong interpretation of relative path arguments
5.2.1 - [artwork] Fixed a bug that make the --album or --artwork option crash
5.2.0 - SEE CHANGELOG
5.1.1 - Some CSS-Updates to increase font size on 4k screens
Expand Down
14 changes: 14 additions & 0 deletions mod/artwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def UpdateAlbum(self, albumpath, artworkpath=None):
This method does partial update and can be used to force a specific artwork.
If *artworkpath* is given, that artwork will be copied to the cache instead of extraction one from the metadata.
This method expects absolute paths or paths relative to the music root directory.
Args:
albumpath (str): Path to an album. This can be absolute or relative to the music directory.
artworkpath (str / NoneType): Absolute path to the artwork that shall be used if given.
Expand Down Expand Up @@ -136,6 +138,18 @@ def UpdateAlbum(self, albumpath, artworkpath=None):


def MDBM_Main(self, args):
# Make user paths absolute and check if they exist
if args.artwork:
args.artwork = os.path.abspath(args.artwork)
if not os.path.exists(args.artwork):
print("\033[1;31mERROR: Artwork path "+args.artwork+" does not exist!\033[0m")
return 1

if args.album:
args.album = os.path.abspath(args.album)
if not os.path.exists(args.album):
print("\033[1;31mERROR: Album path "+args.album+" does not exist!\033[0m")
return 1

# Update Cache and Manifest
if args.update:
Expand Down

0 comments on commit 99dc258

Please sign in to comment.