Example #1
0
// -------------------------------------------------------------------------------- //
void guDbRadios::SetRadioStationsLabels( const guArrayListItems &labelsets )
{
  wxString query;
  wxArrayInt Stations;
  wxArrayInt Labels;
  int StaIndex;
  int StaCount;
  int LaIndex;
  int LaCount;

  if( ( StaCount = labelsets.Count() ) )
  {
    for( StaIndex = 0; StaIndex < StaCount; StaIndex++ )
    {
        Stations.Add( labelsets[ StaIndex ].GetId() );
    }
    query = wxT( "DELETE FROM radiosetlabels " \
                 "WHERE radiosetlabel_stationid IN " ) + ArrayIntToStrList( Stations );

    ExecuteUpdate( query );

    for( StaIndex = 0; StaIndex < StaCount; StaIndex++ )
    {
      Labels = labelsets[ StaIndex ].GetData();
      LaCount = Labels.Count();
      for( LaIndex = 0; LaIndex < LaCount; LaIndex++ )
      {
        query = wxString::Format( wxT( "INSERT INTO radiosetlabels( radiosetlabel_labelid, radiosetlabel_stationid ) " \
                                       "VALUES( %u, %u );" ), Labels[ LaIndex ], Stations[ StaIndex ] );
        ExecuteUpdate( query );
      }
    }
  }
}
Example #2
0
// -------------------------------------------------------------------------------- //
void guJamendoLibrary::UpdateAlbumsLabels( const guArrayListItems &labelsets )
{
  guListItems   LaItems;

  // The ArtistLabels string is the same for all songs so done out of the loop
  GetLabels( &LaItems, true );

  int           ItemIndex;
  int           ItemCount = labelsets.Count();
  for( ItemIndex = 0; ItemIndex < ItemCount; ItemIndex++ )
  {
    wxArrayInt ItemLabels = labelsets[ ItemIndex ].GetData();

    //guLogMessage( wxT( "Artist Labels : '%s'" ), ArtistLabelStr.c_str() );
    // Update the Database
    wxArrayInt ItemIds;
    ItemIds.Add( labelsets[ ItemIndex ].GetId() );
    SetAlbumsLabels( ItemIds, ItemLabels );
  }
}