Batch processing
Useful Python scripts for every day
Repository includes various Python scripts for batch processing. Total number of files varies over time. Most suitable seem to be:
- dir LibreOffice rtf2docx - batch convertion of .rtf, .doc, .odt and .fb2 files to .docx using LibreOffice. Overcomes clumsy LibreOffice ideas like starting several instances, or exporting all files into one dir, or something. Surely may be used for batch conversion of not only rtf to docx (that was it's initial purpose) but also anything LibreOffice can read into anything it can write, like doc to PDF etc.
- dir ffmpeg flac2ogg 48 - converts all .flac within dir and subdirs to .ogg 48 kHz, using FFMPEG; removes junk like preview and «Zdes' byl Vasya» comments.
- dir ffmpeg flac2ogg 44 - converts all .flac within dir and subdirs to 16-bit 44.1 kHz (CD quality) .ogg, using FFMPEG; removes junk.
- dir OPTIVORBIS ogg - recompress all .ogg files within dir and subdirs, using OPTIVORBIS; saves up to 10 % of .ogg size after ffmpeg.
- dir COMPACT LZX - suitable GUI to Microsoft compact.exe, allowing to compress dir and subdirs using LZX compression (supported since Windows 8); modern bloatware typically get compressed 2.5-2.7 : 1, sometimes 3 : 1. Well, actually it's an example of redirecting compact.exe console output via subprocess Popen pipe to Tkinter ScrolledText ;-)
- dir AdvZIP docx - recompressing .docx after dir LibreOffice rtf2docx gives up to 7 % space saving.
- dir RENAME untranslit - intended for Russian users. Программа для оптового переименования (batch renaming) файлов с латиницы на русский (кириллицу). Не соответствует ISO 9, поскольку ISO 9 всё равно никто не использует, кроме как на федеральной службе; словари переименования составлены на основе того, с чем я лично сталкиваюсь, и периодически пополняются после новых столкновений. Словари (их три, средний для дифтонгов, предыдущий для более заковыристых, последний для отдельных букв) далеки от идеала (например, не умеют вставлять мягкие знаки после согласных там, где нужно), так что смело редактируйте, и не забывайте поделиться полезными комбинациями. И да, нет, не всё - будьте крайне осторожны, не направляйте эту программу на директории типа Windows или Program Files. Всё она, конечно, не переименует, но многое успеет...
- dir RENAME unflibusta - batch renaming of files according to patterns, like replacing underscores with spaces, removing digits, and so on. Edit rules pattern to your need.
Note that programs dir COMPACT LZX, dir OPTIVORBIS ogg, dir ffmpeg flac2ogg 48 and dir ffmpeg flac2ogg 44 accept command line arguments at start time. Argument is supposed to be a name of folder; in this case program GUI opens right in this folder. If argument happen to be a file, GUI will be opened in folder containing it. You may use it for creating shortcuts like:
pythonw.exe "dir COMPACT LZX.py.py" "%1"
(using actual addresses of Python and script on your system, of course) and then simply drag-and-drop folders onto shortcut to open program right where you need it. If argument is absent (e.g., you just double-click program), program simply opens in default directory and wait for you to browse and point to required location.
Proceed to Batchfiles at GitHub for downloads.
Move back to main page.