timothyqiu / xiami-downloader

A simple tool for downloading music previews from Xiami.
http://timothyqiu.com/archives/xiami-music-preview-downloader/
MIT License
74 stars 25 forks source link

Filesystem character limit #7

Closed m-tana closed 10 years ago

m-tana commented 10 years ago
python xiami.py -s 1772167565
1 file(s) to download

[1/1] /home/m/Desktop/xiami-downloader/Complete Beethoven Edition Vol.1_ Symphonies/01 - Ludwig van Beethoven_ Symphony No.9 in D minor, Op.125 - "Choral" - 1. Allegro ma non troppo, un poco maestoso - Gundula Janowitz;Hilde Rössl-Majdan;Waldemar Kmentt;Walter Berry;Vienna Singverein;Berlin Philharmonic Orchestra;Herbert von Kar.mp3
/home/m/Desktop/xiami-downloader/Complete Beethoven Edition Vol.1_ Symphonies/01 - Ludwig van Beethoven_ Symphony No.9 in D minor, Op.125 - "Choral" - 1. Allegro ma non troppo, un poco maestoso - Gundula Janowitz;Hilde Rössl-Majdan;Waldemar Kmentt;Walter Berry;Vienna Singverein;Berlin Philharmonic Orchestra;Herbert von Kar.mp3: File name too long
Traceback (most recent call last):
  File "xiami.py", line 318, in <module>
    main()
  File "xiami.py", line 311, in main
    downloaded = xiami.download(track['url'], output_file)
  File "xiami.py", line 185, in download
    self.downloader(url, filename, HEADERS)
  File "/home/m/Desktop/xiami-downloader/xiami_dl.py", line 52, in wget_downloader
    raise Exception('wget exited abnormaly')
Exception: wget exited abnormaly
timothyqiu commented 10 years ago

Hi, thank you for the bug report.

I pushed a newer version just now. And now you can use the --name-template options to change the filename pattern. For example, using the command

python xiami.py -s 1772167565 --name-template '{id} - {title}'

makes a shorter filename from the default pattern '{id} - {title} - {artist}'.