Merge pull request #2 from soimort/master

update
This commit is contained in:
zhuhuotui 2013-04-14 05:41:33 -07:00
commit a0e6bae019
5 changed files with 24 additions and 12 deletions

View File

@ -1,6 +1,14 @@
Changelog
=========
0.3.9
-----
*Date: 2013-04-12*
* Add support for:
- Freesound
0.3.8
-----

View File

@ -134,10 +134,13 @@ def url_info(url, faker = False):
else:
type = None
if headers['content-disposition']:
filename = parse.unquote(r1(r'filename="?(.+)"?', headers['content-disposition']))
if len(filename.split('.')) > 1:
ext = filename.split('.')[-1]
else:
try:
filename = parse.unquote(r1(r'filename="?(.+)"?', headers['content-disposition']))
if len(filename.split('.')) > 1:
ext = filename.split('.')[-1]
else:
ext = None
except:
ext = None
else:
ext = None

View File

@ -43,6 +43,8 @@ def xiami_download_song(sid, output_dir = '.', merge = True, info_only = False):
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
lrc_url = i.getElementsByTagName("lyric")[0].firstChild.nodeValue
type, ext, size = url_info(url, faker = True)
if not ext:
ext = 'mp3'
print_info(site_info, song_title, type, size)
if not info_only:
@ -66,6 +68,8 @@ def xiami_download_showcollect(cid, output_dir = '.', merge = True, info_only =
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
lrc_url = i.getElementsByTagName("lyric")[0].firstChild.nodeValue
type, ext, size = url_info(url, faker = True)
if not ext:
ext = 'mp3'
print_info(site_info, song_title, type, size)
if not info_only:
@ -88,7 +92,9 @@ def xiami_download_album(aid, output_dir = '.', merge = True, info_only = False)
url = location_dec(i.getElementsByTagName("location")[0].firstChild.nodeValue)
lrc_url = i.getElementsByTagName("lyric")[0].firstChild.nodeValue
type, ext, size = url_info(url, faker = True)
if not ext:
ext = 'mp3'
print_info(site_info, song_title, type, size)
if not info_only:
file_name = "%02d.%s" % (track_nr, song_title)

View File

@ -2,5 +2,5 @@
__all__ = ['__version__', '__date__']
__version__ = '0.3.8'
__date__ = '2013-04-05'
__version__ = '0.3.9'
__date__ = '2013-04-12'

View File

@ -39,11 +39,6 @@ class YouGetTests(unittest.TestCase):
"http://www.mixcloud.com/DJVadim/north-america-are-you-ready/",
])
def test_vid48(self):
test_urls([
"http://vid48.com/watch_video.php?v=KXUSG8169U41",
])
def test_vimeo(self):
test_urls([
"http://vimeo.com/56810854",