Beispiel #1
0
        private void Task_MediaLoaded(WorkerTask task)
        {
            MediaInfo2 mi = task.Info.TaskSettings.Media;

            gbDVD.Enabled = (task.Info.TaskSettings.MediaOptions.MediaTypeChoice == MediaType.MediaDisc);
            foreach (MediaFile mf in mi.MediaFiles)
            {
                lbMediaInfo.Items.Add(mf);
                lbMediaInfo.SelectedIndex = lbMediaInfo.Items.Count - 1;
            }
        }
Beispiel #2
0
        private void PrepareNewMedia(TaskSettings taskSettings, string p)
        {
            MediaInfo2 mi = new MediaInfo2(taskSettings.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;

            if (App.Settings.ProfileActive.Publisher == PublishInfoType.ExternalTemplate)
            {
                mi.TemplateLocation = Path.Combine(App.TemplatesDir, App.Settings.ProfileActive.PublisherExternalTemplateName);
            }

            taskSettings.Media = mi;
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            string dirImages     = string.Empty;
            string dirRoot       = string.Empty;
            string mSettingsFile = 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 => mSettingsFile = v },
                { "rd=", "Root directory for screenshots, torrent and all other output files. Overrides all other custom folders.", v => dirRoot = v },
                { "s", "Create and upload 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 },
                { "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(mSettingsFile))
            {
                Program.AppConf = AppSettings.Read();
                mSettingsFile   = Program.AppConf.XMLSettingsFile;
            }

            if (File.Exists(mSettingsFile))
            {
                Program.conf = XMLSettingsCore.Read(mSettingsFile);
            }

            if (Program.conf != null)
            {
                Program.InitializeDefaultFolderPaths();
                Program.mtnProfileMgr = XMLSettingsMtnProfiles.Read();

                Console.WriteLine("Media location:");
                Console.WriteLine(mMediaLoc);
                Console.WriteLine();

                Console.WriteLine("Settings file");
                Console.WriteLine(mSettingsFile);
                Console.WriteLine();

                Console.WriteLine("MTN Path:");
                Console.WriteLine(Program.conf.MTNPath);
                Console.WriteLine();

                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.MediaTypeChoice, mMediaLoc);
                mi.ReadMedia();

                TorrentInfo ti = new TorrentInfo(mi);
                CreateScreenshot(ti);
                CreatePublish(ti);
                CreateTorrent(ti);
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to exit.");
            Console.ReadLine();
        }
Beispiel #4
0
        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;
                }

                TaskSettings ts = new TaskSettings();
                ts.MediaOptions.CreateScreenshots = mScreenshotsCreate;
                ts.MediaOptions.UploadScreenshots = mScreenshotsUpload;

                WorkerTask task = new WorkerTask(ts);
                MediaInfo2 mi   = new MediaInfo2(mwo, mMediaLoc);
                mi.ReadMedia();

                if (mScreenshotsUpload)
                {
                    TakeScreenshots(task);
                    task.UploadScreenshots();
                }
                else if (mScreenshotsCreate)
                {
                    TakeScreenshots(task);
                }

                //  CreatePublish(ti);
                //  CreateTorrent(ti);
            }
        }