Beispiel #1
0
        public static string CreatePublish(TorrentInfo ti, PublishOptionsPacket pop)
        {
            string pt = "";

            switch (pop.PublishInfoTypeChoice)
            {
                case PublishInfoType.ExternalTemplate:
                    if (Directory.Exists(pop.TemplateLocation))
                    {
                        pt = ti.CreatePublishExternal(pop, new TemplateReader(pop.TemplateLocation, ti));
                    }
                    else if (Directory.Exists(ti.Media.TemplateLocation))
                    {
                        pt = ti.CreatePublishExternal(pop, new TemplateReader(ti.Media.TemplateLocation, ti));
                    }
                    else
                    {
                        pt = ti.CreatePublishInternal(pop);
                    }
                    break;

                case PublishInfoType.InternalTemplate:
                    pt = ti.CreatePublishInternal(pop);
                    break;

                case PublishInfoType.MediaInfo:
                    pt = ti.CreatePublishMediaInfo(pop);
                    break;
            }

            ti.Media.ReleaseDescription = Adapter.StripImg(pt).Trim();
            ;

            return pt;
        }
Beispiel #2
0
        public static string CreatePublish(TorrentInfo ti, PublishOptionsPacket pop)
        {
            string pt = "";

            switch (pop.PublishInfoTypeChoice)
            {
            case PublishInfoType.ExternalTemplate:
                if (Directory.Exists(pop.TemplateLocation))
                {
                    pt = ti.CreatePublish(pop, new TemplateReader2(pop.TemplateLocation, ti));
                }
                else if (Directory.Exists(ti.Media.TemplateLocation))
                {
                    pt = ti.CreatePublish(pop, new TemplateReader2(ti.Media.TemplateLocation, ti));
                }
                else
                {
                    pt = ti.CreatePublishInternal(pop);
                }
                break;

            case PublishInfoType.InternalTemplate:
                pt = ti.CreatePublishInternal(pop);
                break;

            case PublishInfoType.MediaInfo:
                pt = ti.CreatePublishMediaInfo(pop);
                break;
            }

            ti.Media.ReleaseDescription = Adapter.StripImg(pt).Trim();;

            return(pt);
        }
Beispiel #3
0
        /// <summary>
        /// Create Publish based on Default (built-in) Template.
        /// Uses ToString() method of MediaInfo2
        /// </summary>
        /// <param name="ti"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public string CreatePublishInternal(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();
            string        info      = Media.MediaTypeChoice == MediaType.MusicAudioAlbum ? Media.ToStringAudio() : Media.ToStringMedia(pop);

            sbPublish.Append(GetPublishString(info, pop));

            return(sbPublish.ToString().Trim());
        }
Beispiel #4
0
        /// <summary>
        /// Create Publish based on a Template
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public string CreatePublish(PublishOptionsPacket options, TemplateReader2 tr)
        {
            tr.SetFullScreenshot(options.FullPicture);
            tr.CreateInfo();

            StringBuilder sbPublish = new StringBuilder();
            sbPublish.Append(GetPublishString(tr.PublishInfo, options));

            return sbPublish.ToString();
        }
Beispiel #5
0
        public string CreatePublishMediaInfo(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();

            switch (Media.MediaTypeChoice)
            {
            case MediaType.MediaDisc:
                StringBuilder sbMediaInfo = new StringBuilder();
                if (Media.MediaFiles.Count > 0)
                {
                    foreach (MediaFile mf in Media.MediaFiles)
                    {
                        sbMediaInfo.AppendLine(BbCode.Bold(mf.FileName));
                        sbMediaInfo.AppendLine(mf.Summary.Trim());
                        sbMediaInfo.AppendLine();
                    }
                }
                else
                {
                    sbMediaInfo.AppendLine(Media.Overall.Summary.Trim());
                    sbMediaInfo.AppendLine();
                }

                sbPublish.AppendLine(GetPublishString(sbMediaInfo.ToString(), pop));

                if (Media.UploadScreenshots)
                {
                    sbPublish.AppendLine(Media.Overall.GetScreenshotString(pop));
                }

                break;

            default:
                foreach (MediaFile mf in Media.MediaFiles)
                {
                    sbMediaInfo = new StringBuilder();
                    sbMediaInfo.AppendLine(BbCode.Bold(mf.FileName));
                    sbMediaInfo.AppendLine();
                    sbMediaInfo.AppendLine(mf.Summary.Trim());
                    sbMediaInfo.AppendLine();

                    sbPublish.AppendLine(GetPublishString(sbMediaInfo.ToString(), pop));

                    if (Media.UploadScreenshots)
                    {
                        sbPublish.AppendLine(mf.GetScreenshotString(pop));
                    }
                }

                break;
            }

            return(sbPublish.ToString());
        }
