Exemplo n.º 1
0
 public static string addTitleToEpisode(string namefile, string title = "", int idSerie = -1)
 {
     if (title == "")
     {
         if (idSerie == -1)
         {
             idSerie = MovieDB.getIDofSerie(Code.nameserie(namefile));
         }
         int currentSeason  = int.Parse(Code.numberSeason(namefile));
         int currentEpisode = int.Parse(Code.numberEpisode(namefile));
         title = MovieDB.getNameOfTvEpisode(idSerie, currentSeason, currentEpisode);
     }
     namefile = namefile.Insert(namefile.Length - 4, " " + title);
     return(namefile);
 }
Exemplo n.º 2
0
        private void search()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Id");
            dt.Columns.Add("Name");
            MDBresults = MovieDB.getSearchTv(TB_Search.Text);
            MDBresults.Results.ForEach(Serie => {
                DataRow Row = dt.NewRow();
                Row["ID"]   = Serie.Id;
                Row["Name"] = Serie.Name;
                dt.Rows.Add(Row);
            });
            CB_Result.DataSource    = dt;
            CB_Result.DisplayMember = "Name";
            CB_Result.ValueMember   = "Id";
        }
Exemplo n.º 3
0
        private void cpy_btn_findTitle_Click(object sender, EventArgs e)
        {
            if (IcanWork())
            {
                try
                {
                    int idSerie = MovieDB.getIDofSerie(Code.nameserie(cpy_list_episode_renommer.Items[0].ToString()));
                    if (idSerie != -1)
                    {
                        var MsgBResult = MessageBox.Show("J'ai aasocié la serie selectionnée à : " + MovieDB.getTvShow(idSerie).Name +
                                                         "\nEst-ce la bonne serie ?", "Recherche Titre", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                        switch (MsgBResult)
                        {
                        case DialogResult.Yes:
                            cpy_btn_findTitle.Enabled = false;
                            cpy_add_title(idSerie);
                            break;

                        case DialogResult.No:

                            MovieDbSelectSerie SearchSerie = new MovieDbSelectSerie(cpy_cb_Serie.SelectedItem.ToString());
                            var SelectSerie = SearchSerie.ShowDialog();
                            if (SelectSerie == DialogResult.OK)
                            {
                                cpy_add_title(SearchSerie.idSerie);
                            }
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Aucun resultat pour la serie : " + Code.nameserie(cpy_list_episode_renommer.Items[0].ToString()) + ".\nVerfier le nom.", "FindSerie : Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    var result = MessageBox.Show("Une Erreur est survenue verifier votre connection Internet", "FindSerie : Erreur", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    if (result == DialogResult.Retry)
                    {
                        cpy_btn_findTitle_Click(sender, e);
                    }
                }
            }
        }
Exemplo n.º 4
0
 private void rnm_btn_findTitle_Click(object sender, EventArgs e)
 {
     logbox_addtext("Recherche des titres sur TheMovieDB ...");
     try
     {
         int i = 0;
         while (i < rnm_listBox2.Items.Count)
         {
             try
             {
                 if (MovieDB.getIDofSerie(Code.nameserie(rnm_listBox2.Items[i].ToString())) != -1)
                 {
                     string newfilename = Code.addTitleToEpisode(rnm_listBox2.Items[i].ToString());
                     //int a = rnm_listBox2.Items.IndexOf(rnm_listBox2.Items[i].ToString());
                     rnm_listBox2.Items.RemoveAt(i);
                     rnm_listBox2.Items.Insert(i, newfilename);
                 }
                 else
                 {
                     logbox_addtext("Aucun resultat pour : " + rnm_listBox2.Items[i].ToString());
                 }
                 if (i == 20)
                 {
                 }
                 i++;
             }
             catch (Exception ex)
             {
                 logbox_addtext(i.ToString());
                 Thread.Sleep(1000);//Attente de pouvoir refaire des requete sur TheMovieDB
             }
         }
     }
     catch (Exception ex)
     {
         logbox_addtext(ex.Message);
     }
     logbox_addtext("Recherche terminee");
 }
Exemplo n.º 5
0
 private void CB_Result_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         DataRow selectedDataRow = ((DataRowView)CB_Result.SelectedItem).Row;
         int     serieId         = Convert.ToInt32(selectedDataRow["Id"]);
         label_Sysnopsis.Text = serieId.ToString();
         var SelectSerie = from Result in MDBresults.Results where Result.Id == serieId select Result;
         foreach (var Result in SelectSerie)
         {
             label_NameSerie.Text     = Result.Name.ToString();
             label_nbSeason.Text      = "Nombre(s) de Saison(s) : " + MovieDB.getNBSeason(Result.Id);
             label_Resallisateur.Text = Result.BackdropPath;
             label_Year.Text          = "Annee : " + Result.FirstAirDate.Value.Year;
             img_Serie.Load(@"https://image.tmdb.org/t/p/w300" + Result.PosterPath);
             TB_Synopsis.Text = Result.Overview;
             break;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Une erreur s'est produite");
     }
 }