Exemplo n.º 1
0
    def _search(self):

        artist = str(self.widget.textArtist.text())
        track = str(self.widget.textTitle.text())

        if artist == '' or track == '':
            self.set_status('Please enter an artist and track')
            return

        if not Config.option_exists('requests', 'whatcd_session_saved') or not Config.getboolean('requests', 'whatcd_session_saved'):
            result, whatcdpassword, save_session = popup_whatcd_login(self.widget)  # open popup

            if result == 0: # cancelled
                logging.info('user cancelled whatcd login popup')
                return

            Config.set_requests_option('whatcd_session_saved', save_session)
            logging.info('saving whatcd session? ' + repr(save_session))

            username = Config.getstring('requests', 'whatcd_username')
            self.track_requests.set_whatcd_credentials(username, whatcdpassword, save_session)
            logging.info('user accepted whatcd login popup')


        if self._DEBUG_SEARCH:
            Config.set_requests_option('debug_last_search_artist', artist)
            Config.set_requests_option('debug_last_search_title', track)

        allowed = self.track_requests.set_wanted_track(artist, track, self.widget.checkAllowRadioEdit.isChecked())

        if allowed:
            self.track_requests.start()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.popup = uic.loadUi(resource_path('interface/popup_whatcd_login.ui'), self)
        self.setFixedSize(self.size())
        self.setWindowFlags(QtCore.Qt.CustomizeWindowHint | QtCore.Qt.Dialog)

        if Config.option_exists('requests', 'whatcd_username'):
            self.popup.editWhatCDUsername.setText(Config.getstring('requests', 'whatcd_username'))

        if Config.option_exists('requests', 'whatcd_password'):
            self.popup.editWhatCDPassword.setText(Config.getstring('requests', 'whatcd_password'))

        self.popup.editWhatCDUsername.editingFinished.connect(self.whatcd_username_finished)
        self.popup.buttonBox.accepted.connect(self.popup_accepted)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.popup = uic.loadUi(
            resource_path('interface/popup_whatcd_login.ui'), self)
        self.setFixedSize(self.size())
        self.setWindowFlags(QtCore.Qt.CustomizeWindowHint | QtCore.Qt.Dialog)

        if Config.option_exists('requests', 'whatcd_username'):
            self.popup.editWhatCDUsername.setText(
                Config.getstring('requests', 'whatcd_username'))

        if Config.option_exists('requests', 'whatcd_password'):
            self.popup.editWhatCDPassword.setText(
                Config.getstring('requests', 'whatcd_password'))

        self.popup.editWhatCDUsername.editingFinished.connect(
            self.whatcd_username_finished)
        self.popup.buttonBox.accepted.connect(self.popup_accepted)
Exemplo n.º 4
0
def main():
    app = QtGui.QApplication(sys.argv)

    if not Config.option_exists('general', 'disclaimer_accepted'):
        popup_disclaimer()

    mainwindow = MainWindow()
    mainwindow.show()

    sys.exit(app.exec_())
Exemplo n.º 5
0
def main():
    app = QtGui.QApplication(sys.argv)

    if not Config.option_exists('general', 'disclaimer_accepted'):
        popup_disclaimer()

    mainwindow = MainWindow()
    mainwindow.show()

    sys.exit(app.exec_())
Exemplo n.º 6
0
    def _search(self):

        artist = str(self.widget.textArtist.text())
        track = str(self.widget.textTitle.text())

        if artist == '' or track == '':
            self.set_status('Please enter an artist and track')
            return

        if not Config.option_exists(
                'requests', 'whatcd_session_saved') or not Config.getboolean(
                    'requests', 'whatcd_session_saved'):
            result, whatcdpassword, save_session = popup_whatcd_login(
                self.widget)  # open popup

            if result == 0:  # cancelled
                logging.info('user cancelled whatcd login popup')
                return

            Config.set_requests_option('whatcd_session_saved', save_session)
            logging.info('saving whatcd session? ' + repr(save_session))

            username = Config.getstring('requests', 'whatcd_username')
            self.track_requests.set_whatcd_credentials(username,
                                                       whatcdpassword,
                                                       save_session)
            logging.info('user accepted whatcd login popup')

        if self._DEBUG_SEARCH:
            Config.set_requests_option('debug_last_search_artist', artist)
            Config.set_requests_option('debug_last_search_title', track)

        allowed = self.track_requests.set_wanted_track(
            artist, track, self.widget.checkAllowRadioEdit.isChecked())

        if allowed:
            self.track_requests.start()
