-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux tweaks #206
base: master
Are you sure you want to change the base?
Linux tweaks #206
Conversation
mmfunctions
Outdated
if [[ "$(uname -s)" = "Darwin" ]] ; then | ||
FFMPEGFONTPATH='/Library/Fonts/Andale Mono.ttf' | ||
XMLSTARLET='xml' | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to use an explicit
elif [[ $(uname -s)" = "Linux" ]]
and something like
else
echo "Error: Unsupported OS. Exiting."
exit 1
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense to me!
I just noticed one thing, on linux in windows uname -s
returns Linux
which I assume would cause this to still assign a bad file path for the text file in that environment.
@retokromer, I know you have been running more of these scripts in the linux on windows environment, have you run into any problems due to the lack of specificity in using uname
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot remember a specific problem, but I will check as soon as I am back at the lab.
switch to echo
made some changes to make it more specific - I set it to warn rather than exit if it can't set these variables as they are only used in a small subset of scripts and I wouldn't want to cripple any scripts that potentially would work. |
@dericed , @aeschweik, could one of you confirm that switching to |
had @ablwr test the |
VIDEOCHECK='file -Ib' | ||
elif [[ "$(uname -s)" = Linux ]] ; then | ||
VIDEOCHECK='file -i' | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add also here an
else
with a warning or an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is just a check to see if the input is a video (and throw an error if it isn't) I thought it would be better to attempt to set the variable, but then to skip the video check if the variable was unset (See line 48).
This way, if the person was using an irregular system (but somehow everything else was working) with a valid input it would allow them to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. Would in this case an
unset VIDEOCHECK
before the line 43 be appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point! I'll add that in!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sorry to have missed this earlier - it's working on a Mac over here! (with the change back to |
Thanks @aeschweik! Guess I'll merge next week if there are no other suggestions/objections? |
Since homebrew symlinks xml to xmlstarlet, https://github.com/Homebrew/homebrew-core/blob/3147824bf1507ea3f7e6e8d9517d47f13f8838a7/Formula/xmlstarlet.rb#L22, I prefer the easier approach of substituting |
Cool, that makes sense - since I couldn't test it myself I was using an abundance of caution - I'll switch it over to the universal command! |
Made more tweaks to the tweaks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
VIDEOCHECK='file -i' | ||
fi | ||
if ! [[ -z ${VIDEOCHECK} ]] ; then | ||
if [[ -z $(${VIDEOCHECK} "${INPUT}" | grep video) ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on mac running:
VIDEOCHECK='file -Ib' ; $(${VIDEOCHECK} /Users/daverice/Desktop/test5_prores.mov)
I get
-bash: video/quicktime;: No such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that because it is using command substitution and attempting to run the output of $(${VIDEOCHECK} /Users/daverice/Desktop/test5_prores.mov)
as a command?
In the same way that just running $(echo "hello")
will also throw an error as it attempts to execute hello
?
On my end, using the command VIDEOCHECK='file -i' ; $(${VIDEOCHECK} input.mov)
will also throw an error, but within the context of the script, or even something like VIDEOCHECK='file -i' ; var=$(${VIDEOCHECK} input.mov) ; echo "${var}"
gives the expected output/behavior.
I guess so as well. On my end, Andrew’s version works on both Ubuntu 16.04.3 LTS and macOS 10.11.6. |
searchfingerprint
Outdated
@@ -40,7 +40,7 @@ while [ "${*}" != "" ] ; do | |||
shift | |||
|
|||
#Confirm input is a video file | |||
if [[ -z $(file -Ib "${INPUT}" | grep video) ]] ; then | |||
if [[ -z $(file -i "${INPUT}" | grep video) ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks for me. Maybe using ffmpeg is safer.
file -i TEST.mov
/Users/daverice/Desktop/TEST.mov: regular file
vs
file -Ib TEST.mov
video/quicktime; charset=binary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using ffmpeg is safer.
+1
After 530d662, I think what remains in this PR is a system-specific handling of the font files for ffmpeg and some workaround for macos's For file handling I suggest to do it by file accessibility rather than by system, such as if [[ -f "/Library/Fonts/somefont.tff" ]] ; then
TIMECODE_FONT="/Library/Fonts/somefont.tff"
elif [[ -f "/usr/lib/somewhere/where/i/hide/the/fonts/on/linux/somefont.tff" ]] ; then
TIMECODE_FONT="/usr/lib/somewhere/where/i/hide/the/fonts/on/linux/somefont.tff"
else
_report "uhhh, where's your fonts?"
fi and Lines 999 to 1006 in 7aa1625
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments in #206 (comment)
I think that both of those options sounds like reasonable changes to me! |
Could possibly the conflicts be resolved and this pull request merged? Thanks! |
Made some changes to address problems in #205 and make things a bit more cross platform.
Haven't been able to test in macOS, so probably should be run by someone with access to a mac!
In particular, I think this command change is cross platform, but should be confirmed!