Example #1
0
def shall_I_begin(in_str, is_file=False, is_hq=False):
    #start terminate_watcher
    Terminate_Watcher()

    #xiami obj
    xiami_obj = xm.Xiami(config.XIAMI_LOGIN_EMAIL,\
            config.XIAMI_LOGIN_PASSWORD, \
            is_hq)
    #netease obj
    m163 = netease.Netease(is_hq)

    if is_file:
        from_file(xiami_obj, m163,in_str)
    elif re.match(pat_xm, in_str):
        from_url_xm(xiami_obj, in_str)
    elif re.match(pat_163, in_str):
        from_url_163(m163, in_str)

    print border
    if len(dl_songs):
        LOG.info(u' 下载任务总数: %d \n 3秒后开始下载' % len(dl_songs))
        sleep(3)
        downloader.start_download(dl_songs)
    else:
        LOG.warning(u' 没有可下载任务,自动退出.')
Example #2
0
def __init_xiami_obj(option):
    #if ppool is required, it should have been initialized in shall_i_begin()
    global xiami_obj
    if not xiami_obj:
        xiami_obj = xm.Xiami(config.XIAMI_LOGIN_EMAIL,\
            config.XIAMI_LOGIN_PASSWORD, \
            option)
Example #3
0
def shall_I_begin(in_str, is_file=False, is_hq=False, need_proxy_pool=False):
    #start terminate_watcher
    Terminate_Watcher()
    global ppool
    if need_proxy_pool:
        LOG.info(u'初始化proxy pool')
        ppool = ProxyPool()
        LOG.info(u'proxy pool:[%d] 初始完毕' % len(ppool.proxies))

    #xiami obj
    xiami_obj = xm.Xiami(config.XIAMI_LOGIN_EMAIL,\
            config.XIAMI_LOGIN_PASSWORD, \
            is_hq,proxies=ppool)
    #netease obj
    m163 = netease.Netease(is_hq, proxies=ppool)

    if is_file:
        from_file(xiami_obj, m163, in_str)
    elif re.match(pat_xm, in_str):
        from_url_xm(xiami_obj, in_str)
    elif re.match(pat_163, in_str):
        from_url_163(m163, in_str)

    print border
    if len(dl_songs):
        LOG.info(u' 下载任务总数: %d \n 3秒后开始下载' % len(dl_songs))
        sleep(3)
        downloader.start_download(dl_songs)
    else:
        LOG.warning(u' 没有可下载任务,自动退出.')
Example #4
0
def shall_I_begin(in_str, is_file=False, is_hq=False):
    xiami_obj = xm.Xiami(config.XIAMI_LOGIN_EMAIL,\
            config.XIAMI_LOGIN_PASSWORD, \
            is_hq)
    if is_file:
        from_file(xiami_obj, in_str)
    else:
        from_url(xiami_obj, in_str)

    print border
    LOG.info(u' 下载任务总数: %d' % len(dl_songs))
    sleep(3)
    downloader.start_download(dl_songs)
Example #5
0
def shall_I_begin(url, is_file=False, is_hq=False, need_proxy_pool=False):
    #start terminate_watcher
    # Terminate_Watcher()
    global ppool
    if need_proxy_pool:
        print '初始化proxy pool'
        ppool = ProxyPool()
        print('proxy pool:[%d] 初始完毕' % len(ppool.proxies))

    #xiami obj
    xiami_obj = xm.Xiami(config.XIAMI_LOGIN_EMAIL,\
            config.XIAMI_LOGIN_PASSWORD, \
            is_hq,proxies=ppool)
    #netease obj
    m163 = netease.Netease(is_hq, proxies=ppool)

    #用来得到歌手ID的排序名单txt,用过一次就行了,什么时候想起来了再更新一次
    # artistIDs = getTopArtists(xiami_obj, url)

    getTopSongs(xiami_obj)