Exemplo n.º 7
0
    def __init__(self, parent):
        super(QWidget, self).__init__(parent)

        self.widget = uic.loadUi(resource_path('interface/tab_requests.ui'), self)

        self.track_requests = ModuleTrackRequests()
        self.track_requests.set_parent(self)

        # Get previously saved values
        if Config.option_exists('requests', 'allow_radio_edit'):
            self.widget.checkAllowRadioEdit.setChecked(Config.getboolean('requests', 'allow_radio_edit'))
        if self._DEBUG_SEARCH:
            if Config.option_exists('requests', 'debug_last_search_artist'):
                self.widget.textArtist.setText(Config.getstring('requests', 'debug_last_search_artist'))
            if Config.option_exists('requests', 'debug_last_search_title'):
                self.widget.textTitle.setText(Config.getstring('requests', 'debug_last_search_title'))

        # Connect signals
        self.widget.buttonSearch.clicked.connect(self._search)
        self.widget.buttonCancel.clicked.connect(self.track_requests.cancel_request)

        self.widget.buttonOpenFolder.clicked.connect(lambda: open_folder(self.track_requests.get_download_path()))

        self.connect(self.track_requests, self.track_requests.signal_album, self.widget.labelAlbum.setText)
        self.connect(self.track_requests, self.track_requests.signal_status, self.set_status)
        self.connect(self.track_requests, self.track_requests.signal_track, self.widget.labelTrack.setText)
        self.connect(self.track_requests, self.track_requests.signal_artist, self.widget.labelArtist.setText)
        self.connect(self.track_requests, self.track_requests.signal_bitrate, self.widget.labelBitrate.setText)
        self.connect(self.track_requests, self.track_requests.signal_genre, self.widget.labelGenre.setText)
        self.connect(self.track_requests, self.track_requests.signal_length, self.widget.labelLength.setText)
        self.connect(self.track_requests, self.track_requests.signal_filesize, self.widget.labelFilesize.setText)
        self.connect(self.track_requests, self.track_requests.signal_filename, self.widget.labelFilename.setText)
        self.connect(self.track_requests, self.track_requests.signal_progress, self.update_progress_bar)
        self.connect(self.track_requests, self.track_requests.signal_reset_credentials, self.widget.reset_credentials)
        self.connect(self.track_requests, self.track_requests.signal_coverart, self.widget.album_cover_art)
        self.connect(self.track_requests, self.track_requests.signal_occupied, self._buttons_occupied)

        self.widget.checkAllowRadioEdit.stateChanged.connect(self._check_allowradioedit)

        self.widget.textTitle.returnPressed.connect(self._search)
        self.widget.textArtist.returnPressed.connect(self._search)
Exemplo n.º 8
0
 def whatcd_username_finished(self):
     username = self.popup.editWhatCDUsername.text()
     Config.set_requests_option('whatcd_username', username)
Exemplo n.º 9
0
 def _check_allowradioedit(self):
     Config.set_requests_option('allow_radio_edit',
                                self.widget.checkAllowRadioEdit.isChecked())
Exemplo n.º 10
0
 def reset_credentials(self):
     Config.set_requests_option('whatcd_session_saved', False)
     if os.path.isfile(self.track_requests.WHATCD_SESSION_PATH):
         os.remove(self.track_requests.WHATCD_SESSION_PATH)