Beispiel #6
0
        /// <summary>
        /// Create Publish based on a Template
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public string CreatePublish(PublishOptionsPacket options, TemplateReader2 tr)
        {
            tr.SetFullScreenshot(options.FullPicture);
            tr.CreateInfo();

            StringBuilder sbPublish = new StringBuilder();

            sbPublish.Append(GetMediaInfo(tr.PublishInfo, options));

            return(sbPublish.ToString());
        }
Beispiel #7
0
        private static void CreatePublish(TorrentInfo ti)
        {
            PublishOptionsPacket pop = new PublishOptionsPacket()
            {
                AlignCenter = App.Settings.ProfileActive.AlignCenter,
                FullPicture = App.Settings.ProfileActive.UseFullPictureURL,
                PreformattedText = App.Settings.ProfileActive.PreText,
                PublishInfoTypeChoice = App.Settings.ProfileActive.Publisher,
                TemplateLocation = Path.Combine(App.TemplatesDir, "BTN")
            };
            ti.PublishString = Adapter.CreatePublish(ti, pop);

            Console.WriteLine(ti.PublishString);
        }
Beispiel #8
0
        public string GetScreenshotString(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();

            foreach (Screenshot ss in this.Thumbnailer.Screenshots)
            {
                if (!string.IsNullOrEmpty(ss.FullImageLink) && pop.FullPicture)
                {
                    sbPublish.AppendLine(BbCode.Img(ss.FullImageLink));
                }
                else if (!string.IsNullOrEmpty(ss.LinkedThumbnail))
                {
                    sbPublish.AppendLine(ss.LinkedThumbnail);
                }
                sbPublish.AppendLine();
            }

            return(sbPublish.ToString());
        }
Beispiel #9
0
        public string GetMediaInfo(string p, PublishOptionsPacket options)
        {
            StringBuilder sbPublish = new StringBuilder();

            if (options.AlignCenter)
            {
                p = BbCode.AlignCenter(p);
            }

            if (options.PreformattedText)
            {
                sbPublish.AppendLine(BbCode.Pre(p));
            }
            else
            {
                sbPublish.AppendLine(p);
            }

            return(sbPublish.ToString());
        }
Beispiel #10
0
        public string GetMediaInfo(string p, PublishOptionsPacket options)
        {
            StringBuilder sbPublish = new StringBuilder();

            if (options.AlignCenter)
            {
                p = BbCode.AlignCenter(p);
            }

            if (options.PreformattedText)
            {
                sbPublish.AppendLine(BbCode.Pre(p));
            }
            else
            {
                sbPublish.AppendLine(p);
            }

            return sbPublish.ToString();
        }
Beispiel #11
0
        private string CreatePublishInitial(TorrentInfo ti)
        {
            PublishOptionsPacket pop = new PublishOptionsPacket();
            pop.AlignCenter = Program.Settings.AlignCenter;
            pop.FullPicture = ti.Media.UploadScreenshots && Program.Settings.UseFullPicture;
            pop.PreformattedText = Program.Settings.PreText;
            pop.PublishInfoTypeChoice = Program.Settings.PublishInfoTypeChoice;
            ti.PublishOptions = pop;

            return Adapter.CreatePublish(ti, pop);
        }
