internal static void LinkFilmItemChains (IMLSection moviesSection, IMLItemList allFilmItems, IMLItem Item) { if (!MeediFier.Settings .FilmItemChainLinkerIsEnabled) return; if (allFilmItems == null || allFilmItems.Count <= 0) return; MainImportingEngine.ThisProgress.Progress (MainImportingEngine.CurrentProgress, "scanning for un-linked files..."); Application.DoEvents(); foreach (IMLItem item in allFilmItems) { string itemImdbID = Helpers .GetTagValueFromItem (item, "ImdbID"); string itemToCompareImdbID = Helpers .GetTagValueFromItem (Item, "ImdbID"); if (item.Location == Item.Location || itemImdbID != itemToCompareImdbID) continue; if (item.Location.StartsWith("|") || Item.Location.StartsWith("|")) continue; Item.Location = "|" + Item.Location + "|" + item.Location + "|"; Item.SaveTags(); moviesSection.DeleteItem(item); } }
private static void CleanEmptyFields(bool cleanEmptyFields, IMLSection section) { if (!cleanEmptyFields) return; //Importer.CurrentProgress++; MainImportingEngine.ThisProgress.Progress (MainImportingEngine.CurrentProgress, "Cleaning empty library fields..."); //Thread.Sleep(800); string[] tagNames = section.GetTagNames(); section.BeginUpdate(); foreach (string tagName in tagNames) { bool allTagValuesAreEmpty = true; //Importer.thisProgress.Progress(100, TagName); //Thread.Sleep(1000); if (tagName == "ToDelete") { } if (section.GetTagValues(tagName) == null) continue; string[] TagValues = section.GetTagValues(tagName); foreach (string tagvalue in TagValues.Where(tagvalue => !String.IsNullOrEmpty(tagvalue))) allTagValuesAreEmpty = false; if (allTagValuesAreEmpty) section.DeleteTag(tagName); } section.EndUpdate(); section.BeginUpdate(); //Importer.CurrentProgress++; MainImportingEngine.ThisProgress.Progress (MainImportingEngine.CurrentProgress, "Removing items marked for deletion..."); Thread.Sleep(800); IMLItemList itemsToDelete = section.SearchByTag("ToDelete", "true"); foreach (IMLItem t in itemsToDelete) section.DeleteItem(t); section.EndUpdate(); }
internal static void MoveToTvSection(IMLSection section, IMLSection tvSection, IMLItem item, bool ranFromTvSection, string seasonNumber, string episodeNumber, string seriesName) { if (tvSection == null) return; bool moveSeriesToTvSection = !ranFromTvSection; if (!moveSeriesToTvSection) return; Debugger.LogMessageToFile("Moving episode " + item.Name + " to TvEpisodes section..."); tvSection.BeginUpdate(); IMLItem tvItem = tvSection.AddNewItem(item.Name, item.Location); tvItem.Tags["SeasonNumber"] = seasonNumber; tvItem.Tags["EpisodeNumber"] = episodeNumber; tvItem.Tags["SeriesName"] = seriesName; tvItem.SaveTags(); tvSection.EndUpdate(); section.DeleteItem(item); }
private static void DeleteMediaImagesAndLibraryItem (IMLSection section, IMLItem item) { Debugger.LogMessageToFile(String.Format("The non-existent item {0}will be deleted from section.", item.Name)); Helpers.UpdateProgress ("Performing Diagnostic Operations", String.Format("The non-existent item " + "{0} will be deleted from section.", item.Name), item); Thread.Sleep(100); string imageFile = item.ImageFile; string fanart = (string) item.Tags["fanart"]; DeleteCoverAndFanartImages (fanart, imageFile); section.DeleteItem(item); }