+2
Solved

Import and Export Metadata

ursiseli 5 months ago in Feature requests • updated by Vlad R 2 months ago 9

Is it possible to Export or Import all my Metadata in a csv-file?

Ideas?

Answer

Answer


Given that one metadata field can have multiple values, CSV is not the best format for it, so we'll use JSON instead.

Exporting metadata:

1. Download http://f.afian.se/wl/?id=u96zKAHJmyNTaweLjX1W5W6qVgde93tz and place the folder "export_meta" inside "/customizables/plugins".

2. Clear your browser cache.

3. Sign in to FileRun as Superuser. Note that the plugin will show only for the FileRun Superuser account.

4. Right-click any folder and choose "Open with.." -> "Export Metadata to JSON"

5. This will trigger the download of a JSON file which will contain the metadata of the files from the selected folder, including from subfolders.


The data is structured in a human-readable way. Here's an example:

[
  {
    "path": "f:/testeaza_aici/Audio formats/The Lay of the Last Minstrel.M4A",
    "metadata": {
      "fieldsets": [
        {
          "id": "5",
          "name": "Audio properties",
          "fields": [
            {
              "id": "20",
              "type": "",
              "name": "Artist",
              "values": [
                "Martyn Brabbins: BBC Scottish Symphony Orchestra"
              ]
            },
            {
              "id": "21",
              "type": "",
              "name": "Title",
              "values": [
                "MacCunn: The Lay of the Last Minstrel - Part 2. Final chorus: O Caledonia! stern and wild"
              ]
            },
            {
              "id": "22",
              "type": "",
              "name": "Album",
              "values": [
                "Maccunn: Land of the Mountain & the Flood"
              ]
            },
            {
              "id": "23",
              "type": "small",
              "name": "Duration",
              "values": [
                "2:55"
              ]
            },
            {
              "id": "24",
              "type": "",
              "name": "Codec",
              "values": [
                "Apple Lossless Audio Codec"
              ]
            }
          ]
        }
      ]
    }
  }
]



Importing metadata:


1. Download http://f.afian.se/wl/?id=cYMN4f0As5DZmby6YA1jg319SMS5PChk and place the folder "import_meta" inside "/customizables/plugins".

2. Clear your browser cache.

3. Sign in to FileRun as Superuser. Note that the plugin will show only for the FileRun Superuser account.

4. Right-click a JSON file, using the format shown above, and choose "Open with.." -> "Import Metadata"

5. The metadata will be imported to the files specified inside the JSON file, regardless of the location of the JSON file or the user's home folder.

Note that this will not remove or update existing metadata values. It will only add missing values, without creating duplicates.

Under review

There are no options currently, but if you'd tell us a bit on how you would use this, we'll consider adding some.

Thanks!

Do you have an idea to connect directly to the asset database? I would like to produce automatically with some metadata using my database publishing tool in Adobe-Indesign

I am not familiar with Indesign, but I doubt that you can connect to FileRun's database directly, as it is rather complex. You would need some custom application for it, or to export from FileRun in some easy to process format, like a spreadsheet.

If you would describe in details how you would like this to work, we can help better. I still don't know what it is you wish to achieve. Is it a simple list of file paths with metadata columns?

I woukd like to export from FileRun in some easy to process format, like a spreadsheet.

Can you describe in details how i would like this to work?


Greets Urs

Hi

Yes metadata columns of all metadata in my database would be great. Everything else I have under control

Urs

Hi,

here's the first version of my import script: import.zip

Just unzip it to the filerun root folder. It includes database access from autoconfig.php and reads/writes directly to database tables. Please bee aware it is setup to write only to the meta field 'tags', but you can adjust it to your needs. Just get the corresponding field id from df_modules_metadata_fields.

You could also wrap the final foreach loop with another foreach iterating through an array of meta fields.

If you can follow my approach, it shouldn't be too difficult to setup an export script (which outputs a csv file) in the very same way.


Best regards, Patrick

Hi,

here's an export plugin, just unzip and copy to customizables/plugins folder and enter or copy database settings from autoconfig.php. Clear cache, reload and use 'Open with' action on a folder to export all meta data of all files in this folder. Works recursively.

export_meta.zip

Best regards, Patrick

Answer


Given that one metadata field can have multiple values, CSV is not the best format for it, so we'll use JSON instead.

Exporting metadata:

1. Download http://f.afian.se/wl/?id=u96zKAHJmyNTaweLjX1W5W6qVgde93tz and place the folder "export_meta" inside "/customizables/plugins".

2. Clear your browser cache.

3. Sign in to FileRun as Superuser. Note that the plugin will show only for the FileRun Superuser account.

4. Right-click any folder and choose "Open with.." -> "Export Metadata to JSON"

5. This will trigger the download of a JSON file which will contain the metadata of the files from the selected folder, including from subfolders.


The data is structured in a human-readable way. Here's an example:

[
  {
    "path": "f:/testeaza_aici/Audio formats/The Lay of the Last Minstrel.M4A",
    "metadata": {
      "fieldsets": [
        {
          "id": "5",
          "name": "Audio properties",
          "fields": [
            {
              "id": "20",
              "type": "",
              "name": "Artist",
              "values": [
                "Martyn Brabbins: BBC Scottish Symphony Orchestra"
              ]
            },
            {
              "id": "21",
              "type": "",
              "name": "Title",
              "values": [
                "MacCunn: The Lay of the Last Minstrel - Part 2. Final chorus: O Caledonia! stern and wild"
              ]
            },
            {
              "id": "22",
              "type": "",
              "name": "Album",
              "values": [
                "Maccunn: Land of the Mountain & the Flood"
              ]
            },
            {
              "id": "23",
              "type": "small",
              "name": "Duration",
              "values": [
                "2:55"
              ]
            },
            {
              "id": "24",
              "type": "",
              "name": "Codec",
              "values": [
                "Apple Lossless Audio Codec"
              ]
            }
          ]
        }
      ]
    }
  }
]



Importing metadata:


1. Download http://f.afian.se/wl/?id=cYMN4f0As5DZmby6YA1jg319SMS5PChk and place the folder "import_meta" inside "/customizables/plugins".

2. Clear your browser cache.

3. Sign in to FileRun as Superuser. Note that the plugin will show only for the FileRun Superuser account.

4. Right-click a JSON file, using the format shown above, and choose "Open with.." -> "Import Metadata"

5. The metadata will be imported to the files specified inside the JSON file, regardless of the location of the JSON file or the user's home folder.

Note that this will not remove or update existing metadata values. It will only add missing values, without creating duplicates.