Creating a Metadata File using the MyMedia-card Gem

require 'mymedia-card' 

mmc = MyMediaCard.new(config: '/home/james/jamesrobertson.eu/s1/mymedia.conf', 
                                            public_type: 'images', ext: '.jpg')
mmc.create_metadata_file

File (meta040515T1548.txt) observed after exectution:

<?kvx type='images'?>
title: Arduino Pro Mini
tags: arduino promini
----------------------------------

file: arduino-pro-mini.jpg

How did it create the file?

Using the file path provided from the config file along with parameters public_type: and ext: it found the latest image file (Arduino-Pro-Mini--arduino--promini.jpg) to be published. It then extracted the information from the filename and then renamed the original file.

Why do this?

The idea is that it's easier and more convenient for me to create information about a file by simply saving the filename with relevant information.

Config file used

Below is a copy of the config file I used. Some of the entries aren't used by the script however I have preserved it for completeness.

# file: mymedia.conf

home: /home/james/jamesrobertson.eu/s1
website: http://s1.jamesrobertson.eu
username: user
password: *****

dynamic_website: http://s1.jamesrobertson.eu
www: www
index_page: true
log: /home/james/mm.log

sps:
  address: sps
  default_subscriber: mymedia/jr/s1
  
views: /home/james/da2

Resources