Sonarr version: 2.0.0.5322
Mono version: 5.16.0
OS: Unraid
Debug logs:
Description of issue:
Hi Guys,
So i’ve been encountering the random Mono bug that stops you from setting the modified date of some files. This wouldn’t normally be an issue but i’m using rclone to store a bunch of media in the cloud and each time it re scans it was downloading some files locally to update the air date. To get round this I decided to write a simple post processing script to set the modified date of downloaded files to the Local Air date. Script is below.
#For Testing
#sonarr_episodefile_episodeairdatesutc="9/11/2017 02:00:00"
#sonarr_episodefile_path="/mnt/user/Media/TV_Shows/This Is Us/Season 02/This Is Us - S02E07 - The Most Disappointed Man.mkv"
#Setting TimeZone to UTC
TZUTC='TZ="UTC"'
#Converting Date from DD/MM/YYYY to MM/DD/YYYY so Date doesn't throw invalid date errors.
convert_date=$(echo "${sonarr_episodefile_episodeairdatesutc}" | awk -v FS=/ -v OFS=/ '{print $2,$1,$3}')
touch_date=$(date -d "${TZUTC} ${convert_date}" '+%c')
#Touching file with Air Date
touch -d "${touch_date}" "${sonarr_episodefile_path}"
This works great and it is touching the files with the local air-date and time relative to my time zone.
The problem i have found is if i use the inbuilt “Change File Date” function it set’s the modified date to local time relative to the network it aired on.
For instance if a show airs at 9pm Local time the inbuilt function will touch the file with 9pm the previous night.
If i use my script it will touch it with 11am the next day due to my different timezone.
From what i have read the network/time translation is done either somewhere in the back end.
Unfortunately i can’t see any environment variable with this information that I could incorporate into my script.
For now i’m just using UTC time which is working well, But if there is a way to solve this it would make my OCD Day.