Beispiel #1
0
        private static void Restore()
        {
            // back the corrupt database in case user wants to fix themselves
            string backupDirectory = Config.GetSubFolder(Config.Dir.Database, "MP-TVSeries_Backup");
            string sourceFile      = Settings.GetPath(Settings.Path.database);
            string destinationFile = Path.Combine(backupDirectory, string.Format("TVSeriesDatabase4-Corrupt-{0}.db3", DateTime.Now.ToString("yyyyMMddHHmmss")));

            MPTVSeriesLog.Write("Backing up corrupt database. Filename = '{0}'", destinationFile);

            try
            {
                File.Copy(sourceFile, destinationFile, true);
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("Failed to backup corrupt database. Source File = '{0}', Destination File = '{1}', Reason = '{2}'", sourceFile, destinationFile, ex.Message);
            }

            MPTVSeriesLog.Write("Restoring last known good database");

            sourceFile      = Path.Combine(backupDirectory, "TVSeriesDatabase4.db3");
            destinationFile = Settings.GetPath(Settings.Path.database);

            try
            {
                File.Copy(sourceFile, destinationFile, true);
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("Failed to restore database. Source File = '{0}', Destination File = '{1}', Reason = '{2}'", sourceFile, destinationFile, ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Resolves skin\\ and thumbs\\ relative paths to absolute.
        /// Other relative paths are resolved using MediaPortal installation directory.
        /// Absolute paths are just cleaned.
        /// </summary>
        /// <param name="file">Relative or absolute path to resolve</param>
        /// <returns></returns>
        public static string getCleanAbsolutePath(string file)
        {
            if (!System.IO.Path.IsPathRooted(file))
            {
                // Respect custom skin folders
                if (file.ToLower().StartsWith("skin\\"))
                {
                    file = file.Replace("skin", Settings.GetPath(Settings.Path.skin));
                }
                else if (file.ToLower().StartsWith("thumbs\\"))
                {
                    file = file.Replace("thumbs", Settings.GetPath(Settings.Path.thumbs));
                }
                else
                {
                    file = Helper.PathCombine(Settings.GetPath(Settings.Path.app), file);
                }
            }

            foreach (char c in System.IO.Path.GetInvalidPathChars())
            {
                file = file.Replace(c, '_');
            }

            return(file);
        }
Beispiel #3
0
        /// <summary>
        /// Deletes all cached thumbs for a Series Fanart
        /// Sometimes fanarts get deleted online but we still have the old
        /// thumbs cached. This allows the user to clear the cache and re-download the thumbs
        /// </summary>
        /// <param name="seriesID"></param>
        public static void ClearFanartCache(int seriesID)
        {
            string searchPattern = seriesID.ToString() + "*.jpg";
            string cachePath     = Helper.PathCombine(Settings.GetPath(Settings.Path.fanart), @"_cache\fanart\original\");

            if (!System.IO.Directory.Exists(cachePath))
            {
                return;                                         //exit if no dir to avoid any exception in GetFiles
            }
            string[] fileList = Directory.GetFiles(cachePath, searchPattern);

            foreach (string file in fileList)
            {
                MPTVSeriesLog.Write("Deleting Cached Fanart Thumbnail: " + file);
                FileInfo fileInfo = new FileInfo(file);
                try {
                    fileInfo.Delete();
                }
                catch (Exception ex) {
                    MPTVSeriesLog.Write("Failed to Delete Cached Fanart Thumbnail: " + file + ": " + ex.Message);
                }
            }

            // Clear DB and Clear Cache
            DBFanart.ClearDB(seriesID);
        }
Beispiel #4
0
 public void setUpPaths()
 {
     locationBrowser1.setUpFile("Database:", Settings.GetPath(Settings.Path.database));
     locationBrowser2.setUpFile("Log:", Settings.GetPath(Settings.Path.log));
     locationBrowser3.setUpFolder("Banners:", Settings.GetPath(Settings.Path.banners));
     locationBrowser4.setUpFolder("Fanart:", Settings.GetPath(Settings.Path.fanart));
     locationBrowser5.setUpFolder("Languages:", Settings.GetPath(Settings.Path.lang));
 }
Beispiel #5
0
        void doWork(String sSeriesID, string sAccountID)
        {
            XmlNode node     = null;
            string  filename = string.Empty;

            if (sSeriesID != null)
            {
                filename = Path.Combine(Settings.GetPath(Settings.Path.config), string.Format(@"Cache\{0}\ratings.xml", sSeriesID));

                // check if we have user rating in cache
                node = Helper.LoadXmlCache(filename);
            }

            // download ratings
            if (node == null)
            {
                node = Online_Parsing_Classes.OnlineAPI.GetUserRatings(sSeriesID, sAccountID);

                if (node == null)
                {
                    return;
                }

                // check if there is any user ratings
                if (node.SelectSingleNode("/Data/Error") != null)
                {
                    MPTVSeriesLog.Write("User Ratings: " + node.SelectSingleNode("/Data/Error").InnerText, MPTVSeriesLog.LogLevel.Debug);
                    return;
                }

                // save to file cache
                if (sSeriesID != null)
                {
                    Helper.SaveXmlCache(filename, node);
                }
            }

            try
            {
                if (sSeriesID != null)
                {
                    // download all series and episode ratings
                    GetSeriesAndEpisodeRatings(node);
                }
                else
                {
                    // only update series ratings, not individual episode ratings
                    // quicker b/c we can pull them all in one query
                    GetSeriesRatings(node);
                }
            }
            catch (Exception e)
            {
                MPTVSeriesLog.Write("Error getting User Ratings: {0}", e.Message);
            }
        }
Beispiel #6
0
        public static void DeleteXmlCache(int aSeriesID)
        {
            string lPath = Path.Combine(Settings.GetPath(Settings.Path.config), string.Format(@"Cache\{0}\", aSeriesID.ToString()));

            MPTVSeriesLog.Write($"Deleting series API cache. Path={lPath}");
            try
            {
                Directory.Delete(lPath, true);
            }
            catch (Exception e)
            {
                MPTVSeriesLog.Write($"Error deleting series API cache. Exception={e.Message}");
            }
        }
Beispiel #7
0
        private static void InitDB()
        {
            if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower() == "devenv")
            {
                return;
            }

            string databaseFile = Settings.GetPath(Settings.Path.database);

            bool databaseExists = true;

            if (!File.Exists(databaseFile))
            {
                databaseExists = false;
            }

            try
            {
                m_db = new SQLiteClient(databaseFile);

                // check database integrity
                if (databaseExists)
                {
                    if (CheckIntegrity())
                    {
                        // backup volume if all is good
                        Backup();
                    }
                    else
                    {
                        // restore last known good volume if corrupt
                        Restore();
                    }
                }

                ExecutePragmas();

                MPTVSeriesLog.Write("Successfully opened database. Filename = '{0}'", databaseFile);

                return;
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("Failed to open database. Filename = '{0}', Reason = '{1}'", databaseFile, ex.Message);

                // restore last known good volume
                Restore();
                ExecutePragmas();
            }
        }
Beispiel #8
0
        static MPTVSeriesLog()
        {
            if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower() == "devenv")
            {
                return;
            }

            InitLogLevel();

            // let's rename the old one to .bak just like MP does
            try
            {
                if (File.Exists(m_filename))
                {
                    string bgFile = Settings.GetPath(Settings.Path.logBackup);
                    if (File.Exists(bgFile))
                    {
                        File.Delete(bgFile);
                    }
                    File.Move(m_filename, Settings.GetPath(Settings.Path.logBackup));
                }
            }
            catch (Exception e)
            {
                Write("Problem backing up Log file: " + e.Message);
            }
            try
            {
                m_LogStream = File.CreateText(m_filename);
                m_LogStream.Close();
                m_LogStream.Dispose();
            }
            catch (Exception)
            {
                // oopps, can't create file
            }

            // log data to and from themoviedb.org
            TmdbAPI.TmdbAPI.OnDataSend     += new TmdbAPI.TmdbAPI.OnDataSendDelegate(API_OnDataSend);
            TmdbAPI.TmdbAPI.OnDataError    += new TmdbAPI.TmdbAPI.OnDataErrorDelegate(API_OnDataError);
            TmdbAPI.TmdbAPI.OnDataReceived += new TmdbAPI.TmdbAPI.OnDataReceivedDelegate(API_OnDataReceived);

            // log data to and from themoviedb.org
            FanartTvAPI.FanartTvAPI.OnDataSend     += new FanartTvAPI.FanartTvAPI.OnDataSendDelegate(API_OnDataSend);
            FanartTvAPI.FanartTvAPI.OnDataError    += new FanartTvAPI.FanartTvAPI.OnDataErrorDelegate(API_OnDataError);
            FanartTvAPI.FanartTvAPI.OnDataReceived += new FanartTvAPI.FanartTvAPI.OnDataReceivedDelegate(API_OnDataReceived);

            pauseAutoWriteDB = true;
        }
Beispiel #9
0
        static Settings()
        {
            try
            {
                apppath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);

                _entryAssembly = Assembly.GetEntryAssembly();
                _isConfig      = !System.IO.Path.GetFileNameWithoutExtension(EntryAssembly.Location).Equals("mediaportal", StringComparison.InvariantCultureIgnoreCase);
                _version       = Assembly.GetCallingAssembly().GetName().Version;
                _mpVersion     = Assembly.GetEntryAssembly().GetName().Version;
                _buildDate     = getLinkerTimeStamp(Assembly.GetAssembly(typeof(Settings)).Location);
                _mpBuildDate   = getLinkerTimeStamp(System.IO.Path.Combine(Settings.GetPath(Path.app), "MediaPortal.exe"));
                _userAgent     = string.Format("MPTVSeries{0}/{1}", isConfig ? "Config" : string.Empty, Version);
            }
            catch (Exception) { }

            // AB: can override DB path, stored in the registry
            RegistryKey rk = Registry.CurrentUser.OpenSubKey("Software\\MPTVSeries");

            if (rk == null)
            {
                rk = Registry.CurrentUser.CreateSubKey("Software\\MPTVSeries");
            }

            dbPath = Config.GetFile(Config.Dir.Database, "TVSeriesDatabase4.db3");

            if (rk != null)
            {
                // input fields
                Object value;
                value = rk.GetValue("DBFile");
                if (value != null)
                {
                    dbPath = value.ToString();
                }
            }

            // we respect overall MP settings which can be optinally defined
            logPath       = Config.GetFile(Config.Dir.Log, "MP-TVSeries.log");
            backupLogPath = Config.GetFile(Config.Dir.Log, "MP-TVSeries.bak");
            bannersPath   = Config.GetSubFolder(Config.Dir.Thumbs, "MPTVSeriesBanners");
            langPath      = Config.GetSubFolder(Config.Dir.Language, "MP-TVSeries");
            thumbsPath    = Config.GetFolder(Config.Dir.Thumbs);
            skinPath      = Config.GetFolder(Config.Dir.Skin);
            fanArtPath    = thumbsPath + @"\Fan Art";
            configPath    = Config.GetSubFolder(Config.Dir.Config, "MP-TVSeries");
            initFolders();
        }
Beispiel #10
0
        public static void Close()
        {
            string databaseFile = Settings.GetPath(Settings.Path.database);

            try
            {
                m_db.Close();
                m_db.Dispose();
                m_db = null;
                MPTVSeriesLog.Write("Successfully closed database. Filename = '{0}'", databaseFile);
            }
            catch (Exception)
            {
                MPTVSeriesLog.Write("Failed to close database. Filename = '{0}'", databaseFile);
            }
        }
Beispiel #11
0
        public void load()
        {
            folderBrowserDialog1.SelectedPath = Settings.GetPath(Settings.Path.banners);

            openFileDialog1.CheckFileExists  = true;
            openFileDialog1.Filter           = "Image Files(*.BMP;*.JPG;*.PNG)|*.BMP;*.JPG;*.PNG";
            openFileDialog1.FileName         = string.Empty;
            openFileDialog1.InitialDirectory = Settings.GetPath(Settings.Path.banners);

            // hard coded templates
            getHardCodedTemplates();

            foreach (Template temp in templates)
            {
                this.listBox1.Items.Add(temp.name);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Creates a List of Fanarts in your Thumbs folder
        /// </summary>
        void getFanart()
        {
            string fanartFolder = Settings.GetPath(Settings.Path.fanart);

            // Check if Fanart folder exists in MediaPortal's Thumbs directory
            if (System.IO.Directory.Exists(fanartFolder))
            {
                MPTVSeriesLog.Write("Checking for Fanart on series: ", Helper.getCorrespondingSeries(_seriesID).ToString(), MPTVSeriesLog.LogLevel.Debug);
                try
                {
                    // Create a Filename filter for Season / Series Fanart
                    string seasonFilter = string.Format(seasonFanArtFilenameFormat, _seriesID, _seasonIndex);
                    string seriesFilter = string.Format(seriesFanArtFilenameFormat, _seriesID);

                    string filter = _seasonMode ? seasonFilter : seriesFilter;

                    _fanArts = new List <string>();
                    // Store list of all fanart files found in all sub-directories of fanart thumbs folder
                    _fanArts.AddRange(System.IO.Directory.GetFiles(fanartFolder, filter, System.IO.SearchOption.AllDirectories));

                    // If no Season Fanart was found, see if any Series fanart exists
                    if (_fanArts.Count == 0 && _seasonMode)
                    {
                        MPTVSeriesLog.Write("No Season Fanart found on disk, searching for series fanart", MPTVSeriesLog.LogLevel.Debug);
                        _fanArts.AddRange(System.IO.Directory.GetFiles(fanartFolder, seriesFilter, System.IO.SearchOption.AllDirectories));
                    }

                    // Remove any files that we dont want e.g. thumbnails in the _cache folder
                    // and Season fanart if we are not in Season Mode
                    if (!_seasonMode)
                    {
                        removeSeasonFromSeries();
                    }
                    removeFromFanart("_cache");

                    MPTVSeriesLog.Write("Number of fanart found on disk: ", _fanArts.Count.ToString(), MPTVSeriesLog.LogLevel.Debug);
                }
                catch (Exception ex)
                {
                    MPTVSeriesLog.Write("An error occured looking for fanart: " + ex.Message);
                }
            }
        }
Beispiel #13
0
        public GetFanart(int SeriesID)
        {
            XmlNode node = OnlineAPI.getBannerList(SeriesID);

            if (node == null)
            {
                return;
            }

            foreach (XmlNode fanartNode in node.SelectNodes("/Banners/Banner[BannerType='fanart']"))
            {
                DBFanart dbf = new DBFanart();
                foreach (XmlNode propertyNode in fanartNode.ChildNodes)
                {
                    try
                    {
                        dbf[propertyNode.Name] = propertyNode.InnerText;
                    }
                    catch (Exception ex)
                    {
                        MPTVSeriesLog.Write("Error adding Fanart Property to DBEntry: " + propertyNode.Name + " - " + ex.Message);
                    }
                }

                // Sync local files with database
                string localPath = dbf[DBFanart.cBannerPath];
                localPath = localPath.Replace("/", @"\");
                string fanart = Helper.PathCombine(Settings.GetPath(Settings.Path.fanart), localPath);
                if (File.Exists(fanart))
                {
                    dbf[DBFanart.cLocalPath] = localPath;
                }
                else
                {
                    dbf[DBFanart.cLocalPath] = string.Empty;
                }

                dbf[DBFanart.cSeriesID] = SeriesID;
                _fanart.Add(dbf);
            }
        }
Beispiel #14
0
        private static void Backup()
        {
            MPTVSeriesLog.Write("Backing up database");

            string backupDirectory = Config.GetSubFolder(Config.Dir.Database, "MP-TVSeries_Backup");
            string sourceFile      = Settings.GetPath(Settings.Path.database);
            string destinationFile = Path.Combine(backupDirectory, "TVSeriesDatabase4.db3");

            try
            {
                if (!Directory.Exists(backupDirectory))
                {
                    Directory.CreateDirectory(backupDirectory);
                }

                File.Copy(sourceFile, destinationFile, true);
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("Failed to backup database. Source File = '{0}', Destination File = '{1}', Reason = '{2}'", sourceFile, destinationFile, ex.Message);
            }
        }
Beispiel #15
0
        static MPTVSeriesLog()
        {
            if (System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower() == "devenv")
            {
                return;
            }

            InitLogLevel();

            // let's rename the old one to .bak just like MP does
            try
            {
                if (File.Exists(m_filename))
                {
                    string bgFile = Settings.GetPath(Settings.Path.logBackup);
                    if (File.Exists(bgFile))
                    {
                        File.Delete(bgFile);
                    }
                    File.Move(m_filename, Settings.GetPath(Settings.Path.logBackup));
                }
            }
            catch (Exception e)
            {
                Write("Problem backing up Log file: " + e.Message);
            }
            try
            {
                m_LogStream = File.CreateText(m_filename);
                m_LogStream.Close();
                m_LogStream.Dispose();
            }
            catch (Exception)
            {
                // oopps, can't create file
            }

            pauseAutoWriteDB = true;
        }
Beispiel #16
0
        private List <DBFanart> getFanart(XmlNode aNode, int aSeriesID)
        {
            List <DBFanart> lFanarts = new List <DBFanart>();

            foreach (XmlNode fanartNode in aNode.SelectNodes("/Banners/Banner[BannerType='fanart']"))
            {
                DBFanart dbf = new DBFanart();
                foreach (XmlNode propertyNode in fanartNode.ChildNodes)
                {
                    try
                    {
                        dbf[propertyNode.Name] = propertyNode.InnerText;
                    }
                    catch (Exception ex)
                    {
                        MPTVSeriesLog.Write("Error adding Fanart Property to DBEntry: " + propertyNode.Name + " - " + ex.Message);
                    }
                }

                // Sync local files with database
                string localPath = GUITVSeries.Fanart.GetLocalPath(dbf);
                string fanart    = Helper.PathCombine(Settings.GetPath(Settings.Path.fanart), localPath);
                if (File.Exists(fanart))
                {
                    dbf[DBFanart.cLocalPath] = localPath;
                }
                else
                {
                    dbf[DBFanart.cLocalPath] = string.Empty;
                }

                dbf[DBFanart.cSeriesID] = aSeriesID;
                lFanarts.Add(dbf);
            }

            return(lFanarts);
        }
Beispiel #17
0
        static DBSeries()
        {
            // make sure the table is created on first run (and columns are added before we call SET)
            DBSeries dummy = new DBSeries();

            s_nLastLocalID = DBOption.GetOptions(DBOption.cDBSeriesLastLocalID);

            s_FieldToDisplayNameMap.Add(cParsedName, "Parsed Name");

            int nCurrentDBVersion = cDBVersion;
            int nUpgradeDBVersion = DBOption.GetOptions(DBOption.cDBSeriesVersion);

            while (nUpgradeDBVersion != nCurrentDBVersion)
            {
                SQLCondition    condEmpty = new SQLCondition();
                List <DBSeries> AllSeries = Get(condEmpty);

                // take care of the upgrade in the table
                switch (nUpgradeDBVersion)
                {
                case 1:
                case 2:
                    // upgrade to version 3; clear the series table (we use 2 other tables now)
                    try
                    {
                        String sqlQuery = "DROP TABLE series";
                        DBTVSeries.Execute(sqlQuery);
                        nUpgradeDBVersion++;
                    }
                    catch { }
                    break;

                case 3:
                    // set all new perseries timestamps to 0
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cGetEpisodesTimeStamp, 0, new SQLCondition());
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cUpdateBannersTimeStamp, 0, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 4:
                    DBSeries.GlobalSet(new DBSeries(), DBSeries.cHidden, 0, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 5:
                    // copy all local parsed name into the online series if seriesID = 0
                    SQLCondition conditions = new SQLCondition();
                    conditions.Add(new DBOnlineSeries(), DBOnlineSeries.cID, 0, SQLConditionType.LessThan);
                    // just getting the series should be enough
                    List <DBSeries> seriesList = DBSeries.Get(conditions);
                    nUpgradeDBVersion++;
                    break;

                case 6:
                    // set all watched flag timestamp to 0 (will be created)
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cWatchedFileTimeStamp, 0, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 7:
                    // all series no tagged for auto download at first
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cTaggedToDownload, 0, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 8:
                    // create the unwatcheditem value by parsin the episodes
                    foreach (DBSeries series in AllSeries)
                    {
                        DBEpisode episode = DBEpisode.GetFirstUnwatched(series[DBSeries.cID]);
                        if (episode != null)
                        {
                            series[DBOnlineSeries.cUnwatchedItems] = true;
                        }
                        else
                        {
                            series[DBOnlineSeries.cUnwatchedItems] = false;
                        }
                        series.Commit();
                    }
                    nUpgradeDBVersion++;
                    break;

                case 9:
                    // Set number of watched/unwatched episodes
                    foreach (DBSeries series in AllSeries)
                    {
                        int epsTotal     = 0;
                        int epsUnWatched = 0;
                        DBEpisode.GetSeriesEpisodeCounts(series[DBSeries.cID], out epsTotal, out epsUnWatched);
                        series[DBOnlineSeries.cEpisodeCount]      = epsTotal;
                        series[DBOnlineSeries.cEpisodesUnWatched] = epsUnWatched;
                        series.Commit();
                    }
                    nUpgradeDBVersion++;
                    break;

                case 10:
                    // Update Sort Name Column
                    foreach (DBSeries series in AllSeries)
                    {
                        series[DBOnlineSeries.cSortName] = Helper.GetSortByName(series[DBOnlineSeries.cPrettyName]);
                        series.Commit();
                    }
                    nUpgradeDBVersion++;
                    break;

                case 11:
                    // Migrate isFavourite to new Tagged View
                    conditions = new SQLCondition();
                    conditions.Add(new DBOnlineSeries(), DBOnlineSeries.cIsFavourite, "1", SQLConditionType.Equal);
                    seriesList = DBSeries.Get(conditions);

                    MPTVSeriesLog.Write("Migrating Favourite Series");
                    foreach (DBSeries series in seriesList)
                    {
                        // Tagged view are seperated with the pipe "|" character
                        string tagName = "|" + DBView.cTranslateTokenFavourite + "|";
                        series[DBOnlineSeries.cViewTags] = Helper.GetSeriesViewTags(series, true, tagName);
                        series.Commit();
                    }

                    // Migrate isOnlineFavourite to new TaggedView
                    conditions = new SQLCondition();
                    conditions.Add(new DBOnlineSeries(), DBOnlineSeries.cIsOnlineFavourite, "1", SQLConditionType.Equal);
                    seriesList = DBSeries.Get(conditions);

                    MPTVSeriesLog.Write("Migrating Online Favourite Series");
                    foreach (DBSeries series in seriesList)
                    {
                        // Tagged view are seperated with the pipe "|" character
                        string tagName = "|" + DBView.cTranslateTokenOnlineFavourite + "|";
                        series[DBOnlineSeries.cViewTags] = Helper.GetSeriesViewTags(series, true, tagName);
                        series.Commit();
                    }

                    nUpgradeDBVersion++;
                    break;

                case 12:
                    // we now have parsed_series names as titlecased
                    // to avoid users having to re-identify series for new episodes, and to avoid duplicate entries, we upgrade existing series names

                    foreach (var series in AllSeries)
                    {
                        string oldName = series[DBSeries.cParsedName];
                        string newName = oldName.ToTitleCase();
                        MPTVSeriesLog.Write(string.Format("Upgrading Parsed Series Name: {0} to {1}", oldName, newName));
                        series[DBSeries.cParsedName] = newName;
                        series.Commit();
                    }

                    nUpgradeDBVersion++;
                    break;

                case 13:
                    // original name not working in previous release
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cOriginalName, (DBValue)string.Empty, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 14:
                    // original name not working in previous release
                    DBOnlineSeries.GlobalSet(new DBOnlineSeries(), DBOnlineSeries.cTraktIgnore, 0, new SQLCondition());
                    nUpgradeDBVersion++;
                    break;

                case 15:
                    // delete the API cache associated with each series
                    try
                    {
                        string lCacheDir = Path.Combine(Settings.GetPath(Settings.Path.config), @"Cache");
                        Directory.Delete(lCacheDir, true);
                    }
                    catch (Exception) { }

                    nUpgradeDBVersion++;
                    break;

                default:
                    // new DB, nothing special to do
                    nUpgradeDBVersion = nCurrentDBVersion;
                    break;
                }
            }
            DBOption.SetOptions(DBOption.cDBSeriesVersion, nCurrentDBVersion);
        }