Multimedia scripts for windows
Last update
2024-01-14
2024-01-14
«scripts per organizzare i files multimediali ai suoceri»
external tools
- ffmpeg for windows
- jhead
- VisiPics photo duplicate finder
- WinDirStat folder tree size
comprimi_media
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/env ruby dirs = %x[ find -mindepth 1 -maxdepth 1 -type d ].split("\n").sort dirs.each do |d| puts "===== CARTELLA [ #{d} ] =====" print 'foto : '; system 'ls|egrep -i "(jpe*g|png|heic)$"|wc -l', chdir: d print 'video: '; system 'ls|egrep -i "(mp4|mov|avi|mpeg|hevc)$"|wc -l', chdir: d system 'comprimi_media.single', chdir: d end puts "\n\nFINE" |
comprimi_media.single
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/bin/env ruby %w{ shellwords FileUtils progressbar }.each{|l| require l } pb_opts = { progress_mark: '#', remainder_mark: '_', length: 79, starting_at: 0, format: '%t: %J |
misc ruby
1 2 3 4 5 | # rename_foto_by_ts ruby -e 'Dir["**/*"].grep(/\.jpg/i).sort.each{|f| system %Q[jhead -n"%Y-%m-%d_%H-%M-%S" "#{f}"] }' # enumerate files Dir['*'].sort.each_with_index{|f, i| File.rename f, "#{'%04d' % (i+1)}.mp4"}; nil |
misc shell
1 2 3 4 5 | # PDF to JPG ls *.pdf | sed -r 's/(.+).pdf/pdftoppm -jpeg \0 \L\1.jpg/' | sh # lossless rotate JPG jpegtran -rotate 90 in.jpg > out.jpg |