# Path: dunyadesktop_app/cultures/dunya/makam.py
# def get_recordings():
# def get_recording(rmbid):
# def get_artists():
# def get_artist(ambid):
# def get_composers():
# def get_composer(cmbid):
# def get_releases():
# def get_release(cmbid):
# def get_works():
# def get_work(wmbid):
# def get_instruments():
# def get_instrument(iid):
# def get_forms():
# def get_form(fid):
# def get_makams():
# def get_makam(mid):
# def get_usuls():
# def get_symbtrs():
# def get_symbtr(uuid):
# def get_usul(uid):
# def get_works_by_query(mid='', uid='', fid='', cmbid='', ambid=''):
# def download_mp3(recordingid, location, slugify=False):
# def download_release(releaseid, location, slugify=False):
# def slugify_tr(value):


from ..dunya import makam
from PyQt5.QtCore import QThread, QObject, pyqtSignal
class QueryThread(QThread):
    fetching_completed = pyqtSignal(object)
    progress_number = pyqtSignal(object)
    query_completed = pyqtSignal(object)
    combobox_results = pyqtSignal(object)

    def __init__(self, parent=None):
        QThread.__init__(self, parent)
        self.stopped = False

        self.mid = None
        self.uid = None
        self.fid = None
        self.cmbid = None
        self.ambid = None
        self.iid = None

        self.parent = self.parent()
        self.fetching_completed.connect(self.parent.work_received)
        self.combobox_results.connect(self.parent.change_combobox_backgrounds)
        self.progress_number.connect(self.parent.set_progress_number)
        self.query_completed.connect(self.parent.query_finished)

    def check_selection(self):
        iteration = iter([self.mid, self.fid, self.uid,
                          self.cmbid, self.ambid])
        return any(iteration) and not any(iteration)

    def fetch_recordings(self):
        for work in self.works:

# Path: dunyadesktop_app/cultures/dunya/makam.py
# def get_recordings():
# def get_recording(rmbid):
# def get_artists():
# def get_artist(ambid):
# def get_composers():
# def get_composer(cmbid):
# def get_releases():
# def get_release(cmbid):
# def get_works():
# def get_work(wmbid):
# def get_instruments():
# def get_instrument(iid):
# def get_forms():
# def get_form(fid):
# def get_makams():
# def get_makam(mid):
# def get_usuls():
# def get_symbtrs():
# def get_symbtr(uuid):
# def get_usul(uid):
# def get_works_by_query(mid='', uid='', fid='', cmbid='', ambid=''):
# def download_mp3(recordingid, location, slugify=False):
# def download_release(releaseid, location, slugify=False):
# def slugify_tr(value):


# Path: dunyadesktop_app/cultures/makam/query.py
from ..dunya import makam
from PyQt5.QtCore import QThread, QObject, pyqtSignal

class QueryThread(QThread):
    fetching_completed = pyqtSignal(object)
    progress_number = pyqtSignal(object)
    query_completed = pyqtSignal(object)
    combobox_results = pyqtSignal(object)

    def __init__(self, parent=None):
        QThread.__init__(self, parent)
        self.stopped = False

        self.mid = None
        self.uid = None
        self.fid = None
        self.cmbid = None
        self.ambid = None
        self.iid = None

        self.parent = self.parent()
        self.fetching_completed.connect(self.parent.work_received)
        self.combobox_results.connect(self.parent.change_combobox_backgrounds)
        self.progress_number.connect(self.parent.set_progress_number)
        self.query_completed.connect(self.parent.query_finished)

    def check_selection(self):
        iteration = iter([self.mid, self.fid, self.uid,
                          self.cmbid, self.ambid])
        return any(iteration) and not any(iteration)

    def fetch_recordings(self):
        for work in self.works:

            w = makam.get_work(work['mbid'])