Beispiel #12
0
        public string ToStringMedia(PublishOptionsPacket pop)
        {
            int fontSizeHeading1 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                                         Program.Settings.FontSizeHeading1 + Program.Settings.FontSizeIncr :
                                         Program.Settings.FontSizeHeading1);

            int fontSizeHeading2 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                                         Program.Settings.FontSizeHeading2 + Program.Settings.FontSizeIncr :
                                         Program.Settings.FontSizeHeading2);

            int fontSizeBody = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                                     Program.Settings.FontSizeBody + Program.Settings.FontSizeIncr :
                                     Program.Settings.FontSizeBody);

            StringBuilder sbBody = new StringBuilder();

            // Show Title
            if (Program.Settings.bTitle)
            {
                sbBody.AppendLine(BbCode.Size(fontSizeHeading1, BbCode.Bold(this.Title)));
                sbBody.AppendLine();
            }

            StringBuilder sbTitleInfo = new StringBuilder();

            // Source
            if (!string.IsNullOrEmpty(this.Source))
            {
                sbTitleInfo.AppendLine(string.Format("[u]Source:[/u] {0}", this.Source));
            }

            if (MediaTypeChoice == MediaType.MediaDisc)
            {
                // Authoring
                if (Program.Settings.bAuthoring && !string.IsNullOrEmpty(this.Authoring))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Authoring:[/u] {0}", this.Authoring));
                }
                if (Program.Settings.bDiscMenu && !string.IsNullOrEmpty(this.Menu))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Menu:[/u] {0}", this.Menu));
                }

                // Extras
                if (Program.Settings.bExtras && !string.IsNullOrEmpty(this.Extras))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Extras:[/u] {0}", this.Extras));
                }

                // WebLink
                if (Program.Settings.bWebLink && !string.IsNullOrEmpty(this.WebLink))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Web Link:[/u] {0}", this.WebLink));
                }
            }

            if (!string.IsNullOrEmpty(sbTitleInfo.ToString()))
            {
                sbBody.AppendLine(BbCode.Size(fontSizeBody, sbTitleInfo.ToString()));
                sbBody.AppendLine();
            }

            if (this.MediaFiles.Count > 1 && this.MediaTypeChoice == MediaType.MediaDisc)

            // is a DVD so need Overall Info only
            {
                sbBody.AppendLine(this.Overall.ToStringPublish(pop));
            }
            else
            {
                // If the loaded folder is not a Disc but individual ripped files or a collection of files
                if (MediaTypeChoice == MediaType.MediaCollection)
                {
                    sbBody.AppendLine(ToStringMediaList());
                }
                else
                {
                    foreach (MediaFile mf in this.MediaFiles)
                    {
                        sbBody.AppendLine(BbCode.Size(fontSizeHeading2, BbCode.BoldItalic(mf.FileName)));
                        sbBody.AppendLine();
                        sbBody.AppendLine(mf.ToStringPublish(pop));
                    }
                }
            }

            // CREATING XML TORRENT UPLOAD FILE DOES NOT REQUIRE SCREENSHOT IN RELEASE DESCRIPTION
            // THE SCREENSHOTS ARE IN THE XML INSTEAD
            if (this.HasScreenshots())
            {
                sbBody.AppendLine();
            }
            foreach (MediaFile mf in this.MediaFiles)
            {
                if (mf.Thumbnailer != null)
                {
                    sbBody.AppendLine(mf.GetScreenshotString(pop));
                }
            }

            return(sbBody.ToString());
        }
Beispiel #13
0
        private void CreatePublishUser()
        {
            if (!bwApp.IsBusy)
            {
                TorrentInfo ti = GetTorrentInfo();
                if (ti != null)
                {
                    PublishOptionsPacket pop = new PublishOptionsPacket();
                    pop.AlignCenter = chkQuickAlignCenter.Checked;
                    pop.FullPicture = chkQuickFullPicture.Checked;
                    pop.PreformattedText = chkQuickPre.Checked;

                    pop.PublishInfoTypeChoice = (PublishInfoType)cboQuickPublishType.SelectedIndex;
                    pop.TemplateLocation = Path.Combine(Program.TemplatesDir, cboQuickTemplate.Text);

                    txtPublish.Text = Adapter.CreatePublish(ti, pop);

                    if (ti.Media.MediaTypeChoice == MediaType.MusicAudioAlbum)
                    {
                        txtPublish.BackColor = System.Drawing.Color.Black;
                        txtPublish.ForeColor = System.Drawing.Color.White;
                    }
                    else
                    {
                        txtPublish.BackColor = System.Drawing.SystemColors.Window;
                        txtPublish.ForeColor = System.Drawing.SystemColors.WindowText;
                    }
                }
                Console.WriteLine("CreatePublish called from " + new StackFrame(1).GetMethod().Name);
            }
        }
