Reverting commit cb4b7b6f63

This commit is contained in:
RemixDev 2020-06-13 09:58:45 +02:00
parent e19b33954b
commit c987cc8a8c
4 changed files with 4 additions and 16 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
import os.path as path
from os import mkdir, chmod
from os import mkdir
from deemix.utils import localpaths
from deemix.api.deezer import Deezer
@ -32,7 +32,6 @@ def login():
arl = requestValidArl()
with open(path.join(configFolder, '.arl'), 'w') as f:
f.write(arl)
chmod(path.join(configFolder, '.arl'), 0o770)
def downloadLink(url, settings, bitrate=None):

View File

@ -3,7 +3,7 @@ import os.path
import re
import traceback
from concurrent.futures import ThreadPoolExecutor
from os import makedirs, remove, system as execute, chmod
from os import makedirs, remove, system as execute
from tempfile import gettempdir
from time import sleep
@ -93,7 +93,6 @@ def downloadImage(url, path, overwrite="n"):
image.raise_for_status()
with open(path, 'wb') as f:
f.write(image.content)
chmod(path, 0o770)
return path
except HTTPError:
if 'cdns-images.dzcdn.net' in url:
@ -702,7 +701,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
if not os.path.isfile(os.path.join(filepath, filename + '.lrc')) or settings['overwriteFile'] in ['y', 't']:
with open(os.path.join(filepath, filename + '.lrc'), 'wb') as f:
f.write(track['lyrics']['sync'].encode('utf-8'))
chmod(os.path.join(filepath, filename + '.lrc'), 0o770)
# Save local album art
if coverPath:
@ -740,7 +738,6 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
try:
with open(writepath, 'wb') as stream:
stream_track(dz, track, stream, trackAPI, queueItem, interface)
chmod(writepath, 0o770)
except downloadCancelled:
remove(writepath)
result['cancel'] = True
@ -925,17 +922,14 @@ def after_download(tracks, settings, queueItem):
if settings['logErrors'] and errors != "":
with open(os.path.join(extrasPath, 'errors.txt'), 'wb') as f:
f.write(errors.encode('utf-8'))
chmod(os.path.join(extrasPath, 'errors.txt'), 0o770)
if settings['logSearched'] and searched != "":
with open(os.path.join(extrasPath, 'searched.txt'), 'wb') as f:
f.write(searched.encode('utf-8'))
chmod(os.path.join(extrasPath, 'searched.txt'), 0o770)
if settings['createM3U8File']:
filename = settingsRegexPlaylistFile(settings['playlistFilenameTemplate'], queueItem, settings) or "playlist"
with open(os.path.join(extrasPath, filename+'.m3u8'), 'wb') as f:
for line in playlist:
f.write((line + "\n").encode('utf-8'))
chmod(os.path.join(extrasPath, filename+'.m3u8'), 0o770)
if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", extrasPath))
return extrasPath
@ -958,7 +952,6 @@ def after_download_single(track, settings, queueItem):
orig += "\r\n"
orig += track['searched'] + "\r\n"
f.write(orig.encode('utf-8'))
chmod(os.path.join(track['extrasPath'], 'searched.txt'), 0o770)
if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", track['extrasPath']).replace("%filename%", track['playlistPosition']))
return track['extrasPath']

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import json
import os.path as path
from os import makedirs, chmod
from os import makedirs
import random
import string
import logging
@ -30,7 +30,6 @@ def initSettings(localFolder = False, configFolder = None):
if not path.isfile(path.join(configFolder, 'config.json')):
with open(path.join(configFolder, 'config.json'), 'w') as f:
json.dump(defaultSettings, f, indent=2)
chmod(path.join(configFolder, 'config.json'), 0o770)
with open(path.join(configFolder, 'config.json'), 'r') as configFile:
settings = json.load(configFile)
settingsCheck()
@ -60,7 +59,6 @@ def saveSettings(newSettings):
settings = newSettings
with open(path.join(configDir, 'config.json'), 'w') as configFile:
json.dump(settings, configFile, indent=2)
chmod(path.join(configDir, 'config.json'), 0o770)
return True

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import json
import os.path as path
from os import mkdir, chmod
from os import mkdir
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
@ -42,7 +42,6 @@ class SpotifyHelper:
if not path.isfile(path.join(self.configFolder, 'authCredentials.json')):
with open(path.join(self.configFolder, 'authCredentials.json'), 'w') as f:
json.dump({'clientId': "", 'clientSecret': ""}, f, indent=2)
chmod(path.join(self.configFolder, 'authCredentials.json'), 0o770)
with open(path.join(self.configFolder, 'authCredentials.json'), 'r') as credentialsFile:
self.credentials = json.load(credentialsFile)
self.checkCredentials()
@ -65,7 +64,6 @@ class SpotifyHelper:
def setCredentials(self, spotifyCredentials):
with open(path.join(self.configFolder, 'authCredentials.json'), 'w') as f:
json.dump(spotifyCredentials, f, indent=2)
chmod(path.join(self.configFolder, 'authCredentials.json'), 0o770)
self.credentials = spotifyCredentials
self.checkCredentials()