internal static void AddFileToSection (out IMLItem item, IMLSection section, string itemName, string itemLocation, string externalID) { //TODO: Implement option to not update the Media Section on each imported item. if (Settings.UpdateMediaSectionOnEachImportedItem) { section.BeginUpdate(); } item = section.AddNewItem (itemName, itemLocation); item.ExternalID = externalID; item.SaveTags(); if (Settings.UpdateMediaSectionOnEachImportedItem) { section.EndUpdate(); } }
internal static bool ImportPcGame(WshShell shell, string linkPathName, IMLSection pcGamesSection ) { IWshShortcut link = (IWshShortcut)shell.CreateShortcut(linkPathName); FileInfo linkFile = new FileInfo(link.FullName); string shortcutName = linkFile.Name; shortcutName = shortcutName.Remove(shortcutName.Length - 4, 4); FileVersionInfo myFileVersionInfo; try { myFileVersionInfo = FileVersionInfo.GetVersionInfo(link.TargetPath); } catch (Exception e) { Debugger.LogMessageToFile("An unexpected error ocurred while trying to retrieve this game's version information from the game's executable. The error was: " + Environment.NewLine + e ); return false; } string title = myFileVersionInfo.ProductName; string company = myFileVersionInfo.CompanyName; string language = myFileVersionInfo.Language; string description = myFileVersionInfo.FileDescription; string version = myFileVersionInfo.FileVersion; IMLItem item = pcGamesSection.FindItemByLocation(link.TargetPath); if (item == null) item = pcGamesSection.AddNewItem(title, link.TargetPath); else return false; if (!String.IsNullOrEmpty(title)) { item.Name = title; item.Tags["Title"] = title; } else { item.Name = shortcutName; item.Tags["Title"] = shortcutName; } item.Tags["Company"] = company; item.Tags["Language"] = language; item.Tags["Description"] = description; item.Tags["Version"] = version; item.SaveTags(); return true; }
internal static void AddFileToSection(out IMLItem item, IMLSection section, string itemName, string itemLocation, string externalID) { //TODO: Implement option to not update the Media Section on each imported item. if (Settings.UpdateMediaSectionOnEachImportedItem) section.BeginUpdate(); item = section.AddNewItem (itemName, itemLocation); item.ExternalID = externalID; item.SaveTags(); if (Settings.UpdateMediaSectionOnEachImportedItem) section.EndUpdate(); }
private static void DownloadNewReleasesFromSource (string RssSource, IMLSection MediaSection, IMLSection ReleasesSection, ConnectionResult connResult, IEnumerable<string> combinedSceneTags) { WebClient client = new WebClient(); XmlDocument xDoc = new XmlDocument(); //Importer.thisProgress.Progress(Importer.CurrentProgress, "Scanning for new releases..."); Helpers.UpdateProgress("Updating Downloads library" + MediaSection.Name + "Section", "Scanning for new releases..." , null); //WebResponse response = Helpers.TryDatabaseRequest(RssSource,MediaSection.Name, "Mininova",null ); string xmlData = Downloaders.GetUrl(RssSource, null, true); if (String.IsNullOrEmpty(xmlData)) return; StringReader reader = new StringReader(xmlData); //if (response == null) //{ //MessageBox.Show("Unable to communicate with online source"); // return false; //} //Stream stream = response.GetResponseStream(); #region try to load online xml stream try { xDoc.Load(reader); } catch (Exception e) { MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "An error occured while reading the rss document. Please try later."); Thread.Sleep(1500); MessageBox.Show(e.ToString()); try { xDoc.Load(reader); } catch (Exception) { MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "An error occured while reading the rss document. Please try later."); Thread.Sleep(1500); return; } } #endregion //MessageBox.Show(xDoc.InnerXml); XmlNodeList torrents = xDoc.GetElementsByTagName("item"); foreach (XmlNode torrent in torrents) { XmlNodeList tags = torrent.ChildNodes; string title = ""; string year = ""; string seeds = ""; string leechers = ""; string link = ""; #region loop torrent tags and retrieve their values foreach (XmlNode tag in tags) { #region retrieve url if (tag.Name == "enclosure") { XmlAttributeCollection attributes = tag.Attributes; foreach (XmlAttribute attribute in attributes) { if (attribute.Name == "url") { //MessageBox.Show("attrib innertext: " + attribute.InnerText); link = attribute.InnerText; } } } #endregion if (tag.Name == "title") { //MessageBox.Show(tag.InnerText); #region parse release name and return film information Regex regex = new Regex(".*?(?<Title>.*?)\\[(?<Year>.*?)\\].*?\\((?<Seeds>.*?)S/(?<Leechers>.*?)L"); MatchCollection matches = regex.Matches(tag.InnerText); if (matches.Count == 0) { regex = new Regex("(?<Title>.*?)\\z"); matches = regex.Matches(tag.InnerText); if (matches.Count == 0) continue; } Match match = matches[0]; #region mine data from match int i = 0; foreach (Group group in match.Groups) { //Console.WriteLine(i); #region retrieve item tags from regex captures foreach (Capture captrue in @group.Captures) { #region extract title if (i == 1) //this is the image's url { title = captrue.Value; //MessageBox.Show("Title: " + captrue.Value); } #endregion #region extract year if (i == 2) { year = captrue.Value; //MessageBox.Show("Year: " + captrue.Value); } #endregion #region extract Seeds if (i == 3) { seeds = captrue.Value; //MessageBox.Show("Seeds: " + captrue.Value); } #endregion #region extract Leechers if (i == 4) { leechers = captrue.Value; //MessageBox.Show("Leechers: " + captrue.Value); } #endregion } #endregion i++; } #endregion #endregion } } #endregion #region check if torrent already exists IMLItemList items = ReleasesSection.SearchByLocation(link); if (items.Count != 0) continue; #endregion #region add & identify films ReleasesSection.BeginUpdate(); #region create new torrent item //MessageBox.Show(link); IMLItem Item = ReleasesSection.AddNewItem(title, link); Item.Tags["Title"] = title; Item.Tags["Year"] = year; Item.Tags["Seeds"] = seeds; Item.Tags["Peers"] = leechers; string imdbid = Helpers.GetTagValueFromItem(Item,"IMDbID"); Item.SaveTags(); #endregion //MessageBox.Show("Before: " + Item.Name); MovieFileMetadataExtractor.ExtractMetadataFromMovieFilename(Item, ref imdbid, combinedSceneTags); //MessageBox.Show("After: " + Item.Name); Item.Name = Item.Name.Replace('.', ' '); Item.Tags["Title"] = Item.Name; Item.SaveTags(); if (Settings.FilmRatingMin != 0) { IMDbOperations imdbOP = new IMDbOperations(); imdbOP._assistType = IMDbOperations.AssistType.Never; connResult.OSDbIsOnline = false; string tmp = ""; Helpers.IdentifyVideo(ref imdbid, ref tmp, ref imdbOP, Item, true, false, "", "", year , connResult, ReleasesSection); tmp = null; #region IMDb Detailer string HasDetails = Helpers.GetTagValueFromItem(Item,"HasDetails"); if (HasDetails != "True") { ////MessageBox.Show("About to d/load film details from IMDB..."); #region ...now get film details using this iMDBiD... //MessageBox.Show("imdbid before d/loading details is: " + imdbid); //MessageBox.Show("imdbOP._imdbID before d/loading details is: " + imdbOP._imdbID); if (imdbOP.ImdbId != "") imdbid = imdbOP.ImdbId; if (imdbid != "") imdbOP.ImdbId = imdbid; imdbOP.ImdbMovie = null; if (!String.IsNullOrEmpty(imdbOP.ImdbId)) { imdbid = imdbOP.ImdbId; //imdbOP._imdbID = imdbid; //////MessageBox.Show("imdbID before getting details is: " + imdbid ); //////MessageBox.Show("IMDbOP.imdbid is: " + imdbOP._imdbID); #region ...get the film's details. if (!imdbid.StartsWith("tt")) imdbid = "tt" + imdbid; // _progressText = "Grabbing IMDb ID: " + imdbOP._imdbID; MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Downloading details from IMDb for " + imdbOP.ImdbId + "..."); imdbOP.GetIMDbMovieDetails(imdbid, true); #endregion } #endregion #region ...finally if the movie struct is filled, save the film details in the item's fields. if (!String.IsNullOrEmpty(imdbid)) { //string Episode = imdbOP._imdbMovie.Episode; //MessageBox.Show(Episode); //MessageBox.Show("title before saving: " + imdbOP._imdbMovie.Title); //MessageBox.Show("... movie struct is filled, about to save details in tags..."); imdbOP.SaveIMDbMovieDetails(Item, ReleasesSection , imdbOP); if (Item.Name.StartsWith("\"")) { MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "This item is a TV episode."); Thread.Sleep(1000); MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Searching for episode information..."); imdbOP.SaveEpisodeInfo(imdbid, Item ); } //////MessageBox.Show("Saved movie details. continuing to cover art..."); //Item.Tags["HasDetails"] = "True"; //Item.SaveTags(); } #endregion } #endregion } ReleasesSection.EndUpdate(); #endregion #region Get torrent destination string location = Item.Location; string destination = ""; if (String.IsNullOrEmpty(Settings.TorrentsFolder)) destination = Debugger.GetPluginPath() + "test.torrent"; else { destination = Settings.TorrentsFolder + title + ".torrent"; } #endregion #region check if Title already exists in Releases section string Title = Helpers.GetTagValueFromItem(Item,"Title"); IMLItemList itemsb = ReleasesSection.SearchByTag("Title", Title); if (itemsb.Count > 1) continue; #endregion #region check if Title already exists in Movies section IMLItemList itemsc = MediaSection.SearchByTag("Title", Title); if (itemsc.Count != 0) continue; #endregion #region Donwload the torrent double review = Convert.ToDouble(Helpers.GetTagValueFromItem(Item,"Review")); if (review > Settings.FilmRatingMin || Settings.FilmRatingMin == 0) { //MessageBox.Show("destination: " + destination); //MessageBox.Show("location: " + location); #region Download torrent try { client.DownloadFile(location, destination); } catch (Exception e) { Debugger.LogMessageToFile("[RSS torrent downloader] The torrent '" + location + "' could not be downloaded. The erros was: " + e.ToString() ); } #endregion #region Start torrent //if (String.IsNullOrEmpty(Importer.TorrentsFolder)) //{ #region start torrent directly Process p = new Process(); p.StartInfo.FileName = destination; p.Start(); //while (!p.HasExited) //{ // Application.DoEvents(); // Thread.Sleep(50); //} Thread.Sleep(5000); try { File.Delete(destination); } catch { } #endregion //} #endregion } #endregion } }
public static void SynchronizeITunesIpod(IMLSection MusicSection) { Importer.CurrentProgress = 0; Importer.GeneralStatus = "Synchronizing iTunes..."; Importer.SpecialStatus = String.Empty; #region iTunes % iPod if (Settings.WantItunesSync && Settings.WantToUpdateMusicSection && MusicSection != null) { try { iTunesLib.IiTunes iTunesApp; iTunesLib.IITLibraryPlaylist playlist; iTunesLib.IITTrackCollection TrackCollection; #region Launch itunes //Importer.CurrentProgress++; Importer.ThisProgress.Progress(Importer.CurrentProgress, "Launching iTunes..."); iTunesApp = new iTunesLib.iTunesAppClass(); Thread.Sleep(5000); iTunesLib.IITWindowCollection windows = iTunesApp.Windows; foreach (iTunesLib.IITWindow window in windows) { if (window.Name == "iTunes") { window.Minimized = true; } } #endregion #region iTunes Synchronizer #region sync libraries playlist = iTunesApp.LibraryPlaylist; TrackCollection = playlist.Tracks; MusicSection.BeginUpdate(); try { foreach (iTunesLib.IITTrack track in TrackCollection) { if (track.Kind == iTunesLib.ITTrackKind.ITTrackKindFile) { iTunesLib.IITPlaylist trackPlaylist = track.Playlist; //MessageBox.Show(trackPlaylist.Name); //iTunesLib.IITPlaylist track_playlist = track.Playlist; //MessageBox.Show("Track playlist: " + track_playlist.Name); iTunesLib.IITFileOrCDTrack file = (iTunesLib.IITFileOrCDTrack)track; if (file.Location != "" && file.Location != null) { FileInfo fiB = new FileInfo(file.Location); //MessageBox.Show(fiB.Extension); #region check to make sure that the file is not video... if (fiB.Extension != ".m4v") { IMLItem Item = MusicSection.FindItemByLocation(file.Location); if (Item == null && file.Podcast == false) { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Adding audio track " + track.Name + " to music library..."); Item = MusicSection.AddNewItem(track.Name, file.Location); #region write item tags Item.Tags["Artist"] = track.Artist; Item.Tags["Album"] = track.Album; Item.Tags["Title"] = track.Name; Item.Tags["Genre"] = track.Genre; if (track.TrackNumber != 0) Item.Tags["Track"] = track.TrackNumber; if (track.Year != 0) Item.Tags["Year"] = track.Year; try { if (file.Lyrics != null && file.Lyrics != "") Item.Tags["Lyrics"] = file.Lyrics; } catch (Exception) { } if (track.Rating != 0) Item.Tags["Rating"] = Convert.ToString(track.Rating); if (track.SampleRate != 0) Item.Tags["SampleRate"] = track.SampleRate; if (track.BitRate != 0) Item.Tags["BitRate"] = track.BitRate; if (track.Duration != 0) Item.Tags["Duration"] = track.Duration; #endregion #region save artwork to file and add to imagefield try { iTunesLib.IITArtworkCollection artworks = track.Artwork; foreach (iTunesLib.IITArtwork artwork in artworks) { FileInfo fi = new FileInfo(file.Location); DirectoryInfo di = fi.Directory; string trackDirectory = di.FullName; string artworkPath = trackDirectory + @"\" + "folder.jpg"; //MessageBox.Show(artworkPath); artwork.SaveArtworkToFile(artworkPath); Item.ImageFile = artworkPath; } } catch (Exception) { } #endregion Item.SaveTags(); } } #endregion } } } } catch (Exception e) { MusicSection.EndUpdate(); MessageBox.Show(e.ToString()); } MusicSection.EndUpdate(); #endregion #endregion #region manage and Update iPod //iTunesApp.UpdateIPod(); iTunesLib.IITSourceCollection sources = iTunesApp.Sources; foreach (iTunesLib.IITSource source in sources) { //MessageBox.Show(source.Name); if (source.Kind == iTunesLib.ITSourceKind.ITSourceKindIPod) { object iSource = source; //iTunesLib.IITLibraryPlaylist MyPlaylist =(iTunesLib.IITLibraryPlaylist) iTunesApp.CreatePlaylistInSource("MyPlaylist", ref iSource); //MyPlaylist.AddFile("D:\test.mp3"); //iTunesLib.IITPlaylistCollection iPodPlaylists = source.Playlists; //foreach (iTunesLib.IITPlaylist ipodPlaylist in iPodPlaylists) //{ // //MessageBox.Show("iPod library name:" + ipodlibrary.Name); // //MessageBox.Show("Duration: " + Convert.ToString(ipodlibrary.Duration)); // if (ipodPlaylist.Kind == iTunesLib.ITPlaylistKind.ITPlaylistKindLibrary) // { // iTunesLib.IITLibraryPlaylist iPodLibrary = (iTunesLib.IITLibraryPlaylist)ipodPlaylist; // iPodLibrary.AddFile("D:\test.mp3"); // } //} } //foreach (iTunesLib.IITLibraryPlaylist ipodlibrary in ipodPlaylists) //{ // MessageBox.Show("Passed 4"); // MessageBox.Show(Convert.ToString(ipodlibrary.Duration)); //} } #endregion } catch (Exception) { } } #endregion }
private void IdentifyBluRayDisc(string drive, IMLSection moviesSection, string d2) { if (!Settings.BRMovieOptions && !Settings.BRTVOptions) return; if (!Directory.Exists(drive + ":\\BDMV")) return; #region Get Movie name //IF BLURAY, GET MOVIE NAME FROM META XML FILE ON DISC _brTitle3 = DVDUtils.GetBluRayTitle(drive); if (!String.IsNullOrEmpty(_brTitle3)) Helpers.UpdateProgress(Importer.GeneralStatus, "Blu-Ray identified as " + _brTitle3, null); //IF NAME IS NOT FOUND, PROMPT USER FOR MOVIE NAME bool manualTitle = false; if (String.IsNullOrEmpty(_brTitle3) && Settings.PromptForOfflineMediaName) { _brTitle3 = InputBox.Show("Please enter the film's title:", "MediaFairy offline media importer"); if (!String.IsNullOrEmpty(_brTitle3)) manualTitle = true; } #endregion #region Tv Series /////////////////////////BLU-RAY TV CODE////////////////////// //if (Importer.BRTVOptions) //{ // //DETERMINE IF BLU-RAY MIGHT CONTAIN TV EPISODES // String TVServerDirectory = ""; // SeriesName = BRTitle3; // tvShow = ToolBox.DVDUtils.IsTVSeries(SeriesName); // if (tvShow == true) // { // //CONFIRM DVD IS TV SERIES WITH DIALOG BOX // string Description = (SeriesName + " has been identified as a disc that may contain television episodes. Please confirm if this is a TV or Movie DVD."); // //ToolBox.MeedioUtils.ShowDialogBox(MeedioSystem, Message, "Please confirm disc type", Description, "yes/no", "TV Series", "Movie", Log, swWriteLog); // DialogResult result = MessageBox.Show(Description, "Please confirm disc type", MessageBoxButtons.YesNo); // //SHOW ON SCREEN KEYBOARD AND CONFIRM SEASON NUMBER // string SeasonNumber = ToolBox.DVDUtils.GetSeasonNumber(D2); // ToolBox.MeedioUtils.ShowOnScreenKeyboard(MeedioSystem, Message, "Please confirm season number", SeasonNumber, Log, swWriteLog); // SeasonNumber = InputBox.Show("Please confirm season number", "Confirm season number", SeasonNumber); // //mre.WaitOne(); //Pause and wait // //mre.Reset(); //Reset thread wait // string SeasonNumforFileName = BRTitle3.Trim().PadLeft(2, '0'); // SeasonNumber = "Season " + BRTitle3.Trim().PadLeft(2, '0'); // //SHOW ON SCREEN KEYBOARD AND CONFIRM DISC NUMBER // string DiscNumber = ToolBox.DVDUtils.GetSeasonDiscNumber(D2); // ToolBox.MeedioUtils.ShowOnScreenKeyboard(MeedioSystem, Message, "Please confirm disc number", DiscNumber, Log, swWriteLog); // mre.WaitOne(); //Pause and wait // mre.Reset(); //Reset thread wait // string DiscNumberforFileName = BRTitle3.Trim().PadLeft(2, '0'); // DiscNumber = BRTitle3.Trim(); // string SeriesforFileName = ToolBox.StringFunctions.replaceIllegalCharacters(SeriesName, " "); // string FileName = SeriesforFileName + " S" + SeasonNumforFileName + "D" + DiscNumberforFileName; // Debugger.LogMessageToFile("[MAIN CODE] - Series name: " + SeriesName); // //CREATE DIRECTORY ON SERVER // SeriesName = (SeriesName + "\\" + SeasonNumber).Trim(); // TVServerDirectory = CreateDirectory(SeriesName, "", "", "TV"); // Debugger.LogMessageToFile("[MAIN CODE] - TV server directory: " + TVServerDirectory); // #region EJECT DVD // // EJECT DVD // if (Importer.EjectDvd) // { // try // { // ToolBox.DVDUtils.MCICDROM.Eject(D2); // } // catch (Exception e) // { // Debugger.LogMessageToFile("[MAIN CODE] - Error on OnMessage: " + e.ToString()); // } // } // #endregion // } //} #endregion #region Movies if (_tvShow == false) { #region GET YEAR FROM BRDISC FILE CREATION DATE String brPlaylistDirectory = (drive + ":\\BDMV\\PLAYLIST"); String[] brPlaylistFiles = Directory.GetFiles(brPlaylistDirectory, "*.MPLS", SearchOption.AllDirectories); String brYear = string.Empty; foreach (string f in brPlaylistFiles) { try { DateTime BRDate = File.GetCreationTime(Path.GetFullPath(f)); int intYear = BRDate.Year; brYear = Convert.ToString(intYear); Debugger.LogMessageToFile("Year from file: " + brYear); break; } catch (Exception) { //TODO: Handle exception } } #endregion #region GET IMDb BASED ON NAME & YEAR try { _movieImdbId = ""; _movieImdbId = GetIMDBID(_brTitle3, "", "", brYear, ""); Debugger.LogMessageToFile("IMDb ID: " + _movieImdbId); } catch (Exception e) { Debugger.LogMessageToFile("An error occurred in GetIMDBID function: " + e.ToString()); } #endregion //GET IMDB TITLE IF TITLE WAS MANUALLY ENTERED if (_movieImdbId != "" && manualTitle == true) { _brTitle3 = GetIMDBTITLE(_movieImdbId); Debugger.LogMessageToFile("Manually entered name adjusted to IMDb title: " + _brTitle3); } #region Create new library entry for Bluray IMLItem Item = moviesSection.AddNewItem(_brTitle3,""); Item.ExternalID = drive + ""; Item.Tags["DiscID"] = _hexId; Item.Tags["IMDbID"] = _movieImdbId; Item.SaveTags(); #endregion } #endregion EjectDvd(d2, drive); }
private void IdentifyDvdDisc(IMLSection moviesSection, string drive, string d2) { if (!Settings.DVDMovieOptions && !Settings.DVDTVOptions) return; if (!Directory.Exists(drive + ":\\VIDEO_TS")) return; //IF DISC IS A REGULAR DVD RUN THE FOLLOWING CODE: AnyDvd(false); //Disable AnyDVD #region Get DVD disc ID try { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Getting Disc ID..."); _hexId = DVDUtils.GetDVDID(drive); } catch (Exception e) { Debugger.LogMessageToFile("[MAIN CODE] - Error getting DVDID: " + e); } #endregion AnyDvd(true); //Re-enable AnyDVD if (DVDUtils.IsAnyDVDRunning()) { Debugger.LogMessageToFile("[MAIN CODE] - Waiting for AnyDVD to read disc..."); Thread.Sleep(5000); //wait for anydvd to process disc } #region Check if disc is TV Series if (Settings.DVDTVOptions) { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Recognizing Series..."); //GET DVD NAME AND EPISODE NAME FOR TVDB SEARCH try { _seriesName = DVDWebUtils.DVDTitle(_hexId); if (_seriesName.Contains(":")) { int pos = _seriesName.IndexOf(":"); String s2 = _seriesName.Remove(pos); _seriesName = s2.Trim(); } } catch (Exception e) { //TODO: Handle exception } //DETERMINE IF DVD MIGHT CONTAIN TV EPISODES _tvShow = DVDUtils.IsTVSeries(_seriesName); } #endregion #region TV Series /////////////////////////DVD TV CODE////////////////////// //if (tvShow) //{ // String TVServerDirectory = ""; // //CONFIRM DVD IS TV SERIES WITH DIALOG BOX // string Description = (SeriesName + " has been identified as a disc that may contain television episodes. Please confirm if this is a TV or Movie DVD."); // //ToolBox.MeedioUtils.ShowDialogBox(MeedioSystem, Message, "Please confirm disc type", Description, "yes/no", "TV Series", "Movie"); // DialogResult result = MessageBox.Show(Description, "Please confirm disc type", MessageBoxButtons.YesNo); // if (result == DialogResult.Yes) // tvShow = true; // else tvShow = false; // if (tvShow == true) // { // //SHOW ON SCREEN KEYBOARD AND CONFIRM SEASON NUMBER // string SeasonNumber = ToolBox.DVDUtils.GetSeasonNumber(D2); // //ToolBox.MeedioUtils.ShowOnScreenKeyboard(MeedioSystem, Message, "Please confirm season number", SeasonNumber); // SeasonNumber = InputBox.Show("Plase confirm season number", "Confirm season", SeasonNumber); // //mre.WaitOne(); //Pause and wait for input // //mre.Reset(); //Reset thread wait // string SeasonNumforFileName = DVDTitle.Trim().PadLeft(2, '0'); // SeasonNumber = "Season " + DVDTitle.Trim().PadLeft(2, '0'); // //SHOW ON SCREEN KEYBOARD AND CONFIRM DISC NUMBER // string DiscNumber = ToolBox.DVDUtils.GetSeasonDiscNumber(D2); // //ToolBox.MeedioUtils.ShowOnScreenKeyboard(MeedioSystem, Message, "Please confirm disc number", DiscNumber); // DiscNumber = InputBox.Show("Plase confirm disc number", "Confirm disc number", DiscNumber); // //mre.WaitOne(); //Pause and wait for input // //mre.Reset(); //Reset thread wait // string DiscNumberforFileName = DVDTitle.Trim().PadLeft(2, '0'); // DiscNumber = DVDTitle.Trim(); // string SeriesforFileName = ToolBox.StringFunctions.replaceIllegalCharacters(SeriesName, " "); // string FileName = SeriesforFileName + " S" + SeasonNumforFileName + "D" + DiscNumberforFileName; // Debugger.LogMessageToFile("[MAIN CODE] - Series name: " + SeriesName); // //CREATE DIRECTORY ON SERVER // SeriesName = (SeriesName + "\\" + SeasonNumber).Trim(); // TVServerDirectory = CreateDirectory(SeriesName, "", "", "TV"); // Debugger.LogMessageToFile("[MAIN CODE] - TV server directory: " + TVServerDirectory); // } // //EJECT DVD // ToolBox.DVDUtils.MCICDROM.Eject(D2); //} #endregion #region Film Identifier if (_tvShow == false) { #region Get DVD film's primary keys try { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Trying to identify film by Disc ID..."); _dvdTitle = DVDWebUtils.DVDTitle(_hexId); _dvdDirectors = DVDWebUtils.DVDDirector(_hexId); _dvdActors = DVDWebUtils.DVDFirstActor(_hexId); if (!String.IsNullOrEmpty(_dvdTitle)) MessageBox.Show(Resources.DiscIdentifier_IdentifyDvdDisc_DVD_identified_as_ + _dvdTitle); } catch (Exception e) { Debugger.LogMessageToFile("Error retrieving online data for this DVD film: " + e.ToString()); } #endregion #region If Title was not recognized, prompt for Title bool manualTitle = false; if (String.IsNullOrEmpty(_dvdTitle) && Settings.PromptForOfflineMediaName) { //ToolBox.MeedioUtils.ShowOnScreenKeyboard(MeedioSystem, Message, "Please enter movie title", "", Log, swWriteLog); _dvdTitle = InputBox.Show("Please enter the Title of this film: ", "Enter film Title"); if (!String.IsNullOrEmpty(_dvdTitle)) manualTitle = true; } #endregion #region Match MS Director and Actor to IMDb ID try { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Getting film IMDb ID..."); _movieImdbId = ""; _movieImdbId = GetIMDBID(_dvdTitle, _dvdDirectors, _dvdActors, "", _hexId); Debugger.LogMessageToFile("IMDb ID: " + _movieImdbId); } catch (Exception e) { Debugger.LogMessageToFile("Error matching MS Director and Actor to IMDb ID: " + e.ToString()); } #endregion #region GET IMDB TITLE IF TITLE IS MANUALLY ENTERED if (!String.IsNullOrEmpty(_movieImdbId) && manualTitle) { Importer.ThisProgress.Progress(Importer.CurrentProgress, "Getting IMDb film Title..."); _dvdTitle = GetIMDBTITLE(_movieImdbId); Debugger.LogMessageToFile("Manually entered name adjusted to IMDb title: " + _dvdTitle); } #endregion #region Create new library entry for DVD Importer.ThisProgress.Progress(Importer.CurrentProgress, "Adding disc to films section..."); IMLItem Item = moviesSection.AddNewItem(_dvdTitle, drive + ":\\VIDEO_TS\\video_ts.ifo"); Item.ExternalID = drive + ":\\VIDEO_TS\\video_ts.ifo"; Item.Tags["DiscID"] = _hexId; Item.Tags["IMDbID"] = _movieImdbId; Item.SaveTags(); #endregion } #endregion EjectDvd(d2, drive); }
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 IMLItem CreateFeedEntry (IMLSection newsSection, RssItem rssItem) { Debugger.LogMessageToFile("[RSS news downloader] Creating RSS feed entry..."); IMLItem item = newsSection.AddNewItem(rssItem.Title, rssItem.Link); item.ExternalID = rssItem.Link; return item; }
public bool Import(IMLSection Section, IMLImportProgress Progress) { XmlDocument IceCastDirectoryXml = new XmlDocument(); WebClient client = new WebClient(); const string iceCastDirectoryURL = "http://dir.xiph.org/yp.xml"; Console.WriteLine("Downloading xml data..."); Progress.Progress(0, "Loading IceCast station directory..."); byte[] data = client.DownloadData(iceCastDirectoryURL); Stream stream = new MemoryStream(data); IceCastDirectoryXml.Load(stream); XmlNode directoryNode = IceCastDirectoryXml.ChildNodes[1]; Console.WriteLine(directoryNode.Name); XmlNodeList directoryEntries = directoryNode.ChildNodes; Section.BeginUpdate(); foreach (XmlNode radioStation in directoryEntries) { XmlNodeList stationProperties = radioStation.ChildNodes; string itemName = String.Empty; string itemLocation = String.Empty; string itemBitrate = String.Empty; string itemGenre = String.Empty; foreach (XmlNode stationProperty in stationProperties) { if (stationProperty.Name == "server_name") { itemName = stationProperty.InnerText; } if (stationProperty.Name == "listen_url") { itemLocation = stationProperty.InnerText; } if (stationProperty.Name == "bitrate") { itemBitrate = stationProperty.InnerText; } if (stationProperty.Name == "genre") { itemGenre = stationProperty.InnerText; } } if (String.IsNullOrEmpty(itemName)) continue; if (String.IsNullOrEmpty(itemLocation)) continue; IMLItem item = Section.AddNewItem (itemName, itemLocation); item.Tags["BitRate"] = itemBitrate; item.Tags["Genre"] = itemGenre; item.SaveTags(); } Section.EndUpdate(); Progress.Progress(100, "RadioActive completed succesfully!"); return true; }
internal static void AddFileToSection(out IMLItem item, IMLSection section, string itemName, string itemLocation, string externalID) { //TODO: Implement option to not update the Media Section on each imported item. if (Settings.UpdateMediaSectionOnEachImportedItem) section.BeginUpdate(); item = section.AddNewItem(itemName, itemLocation); item.ExternalID = externalID; item.SaveTags(); //BUG: Enabling this function makes importer unable to inport files! //MediaSectionPopulatorHelpers.ImportDates(item, externalID); if (Settings.UpdateMediaSectionOnEachImportedItem) section.EndUpdate(); }