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

View File

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

View File

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

View File

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