找到ffmpeg的真实位置

刚才用ffmpeg怎么搞来搞去没有10bit x265,结果一看copyright怎么是2016年,明明是刚刚下载的新版本。原来在powershell里面执行没加.\,导致执行的是path里面的ffmpeg。如何找到这个ffmpeg的位置呢,可以通过where命令。注意要在cmd下运行,因为在powershell下面where是另一个命令的别名。最后发现居然在anaconda下面,仔细想想估计是youtube-dl…
参考:https://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-the-windows-command-line

使用powershell 重命名 mlvapp 导出dng为resolve 命名格式

使用MLVAPP导出DNG的时候忘记选择resolve命名格式了,不想再重新导出了,发现powershell可以用正则重命名。原始文件名M23-1242_000000.dng,目标文件名M23-1242_1_2019-02-23_0001_C0000_000000.
Get-ChildItem *.dng | Rename-Item -NewName { $_.name -Replace ‘(_\d{6})’,’_1_2019-02-23_0001_C0000$1′ }
沙雕的我只会match最后六位数字

Nunjucks 变量名冲突

footer.html

{% macro footer(footer='') %}
{{ footer }}
{% endmacro %}

Wrong:

base.html

{% import "base/header.html" as header %}
{% import "base/footer.html" as footer %}
<body>
  {{ header.header(headerTag=headerTag) }}
  {% block content %}{% endblock content %}
  {{ footer.footer(footer=footer) }}
</body>

data.json

{
  "footer": "just a footer"
}

Correct:

base.html

{% import "base/header.html" as header %}
{% import "base/footer.html" as footer %}
<body>
  {{ header.header(headerTag=headerTag) }}
  {% block content %}{% endblock content %}
  {{ footer.footer(footer=another_footer) }}
</body>

data.json

{
  "another_footer": "just a footer"
}

render出来一直是null,最后换了变量名字就好了。

Use nunjucks-precompile under windows

Avoid using under windows if your template contains non-ascii characters. For reasons I cannot figure out there are always strange characters in the compiled file…

I tried to run below command under powershell, still got corrupted file.

npx nunjucks-precompile PATH_TO_TEMPLATE_FILE/FOLDER | out-file -filepath PATH_TO_OUTPUT_JS_FILE -encoding Default