This is a Python script that facilitates the process of downloading files from an FTP server, extracting them from zip archives, renaming the files based on TV channel names, and uploading them to another location. It is designed to automate the workflow for TV content processing.
The story behind this, it was a bash tool I did some years ago (and which is kept in the folder), so this is just an exercise on adapting it 100% to Python and add some unit testing.
- Downloads files from an FTP server using the
lftp
command-line tool. - Extracts files from zip archives.
- Renames files according to TV channel names and adds a configurable delay.
- Moves the renamed files to an "uploading" folder.
- Supports configurable timeouts for waiting for downloaded files.
Just clone the repository:
git clone https://github.com/your-username/ftp-downloader.git
Configure the FTP connection and download settings in download.config. Run the script with the desired command-line arguments:
python Multitool_full.py -k TV1 -i /path/to/folder -o /path/to/download -d download.config -t 60 -r 2
-k/--tv_name: The TV name for the platform (required).
-i/--folder: The folder where the files are downloaded (required).
-o/--download_folder: The main folder of the downloader (required).
-d/--download_config: The downloading configuration for the lftp tool (required).
-t/--timeout: Timeout (in seconds) for waiting for downloaded files (required).
-r/--delay: Hours delayed in the final file name (required).
The project includes a comprehensive set of unit tests to ensure the correctness of the functionality. To run the unit tests, execute the following command:
python -m unittest discover
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize the content as per your project's specific details and requirements.