Exemplo n.º 11
0
    def __init__(self, parent):
        super(QWidget, self).__init__(parent)

        self.widget = uic.loadUi(resource_path('interface/tab_requests.ui'),
                                 self)

        self.track_requests = ModuleTrackRequests()
        self.track_requests.set_parent(self)

        # Get previously saved values
        if Config.option_exists('requests', 'allow_radio_edit'):
            self.widget.checkAllowRadioEdit.setChecked(
                Config.getboolean('requests', 'allow_radio_edit'))
        if self._DEBUG_SEARCH:
            if Config.option_exists('requests', 'debug_last_search_artist'):
                self.widget.textArtist.setText(
                    Config.getstring('requests', 'debug_last_search_artist'))
            if Config.option_exists('requests', 'debug_last_search_title'):
                self.widget.textTitle.setText(
                    Config.getstring('requests', 'debug_last_search_title'))

        # Connect signals
        self.widget.buttonSearch.clicked.connect(self._search)
        self.widget.buttonCancel.clicked.connect(
            self.track_requests.cancel_request)

        self.widget.buttonOpenFolder.clicked.connect(
            lambda: open_folder(self.track_requests.get_download_path()))

        self.connect(self.track_requests, self.track_requests.signal_album,
                     self.widget.labelAlbum.setText)
        self.connect(self.track_requests, self.track_requests.signal_status,
                     self.set_status)
        self.connect(self.track_requests, self.track_requests.signal_track,
                     self.widget.labelTrack.setText)
        self.connect(self.track_requests, self.track_requests.signal_artist,
                     self.widget.labelArtist.setText)
        self.connect(self.track_requests, self.track_requests.signal_bitrate,
                     self.widget.labelBitrate.setText)
        self.connect(self.track_requests, self.track_requests.signal_genre,
                     self.widget.labelGenre.setText)
        self.connect(self.track_requests, self.track_requests.signal_length,
                     self.widget.labelLength.setText)
        self.connect(self.track_requests, self.track_requests.signal_filesize,
                     self.widget.labelFilesize.setText)
        self.connect(self.track_requests, self.track_requests.signal_filename,
                     self.widget.labelFilename.setText)
        self.connect(self.track_requests, self.track_requests.signal_progress,
                     self.update_progress_bar)
        self.connect(self.track_requests,
                     self.track_requests.signal_reset_credentials,
                     self.widget.reset_credentials)
        self.connect(self.track_requests, self.track_requests.signal_coverart,
                     self.widget.album_cover_art)
        self.connect(self.track_requests, self.track_requests.signal_occupied,
                     self._buttons_occupied)

        self.widget.checkAllowRadioEdit.stateChanged.connect(
            self._check_allowradioedit)

        self.widget.textTitle.returnPressed.connect(self._search)
        self.widget.textArtist.returnPressed.connect(self._search)
Exemplo n.º 12
0
def main():
    app = QtGui.QApplication(sys.argv)

    if not Config.option_exists('general', 'disclaimer_accepted'):
        popup_disclaimer()

    mainwindow = MainWindow()
    mainwindow.show()

    sys.exit(app.exec_())

if __name__ == '__main__':

    # Set data dirs
    appdirs.appauthor = ''        # USAGE: https://pypi.python.org/pypi/appdirs/1.2.0
    appdirs.appname = 'DeputyDJ'
    appdirs.dirs = appdirs.AppDirs(appdirs.appname, appdirs.appauthor)

    # Init logging
    if not os.path.exists(appdirs.dirs.user_log_dir): os.makedirs(appdirs.dirs.user_log_dir)
    logfile = appdirs.dirs.user_log_dir + '\\requests-' + time.strftime('%Y-%m-%d') + '.log'
    os.open(logfile, os.O_CREAT)
    logging.basicConfig(filename=logfile, level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')

    # Init config
    Config.init_config(appdirs.dirs.user_data_dir, 'config.ini')

    logging.info('started DeputyDJ')

    main()
Exemplo n.º 13
0
 def _check_allowradioedit(self):
     Config.set_requests_option('allow_radio_edit', self.widget.checkAllowRadioEdit.isChecked())
Exemplo n.º 14
0
 def reset_credentials(self):
     Config.set_requests_option('whatcd_session_saved', False)
     if os.path.isfile(self.track_requests.WHATCD_SESSION_PATH):
         os.remove(self.track_requests.WHATCD_SESSION_PATH)
Exemplo n.º 15
0
 def whatcd_username_finished(self):
     username = self.popup.editWhatCDUsername.text()
     Config.set_requests_option('whatcd_username', username)
Exemplo n.º 16
0
    def button_accept(self):
        if self.popup.checkNotShowAgain.isChecked():
            logging.info('user chose not to show disclaimer again')
            Config.set_general_option('disclaimer_accepted', True)

        self.popup.accept()
Exemplo n.º 17
0
    mainwindow = MainWindow()
    mainwindow.show()

    sys.exit(app.exec_())


if __name__ == '__main__':

    # Set data dirs
    appdirs.appauthor = ''  # USAGE: https://pypi.python.org/pypi/appdirs/1.2.0
    appdirs.appname = 'DeputyDJ'
    appdirs.dirs = appdirs.AppDirs(appdirs.appname, appdirs.appauthor)

    # Init logging
    if not os.path.exists(appdirs.dirs.user_log_dir):
        os.makedirs(appdirs.dirs.user_log_dir)
    logfile = appdirs.dirs.user_log_dir + '\\requests-' + time.strftime(
        '%Y-%m-%d') + '.log'
    os.open(logfile, os.O_CREAT)
    logging.basicConfig(filename=logfile,
                        level=logging.INFO,
                        format='%(asctime)s %(message)s',
                        datefmt='%Y-%m-%d %H:%M:%S')

    # Init config
    Config.init_config(appdirs.dirs.user_data_dir, 'config.ini')

    logging.info('started DeputyDJ')

    main()