sk1418 / zhuaxia

download mp3 files/albums from xiami.com and music.163.com
Other
410 stars 83 forks source link

[Feature request] Allow for setting the format for the files #41

Open X-Ryl669 opened 8 years ago

X-Ryl669 commented 8 years ago

By default, zx does "Artist_Song.mp3" in "Artist_Album" folder. Is it possible to change this so it's user-defineable ?

sk1418 commented 8 years ago

I was considering to let user define the naming pattern. well technically, it is not hard to achieve. However the pattern elements are not so many, just albumName, ArtistsName, and Songnames. There is a trackNo too, but for xiami (or 163 I forgot which one exactly) we have to do one more request to get this NO, so I didn't go with it. Also if user gave a pattern with mistakes, e.g. the filename was not unique, then some files could be overwritten. Due to those concerns I didn't let user define the naming pattern. Currently zhuaxia has no warning or interactive options during downloading, if file overwriting occurred.

btw, what kind of naming pattern do you prefer?

X-Ryl669 commented 8 years ago

Maybe have a config line in with this (for example: formatSave="$Artist/$Album/$Song.mp3" and do a regex replace in the pattern to set the values)

sk1418 commented 8 years ago

@X-Ryl669 I don't want the user to define the directory structure... also zhuaxia can download mp3 of different types (single Song, multiple songs, album, user favorites, user collections, artists' top X ...) That was another reason, I didn't give user this option to customize dir/file name. I think an awk one-liner or shell script could convert the default filename into $Artist/$Album/$Song.mp3... I know that it is a workaround.. I can support if you need on batch renaming/mving