コード例 #1
0
    def run(self):
        setup()
        urls = os.environ['urls']
        urls_list = urls.split(',')
        new = False
        while True:
            for url in urls_list:
                test = cli.cli('./music', './')
                edit_config()
                test.login()
                deezer_sesh = test.dz.session
                deezer_headers = test.dz.http_headers
                deezer_api = deezer.API(deezer_sesh, deezer_headers)
                albums = api_call_test(url.strip(), deezer_sesh,
                                       deezer_headers)
                for album in albums:
                    new = False
                    if add_to_lib(id=album):
                        new = True
                        global lock_encoder
                        lock_encoder = True
                        test.qm.addToQueue(
                            dz=test.dz,
                            url=f'https://www.deezer.com/en/album/{album}',
                            settings=test.set.settings,
                            bitrate=os.environ['bitrate'])
                        lock_encoder = False
                        q(StartEncoder())
                if not new:
                    logger.info('No new albums found today')

            logger.info('Running audio conversion')
            wait_to_tomorrow()
コード例 #2
0
 def login(arl: str, songs_path: str = None):
     """
     Initializing Deezer session.
     """
     localpath = realpath('.')
     config_folder = join(localpath, 'config')
     songs_folder = realpath(songs_path) if songs_path else join(localpath, 'Songs')
     app = cli(songs_folder, config_folder)
     app.login(arl)
     return app
コード例 #3
0
 def download_artists(self) -> None:
     # Calls the cli wrapper around deemix.app.deemix
     # For the most part, we access deemix almost as high level as the interactive user
     # passing None uses the default path from config/config.json
     deemix_cli = cli(None, self.config_path)
     deemix_cli.login()
     deemix_cli.downloadLink(
         self.artist_urls,
         None)  # As above, passing None uses bitrate from config.json
     click.echo("Finished downloading.")
コード例 #4
0
    def run(self):
        setup()
        test = cli.cli('./music', './')
        edit_config()
        test.login()
        deezer_sesh = test.dz.session
        deezer_headers = test.dz.http_headers
        deezer_api = deezer.API(deezer_sesh, deezer_headers)
        if add_to_lib(id=self.albumId):
            global lock_encoder
            lock_encoder = True
            try:
                bitrate = os.environ['bitrate']
            except Exception as e:
                bitrate = 'flac'

            test.qm.addToQueue(
                dz=test.dz,
                url=f'https://www.deezer.com/en/album/{self.albumId}',
                settings=test.set.settings,
                bitrate=bitrate)
            lock_encoder = False
            q(StartEncoder())