Beispiel #14
0
        /// <summary>
        /// Returns a Publish layout of Media Info that has Audio and Video
        /// </summary>
        /// <returns></returns>
        public string ToStringPublish(PublishOptionsPacket pop)
        {
            int fontSizeHeading3 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                                         Program.Settings.FontSizeHeading3 + Program.Settings.FontSizeIncr :
                                         Program.Settings.FontSizeHeading3);

            int fontSizeBody = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                                     Program.Settings.FontSizeBody + Program.Settings.FontSizeIncr :
                                     Program.Settings.FontSizeBody);

            StringBuilder sbBody = new StringBuilder();

            //*********************
            //* General
            //*********************
            StringBuilder sbGeneral = new StringBuilder();

            sbBody.AppendLine(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("General:")));
            sbBody.AppendLine();

            // Format
            sbGeneral.Append(string.Format("            [u]Format:[/u] {0}", this.Format));
            if (!string.IsNullOrEmpty(this.FormatInfo))
            {
                sbGeneral.Append(string.Format(" ({0})", this.FormatInfo));
            }
            sbGeneral.Append(Environment.NewLine);

            // File Size
            sbGeneral.AppendLine(string.Format("         [u]File Size:[/u] {0}", this.FileSizeString));

            // Duration
            sbGeneral.AppendLine(string.Format("          [u]Duration:[/u] {0}", this.DurationString2));

            // Bitrate
            sbGeneral.AppendLine(string.Format("           [u]Bitrate:[/u] {0}", this.BitrateOverall));

            // Subtitles
            if (!string.IsNullOrEmpty(this.Subtitles))
            {
                sbGeneral.AppendLine(string.Format("         [u]Subtitles:[/u] {0}", this.Subtitles));
            }

            sbBody.AppendLine(BbCode.Size(fontSizeBody, sbGeneral.ToString()));

            if (this.Thumbnailer != null)
            {
                string ss = this.GetScreenshotString(pop);
                if (ss.Length > 0)
                {
                    sbBody.AppendLine(this.GetScreenshotString(pop));
                }
            }

            //*********************
            //* Video
            //*********************
            VideoInfo vi = this.Video;

            sbBody.AppendLine();
            sbBody.AppendLine(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("Video:")));
            sbBody.AppendLine();

            StringBuilder sbVideo = new StringBuilder();

            // Format
            sbVideo.Append(string.Format("              [u]Format:[/u] {0}", this.Video.Format));
            if (!string.IsNullOrEmpty(this.Video.FormatVersion))
            {
                sbVideo.Append(string.Format(" {0}", this.Video.FormatVersion));
            }
            sbVideo.Append(Environment.NewLine);

            // Codec
            if (!string.IsNullOrEmpty(vi.Codec))
            {
                sbVideo.AppendLine(string.Format("               [u]Codec:[/u] {0}", vi.Codec));
            }

            // Bitrate
            sbVideo.AppendLine(string.Format("             [u]Bitrate:[/u] {0}", this.Video.Bitrate));

            // Standard
            if (!string.IsNullOrEmpty(vi.Standard))
            {
                sbVideo.AppendLine(string.Format("            [u]Standard:[/u] {0}", this.Video.Standard));
            }

            // Frame Rate
            sbVideo.AppendLine(string.Format("          [u]Frame Rate:[/u] {0}", vi.FrameRate));

            // Scan Type
            sbVideo.AppendLine(string.Format("           [u]Scan Type:[/u] {0}", vi.ScanType));
            sbVideo.AppendLine(string.Format("  [u]Bits/(Pixel*Frame):[/u] {0}", vi.BitsPerPixelXFrame));
            sbVideo.AppendLine(string.Format("[u]Display Aspect Ratio:[/u] {0}", vi.DisplayAspectRatio));

            // Resolution
            sbVideo.AppendLine(string.Format("          [u]Resolution:[/u] {0}x{1}",
                                             vi.Width,
                                             vi.Height));

            sbBody.Append(BbCode.Size(fontSizeBody, sbVideo.ToString()));

            //*********************
            //* Audio
            //*********************

            int audioCount = this.Audio.Count;

            for (int a = 0; a < audioCount; a++)
            {
                AudioInfo ai = this.Audio[a];

                sbBody.AppendLine();
                sbBody.AppendLine(string.Format(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("Audio #{0}:")), a + 1));
                sbBody.AppendLine();

                StringBuilder sbAudio = new StringBuilder();

                // Format
                sbAudio.Append(string.Format("            [u]Format:[/u] {0}", ai.Format));
                if (!string.IsNullOrEmpty(ai.FormatVersion))
                {
                    sbAudio.Append(string.Format(" {0}", ai.FormatVersion));
                }
                if (!string.IsNullOrEmpty(ai.FormatProfile))
                {
                    sbAudio.Append(string.Format(" {0}", ai.FormatProfile));
                }
                sbAudio.Append(Environment.NewLine);

                // Codec
                if (!string.IsNullOrEmpty(ai.Codec))
                {
                    sbAudio.AppendLine(string.Format("             [u]Codec:[/u] {0}", ai.Codec));
                }

                // Bitrate
                sbAudio.AppendLine(string.Format("           [u]Bitrate:[/u] {0} ({1})", ai.Bitrate, ai.BitrateMode));

                // Channels
                sbAudio.AppendLine(string.Format("          [u]Channels:[/u] {0}", ai.Channels));

                // Sampling Rate
                sbAudio.AppendLine(string.Format("     [u]Sampling Rate:[/u] {0}", ai.SamplingRate));

                // Resolution
                if (!string.IsNullOrEmpty(ai.Resolution))
                {
                    sbAudio.AppendLine(string.Format(("        [u]Resolution:[/u] {0}"), ai.Resolution));
                }

                sbBody.Append(BbCode.Size(fontSizeBody, sbAudio.ToString()));
                sbBody.AppendLine();
            }

            return(sbBody.ToString());
        }
