private string CreateDiscInfo(MediaInfo2 mi) { string pattern = mDiscInfo; if (mi.Overall != null) { string gi = GetGeneralInfo(mGeneralInfo, mi.Overall); string vi = GetVideoInfo(mDiscVideoInfo, mi.Overall); string ai = GetAudioInfo(mDiscAudioInfo, mi.Overall); pattern = Regex.Replace(pattern, "%General_Info%", gi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Video_Info%", vi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Audio_Info%", ai, RegexOptions.IgnoreCase); pattern = GetStringFromAnyPattern(pattern, mi.Overall); pattern = GetStyles(pattern); // apply any formatting foreach (MediaFile mf in mi.MediaFiles) { if (mf.Thumbnailer != null) { pattern = GetScreenshotInfo(pattern, mf); break; } } } return(pattern); }
private string CreateDiscInfo(MediaInfo2 mi) { string pattern = mDiscInfo; if (mi.Overall != null) { string gi = GetGeneralInfo(mGeneralInfo, mi.Overall); string vi = GetVideoInfo(mDiscVideoInfo, mi.Overall); string ai = GetAudioInfo(mDiscAudioInfo, mi.Overall); pattern = pattern.ReplaceCode("%General_Info%", gi); pattern = pattern.ReplaceCode("%Video_Info%", vi); pattern = pattern.ReplaceCode("%Audio_Info%", ai); pattern = GetStringFromAnyPattern(pattern, mi.Overall); pattern = GetStyles(pattern); // apply any formatting foreach (MediaFile mf in mi.MediaFiles) { if (mf.Screenshots.Count > 0) { pattern = GetScreenshotInfo(pattern, mf); break; } } } return(pattern); }
private string CreateFileInfo(MediaInfo2 mi) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < mi.MediaFiles.Count; i++) { MediaFile mf = mi.MediaFiles[i]; string pattern = mFileInfo; string gi = GetGeneralInfo(mGeneralInfo, mf); string vi = GetVideoInfo(mFileVideoInfo, mf); // this is our %Video_Info% string ai = GetAudioInfo(mFileAudioInfo, mf); // this is our %Audio_Info% pattern = Regex.Replace(pattern, "%General_Info%", gi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Video_Info%", vi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Audio_Info%", ai, RegexOptions.IgnoreCase); pattern = GetStringFromAnyPattern(pattern, mf); pattern = GetStyles(pattern); // apply any formatting pattern = GetScreenshotInfo(pattern, mf); sb.AppendLine(pattern); } return(sb.ToString()); }
private string GetSourceInfo(string pattern, MediaInfo2 mi) { if (!string.IsNullOrEmpty(mi.Title)) { pattern = Regex.Replace(pattern, "%Title%", mi.Title, RegexOptions.IgnoreCase); } pattern = Regex.Replace(pattern, "%Source%", mi.Source, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Menu%", mi.Menu, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Extras%", mi.Extras, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Authoring%", mi.Authoring, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%WebLink%", mi.WebLink, RegexOptions.IgnoreCase); return(pattern); }
private string GetSourceInfo(string pattern, MediaInfo2 mi) { try { pattern = pattern.ReplaceCode("%Title%", mi.Title); pattern = pattern.ReplaceCode("%Source%", mi.Source); pattern = pattern.ReplaceCode("%Disc_Menu%", mi.Menu); pattern = pattern.ReplaceCode("%Disc_Extras%", mi.Extras); pattern = pattern.ReplaceCode("%Disc_Authoring%", mi.Authoring); pattern = pattern.ReplaceCode("%WebLink%", mi.WebLink); } catch (Exception) { } return(pattern); }
private string GetSourceInfo(string pattern, MediaInfo2 mi) { if (!string.IsNullOrEmpty(mi.Title)) { pattern = Regex.Replace(pattern, "%Title%", mi.Title, RegexOptions.IgnoreCase); } pattern = Regex.Replace(pattern, "%Source%", mi.Source, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Menu%", mi.Menu, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Extras%", mi.Extras, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Disc_Authoring%", mi.Authoring, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%WebLink%", mi.WebLink, RegexOptions.IgnoreCase); return pattern; }
private string CreateFileInfo(MediaInfo2 mi) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < mi.MediaFiles.Count; i++) { MediaFile mf = mi.MediaFiles[i]; string pattern = mFileInfo; string gi = GetGeneralInfo(mGeneralInfo, mf); string vi = GetVideoInfo(mFileVideoInfo, mf); // this is our %Video_Info% string ai = GetAudioInfo(mFileAudioInfo, mf); // this is our %Audio_Info% pattern = Regex.Replace(pattern, "%General_Info%", gi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Video_Info%", vi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Audio_Info%", ai, RegexOptions.IgnoreCase); pattern = GetStringFromAnyPattern(pattern, mf); pattern = GetStyles(pattern); // apply any formatting pattern = GetScreenshotInfo(pattern, mf); sb.AppendLine(pattern); } return sb.ToString(); }
private string CreateDiscInfo(MediaInfo2 mi) { string pattern = mDiscInfo; if (mi.Overall != null) { string gi = GetGeneralInfo(mGeneralInfo, mi.Overall); string vi = GetVideoInfo(mDiscVideoInfo, mi.Overall); string ai = GetAudioInfo(mDiscAudioInfo, mi.Overall); pattern = Regex.Replace(pattern, "%General_Info%", gi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Video_Info%", vi, RegexOptions.IgnoreCase); pattern = Regex.Replace(pattern, "%Audio_Info%", ai, RegexOptions.IgnoreCase); pattern = GetStringFromAnyPattern(pattern, mi.Overall); pattern = GetStyles(pattern); // apply any formatting foreach (MediaFile mf in mi.MediaFiles) { if (mf.Screenshot != null) { pattern = GetScreenshotInfo(pattern, mf); break; } } } return pattern; }
public TorrentInfo(BackgroundWorker bwApp, MediaInfo2 mi) : this(mi) { this.BwAppMy = bwApp; }
public TorrentInfo(MediaInfo2 mi) { this.Media = mi; }
public static XMLTorrentUpload GetXMLTorrentUpload(MediaInfo2 mi) { string format = string.Empty; string res = string.Empty; string media = mi.Source; if (mi.MediaTypeChoice == MediaType.MediaDisc) { format = mi.Source; res = mi.Overall.Video.Standard; if (format == "DVD-5" || format == "DVD-9") { media = "DVD"; } } else if (!string.IsNullOrEmpty(mi.Overall.Video.Codec)) { string codec = mi.Overall.Video.Codec.ToLower(); if (codec.Contains("divx")) { format = "DivX"; } else if (codec.Contains("xvid")) { format = "XviD"; } else if (codec.Contains("avc") || codec.Contains("x264")) { format = "H.264"; } } if (string.IsNullOrEmpty(res) && !string.IsNullOrEmpty(mi.Overall.Video.Height) && !string.IsNullOrEmpty(mi.Overall.Video.Width)) { string height = mi.Overall.Video.Height; double dblWidth = 0.0; double dblHeight = 0.0; double.TryParse(mi.Overall.Video.Width, out dblWidth); double.TryParse(height, out dblHeight); if (dblWidth > 1900) { res = "1080p"; } else if (dblWidth > 1200) { res = "720p"; } else if (dblHeight > 480) { res = "576p"; } else if (dblWidth > 700) { res = "480p"; } else { res = mi.Overall.Video.Resolution; } } string fileType = string.Empty; string ext = mi.Overall.FileExtension.ToLower(); string[] exts = new string[] { "avi", "mpg", "mpeg", "mkv", "mp4", "vob", "iso" }; if (!string.IsNullOrEmpty(ext)) { foreach (string exMy in exts) { if (ext.Contains(exMy)) { fileType = exMy.ToUpper(); fileType = fileType.Replace("MPEG", "MPG"); fileType = fileType.Replace("VOB", "VOB IFO"); break; } } } XMLTorrentUpload xmlUpload = new XMLTorrentUpload() { TorrentFilePath = mi.TorrentCreateInfoMy.TorrentFilePath, ReleaseDescription = mi.ReleaseDescription, MediaInfoSummary = mi.Overall.Summary, Format = format, Resolution = res, Width = mi.Overall.Video.Width, Height = mi.Overall.Video.Height, Media = media, FileType = fileType }; if (mi.UploadScreenshots) { switch (mi.MediaTypeChoice) { case MediaType.MediaDisc: foreach (Screenshot ss in mi.Overall.Thumbnailer.Screenshots) { xmlUpload.Screenshots.Add(ss.FullImageLink); } break; default: foreach (MediaFile mf in mi.MediaFiles) { foreach (Screenshot ss in mf.Thumbnailer.Screenshots) { xmlUpload.Screenshots.Add(ss.FullImageLink); } } break; } } return(xmlUpload); }
private MediaInfo2 PrepareNewMedia(WorkerTask wt, string p) { MediaType mt = wt.MediaOptions.MediaTypeChoice; MediaInfo2 mi = new MediaInfo2(wt.MediaOptions, p); mi.Extras = cboExtras.Text; if (cboSource.Text == "DVD") { mi.Source = Adapter.GetDVDString(p); } else { mi.Source = cboSource.Text; } mi.Menu = cboDiscMenu.Text; mi.Authoring = cboAuthoring.Text; mi.WebLink = txtWebLink.Text; mi.TorrentCreateInfo = new TorrentCreateInfo(App.Settings.ProfileActive, p); if (App.Settings.ProfileActive.Publisher == PublishInfoType.ExternalTemplate) { mi.TemplateLocation = Path.Combine(App.TemplatesDir, App.Settings.ProfileActive.PublisherExternalTemplateName); } return mi; }
public TorrentInfo(MediaInfo2 mi) { Media = mi; Success = true; // set to false if error }
private static void Main(string[] args) { string dirImages = string.Empty; string dirRoot = string.Empty; string mSettingsFilePath = string.Empty; string dirTorrents = string.Empty; bool mFileCollection = false; bool mShowHelp = false; var p = new OptionSet() { { "c", "Treat multiple files as a collection", v => mFileCollection = v != null }, { "m|media=", "Location of the media file/folder", v => mMediaLoc = v }, { "o|options=", "Location of the settings file", v => mSettingsFilePath = v }, { "rd=", "Root directory for screenshots, torrent and all other output files. Overrides all other custom folders.", v => dirRoot = v }, { "s", "Create screenshots", v => mScreenshotsCreate = v != null }, { "sd=", "Create screenshots in a custom folder and upload", v => dirImages = v }, { "t", "Create torrent file in the parent folder of the media file", v => mTorrentCreate = v != null }, { "td=", "Create torrent file in a custom folder", v => dirTorrents = v }, { "u", "Upload screenshots", v => mScreenshotsUpload = v != null }, { "x|xml", "Folder path of the XML torrent description file", v => mXmlCreate = v != null }, { "h|help", "Show this message and exit", v => mShowHelp = v != null } }; if (args.Length == 0) { mShowHelp = true; } // give cli the ability to replace environment variables string[] args2 = new string[args.Length]; int count = 0; foreach (string arg in args) { args2[count++] = arg.Replace("%appdata%", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)); } try { p.Parse(args2); // set root folder for images or set images dir if set one mScreenshotDir = Directory.Exists(dirRoot) ? dirRoot : dirImages; // set root folder for torrents or set torrents dir if set one mTorrentsDir = Directory.Exists(dirRoot) ? dirRoot : dirTorrents; } catch (Exception ex) { Console.Write("tdmakercli: "); Console.WriteLine(ex.Message); Console.WriteLine("Try 'tdmakercli --help' for more information."); return; } if (mShowHelp) { ShowHelp(p); return; } if (!File.Exists(mSettingsFilePath)) { mSettingsFilePath = App.SettingsFilePath; } if (File.Exists(mSettingsFilePath)) { App.Settings = Settings.Load(mSettingsFilePath); App.UploadersConfig = UploadersConfig.Load(App.UploadersConfigPath); } if (App.Settings != null) { App.InitializeDefaultFolderPaths(); List<string> listFileOrDir = new List<string>() { mMediaLoc }; MediaWizardOptions mwo = Adapter.GetMediaType(listFileOrDir, true); if (mwo.MediaTypeChoice == MediaType.MediaIndiv && mFileCollection) { mwo.MediaTypeChoice = MediaType.MediaCollection; } MediaInfo2 mi = new MediaInfo2(mwo, mMediaLoc); mi.ReadMedia(); TorrentInfo ti = new TorrentInfo(mi); mi.Options.UploadScreenshots = mScreenshotsUpload; if (mScreenshotsUpload) { CreateScreenshots(ti); ti.UploadScreenshots(); } else if (mScreenshotsCreate) { CreateScreenshots(ti); } CreatePublish(ti); CreateTorrent(ti); } }
/// <summary> /// Gets new MediaInfo2 object from settings based on GUI Controls /// </summary> /// <param name="p">File or Folder path of the Media</param> /// <returns>MediaInfo2 object</returns> private MediaInfo2 PrepareNewMedia(WorkerTask wt, string p) { MediaType mt = wt.MediaTypeChoice; MediaInfo2 mi = new MediaInfo2(mt, p); mi.Extras = cboExtras.Text; if (cboSource.Text == "DVD") { mi.Source = Adapter.GetDVDString(p); } else { mi.Source = cboSource.Text; } mi.Menu = cboDiscMenu.Text; mi.Authoring = cboAuthoring.Text; mi.WebLink = txtWebLink.Text; mi.TorrentCreateInfoMy = new TorrentCreateInfo(GetTracker(), p); if (Program.Settings.PublishInfoTypeChoice == PublishInfoType.ExternalTemplate) { mi.TemplateLocation = Path.Combine(Program.TemplatesDir, cboTemplate.Text); } return mi; }
private string CreateDiscInfo(MediaInfo2 mi) { string pattern = mDiscInfo; if (mi.Overall != null) { string gi = GetGeneralInfo(mGeneralInfo, mi.Overall); string vi = GetVideoInfo(mDiscVideoInfo, mi.Overall); string ai = GetAudioInfo(mDiscAudioInfo, mi.Overall); pattern = pattern.ReplaceCode("%General_Info%", gi); pattern = pattern.ReplaceCode("%Video_Info%", vi); pattern = pattern.ReplaceCode("%Audio_Info%", ai); pattern = GetStringFromAnyPattern(pattern, mi.Overall); pattern = GetStyles(pattern); // apply any formatting foreach (MediaFile mf in mi.MediaFiles) { if (mf.Thumbnailer != null) { pattern = GetScreenshotInfo(pattern, mf); break; } } } return pattern; }
public static XMLTorrentUpload GetXMLTorrentUpload(MediaInfo2 mi) { string format = string.Empty; string res = string.Empty; string media = mi.Source; if (mi.MediaTypeChoice == MediaType.MediaDisc) { format = mi.Source; res = mi.Overall.Video.Standard; if (format == "DVD-5" || format == "DVD-9") { media = "DVD"; } } else if (!string.IsNullOrEmpty(mi.Overall.Video.Codec)) { string codec = mi.Overall.Video.Codec.ToLower(); if (codec.Contains("divx")) { format = "DivX"; } else if (codec.Contains("xvid")) { format = "XviD"; } else if (codec.Contains("avc") || codec.Contains("x264")) { format = "H.264"; } } if (string.IsNullOrEmpty(res) && !string.IsNullOrEmpty(mi.Overall.Video.Height) && !string.IsNullOrEmpty(mi.Overall.Video.Width)) { string height = mi.Overall.Video.Height; double dblWidth = 0.0; double dblHeight = 0.0; double.TryParse(mi.Overall.Video.Width, out dblWidth); double.TryParse(height, out dblHeight); if (dblWidth > 1900) { res = "1080p"; } else if (dblWidth > 1200) { res = "720p"; } else if (dblHeight > 480) { res = "576p"; } else if (dblWidth > 700) { res = "480p"; } else { res = mi.Overall.Video.Resolution; } } string fileType = string.Empty; string ext = mi.Overall.FileExtension.ToLower(); string[] exts = new string[] { "avi", "mpg", "mpeg", "mkv", "mp4", "vob", "iso" }; if (!string.IsNullOrEmpty(ext)) { foreach (string exMy in exts) { if (ext.Contains(exMy)) { fileType = exMy.ToUpper(); fileType = fileType.Replace("MPEG", "MPG"); fileType = fileType.Replace("VOB", "VOB IFO"); break; } } } XMLTorrentUpload xmlUpload = new XMLTorrentUpload() { TorrentFilePath = mi.TorrentCreateInfoMy.TorrentFilePath, ReleaseDescription = mi.ReleaseDescription, MediaInfoSummary = mi.Overall.Summary, Format = format, Resolution = res, Width = mi.Overall.Video.Width, Height = mi.Overall.Video.Height, Media = media, FileType = fileType }; if (mi.UploadScreenshots) { switch (mi.MediaTypeChoice) { case MediaType.MediaDisc: foreach (Screenshot ss in mi.Overall.Thumbnailer.Screenshots) { xmlUpload.Screenshots.Add(ss.FullImageLink); } break; default: foreach (MediaFile mf in mi.MediaFiles) { foreach (Screenshot ss in mf.Thumbnailer.Screenshots) { xmlUpload.Screenshots.Add(ss.FullImageLink); } } break; } } return xmlUpload; }
private string GetSourceInfo(string pattern, MediaInfo2 mi) { try { pattern = pattern.ReplaceCode("%Title%", mi.Title); pattern = pattern.ReplaceCode("%Source%", mi.Source); pattern = pattern.ReplaceCode("%Disc_Menu%", mi.Menu); pattern = pattern.ReplaceCode("%Disc_Extras%", mi.Extras); pattern = pattern.ReplaceCode("%Disc_Authoring%", mi.Authoring); pattern = pattern.ReplaceCode("%WebLink%", mi.WebLink); } catch (Exception) { } return pattern; }