petrkotek / chromecastize

Bash script to convert video files into Google Chromecast supported format.
MIT License
178 stars 34 forks source link

Conversion fails if `$HOME` folder is not accessible #44

Closed pfrenssen closed 5 years ago

pfrenssen commented 5 years ago

I am running chromecastize on a headless system that does not have any home folders for the users on the system. If I try to convert a file, this fails when it tries to write to the processed_files which is hardcoded to the path ~/.chromecastize/processed_files.

$ chromecastize my-video.mkv 
mkdir: cannot create directory ‘/home/pieter’: Permission denied
touch: cannot touch '/home/pieter/.chromecastize/processed_files': No such file or directory
===========
Processing: my-video.mkv
grep: /home/pieter/.chromecastize/processed_files: No such file or directory
- general: Matroska -> ok
- video: AVC -> copy
- audio: AC-3 -> libvorbis
- video length: 00:51:21.568
frame=73883 fps=112 q=-1.0 Lsize= 1971531kB time=00:51:21.56 bitrate=5241.1kbits/s speed=4.69x    

- conversion succeeded; file 'my-video.mkv' saved
- renaming original file as 'my-video.mkv.bak'
/usr/local/bin/chromecastize: line 93: /home/pieter/.chromecastize/processed_files: No such file or directory

- failed to convert 'my-video.mkv' (or conversion has been interrupted)
- deleting partially converted file...

I think to solve this we should do two things:

  1. Provide an option to override the location of the config folder.
  2. Check if the processed_files file is writable before starting the conversion, and abort the process if it is not. This will alert the user right away of the problem, and not after waiting for the conversion to complete.