Beispiel #15
0
        /// <summary>
        /// Create Publish based on Default (built-in) Template.
        /// Uses ToString() method of MediaInfo2
        /// </summary>
        /// <param name="ti"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public string CreatePublishInternal(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();
            string info = Media.MediaTypeChoice == MediaType.MusicAudioAlbum ? Media.ToStringAudio() : Media.ToStringMedia(pop);
            sbPublish.Append(GetPublishString(info, pop));

            return sbPublish.ToString().Trim();
        }
Beispiel #16
0
        public string CreatePublishMediaInfo(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();

            switch (Media.Options.MediaTypeChoice)
            {
                case MediaType.MediaDisc:
                    StringBuilder sbMediaInfo = new StringBuilder();
                    if (Media.MediaFiles.Count > 0)
                    {
                        foreach (MediaFile mf in Media.MediaFiles)
                        {
                            sbMediaInfo.AppendLine(BbCode.Bold(mf.FileName));
                            sbMediaInfo.AppendLine(mf.Summary.Trim());
                            sbMediaInfo.AppendLine();
                        }
                    }
                    else
                    {
                        sbMediaInfo.AppendLine(Media.Overall.Summary.Trim());
                        sbMediaInfo.AppendLine();
                    }

                    sbPublish.AppendLine(BbFormat(sbMediaInfo.ToString(), pop));

                    if (Media.Options.UploadScreenshots)
                        sbPublish.AppendLine(Media.Overall.GetScreenshotString(pop));

                    break;
                default:
                    foreach (MediaFile mf in Media.MediaFiles)
                    {
                        sbMediaInfo = new StringBuilder();
                        sbMediaInfo.AppendLine(mf.Summary.Trim());
                        sbMediaInfo.AppendLine();

                        sbPublish.AppendLine(BbFormat(sbMediaInfo.ToString(), pop));

                        if (Media.Options.UploadScreenshots)
                        {
                            sbPublish.AppendLine();
                            sbPublish.AppendLine(mf.GetScreenshotString(pop));
                        }
                    }

                    break;
            }

            string publishInfo = sbPublish.ToString().Trim();

            if (App.Settings.ProfileActive.HidePrivateInfo)
            {
                publishInfo = Regex.Replace(publishInfo, "(?<=Complete name *: ).+?(?=\\r)", match => Path.GetFileName(match.Value));
            }

            return publishInfo;
        }
Beispiel #17
0
        public string CreatePublishMediaInfo(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();

            switch (Media.MediaTypeChoice)
            {
                case MediaType.MediaDisc:
                    StringBuilder sbMediaInfo = new StringBuilder();
                    if (Media.MediaFiles.Count > 0)
                    {
                        foreach (MediaFile mf in Media.MediaFiles)
                        {
                            sbMediaInfo.AppendLine(BbCode.Bold(mf.FileName));
                            sbMediaInfo.AppendLine(mf.Summary.Trim());
                            sbMediaInfo.AppendLine();
                        }
                    }
                    else
                    {
                        sbMediaInfo.AppendLine(Media.Overall.Summary.Trim());
                        sbMediaInfo.AppendLine();
                    }

                    sbPublish.AppendLine(GetPublishString(sbMediaInfo.ToString(), pop));

                    if (Media.UploadScreenshots)
                        sbPublish.AppendLine(Media.Overall.GetScreenshotString(pop));

                    break;

                default:
                    foreach (MediaFile mf in Media.MediaFiles)
                    {
                        sbMediaInfo = new StringBuilder();
                        sbMediaInfo.AppendLine(BbCode.Bold(mf.FileName));
                        sbMediaInfo.AppendLine();
                        sbMediaInfo.AppendLine(mf.Summary.Trim());
                        sbMediaInfo.AppendLine();

                        sbPublish.AppendLine(GetPublishString(sbMediaInfo.ToString(), pop));

                        if (Media.UploadScreenshots)
                            sbPublish.AppendLine(mf.GetScreenshotString(pop));
                    }

                    break;
            }

            return sbPublish.ToString();
        }
