Skip to content

This tool is designed to arrange your media files and assist in the retrieval and rectification of metadata problems.

License

Notifications You must be signed in to change notification settings

BenSabry/MediaHelper

Repository files navigation

Media Helper

Media Helper is a tool engineered to organize your media files into the /Library/Year/Month/file structure, using their creation date as a guide. It's also useful for retrieving any missing metadata from JSON files (for example, Google Takeout), and correcting metadata issues such as duplications or incorrect offsets. It also aids in resolving any Issues like these.

Screenshot of MediaHelper running. *Screenshot of MediaHelper running.

Downloads

Latest release v0.10.0-beta
All releases releases

Story

I’m a proud owner of a Synology (DS720+) and I must say, I’m quite fond of it, especially the Photos/Drive apps.

Previously, I was a Google Photos user, so I downloaded a complete backup of all my media from Google and transferred it to the Synology Photos folder. However, I encountered a significant issue - Some media files lack certain metadata, and the order of the media. All my media was arranged according to the date I uploaded it to Synology, not the creation date or date taken, etc. After some research, I found numerous online discussions about this issue, even Synology Photos’ solution of manually modifying the image date is good but not feasible for a batch of more than 20,000 files!

So, I decided to tackle this problem head-on and develop my own solution. After several days of development and testing on my own media library, I’m happy to report that it’s complete and all my files are now properly sorted on Synology Photos, complete with the retrieved metadata extracted from the JSON files included in my Google Takeout backup.

Why am I sharing this? Because I experienced this frustrating problem and I want to help others who might be facing the same issue. If you’re interested, you can try it out and share your feedback.

Please remember to BACKUP your media before trying anything new, whether it’s from me or anyone else. Lastly, a big thank you to Synology for the excellent combination of software and hardware. I truly enjoy your product.

Notice

This tool is compatible with Synology, Qnap, and other NAS solutions, as well as local media files. If your media is scattered across multiple sources, folders, or locations, and you wish to consolidate and organize them in one place, this tool is ideal. It also supports Google Takeout backups and archived zip files. Simply add these to the sources section in AppSettings.json.

Recommendations

a. BACKUP your media files first.
b. Increase the TasksCount in AppSettings.json (recommended: 2, best: CPU Cores count)

How to use

  1. Add the path of your library to Sources and Target in AppSettings.json file
  2. run the executable MediaHelper.exe and wait

How it works

  1. Scan library files and directories added to Sources in AppSettings.json
  2. Continue processing from where files were last handled, skipping those already processed.
  3. Extract metadata from JSON files if any included (e.g., Google Takeout JSON files).
  4. Extract dates from file metadata, JSON files, and filenames, utilizing a variety of supported datetime format patterns, and then select the earliest datetime.
  5. Copy the file to proper directory Target\Year\Month\File. based on oldest datetime.
  6. Update the missing metadata using information from the JSON files.
  7. Update the creation date tags (e.g., TakenDate, CreateDate) with the earliest valid datetime discovered.
  8. Attempt to fix file metadata (like duplications/incorrect offsets etc.)
  9. Remove any empty directories or temporary backups that were created.

AppSettings

Example of working AppSettings.json.

{
    "TasksCount": 2,
    "EnableLogAndResume": true,
    "AttemptToFixMediaIncorrectOffsets": true,
    "ClearBackupFilesOnComplete": true,
    "DeleteEmptyDirectoriesOnComplete": true,
    "AutoFixArabicNumbersInFileName": true,
    "Target": "\\\\SynologyNAS\\home\\Photos\\PhotoLibrary",
    "Sources": [
        "\\\\SynologyNAS\\home\\Google-Takeout.zip",
        "\\\\SynologyNAS\\home\\Photos\\MobileBackup",
        "D:\\Data\\Media\\Photos\\Personal\\Family",
        "\\\\SynologyNAS\\home\\GraduationPhoto.jpg",
        "\\\\SynologyNAS\\home\\GraduationVideo.mp4"
    ],
    "Ignores": [
        "PersonalVideos",
        ".avi",
        ".m4a"
    ]
}

Fixable Issues

Synology Photos: Not Using Taken Date
Synology Photos: organizes everything by modified date instead of creation date
Synology Photos: Indexing photos/videos with wrong date
Synology Photos: Best practice for photos with no taken date

Tech/Tools used

.NET: is the free, open-source, cross-platform framework for building modern apps and powerful cloud services.
ExifToolWrapper: is a C# library that provides various helper methods and features using ExifTool.

AppSettings Explanation

TasksCount: (number) of Tasks/Threads to work simultaneously.
EnableLogAndResume: (flag) to ensure continuity and avoid repetition, actions are recorded in the log.txt files. This allows for resumption from the exact point where you last left off, rather than starting anew.
AttemptToFixMediaIncorrectOffsets: (flag) to fix file info (like duplications/incorrect offsets etc.)
ClearBackupFilesOnComplete: (flag) Clear temp files on complete.
DeleteEmptyDirectoriesOnComplete: (flag) Delete empty directories on complete.
AutoFixArabicNumbersInFileName: (flag) Fix by replacing Arabic numbers with English numbers.
Target: (text) target directory path where all files will be transferred post-processing..
Sources: (array) paths of libraries or files which will be scanned.
Ignores: (array) ignore keywords. The program will ignore files that contain a specific keyword in their name or path. You can add folder names, file extensions, or parts of file names to the list of ignores list.

About

This tool is designed to arrange your media files and assist in the retrieval and rectification of metadata problems.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Languages