dbr / tvnamer

Automatic TV episode file renamer, uses data from thetvdb.com via tvdb_api
https://pypi.python.org/pypi/tvnamer/
The Unlicense
918 stars 116 forks source link

Tidy download directory once tvshow video file renamed and moved. #99

Open bignellrp opened 10 years ago

bignellrp commented 10 years ago

Not sure if i'm doing this correctly but i have a feature request.

Some tv show downloads have directories and other unneeded files left in the download dir. Could the tvnamer have an option to tidy the download dir once video file has been renamed and moved?

E.g. downloaded/Lost.S01.E01.folder/Lost.S01.E01.xrrp.720p.cloud.mkv

Renamed and moved:

tvshows/Lost/Season\ 01/Lost.S01.E01.mkv

Folder remains:

ls downloaded/ downloaded/Lost.S01.E01.folder/

Option to delete the folder:

rm -rf downloaded/Lost.S01.E01.folder/

lahwaacz commented 10 years ago

There is no way to safely recognize "unneeded" files (whatever it means). This would bring more problems than it would solve. You could try remove empty directories though.

bignellrp commented 10 years ago

Yes, recognising unneeded files would be hard work but an option to delete empty directories would be handy. Thank you for such a fast reply!

dbr commented 10 years ago

I think this would be much tidier done as part of a wrapper script, e.g

  1. Run tvnamer on the folder
  2. Have tvnamer move the good files into a specific folder
  3. Remove the original directory

As a separate script specific to your setup (file layout etc), it should be easy to script, however integrating this into tvnamer as a generically useful feature would be very difficult (and increases the scope of what tvnamer is, which shouldn't extend much beyond just "here's a filename, give it a better name")

SickBeard has features like this, might be worth looking into

bensbrowning commented 9 years ago

As a shell workaround, find ./foo/ -empty -delete will do what you want, recursively.