Beispiel #18
0
        private string BbFormat(string p, PublishOptionsPacket options)
        {
            StringBuilder sbPublish = new StringBuilder();

            if (options.AlignCenter)
            {
                p = BbCode.AlignCenter(p);
            }

            if (options.PreformattedText)
            {
                sbPublish.AppendLine(BbCode.Pre(p));
            }
            else
            {
                sbPublish.AppendLine(p);
            }

            return sbPublish.ToString().Trim();
        }
Beispiel #19
0
        private void CreatePublishUser()
        {
            if (!bwApp.IsBusy)
            {
                TorrentInfo ti = GetTorrentInfo();
                if (ti != null)
                {
                    var pop = new PublishOptionsPacket
                    {
                        AlignCenter = chkQuickAlignCenter.Checked,
                        FullPicture = chkQuickFullPicture.Checked,
                        PreformattedText = chkQuickPre.Checked,
                        PublishInfoTypeChoice = (PublishInfoType)cboQuickPublishType.SelectedIndex,
                        TemplateLocation = Path.Combine(App.TemplatesDir, cboQuickTemplate.Text)
                    };

                    txtPublish.Text = Adapter.CreatePublish(ti, pop);

                    if (ti.Media.Options.MediaTypeChoice == MediaType.MusicAudioAlbum)
                    {
                        txtPublish.BackColor = System.Drawing.Color.Black;
                        txtPublish.ForeColor = System.Drawing.Color.White;
                    }
                    else
                    {
                        txtPublish.BackColor = System.Drawing.SystemColors.Window;
                        txtPublish.ForeColor = System.Drawing.SystemColors.WindowText;
                    }
                }
            }
        }
Beispiel #20
0
        public void CreateInfo(PublishOptionsPacket options)
        {
            SetFullScreenshot(options.FullPicture);

            string pattern = "";

            if (TorrentInfo.Media != null)
            {
                if (TorrentInfo.Media.Options.MediaTypeChoice == MediaType.MediaDisc)
                {
                    pattern = CreateDiscInfo(TorrentInfo.Media);
                }
                else
                {
                    pattern = CreateFileInfo(TorrentInfo.Media);
                }

                pattern = GetSourceInfo(pattern, TorrentInfo.Media);
                pattern = pattern.ReplaceCode("%NewLine%", Environment.NewLine);

                if (string.IsNullOrEmpty(pattern)) return;

                pattern = Regex.Replace(pattern, ".*?%.+?%.*?\\r\\n", "");

                PublishInfo = pattern.Trim();
            }
        }
Beispiel #21
0
        private string CreatePublishInitial(TorrentInfo ti)
        {
            PublishOptionsPacket pop = new PublishOptionsPacket();
            pop.AlignCenter = App.Settings.ProfileActive.AlignCenter;
            pop.FullPicture = ti.Media.Options.UploadScreenshots && App.Settings.ProfileActive.UseFullPictureURL;
            pop.PreformattedText = App.Settings.ProfileActive.PreText;
            pop.PublishInfoTypeChoice = App.Settings.ProfileActive.Publisher;
            ti.PublishOptions = pop;

            return Adapter.CreatePublish(ti, pop);
        }
