Re: [python-win32] How to set value with PyIPropertyStore

2019-11-15 Thread Peng Chen
Ok, I see, thanks a lot for your help though. I probably need to find a different method. Thanks a lot for your patience! On Fri, Nov 15, 2019 at 6:51 AM Tim Roberts wrote: > On Nov 14, 2019, at 4:15 PM, Peng Chen wrote: > > > > Nah, thanks, the stuff I'm trying to do is actually quite

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-14 Thread Tim Roberts
On Nov 14, 2019, at 4:15 PM, Peng Chen wrote: > > Nah, thanks, the stuff I'm trying to do is actually quite simple. > I try to read the "Encoded date" info from video file, apply a timeshift and > write it back. > I searched a few different libs, they are either works for image files only > or

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-14 Thread Peng Chen
Nah, thanks, the stuff I'm trying to do is actually quite simple. I try to read the "Encoded date" info from video file, apply a timeshift and write it back. I searched a few different libs, they are either works for image files only or it's read only and I can't write. So I thought of pywin32 and

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-10 Thread Tim Roberts
On Nov 10, 2019, at 4:13 PM, Peng Chen wrote: > > then I tried > riid = "" > ctx = None > properties = propsys.SHGetPropertyStoreFromParsingName( > file_name, ctx, shellcon.GPS_READWRITE, riid) > it reported: > (-2147221005, 'Invalid Class String', None, None) That’s

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-10 Thread Peng Chen
Hi Tim, Thanks, this works! But now the set value part gives access denied. I checked around, it seems the file needs to be opened in GPS_READWRITE mode in order to write info to the file. So I tried: from win32comext.shell import shellcon properties = propsys.SHGetPropertyStoreFromParsingName(

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-07 Thread Tim Roberts
On Nov 7, 2019, at 2:33 PM, Peng Chen wrote: > > I tried: > dateShifted = propsys.PyPROPVARIANT( > mDate + shift_time.timedelta_obj, pythoncom.VT_DATE) > and it reports: > module 'win32comext.propsys.propsys' has no attribute ‘PyPROPVARIANT' It is embarrassing that I had to figure

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-07 Thread Peng Chen
Thanks Tim, I tried: dateShifted = propsys.PyPROPVARIANT( mDate + shift_time.timedelta_obj, pythoncom.VT_DATE) and it reports: module 'win32comext.propsys.propsys' has no attribute 'PyPROPVARIANT' Should I import it from elsewhere? because the import I had is from win32comext.propsys

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-07 Thread Tim Roberts
Peng Chen wrote: Hi Tim,  Thanks for the reply. Sorry for the late. I just found your email today. Yes I tried with this code: from win32comext.propsys import propsys, pscon VIDEO_DATE_ENCODED = pscon.PKEY_Media_DateEncoded properties = propsys.SHGetPropertyStoreFromParsingName(file_name)

Re: [python-win32] How to set value with PyIPropertyStore

2019-11-06 Thread Peng Chen
Hi Tim, Thanks for the reply. Sorry for the late. I just found your email today. Yes I tried with this code: from win32comext.propsys import propsys, pscon VIDEO_DATE_ENCODED = pscon.PKEY_Media_DateEncoded properties = propsys.SHGetPropertyStoreFromParsingName(file_name) mDate =

Re: [python-win32] How to set value with PyIPropertyStore

2019-10-14 Thread Tim Roberts
Peng Chen wrote: I'm working on a script to shift video media creation time. I can see there is a function PyIPropertyStore.SetValue(key, value) and PyIPropertyStore.Commit() to write the date back, but I'm not sure how to construct the value because it requires PyPROPVARIANT type. I

[python-win32] How to set value with PyIPropertyStore

2019-10-14 Thread Peng Chen
Hi, I'm working on a script to shift video media creation time. I used: properties = propsys.SHGetPropertyStoreFromParsingName(file_name) mDate = properties.GetValue(pscon.PKEY_Media_DateEncoded).GetValue() and successfully retrieved media encoded date property. Now I could shift the time and