All my movies

All My Movies by Boildesoft ( https://www.bolidesoft.com/allmymovies.html ) is a software that lets you manage your collection of bought movies. It downloads movie data from the imdb database and many other services (http://imdb.com). It also let you track and rate movies you have watched.

If you compare to Fast video cataloger the focus of All my movies is toward collecting movies while Fast video cataloger is geared toward organizing any type of video clips you have on your computer or in your organisation.

Importing videos from All my movies

This sample script shows how to use the scripting support in Fast video cataloger to import data from an All my movies database. The full script is included at the end, simply load the script into the script window in Fast video cataloger and run it.

Database format

All my movies uses an Access database with the extension set as .amm. If you rename the file extension to .mdb you can load it straight into Access and have a closer look at the data. To be able to read the Access database in a program you need to install the Access database engine. Download it from here. Since Fast video cataloger is a 64 bit program make sure you install the 64 bit version of the database engine.

Import videos script

The script to import videos is pretty straight forward. To make it easy to follow I have put it all in the entry function. If you want to expand on this script you should split it up into a number of functions and you should add error handling.

First we show a dialog to let the user pick the All my movies database file to read from:


Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "access"; // Default file name
dlg.DefaultExt = ".mdb"; // Default file extension
dlg.Filter = "mdb file (.mdb)|*.mdb|AllMyMovies file (.amm)|*.amm|All files (.*)|*.*"; // Filter files by extension
Nullable result = dlg.ShowDialog();

We then open the database file and runs a simple SQL query to get everything from the movies table in the database.


OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dlg.FileName + @";User Id=admin;Password =;");
connection.Open();
OleDbDataReader reader = null;
OleDbCommand command = new OleDbCommand("SELECT * from movies", connection);
reader = command.ExecuteReader();

Next we create some new extended properties for the catalog. Some of the properties in All my movies are not in the list of default video properties. But, since you can add your own properties in Fast video cataloger we will also do that for these properties.


var catalog = scripting.GetVideoCatalogService();
catalog.SetPropertyMeta("video_property", "year", "edit");
catalog.SetPropertyMeta("video_property", "studio", "edit");
catalog.SetPropertyMeta("video_property", "trailer", "edit");
catalog.SetPropertyMeta("video_property", "length", "edit");
catalog.SetPropertyMeta("video_property", "comments", "edit");

Then we read each line of the movie table in the database to create video entries.

while (reader.Read())
{
  string name = reader["Name"].ToString();
  string path = reader["LocalPath"].ToString();
  string description = reader["description"].ToString();
  string url = reader["url"].ToString();
  int video_id = catalog.AddVideo(path, name, 0, description, 0, 0, url, null, 0, null, null);

Once we have the video created we get the id of the newly created video and can use that to set the extended properties.

  string year = reader["year"].ToString();
  catalog.SetVideoFileExtendedProperty(video_id, "year", year);
  string studio = reader["studio"].ToString();
  catalog.SetVideoFileExtendedProperty(video_id, "studio", studio);
  string trailer = reader["trailer"].ToString();
  catalog.SetVideoFileExtendedProperty(video_id, "trailer", trailer);
  string length = reader["length"].ToString();
  catalog.SetVideoFileExtendedProperty(video_id, "length", length);
  string comments = reader["comments"].ToString();
  catalog.SetVideoFileExtendedProperty(video_id, "comments", comments);
}

Finally, we close the Access database and refresh Fast video cataloger to show the imported videos.


connection.Close();
scripting.GetGUI().Refresh("");

Conclusion

It is pretty easy to import data from All my movies into Fast video cataloger. You can use the same techniques to import data from other software, or, your custom solutions into Fast video cataloger. If you have imported a file to the video you can select “reindex” on the videos. Then the program will scan the video file for thumbnails and extended properties.

Below is the full script. You can also find the file in the sample script folder when you downlod Fast video cataloger.

using System.Collections.Generic;
using VideoCataloger;
using Microsoft.Win32;
using System;
using System.IO;

namespace VideoCataloger
{
    using RemoteCatalogService;
    using System.Data.OleDb;

    public class ImportMDB
    {
        static public void Run(IScripting scripting, string argument)
        {
            scripting.GetConsole().Clear();

            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "access"; 
            dlg.DefaultExt = ".mdb"; 
            dlg.Filter = "mdb file (.mdb)|*.mdb|AllMyMovies file (.amm)|*.amm|All files (.*)|*.*"; 
            Nullable result = dlg.ShowDialog();
            if (result == true)
            {

                try
                {
                    // https://www.microsoft.com/en-us/download/details.aspx?id=13255
                    // to download the access database runtime of the provider is not installed
                    // note you need the 64 bit version

                    OleDbConnection connection = 
                    new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" 
                    + dlg.FileName + @";User Id=admin;Password =;");
                    connection.Open();
                    OleDbDataReader reader = null;
                    OleDbCommand command = new OleDbCommand("SELECT * from  movies", connection);
                    reader = command.ExecuteReader();

                    // Setup the extended video properties
                    var catalog = scripting.GetVideoCatalogService();
                    catalog.SetPropertyMeta("video_property", "year", "edit");
                    catalog.SetPropertyMeta("video_property", "studio", "edit");
                    catalog.SetPropertyMeta("video_property", "trailer", "edit");
                    catalog.SetPropertyMeta("video_property", "length", "edit");
                    catalog.SetPropertyMeta("video_property", "comments", "edit");

                    while (reader.Read())
                    {
                        string name = reader["Name"].ToString();
                        string path = reader["LocalPath"].ToString();
                        string description = reader["description"].ToString();
                        string url = reader["url"].ToString();

                        int video_id = 
                        catalog.AddVideo(path, name, 0, description, 0, 0, url, null, 0, null, null);

                        string year = reader["year"].ToString();
                        catalog.SetVideoFileExtendedProperty(video_id, "year", year);
                        string studio = reader["studio"].ToString();
                        catalog.SetVideoFileExtendedProperty(video_id, "studio", studio);
                        string trailer = reader["trailer"].ToString();
                        catalog.SetVideoFileExtendedProperty(video_id, "trailer", trailer);
                        string length = reader["length"].ToString();
                        catalog.SetVideoFileExtendedProperty(video_id, "length", length);
                        string comments = reader["comments"].ToString();
                        catalog.SetVideoFileExtendedProperty(video_id, "comments", comments);
                    }

                    connection.Close();
                    scripting.GetGUI().Refresh("");
                }
                catch (Exception ex)
                {
                    scripting.GetConsole().WriteLine( ex.Message );
                }
            }
        }
    }

}