Skip to content

Commit 84d3abb

Browse files
committed
fixing #241 - pyradio-recordings folder keeps showing in home directory
1 parent 882212c commit 84d3abb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pyradio/main.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import argparse
77
import shutil
88
from argparse import ArgumentParser, SUPPRESS as SUPPRESS
9-
from os import path, getenv, environ, remove, chmod, makedirs
9+
from os import path, getenv, environ, remove, chmod, makedirs, rmdir
1010
from sys import platform, version_info, executable
1111
from contextlib import contextmanager
1212
from platform import system
@@ -389,7 +389,7 @@ def shell():
389389
import subprocess
390390
r = None
391391
script = None
392-
script = '/home/spiros/projects/my-gits/pyradio/devel/fix_pyradio_desktop_file'
392+
#script = '/home/spiros/projects/my-gits/pyradio/devel/fix_pyradio_desktop_file'
393393
if script is None:
394394
try:
395395
from urllib.request import urlretrieve
@@ -986,6 +986,17 @@ def read_config(pyradio_config):
986986
if pyradio_config.xdg_compliant:
987987
pyradio_config.migrate_xdg()
988988

989+
''' check if ~/pyradio-recordings is created
990+
but is not used and should be deleted
991+
'''
992+
chk = path.join(path.expanduser('~'), 'pyradio-recordings')
993+
if path.exists(chk):
994+
if pyradio_config.recording_dir != chk:
995+
try:
996+
rmdir(chk)
997+
except (FileNotFoundError, OSError):
998+
pass
999+
9891000
def save_config(pyradio_config):
9901001
ret = pyradio_config.save_config(from_command_line=True)
9911002
if ret == -1:

0 commit comments

Comments
 (0)