User edited fields not working as expected (1 Viewer)

JimCatMP

Documentation Group
  • Team MediaPortal
  • April 1, 2010
    654
    285
    Leeds
    Home Country
    United Kingdom United Kingdom
    Hi.

    Latest version differs from previous version in that Genre stated on Config is the delivered Genre from online lookup, previously it was the Genre__USEREDIT_String value.

    System: Genre String - '|Drama|Horror|Science-Fiction|'
    User: Genre__USEREDIT__ String - 'Scary'

    Net result for me is that I can no longer [without dipping into SQLITE] update the Genre to match my preferences.

    In operation, the Genre__USEREDIT_String is still used in live service, but for any new series, as is, I'm locked out of changing Genre without respiring to shell and sqlite3:(

    I cannot see any good reason for this, so assume it's not 'deliberate' change in function but simple side effect of other updates applied.

    For most people, probably not an issue, but any chance of having either old behaviour reinstated or ability to update USEREDIT strings [there are a number of them] in Config in later release [which ever is easier.

    Nothing will stop me using MPTVSeries however, it's still rocks by any measure(n)

    Cheers - JCMP
     

    barneh

    MP Donator
  • Premium Supporter
  • February 4, 2010
    245
    54
    Malmö
    Home Country
    Sweden Sweden
    If I understand you right, when you update the Genre value from '|Horror|' to 'Scary' you would like the field 'Genre' in the database to be updated, and not the 'Genre__USEREDIT__'?
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    If I understand you right, when you update the Genre value from '|Horror|' to 'Scary' you would like the field 'Genre' in the database to be updated, and not the 'Genre__USEREDIT__'?
    I don't think so, it's never been like that. If you edit a field it created a USEREDIT field, maybe something is broken with that e.g. it's not being read and displayed to the user.
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    I did a quick test and confirm something is broken, I edited a field e.g. |Horror| -> |Horror|Test| and after closing the config and re-opening it was not being read back in.

    It does look like its writing to the database as expected.

    I reverted to the last release and it worked as expected, so its a regression with latest changes.
     

    JimCatMP

    Documentation Group
  • Team MediaPortal
  • April 1, 2010
    654
    285
    Leeds
    Home Country
    United Kingdom United Kingdom
    I did a further test and confirmed its being read and displayed to user in the MediaPortal GUI, its just not displaying user edits in the configuration after close and re-open.


    Ah - I didn't check that the edit made it to the DB itself [which given the trouble I went to in digging into the DB with SQLITE, exporting data & schema then comparing them, seems a little silly on my part, only doing 1/2 the job :(

    So, it's the display element of the Config GU, core data management is 100% solid and updating of USEREDIT fields are unchanged - means I can still manage genres, just need to remember I've done it:cool:

    As always, appreciate the help & info chaps:)

    TTFN - JCMP
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    Thanks for reporting, there is a bug obviously with the configuration tool which we have to look at.

    @barneh, do you have time to take a look?
     

    barneh

    MP Donator
  • Premium Supporter
  • February 4, 2010
    245
    54
    Malmö
    Home Country
    Sweden Sweden
    I can... but I need to understand the problem :)

    If I edit the Genre from "|Horror|" to "|Scary|" it makes a a new or change to the Genre__USEREDIT__ field in the DB.
    Is the problem that this __USEREDIT__ field is not shown in Configuration GUI?
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    It makes a new database field called Genre_USEREDIT__ and inserts the genre in there. You can see in the configuration the row turns blue in colour. Now if you restart the config, you can see it shows you Genre instead of Genre_USEREDIT__.

    I can see how it got broken:

    Code:
    private void AddPropertyBindingSource(string FieldPrettyName, string FieldName, string FieldValue, bool CanModify, DataGridViewContentAlignment TextAlign)
      {
      int id = -1;
      bool userEdited = false;
      // are we a user_edited item? if so replace the orig entry
      if (FieldName.EndsWith(DBTable.cUserEditPostFix))
      {
      // except if the content is empty, then we just dont display it
      if (string.IsNullOrEmpty(FieldValue)) return;
      string origFieldName = FieldName.Replace(DBTable.cUserEditPostFix, "");
      for (int i = 0; i < dataGridView1.Rows.Count; i++)
      {
      if (dataGridView1.Rows[i].Cells[1].Tag as string == origFieldName)
      {
      id = i;
      userEdited = true;
      break;
      }
    
      }
      }
    
      if (id < 0)
      {
      DataGridViewRow dataGridDetailRow = new DataGridViewRow();
      DataGridViewTextBoxCell cFieldName;
    
      if ((FieldName == DBOnlineSeries.cLanguage) && (DBOption.GetOptions(DBOption.cOverrideLanguage)))
      {
      dataGridDetailRow = new DataGridViewRow();
      cFieldName = new DataGridViewTextBoxCell();
      DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell();
    
      // First Column (Name)
      cFieldName.Value = FieldPrettyName;
      cFieldName.Style.BackColor = System.Drawing.SystemColors.Control;
      dataGridDetailRow.Cells.Add(cFieldName);
      cFieldName.ReadOnly = true;
    
      // Second Column (Value)
      if (onlineLanguages.Count == 0)
      {
      onlineLanguages.AddRange(new GetLanguages().languages);
      }
    
      foreach (Language lang in onlineLanguages)
      {
      cbCell.Items.Add(lang.language);
      }
    
      Language selectedLang = onlineLanguages.Find(x => x.abbreviation.Contains(FieldValue));
      for (int i = 0; i < cbCell.Items.Count; i++)
      {
      string s = cbCell.Items[i].ToString();
      if (cbCell.Items[i].ToString() == selectedLang.language)
      {
      cbCell.Value = cbCell.Items[i];
      }
      }
    
      cbCell.Tag = FieldName;
    
      dataGridDetailRow.Cells.Add(cbCell);
      cbCell.ReadOnly = false;
    
      // Add the row to the DataGridView
      dataGridView1.Rows.Add(dataGridDetailRow);
      }
      else
      {
      cFieldName = new DataGridViewTextBoxCell();
      DataGridViewTextBoxCell cFieldValue = new DataGridViewTextBoxCell();
    
      if (FieldName == DBEpisode.cAudioLanguage)
      FieldPrettyName = GetAudioLanguageDisplayName(FieldValue);
    
      // First Column (Name)
      cFieldName.Value = FieldPrettyName;
      cFieldName.Style.BackColor = System.Drawing.SystemColors.Control;
      dataGridDetailRow.Cells.Add(cFieldName);
      cFieldName.ReadOnly = true;
    
      cFieldValue.Value = FieldValue;
      cFieldValue.Tag = FieldName;
    
      dataGridDetailRow.Cells.Add(cFieldValue);
    
      if (!CanModify)
      {
      cFieldValue.ReadOnly = true;
      cFieldValue.Style.BackColor = System.Drawing.SystemColors.Control;
      }
    
      if (userEdited)
      {
      cFieldValue.Style.ForeColor = System.Drawing.SystemColors.HotTrack;
    
      }
    
      cFieldValue.Style.Alignment = TextAlign;
    
      // Add the rows to the DataGridView
      dataGridView1.Rows.Add(dataGridDetailRow);
      }
      }
      }

    When there is a user edit, the id is > 0, therefore it gets to the condition "if (id < 0)" and then exits the method.
     

    barneh

    MP Donator
  • Premium Supporter
  • February 4, 2010
    245
    54
    Malmö
    Home Country
    Sweden Sweden
    Sorry but I still don't understand what the problem is?

    I have looked at the code before I added Language, and nothing is broken as I can see...
     

    Users who are viewing this thread

    Top Bottom