Beispiel #22
0
        public string ToStringMedia(PublishOptionsPacket pop)
        {
            int fontSizeHeading1 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
            Program.Settings.FontSizeHeading1 + Program.Settings.FontSizeIncr :
            Program.Settings.FontSizeHeading1);

            int fontSizeHeading2 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                Program.Settings.FontSizeHeading2 + Program.Settings.FontSizeIncr :
                Program.Settings.FontSizeHeading2);

            int fontSizeBody = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                Program.Settings.FontSizeBody + Program.Settings.FontSizeIncr :
                Program.Settings.FontSizeBody);

            StringBuilder sbBody = new StringBuilder();

            // Show Title
            if (Program.Settings.bTitle)
            {
                sbBody.AppendLine(BbCode.Size(fontSizeHeading1, BbCode.Bold(this.Title)));
                sbBody.AppendLine();
            }

            StringBuilder sbTitleInfo = new StringBuilder();

            // Source
            if (!string.IsNullOrEmpty(this.Source))
            {
                sbTitleInfo.AppendLine(string.Format("[u]Source:[/u] {0}", this.Source));
            }

            if (MediaTypeChoice == MediaType.MediaDisc)
            {
                // Authoring
                if (Program.Settings.bAuthoring && !string.IsNullOrEmpty(this.Authoring))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Authoring:[/u] {0}", this.Authoring));
                }
                if (Program.Settings.bDiscMenu && !string.IsNullOrEmpty(this.Menu))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Menu:[/u] {0}", this.Menu));
                }

                // Extras
                if (Program.Settings.bExtras && !string.IsNullOrEmpty(this.Extras))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Extras:[/u] {0}", this.Extras));
                }

                // WebLink
                if (Program.Settings.bWebLink && !string.IsNullOrEmpty(this.WebLink))
                {
                    sbTitleInfo.AppendLine(string.Format("[u]Web Link:[/u] {0}", this.WebLink));
                }
            }

            if (!string.IsNullOrEmpty(sbTitleInfo.ToString()))
            {
                sbBody.AppendLine(BbCode.Size(fontSizeBody, sbTitleInfo.ToString()));
                sbBody.AppendLine();
            }

            if (this.MediaFiles.Count > 1 && this.MediaTypeChoice == MediaType.MediaDisc)

            // is a DVD so need Overall Info only
            {
                sbBody.AppendLine(this.Overall.ToStringPublish(pop));
            }
            else
            {
                // If the loaded folder is not a Disc but individual ripped files or a collection of files
                if (MediaTypeChoice == MediaType.MediaCollection)
                {
                    sbBody.AppendLine(ToStringMediaList());
                }
                else
                {
                    foreach (MediaFile mf in this.MediaFiles)
                    {
                        sbBody.AppendLine(BbCode.Size(fontSizeHeading2, BbCode.BoldItalic(mf.FileName)));
                        sbBody.AppendLine();
                        sbBody.AppendLine(mf.ToStringPublish(pop));
                    }
                }
            }

            // CREATING XML TORRENT UPLOAD FILE DOES NOT REQUIRE SCREENSHOT IN RELEASE DESCRIPTION
            // THE SCREENSHOTS ARE IN THE XML INSTEAD
            if (this.HasScreenshots())
            {
                sbBody.AppendLine();
            }
            foreach (MediaFile mf in this.MediaFiles)
            {
                if (mf.Thumbnailer != null)
                {
                    sbBody.AppendLine(mf.GetScreenshotString(pop));
                }
            }

            return sbBody.ToString();
        }
Beispiel #23
0
        /// <summary>
        /// Create Publish based on a Template
        /// </summary>
        /// <param name="tr"></param>
        /// <returns></returns>
        public string CreatePublishExternal(PublishOptionsPacket options, TemplateReader tr)
        {
            tr.CreateInfo(options);

            return BbFormat(tr.PublishInfo, options);
        }
