Invalid file dates on NAS

Help improve MediaMonkey 5 by testing the latest pre-release builds, and reporting bugs and feature requests.

Moderator: Gurus

fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Invalid file dates on NAS

Post by fgordon »

Hi,

I found out that after tagging files with MM, VLC would refuse to play them. After digging for a while, it turns out it's because somehow, when MM edits the file, the last access date of the file becomes invalid on my NAS. This is consistent. Here is an example (see the Access date):

Code: Select all

# stat "12 Angry Men (1997).mp4"
  File: 12 Angry Men (1997).mp4
  Size: 1062667948      Blocks: 2075528    IO Block: 4096   regular file
...
Access: 30828-09-14 04:48:05.000000000
Modify: 2022-01-16 19:20:12.000000000
Change: 2022-01-16 19:20:11.000000000
This may not actually be MM's fault, it could very well be the NAS OS, since I've read about similar issues on QNAP and Synology forums (my NAS is Asustor) and it was the NAS linux kernel. However, in those cases they had issues with NTFS drives, but I see this both on NTFS and BTRFS disks (BTRFS is "native" to many NASes).

Anyway, I ran a program similar to linux'es "touch" but for windows, and it can fix the access date. The program is "Touch.exe" by Steve Miller and it can be found here: https://stevemiller.net/apps/

MM may help with this: if it could execute either a "touch" command on the file or allow the execution of user-defined post processing commands for each file, then I could use that touch program as a workaround.

Thanks
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Invalid file dates on NAS

Post by Lowlander »

It would seem that the NAS is responsible for managing this and that VLC should be able to handle this.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

Indeed, and I have reported this to Asus. However, given that this type of issues have been reported since 2007 and it took QNAP more than a year to fix theirs, and VLC says they can't do anything on the basis that it's in a third party library... I was basically asking if it would be possible for MM to run custom commands after the processing of each file.
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Invalid file dates on NAS

Post by Lowlander »

VLC shouldn't be asked to fix this, but instead should be able to handle files with this incorrect date.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

That's what I meant. They said to the person who reported this to them that they can't play those files because they can't open the file because the third party library they use won't do it.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

I forgot to mention that so far, the only program I've been able to replicate this with is MediaMonkey. I also edited the movie metada using MyMeta and when I do that, the dates are correctly saved. I also tried replicating this by editing text files and so far, it only happens with MediaMonkey.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

Eventually I worked around this issue by disabling in MM the automatic updating of the tags in files.
In case it helps others, this can be done via Tools -> Options -> select Tags & playlists on the left menu -> uncheck "Update tags when editing properties". Also unchecked "Modify timestamps when updating tags".
First I tried by just unchecking "Modify timestamps when updating tags" but it didn't work.
If I update the tags by hitting Ctrl-S on a file (or right-click on the file -> Edit tags -> Update tags), it does NOT trigger the problem and the file last accessed date is left alone.
Barry4679
Posts: 2398
Joined: Fri Sep 11, 2009 8:07 am
Location: Australia
Contact:

Re: Invalid file dates on NAS

Post by Barry4679 »

fgordon wrote: Sun Jan 16, 2022 9:17 pm Eventually I worked around this issue by disabling in MM the automatic updating of the tags in files.
In case it helps others, this can be done via Tools -> Options -> select Tags & playlists on the left menu -> uncheck "Update tags when editing properties". Also unchecked "Modify timestamps when updating tags".
First I tried by just unchecking "Modify timestamps when updating tags" but it didn't work.
If I update the tags by hitting Ctrl-S on a file (or right-click on the file -> Edit tags -> Update tags), it does NOT trigger the problem and the file last accessed date is left alone.
It is sad that you had to "fix" the problem by not using the (very useful) facility.
First I tried by just unchecking "Modify timestamps when updating tags" but it didn't work.
  • that's disappointing ... did you try changing the option, then closing and restarting MM before doing your test? ... maybe that makes a difference?

    I have a Synology NAS. It runs a Linux OS, like yours appears to.
    I ran a test.
    • update a track with MM (both settings that you mentioned are turned on, ie. Update Tags & Modify Timestamps)
    • the date access and date modified appear OK to me ... viewed via the Synology utility running on the NAS
    You could try rebooting the NAS.
    Its a weird issue. It is strange that Modify date is OK, but Access is screwed up.
    One would have thought that the NAS OS was responsible for both of those, but since that MM allow you to preserve the Access date, maybe MM is involved in the problem somehow.

    I would submit a Support Ticket.
