deemix-py/deemix/app/main.py

39 lines
1.0 KiB
Python
Raw Normal View History

import deemix.utils.localpaths as localpaths
from deemix.app.queuemanager import addToQueue, removeFromQueue, getQueue, cancelAllDownloads
2020-04-07 22:19:27 +00:00
from deemix.app.settings import initSettings
from os import system as execute
import os.path as path
from os import mkdir, rmdir
2020-04-07 22:19:27 +00:00
settings = {}
def getUser(dz):
2020-04-11 19:55:12 +00:00
return dz.user
2020-04-07 22:19:27 +00:00
def initialize():
global settings
settings = initSettings()
2020-04-11 19:55:12 +00:00
return {'settings': settings}
def shutdown(socket=None):
print(getQueue())
cancelAllDownloads(socket)
if socket:
socket.emit("toast", {'msg': "Server is closed."})
def mainSearch(dz, term):
2020-04-09 14:06:33 +00:00
return dz.search_main_gw(term)
def search(dz, term, type, start, nb):
2020-04-09 14:06:33 +00:00
return dz.search_gw(term, type, start, nb)
2020-04-07 22:19:27 +00:00
def addToQueue_link(dz, url, bitrate=None, socket=None):
return addToQueue(dz, url, settings, bitrate, socket)
2020-04-11 13:43:59 +00:00
def removeFromQueue_link(uuid, socket=None):
removeFromQueue(uuid, socket)
2020-04-07 22:19:27 +00:00
def downloadLink(url, bitrate=None):
if settings['executeCommand'] != "":
execute(settings['executeCommand'].replace("%folder%", folder))