Build file index

Remember to build file index before upload.

After modifying some of the content, you should update the index file. If not updated, your changes will not be noticed by MMDAgent-EX clients.

Index file

The index file should be named .mmdagent-content-files and should be placed at the top of your content directory.

Here is an example of the index file. The first line of the file should contain the last update time in UNIX time. After that, each line should have two field separated by spaces, the first one is the file size in bytes and the second one is file path, relative to the top directory. The order of the files are not important.

1543501419
2911 FromExample/Motion/mei_breath/COPYRIGHT.txt
248180 Objects/table.pmd
3455 Objects/pc/cover.jpg
1518 README.txt
210 Main.mdf
1822553 Stage/nit_comspace_f.png
4596 FromExample/Motion/sd_mei_bye/README.txt
30205 Motions/sitdown.vmd
12725 FromExample/Motion/mei_point/mei_point_center_center.vmd
100352 Button/btn_lee.png
4595 FromExample/Motion/mei_laugh/README.txt
2911 FromExample/Motion/mei_idle/COPYRIGHT.txt
2911 FromExample/Motion/sd_mei_wait/COPYRIGHT.txt

Tool mit

A tiny script mit.pl is provided in the GitHub page that can manage the index file. Perl is required to run the script. Below is a usage example of updating index file, adding ALL files under the content directory.

% cd content_topdir
% mit.pl add .
% mit.pl update

After that the index file .mmdagent-content-files will be made up-to-date, and ready to upload to web server.

How it works

At download of a content,

  1. It first fetches the index file at “[content_url]/.mmdagent-content-files”.
  2. Files in local cache folders are compared with the entries (pairs of file name and size)
  3. The differential parts are downloaded.
  4. Start playing the content.

According to the scheme above, MMDAgent-EX can execute per-file download resume at network down.

At content start up,

  1. If the content is marked as “updatable”, re-download content from source before start.
  2. After content start up, it fetch the recent index file from source URL after 5 second of launch in background.
  3. If the time stamp of the newly fetched index file is newer than the local cache, mark the content as “updatable”, to be updated at next startup.

Last modified May 7, 2020: Re-organizing further (4b20b5d)