Beispiel #24
0
        /// <summary>
        /// Returns a Publish layout of Media Info that has Audio and Video
        /// </summary>
        /// <returns></returns>
        public string ToStringPublish(PublishOptionsPacket pop)
        {
            int fontSizeHeading3 = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
               Program.Settings.FontSizeHeading3 + Program.Settings.FontSizeIncr :
               Program.Settings.FontSizeHeading3);

            int fontSizeBody = (int)(Program.Settings.PreText && Program.Settings.LargerPreText == true ?
                Program.Settings.FontSizeBody + Program.Settings.FontSizeIncr :
                Program.Settings.FontSizeBody);

            StringBuilder sbBody = new StringBuilder();

            //*********************
            //* General
            //*********************
            StringBuilder sbGeneral = new StringBuilder();

            sbBody.AppendLine(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("General:")));
            sbBody.AppendLine();

            // Format
            sbGeneral.Append(string.Format("            [u]Format:[/u] {0}", this.Format));
            if (!string.IsNullOrEmpty(this.FormatInfo))
            {
                sbGeneral.Append(string.Format(" ({0})", this.FormatInfo));
            }
            sbGeneral.Append(Environment.NewLine);

            // File Size
            sbGeneral.AppendLine(string.Format("         [u]File Size:[/u] {0}", this.FileSizeString));

            // Duration
            sbGeneral.AppendLine(string.Format("          [u]Duration:[/u] {0}", this.DurationString2));

            // Bitrate
            sbGeneral.AppendLine(string.Format("           [u]Bitrate:[/u] {0}", this.BitrateOverall));

            // Subtitles
            if (!string.IsNullOrEmpty(this.Subtitles))
            {
                sbGeneral.AppendLine(string.Format("         [u]Subtitles:[/u] {0}", this.Subtitles));
            }

            sbBody.AppendLine(BbCode.Size(fontSizeBody, sbGeneral.ToString()));

            if (this.Thumbnailer != null)
            {
                string ss = this.GetScreenshotString(pop);
                if (ss.Length > 0)
                {
                    sbBody.AppendLine(this.GetScreenshotString(pop));
                }
            }

            //*********************
            //* Video
            //*********************
            VideoInfo vi = this.Video;

            sbBody.AppendLine();
            sbBody.AppendLine(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("Video:")));
            sbBody.AppendLine();

            StringBuilder sbVideo = new StringBuilder();

            // Format
            sbVideo.Append(string.Format("              [u]Format:[/u] {0}", this.Video.Format));
            if (!string.IsNullOrEmpty(this.Video.FormatVersion))
            {
                sbVideo.Append(string.Format(" {0}", this.Video.FormatVersion));
            }
            sbVideo.Append(Environment.NewLine);

            // Codec
            if (!string.IsNullOrEmpty(vi.Codec))
                sbVideo.AppendLine(string.Format("               [u]Codec:[/u] {0}", vi.Codec));

            // Bitrate
            sbVideo.AppendLine(string.Format("             [u]Bitrate:[/u] {0}", this.Video.Bitrate));

            // Standard
            if (!string.IsNullOrEmpty(vi.Standard))
                sbVideo.AppendLine(string.Format("            [u]Standard:[/u] {0}", this.Video.Standard));

            // Frame Rate
            sbVideo.AppendLine(string.Format("          [u]Frame Rate:[/u] {0}", vi.FrameRate));

            // Scan Type
            sbVideo.AppendLine(string.Format("           [u]Scan Type:[/u] {0}", vi.ScanType));
            sbVideo.AppendLine(string.Format("  [u]Bits/(Pixel*Frame):[/u] {0}", vi.BitsPerPixelXFrame));
            sbVideo.AppendLine(string.Format("[u]Display Aspect Ratio:[/u] {0}", vi.DisplayAspectRatio));

            // Resolution
            sbVideo.AppendLine(string.Format("          [u]Resolution:[/u] {0}x{1}",
                vi.Width,
                vi.Height));

            sbBody.Append(BbCode.Size(fontSizeBody, sbVideo.ToString()));

            //*********************
            //* Audio
            //*********************

            int audioCount = this.Audio.Count;

            for (int a = 0; a < audioCount; a++)
            {
                AudioInfo ai = this.Audio[a];

                sbBody.AppendLine();
                sbBody.AppendLine(string.Format(BbCode.Size(fontSizeHeading3, BbCode.BoldItalic("Audio #{0}:")), a + 1));
                sbBody.AppendLine();

                StringBuilder sbAudio = new StringBuilder();

                // Format
                sbAudio.Append(string.Format("            [u]Format:[/u] {0}", ai.Format));
                if (!string.IsNullOrEmpty(ai.FormatVersion))
                    sbAudio.Append(string.Format(" {0}", ai.FormatVersion));
                if (!string.IsNullOrEmpty(ai.FormatProfile))
                    sbAudio.Append(string.Format(" {0}", ai.FormatProfile));
                sbAudio.Append(Environment.NewLine);

                // Codec
                if (!string.IsNullOrEmpty(ai.Codec))
                    sbAudio.AppendLine(string.Format("             [u]Codec:[/u] {0}", ai.Codec));

                // Bitrate
                sbAudio.AppendLine(string.Format("           [u]Bitrate:[/u] {0} ({1})", ai.Bitrate, ai.BitrateMode));

                // Channels
                sbAudio.AppendLine(string.Format("          [u]Channels:[/u] {0}", ai.Channels));

                // Sampling Rate
                sbAudio.AppendLine(string.Format("     [u]Sampling Rate:[/u] {0}", ai.SamplingRate));

                // Resolution
                if (!string.IsNullOrEmpty(ai.Resolution))
                    sbAudio.AppendLine(string.Format(("        [u]Resolution:[/u] {0}"), ai.Resolution));

                sbBody.Append(BbCode.Size(fontSizeBody, sbAudio.ToString()));
                sbBody.AppendLine();
            }

            return sbBody.ToString();
        }
Beispiel #25
0
        public string GetScreenshotString(PublishOptionsPacket pop)
        {
            StringBuilder sbPublish = new StringBuilder();

            foreach (Screenshot ss in this.Thumbnailer.Screenshots)
            {
                if (!string.IsNullOrEmpty(ss.FullImageLink) && pop.FullPicture)
                {
                    sbPublish.AppendLine(BbCode.Img(ss.FullImageLink));
                }
                else if (!string.IsNullOrEmpty(ss.LinkedThumbnail))
                {
                    sbPublish.AppendLine(ss.LinkedThumbnail);
                }
                sbPublish.AppendLine();
            }

            return sbPublish.ToString();
        }