Exemplo n.º 1
0
        private void btnImportElements_Click(object sender, EventArgs e)
        {
            var sesi = (SeriesEpisodesShortInfo)tvCollections.SelectedNode.Tag;

            var iParams = new FrmElementsInfoFromFiles(sesi.Id)
            {
                Owner = _parent
            };

            if (iParams.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            var files = Directory.GetFiles(iParams.ElementsImportParams.Location, iParams.ElementsImportParams.FilesExtension);


            var opRes = FilesMetaData.GetFilesTechnicalDetails(files, iParams.ElementsImportParams);

            if (!opRes.Success)
            {
                MsgBox.Show(opRes.CustomErrorMessage, "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var importResult = (KeyValuePair <List <TechnicalDetailsImportError>, List <MovieTechnicalDetails> >)opRes.AdditionalDataReturn;

            if (importResult.Key.Any())
            {
                var frmIE = new FrmImportErrors(importResult.Key, importResult.Value.Any());

                if (frmIE.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            opRes = FilesMetaData.SaveImportedEpisodes(new KeyValuePair <FilesImportParams, List <MovieTechnicalDetails> >(
                                                           iParams.ElementsImportParams, importResult.Value));

            var saveErrors = (List <TechnicalDetailsImportError>)opRes.AdditionalDataReturn;

            if (saveErrors != null && saveErrors.Any())
            {
                var frmIE = new FrmImportErrors(saveErrors, true);
                frmIE.ShowDialog();
            }

            ReloadTreeView(sesi.Id);
            tvCollections.SelectedNode.ExpandAll();

            LoadSelectionDetails();
        }
Exemplo n.º 2
0
        private void btnImportMovies_Click(object sender, EventArgs e)
        {
            var iParams = new FrmMoviesInfoFromFiles {
                Owner = _parent
            };

            if (iParams.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var files = Directory.GetFiles(iParams.MoviesImportParams.Location, iParams.MoviesImportParams.FilesExtension);

            if (files.Length == 0)
            {
                MsgBox.Show("There are no files with the specified extension in the selected folder!", "Error", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
                return;
            }

            if (MsgBox.Show(string.Format("Are you sure you want to import {0} Movies?", files.Length), "Confirm",
                            MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            var opRes = FilesMetaData.GetFilesTechnicalDetails(files, iParams.MoviesImportParams);

            if (!opRes.Success)
            {
                MsgBox.Show(opRes.CustomErrorMessage, "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var importErrors = (List <TechnicalDetailsImportError>)opRes.AdditionalDataReturn;

            if (importErrors.Any())
            {
                var frmIE = new FrmImportErrors(importErrors, true);
                frmIE.ShowDialog();
            }

            ReloadData(true);
        }
Exemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (tbFileName.Text == string.Empty)
            {
                lbFilename.ForeColor = Color.Red;

                MsgBox.Show("Please specify all required import parameters!", "Error", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);

                return;
            }

            btnOk.Text     = "Working ...";
            btnOk.Enabled  = false;
            Cursor.Current = Cursors.WaitCursor;

            var opRes = FilesMetaData.GetFileTechnicalDetails(_filePath);

            if (!opRes.Success)
            {
                MsgBox.Show(opRes.CustomErrorMessage, "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                btnOk.Text     = "Ok";
                btnOk.Enabled  = true;
                Cursor.Current = Cursors.Default;
                return;
            }

            mtd                   = (MovieTechnicalDetails)opRes.AdditionalDataReturn;
            mtd.Quality           = Desene.DAL.GetQualityStrFromSize(mtd);
            mtd.AudioLanguages    = string.Join(", ", mtd.AudioStreams.Select(a => a.Language == "" ? "?" : a.Language).Distinct());
            mtd.SubtitleLanguages = string.Join(", ", mtd.SubtitleStreams.Select(a => a.Language == "" ? "?" : a.Language).Distinct());

            if (cbGenerateThumbnails.Checked)
            {
                FilesMetaData.GetMovieStills(mtd, null);
            }

            if (!_isNew)
            {
                mtd.ParentId = Desene.DAL.CurrentMTD.ParentId;
                mtd.Year     = Desene.DAL.CurrentMTD.Year;
                mtd.Season   = Desene.DAL.CurrentMTD.Season;

                mtd.DescriptionLink = Desene.DAL.CurrentMTD.DescriptionLink;
                mtd.Recommended     = Desene.DAL.CurrentMTD.Recommended;
                mtd.RecommendedLink = Desene.DAL.CurrentMTD.RecommendedLink;
                mtd.Theme           = Desene.DAL.CurrentMTD.Theme;
                mtd.Notes           = Desene.DAL.CurrentMTD.Notes;
                mtd.Synopsis        = Desene.DAL.CurrentMTD.Synopsis;
                mtd.Trailer         = Desene.DAL.CurrentMTD.Trailer;
                mtd.StreamLink      = Desene.DAL.CurrentMTD.StreamLink;
                mtd.Poster          = Desene.DAL.CurrentMTD.Poster;
                mtd.InsertedDate    = Desene.DAL.CurrentMTD.InsertedDate;
                mtd.LastChangeDate  = DateTime.Now;

                //CMA: the CurrentMTD will be reset after save
                //Desene.DAL.CurrentMTD = mtd;
            }

            Cursor.Current = Cursors.Default;
            DialogResult   = DialogResult.OK;
            Close();
        }
Exemplo n.º 4
0
        private void btnImportEpisodes_Click(object sender, EventArgs e)
        {
            if (Common.Helpers.UnsavedChanges)
            {
                if (MsgBox.Show("There are pending changes present! Do you want to save them before continuing?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SaveChangesAndRefresh();
                }
                else
                {
                    UndoChanges();
                }
            }

            var sesi = (SeriesEpisodesShortInfo)tvSeries.SelectedNode.Tag;

            var iParams = new FrmEpisodeInfoFromFiles(sesi.Id, sesi.IsSeason ? sesi.Season : null)
            {
                Owner = _parent
            };

            if (iParams.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            var files = Directory.GetFiles(iParams.EpisodesImportParams.Location, iParams.EpisodesImportParams.FilesExtension);

            var opRes = FilesMetaData.GetFilesTechnicalDetails(files, iParams.EpisodesImportParams);

            if (!opRes.Success)
            {
                MsgBox.Show(opRes.CustomErrorMessage, "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var importResult = (KeyValuePair <List <TechnicalDetailsImportError>, List <MovieTechnicalDetails> >)opRes.AdditionalDataReturn;

            if (importResult.Key.Any())
            {
                var frmIE = new FrmImportErrors(importResult.Key, importResult.Value.Any());

                if (frmIE.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            opRes = FilesMetaData.SaveImportedEpisodes(new KeyValuePair <FilesImportParams, List <MovieTechnicalDetails> >(
                                                           iParams.EpisodesImportParams, importResult.Value));

            var saveErrors = (List <TechnicalDetailsImportError>)opRes.AdditionalDataReturn;

            if (saveErrors != null && saveErrors.Any())
            {
                var frmIE = new FrmImportErrors(saveErrors, true);
                frmIE.ShowDialog();
            }

            opRes = DAL.SetSeriesValuesFromEpisodes(sesi.Id);
            if (!opRes.Success)
            {
                MsgBox.Show(opRes.CustomErrorMessage, "Audio summary determination", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ReloadTreeView(sesi.Id);
            tvSeries.SelectedNode.ExpandAll();

            LoadSelectionDetails();
        }