コード例 #1
0
ファイル: dl.py プロジェクト: darkfeline/vocaran_tools
def dl_nicosound_selenium(file, id, title='', artist='', album='', comment='',
        apic='none'):
    """Download MP3 from nicosound using selenium, then tag using stagger.

    file should probably match the title and end in '.mp3' as the right
    extension.  See getpic() and tag() for information about apic.

    """
    dir = os.path.dirname(__file__)
    selenium_path = os.path.join(dir, 'selenium_dl.py')
    return_code = subprocess.call([selenium_path, id, file])
    if return_code != 0:
        raise FileNotAvailableError()
    tags.tag(file, id, title, artist, album, comment, apic)
コード例 #2
0
ファイル: dl.py プロジェクト: darkfeline/vocaran_tools
def dl_nicosound_spynner(file, id, title='', artist='', album='', comment='',
        apic='none'):
    """Download MP3 from nicosound using spynner, then tag using stagger.

    file should probably match the title and end in '.mp3' as the right
    extension.  See getpic() and tag() for information about apic.

    """
    dir = os.path.dirname(__file__)
    path = os.path.join(dir, 'spynner_dl.py')
    with open(os.devnull, 'wb') as f:
        return_code = subprocess.call([path, id, file], stdout=f, stderr=f)
    if return_code != 0:
        raise FileNotAvailableError()
    tags.tag(file, id, title, artist, album, comment, apic)
コード例 #3
0
ファイル: dl.py プロジェクト: darkfeline/vocaran_tools
def dl_nicomimi(file, id, title='', artist='', album='', comment='',
        apic='none'):
    """Deprecated.

    Request an MP3 download from nicomimi.net, then tag using stagger.

    file should probably match the title and end in '.mp3' as the right
    extension.  See getpic() and tag() for information about apic.

    """
    cj = http.cookiejar.CookieJar()
    opener = urllib.request.build_opener(
        urllib.request.HTTPCookieProcessor(cj))
    conn = opener.open('http://www.nicomimi.net/play/{}'.format(id))
    conn.close()
    conn = opener.open('http://media2.nicomimi.net/get?vid={}'.format(id)) 
    data = conn.read()
    with open(file, 'wb') as f:
        f.write(data)
    conn.close()
    tags.tag(file, id, title, artist, album, comment, apic)