r0oth3x49 / acloud-dl

A cross-platform python based utility to download courses from acloud.guru for personal offline use.
MIT License
351 stars 142 forks source link

Create renamesuffix.py #91

Closed affansyed closed 2 years ago

affansyed commented 2 years ago

This small (and simple) code helps people rename the files downloded into a cumbersome suffix of .VIDEO_AUDIO into .avi for easy access. Will be a super useful tool to add to the repo as I felt is was needed. For the totally no-code approach to this repo :)

Doing some really good work here Nasir.

If accepted, I can write down edits to the README file to support how to use it.

fanuch commented 2 years ago

This is a good idea except they aren't avi. If you run file on them or open up up the media information on VLC they appear to be mp4

image

Also if there was going to be a change, I would suggest it would be around here: https://github.com/r0oth3x49/acloud-dl/blob/dcf350c2e9e22466a128e89b5758bdc2bb982ff1/acloud/_shared.py#L508

That is where I believe the file is renamed. Note that this is where filename (the final name) and temp_filename are both instantiated: https://github.com/r0oth3x49/acloud-dl/blob/dcf350c2e9e22466a128e89b5758bdc2bb982ff1/acloud/_shared.py#L355-L372

You could have an if statement after the filename part such as:

  filename = filename.replace("VIDEO_AUDIO", "mp4")

It's not very specific but a rough idea on what can be done

SmokeShine commented 2 years ago

find . -name "*.VIDEO_AUDIO" -exec sh -c 'mv "$0" "${0%.VIDEO_AUDIO}.mp4"' {} \;

Alternative Terminal command