Want a dark skin for MM5? This is the one that works best for me .. elegant, compact & clear.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

that's disappointing ... did you try changing the option, then closing and restarting MM before doing your test? ... maybe that makes a difference?
I did. Still, the last access date got broken.
You could try rebooting the NAS.
Tried that too, no luck.
One would have thought that the NAS OS was responsible for both of those, but since that MM allow you to preserve the Access date, maybe MM is involved in the problem somehow.
MM is not the culprit here. M$ Word and even Windows Explorer have this issue too with my NAS. In Windows Explorer, if I edit any of the tags of a mp4 video file (yes, that's a thing), the access date gets screwed up.
I believe the reason is the SMB implementation on either the client machine or the NAS. Maxtor had this issue at some point. I guess I could try downgrading the SMB version on my Windows machine but I don't want to.
I would submit a Support Ticket.
I did, but with Asustor. They have to fix it.

L.E. What I would like from MM is to add the ability to run "post-processing" custom commands after tagging a file. Then I could run a command to "touch" the files after MM's done with them, which would work around the problem.
Ludek
Posts: 4947
Joined: Fri Mar 09, 2007 9:00 am

Re: Invalid file dates on NAS

Post by Ludek »

fgordon wrote: Tue Jan 18, 2022 5:20 pm L.E. What I would like from MM is to add the ability to run "post-processing" custom commands after tagging a file. Then I could run a command to "touch" the files after MM's done with them, which would work around the problem.
This is doable via scripting

Code like this should work:

Code: Select all

app.listen(app, 'trackmodified', (track) => {
	setTimeout( () => {
		app.utils.shellExecute('My.exe touch=' + track.path, 'C:\\MyProgram\\');
	}, 5000); // to perform after 5 seconds and be sure that the track has been already tagged
}, false);


Last edited by Ludek on Wed Jan 19, 2022 12:03 pm, edited 1 time in total.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

Ludek wrote: Tue Jan 18, 2022 5:37 pm This is doable via scripting

Code like this should work:

Code: Select all

app.listen('trackChanged', (track) => {
	setTimeout( () => {
		app.utils.shellExecute('C:\MyProgram\My.exe touch=' + track.path);
	}, 5000); // to perform after 5 seconds and be sure that the track has been already tagged
});

Super, I can adapt that! Could you tell me where would such code go? (I know I could read the developers manual but it's a lot to take in for a MM n00b and I'd rather try that quickly)
L.E. typo
Ludek
Posts: 4947
Joined: Fri Mar 09, 2007 9:00 am

Re: Invalid file dates on NAS

Post by Ludek »

Copy e.g. [MM5 install folder]/sampleScripts/hotkeyAction/
to
[MM5 install folder]/scripts/hotkeyAction/
and replace the code in
[MM5 install folder]/scripts/hotkeyAction/actions_add.js
by the code above.

EDIT: Sorry, I had a typo in my code above, this code works:

Code: Select all

app.listen(app, 'trackmodified', (track) => {
	setTimeout( () => {
		app.utils.shellExecute('C:\\MyProgram\\My.exe', 'touch="'+track.path+'"');
	}, 5000); // to perform after 5 seconds and be sure that the track has been already tagged
}, false);
The params of the shellExecute are lpFile and lpParameters here:
https://docs.microsoft.com/en-us/window ... llexecutea

And you can debug your code in DevTools like this:
https://www.dropbox.com/s/npa55cldwej9m ... 4.png?dl=0
i.e. right click an item in MM5 > Open DevTools in Chrome
Last edited by Ludek on Thu Jan 20, 2022 4:08 pm, edited 1 time in total.
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

Thanks, Ludek!
Ludek
Posts: 4947
Joined: Fri Mar 09, 2007 9:00 am

Re: Invalid file dates on NAS

Post by Ludek »

FYI: I edited/corected my code above.
i.e. first param of app.utils.shellExecute needs to be full path to the executable file and the second are command line parameters
fgordon
Posts: 14
Joined: Sat Jan 15, 2022 5:23 am

Re: Invalid file dates on NAS

Post by fgordon »

Thanks!
Post Reply