Skip to content

Commit

Permalink
gyao: "fix" temp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
NoAiOne committed Jan 5, 2020
1 parent c8af7b1 commit e5c834e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions yuu/ext/gyao.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ def __init__(self, files, key, iv, url, session):
self.merge = True

if os.name == "nt":
yuu_folder = os.path.join(os.getenv('LOCALAPPDATA'), 'yuu_data')
self.yuu_folder = os.path.join(os.getenv('LOCALAPPDATA'), 'yuu_data')
sffx = '\\'
else:
self.yuu_folder = os.path.join(os.getenv('HOME'), '.yuu_data')
sffx = '/'
if not os.path.isdir(self.yuu_folder):
os.mkdir(self.yuu_folder)

self.temporary_folder = tempfile.mkdtemp(suffix=sffx, dir=self.yuu_folder)
self.temporary_folder = tempfile.mkdtemp(dir=self.yuu_folder)
self.temporary_folder = self.temporary_folder + sffx


def download_chunk(self):
Expand All @@ -42,12 +43,12 @@ def download_chunk(self):
vid = self.session.get(tsf)
outf.write(vid.content)
except Exception as err:
print('[ERROR] Problem occured\nreason: {}'.format(err))
yuu_log.error('Problem occured\nreason: {}'.format(err))
return None, self.temporary_folder
pbar.update()
self.downloaded_files.append(outputtemp)
except KeyboardInterrupt:
print('[WARN] User pressed CTRL+C, cleaning up...')
yuu_log.warn('User pressed CTRL+C, cleaning up...')
return None, self.temporary_folder
return self.downloaded_files, self.temporary_folder

Expand Down

0 comments on commit e5c834e

Please sign in to comment.