Media Type Reset #media #update

Users can mistakenly add image files to the Media Gallery with the wrong MediaType which prevents the images from being used in reports. MediaType is normally set by user selection in the Add Media Item dialog and cannot be changed from within RootsMagic 6.0.0.2 and earlier. Within RM the only option is to add the media item again selecting Image as the Media type in the Add Media Item dialog. Of course, the item must be tagged to all the same things as the mis-typed item and the latter must be removed from the Gallery. This might be manageable for a few such mistakes but not if one had consistently erred on a large number of additions. Media Type Reset can correct all mis-typed errors in seconds.

The MediaTypeReset script sets the MultimediaTable.MediaType according to the file extension of the media file. It first sets all MediaType values to 0 (untyped), then sets Image (1), Sound (3) and Video (4) types according to the file extensions. All remaining entries are set to File (2).

It is unclear that RootsMagic makes any distinction among the File, Sound and Video types other than the filters applied when browsing for the file to be added and to display a symbolic thumbnail. Regardless, double-clicking on such items in the Media Gallery opens the file with its associated external application. None are included in RM reports.

When Image type is selected, the Scanner button is enabled and the disk browsing filter is set to an undeclared list of image file extensions. By testing with many file type extensions, only those types that pass the browser filter have been included in the script as only those that the Image Viewer/Editor can render should be allowed. More significantly, the Image explorer mimics but seems different from the Windows Explorer opened for the other file types and may ‘remember’ a different path. Some users may prefer to use a consistent browser. Using the File type along with MediaTypeReset allows one to do so.

On adding an item selected through the Image type, RootsMagic generates a thumbnail image. For images added via the other types, no thumbnail is created nor are they used in any reports. After running MediaTypeReset, the thumbnail is generated on opening an Album to which the item is tagged, or on opening the Media Gallery, subject to Program Options.

rev 2023-02-19 added the .mp4 extension as a “Video” type. Tested without error on #RM8.

RMtrix_tiny_check.png contains the 2012-12-09 version which omitted the .mp4 extension

-- MediaTypeReset.sql
/*
2012-12-04 Tom Holden ve3meo
2012-12-09 restricted Image file types to those rendered by Viewer/Reporter
2023-02-19 MP4 added

Users can mistakenly add image files to the Media Gallery with the 
wrong MediaType which prevents the images from being used in reports.
MediaType is normally set by the user selection in the Add Media Item dialog
and cannot be changed from within RootsMagic 6.0.0.2 and earlier.
This script sets the MediaType according to the file extension of the media file.
*/

-- Clear all previous settings
UPDATE MultimediaTable
 SET MediaType=0
;
-- Set Image files (only RM Add Media filters + .targ, .tiff because of viewer/reporter limitations)
UPDATE MultimediaTable
 SET MediaType=1
  WHERE LOWER(SUBSTR(MediaFile,-4)) 
  IN ('.bmp','.gif','.jpg','jpeg','.png','.tga','targ','.tif','tiff')
; 
-- Set Sound files (RM Add Media filters on just .wav, .mid, .mp3 but no player to set constraints)
UPDATE MultimediaTable
 SET MediaType=3
  WHERE LOWER(SUBSTR(MediaFile,-4)) 
  IN ('.wav','.mid','.mp3','.ogg','.gsm','.dct','flac','aiff','.vox','.raw','.wma','.aac')
  OR LOWER(SUBSTR(MediaFile,-3)) 
  IN ('.au','.ra','ram','dss','msv','dvf','ape')
;
-- Set Video files (RM filters on Add Media only for .avi, .mov, .mpg, .mpeg, .wmv but no player to set constraints)
UPDATE MultimediaTable
 SET MediaType=4
  WHERE LOWER(SUBSTR(MediaFile,-4)) 
  IN ('.3gp','.asf','.avi','.dat','.flv','.m4v','.mkv','.mov','mp4','mpeg','.mpg','.mpe','.swf','.wmv')
;
-- Set files, other than previously set Image, Sound, Video types, to File type
UPDATE MultimediaTable
 SET MediaType=2
  WHERE MediaType=0
;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.