Set download_dir only if specified

This commit is contained in:
Fabio Manganiello 2018-04-25 12:03:15 +02:00
parent efe4f32409
commit 7fb0a5bb55

View file

@ -33,7 +33,6 @@ class VideoOmxplayerPlugin(Plugin):
super().__init__(*argv, **kwargs)
self.args = args
self.download_dir = os.path.abspath(os.path.expanduser(download_dir))
self.media_dirs = set(
filter(
lambda _: os.path.isdir(_),
@ -44,7 +43,8 @@ class VideoOmxplayerPlugin(Plugin):
)
)
if self.download_dir:
if download_dir:
self.download_dir = os.path.abspath(os.path.expanduser(download_dir))
if not os.path.isdir(self.download_dir):
raise RuntimeError('download_dir [{}] is not a valid directory'
.format(self.download_dir))