<div dir="ltr">Hi Tim,<div> Thanks for the reply. Sorry for the late. I just found your email today. Yes I tried with this code:</div><div><br></div><div><div style="color:rgb(230,230,230);background-color:rgb(41,42,43);font-family:Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(255,117,181)">from</span> win32comext.propsys <span style="color:rgb(255,117,181)">import</span> propsys, pscon</div><div>
<div style="line-height:19px"><div><span style="color:rgb(255,184,108)">VIDEO_DATE_ENCODED</span> = pscon.<span style="color:rgb(255,184,108)">PKEY_Media_DateEncoded</span></div><div><span style="color:rgb(255,184,108)"></span></div></div>
<div style="line-height:19px"><div>properties = propsys.SHGetPropertyStoreFromParsingName(file_name)</div><div><div style="line-height:19px"><div>mDate = properties.GetValue(<span style="color:rgb(255,184,108)">VIDEO_DATE_ENCODED</span>).GetValue() # got the datetime object</div><div><div style="line-height:19px"><div>dateShifted = mDate + shift_time.timedelta_obj # shift date</div><div><div style="line-height:19px"><div>properties.SetValue(<span style="color:rgb(255,184,108)">VIDEO_DATE_ENCODED</span>, dateShifted) # set value</div><div><div style="line-height:19px"><div>properties.Commit()</div></div></div></div></div></div></div></div></div></div></div><div>
</div></div></div><div><br></div><div>and I got error message when executing to </div><div><div>properties.SetValue(<span style="color:rgb(255,184,108)">VIDEO_DATE_ENCODED</span>, dateShifted) </div><div><div style="line-height:19px"><div></div></div></div></div><div><br></div><div>it reports:</div><div>Object must be a PyPROPVARIANT<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 15, 2019 at 1:25 AM Tim Roberts <<a href="mailto:timr@probo.com" target="_blank">timr@probo.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Peng Chen wrote:<br>
><br>
> I'm working on a script to shift video media creation time.<br>
> ....<br>
> I can see there is a function<br>
> PyIPropertyStore.SetValue(key, value) and PyIPropertyStore.Commit()<br>
> to write the date back, but I'm not sure how to construct the value <br>
> because it requires PyPROPVARIANT type.<br>
> I can't figure out any where to import this type and doesn't know how <br>
> to construct it.<br>
<br>
PyPROPVARIANT is generally a return type. In a case like this, I would <br>
expect that you would simply pass the datetime value, and the interface <br>
code would convert it into a variant. Have you tried that? Did you get <br>
an error?<br>
<br>
-- <br>
Tim Roberts, <a href="mailto:timr@probo.com" target="_blank">timr@probo.com</a><br>
Providenza & Boekelheide, Inc.<br>
<br>
<br>
_______________________________________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org" target="_blank">python-win32@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-win32" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-win32</a><br>
</blockquote></div>