aag / apple_trailer_downloader

A script to download HD trailers from the Apple Trailers website.
GNU General Public License v3.0
23 stars 5 forks source link

Filename Format #22

Closed kapps7 closed 2 years ago

kapps7 commented 2 years ago

Hi, thanks for the script!

Is it possible to specify the filename format in configuration. I would like to remove the resolution and the . and replace it as below. Thanks example: Hunger Games (2017) -trailer.mp4

aag commented 2 years ago

Thanks for the feature request, but I think the script would have to support some kind of filename templating for this to work, and I don't think I'm interested in implementing that. Feel free to submit a PR if you really want it, though.

However, you might not even need it, since it's fairly easy to rename the files after they're downloaded. For example, you could use the Perl rename utility like this:

$ ls
 645.Trailer.1080p.mov
'American Sausage Standoff.Trailer.1080p.mov'
 Dune.Trailer.1080p.mov
'Dune.Trailer 2.1080p.mov'
 Lorelei.Trailer.1080p.mov
'Midnight In The Switchgrass.Trailer.1080p.mov'
'The Card Counter.Trailer.1080p.mov'

$ rename 's/(.*)\.(.*)\.(.*)\.(.*)$/$1 -$2.$4/' *.mov

$ ls
'645 -Trailer.mov'
'American Sausage Standoff -Trailer.mov'
'Dune -Trailer 2.mov'
'Dune -Trailer.mov'
'Lorelei -Trailer.mov'
'Midnight In The Switchgrass -Trailer.mov'
'The Card Counter -Trailer.mov'

If you run that rename command each time after you run the download_trailers.py script, it will rename all new files to the scheme you want.