MythTV  master
importmusic.cpp
Go to the documentation of this file.
1 // qt
2 #include <QDir>
3 #include <QFontMetrics>
4 #include <QApplication>
5 
6 // myth
7 #include <mythcontext.h>
8 #include <mythdbcon.h>
9 #include <musicmetadata.h>
10 #include <mythdialogbox.h>
11 #include <mythuitext.h>
12 #include <mythuiimage.h>
13 #include <mythuicheckbox.h>
14 #include <mythuitextedit.h>
15 #include <mythuibutton.h>
16 #include <mythuibuttonlist.h>
17 #include <mythprogressdialog.h>
18 #include <mythuifilebrowser.h>
19 #include <mythlogging.h>
20 #include <remotefile.h>
21 #include <storagegroup.h>
22 
23 // mythmusic
24 #include "importmusic.h"
25 #include "genres.h"
26 #include "editmetadata.h"
27 #include "musicplayer.h"
28 #include "metaio.h"
29 #include "musicutils.h"
30 
31 
33 
35  MThread("FileScanner"), m_parent(parent)
36 {
37 }
38 
40 {
41  RunProlog();
42  m_parent->doScan();
43  RunEpilog();
44 }
45 
47 
49 {
50  RunProlog();
52  RunEpilog();
53 }
54 
56 
57 
59  MythScreenType(parent, "musicimportfiles"),
60  m_tracks(new std::vector<TrackInfo*>)
61 {
62  QString lastHost = gCoreContext->GetSetting("MythMusicLastImportHost", gCoreContext->GetMasterHostName());
63  QStringList dirs = StorageGroup::getGroupDirs("Music", lastHost);
64  if (dirs.count() > 0)
65  m_musicStorageDir = StorageGroup::getGroupDirs("Music", lastHost).at(0);
66 }
67 
69 {
71  {
73  gPlayer->stop(true);
74  }
75 
76  if (m_locationEdit)
77  gCoreContext->SaveSetting("MythMusicLastImportDir", m_locationEdit->GetText());
78 
79  delete m_tracks;
80 
82  emit importFinished();
83 }
84 
86 {
87  if (!m_tracks->empty())
88  {
89  // update current
90  //: %1 is the current track,
91  //: %2 is the number of tracks
92  m_currentText->SetText(tr("%1 of %2", "Current track position")
93  .arg(m_currentTrack + 1).arg(m_tracks->size()));
94 
95  MusicMetadata *meta = m_tracks->at(m_currentTrack)->metadata;
99  m_artistText->SetText(meta->Artist());
100  m_albumText->SetText(meta->Album());
101  m_titleText->SetText(meta->Title());
102  m_genreText->SetText(meta->Genre());
103  m_yearText->SetText(QString::number(meta->Year()));
104  m_trackText->SetText(QString::number(meta->Track()));
105  if (m_tracks->at(m_currentTrack)->isNewTune)
106  {
108  m_statusText->SetText(tr("New File"));
109  }
110  else
111  {
113  m_statusText->SetText(tr("Already in Database"));
114  }
115  }
116  else
117  {
118  // update current
119  m_currentText->SetText(tr("Not found"));
123  m_artistText->Reset();
124  m_albumText->Reset();
125  m_titleText->Reset();
126  m_genreText->Reset();
127  m_yearText->Reset();
128  m_trackText->Reset();
129  m_statusText->Reset();
131  }
132 }
133 
134 bool ImportMusicDialog::keyPressEvent(QKeyEvent *event)
135 {
136  if (GetFocusWidget() && GetFocusWidget()->keyPressEvent(event))
137  return true;
138 
139  QStringList actions;
140  bool handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
141 
142  for (int i = 0; i < actions.size() && !handled; i++)
143  {
144  QString action = actions[i];
145  handled = true;
146 
147  if (action == "LEFT")
148  {
149  m_prevButton->Push();
150  }
151  else if (action == "RIGHT")
152  {
153  m_nextButton->Push();
154  }
155  else if (action == "EDIT")
156  {
158  }
159  else if (action == "MENU")
160  {
161  ShowMenu();
162  }
163  else if (action == "ESCAPE" && !GetMythMainWindow()->IsExitingToMain())
164  {
165  bool found = false;
166  if (!m_tracks->empty())
167  {
168  uint track = 0;
169  while (track < m_tracks->size())
170  {
171  if (m_tracks->at(track)->isNewTune)
172  {
173  found = true;
174  break;
175  }
176  track++;
177  }
178 
179  if (found)
180  {
181  QString msg = tr("You might have unsaved changes.\nAre you sure you want to exit this screen?");
182  ShowOkPopup(msg, this, SLOT(doExit(bool)), true);
183  }
184  }
185 
186  handled = found;
187  }
188  else if (action == "1")
189  {
190  setCompilation();
191  }
192  else if (action == "2")
193  {
195  }
196  else if (action == "3")
197  {
198  setArtist();
199  }
200  else if (action == "4")
201  {
202  setAlbum();
203  }
204  else if (action == "5")
205  {
206  setGenre();
207  }
208  else if (action == "6")
209  {
210  setYear();
211  }
212  else if (action == "7")
213  {
214  setRating();
215  }
216  else if (action == "8")
217  {
219  }
220  else if (action == "9")
221  {
223  }
224  else if (action == "0")
225  {
226  setTrack();
227  }
228  else
229  handled = false;
230  }
231 
232  if (!handled && MythScreenType::keyPressEvent(event))
233  handled = true;
234 
235  return handled;
236 }
237 
239 {
240  if (!LoadWindowFromXML("music-ui.xml", "import_music", this))
241  return false;
242 
243  bool err = false;
244  UIUtilE::Assign(this, m_locationEdit, "location", &err);
245  UIUtilE::Assign(this, m_locationButton, "directoryfinder", &err);
246  UIUtilE::Assign(this, m_scanButton, "scan", &err);
247  UIUtilE::Assign(this, m_coverartButton, "coverart", &err);
248  UIUtilE::Assign(this, m_filenameText, "filename", &err);
249  UIUtilE::Assign(this, m_compartistText, "compartist", &err);
250  UIUtilE::Assign(this, m_artistText, "artist", &err);
251  UIUtilE::Assign(this, m_albumText, "album", &err);
252  UIUtilE::Assign(this, m_titleText, "title", &err);
253  UIUtilE::Assign(this, m_genreText, "genre", &err);
254  UIUtilE::Assign(this, m_yearText, "year", &err);
255  UIUtilE::Assign(this, m_trackText, "track", &err);
256  UIUtilE::Assign(this, m_currentText, "position", &err);
257  UIUtilE::Assign(this, m_statusText, "status", &err);
258  UIUtilE::Assign(this, m_compilationCheck,"compilation", &err);
259  UIUtilE::Assign(this, m_playButton, "play", &err);
260  UIUtilE::Assign(this, m_nextnewButton, "nextnew", &err);
261  UIUtilE::Assign(this, m_addButton, "add", &err);
262  UIUtilE::Assign(this, m_addallnewButton, "addallnew", &err);
263  UIUtilE::Assign(this, m_nextButton, "next", &err);
264  UIUtilE::Assign(this, m_prevButton, "prev", &err);
265 
266  if (err)
267  {
268  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_music'");
269  return false;
270  }
271 
281 
282  fillWidgets();
283 
284  BuildFocusList();
285 
286  m_locationEdit->SetText(gCoreContext->GetSetting("MythMusicLastImportDir", "/"));
287 
288  return true;
289 }
290 
292 {
293  if (ok)
294  Close();
295 }
296 
298 {
299  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
300  auto *fb = new MythUIFileBrowser(popupStack, m_locationEdit->GetText());
301  // TODO Install a name filter on supported music formats
302  fb->SetTypeFilter(QDir::AllDirs | QDir::Readable);
303  if (fb->Create())
304  {
305  fb->SetReturnEvent(this, "locationchange");
306  popupStack->AddScreen(fb);
307  }
308  else
309  delete fb;
310 }
311 
313 {
315 }
316 
318 {
319  if (m_tracks->empty())
320  return;
321 
322  m_playingMetaData = m_tracks->at(m_currentTrack)->metadata;
323 
325 }
326 
328 {
329  if (m_currentTrack > 0)
330  {
331  m_currentTrack--;
332  fillWidgets();
333  }
334 }
335 
337 {
338  if (m_currentTrack < (int) m_tracks->size() - 1)
339  {
340  m_currentTrack++;
341  fillWidgets();
342  }
343 }
344 
346 {
347  if (m_tracks->empty())
348  return;
349 
350  MusicMetadata *meta = m_tracks->at(m_currentTrack)->metadata;
351 
352  // is the current track a new file?
353  if (m_tracks->at(m_currentTrack)->isNewTune)
354  {
355  // do we need to update the tags?
356  if (m_tracks->at(m_currentTrack)->metadataHasChanged)
357  {
358  MetaIO *tagger = MetaIO::createTagger(meta->Filename());
359  if (tagger)
360  {
361  tagger->write(meta->Filename(), meta);
362  delete tagger;
363  }
364  }
365 
366  // get the save filename
367  QString origFilename = meta->Filename();
368  QString saveFilename = filenameFromMetadata(meta);
369  QString fullFilename;
370 
371  QUrl url(m_musicStorageDir);
372  fullFilename = MythCoreContext::GenMythURL(url.host(), 0, saveFilename, "Music");
373 
374 
375  // we need to manually copy the file extension
376  QFileInfo fi(origFilename);
377  saveFilename += "." + fi.suffix();
378  fullFilename += "." + fi.suffix();
379 
380  LOG(VB_FILE, LOG_INFO, QString("Copying file from: %1").arg(origFilename));
381  LOG(VB_FILE, LOG_INFO, QString("to: ").arg(fullFilename));
382 
383  // copy the file to the new location
384  if (!copyFile(origFilename, fullFilename))
385  {
386  ShowOkPopup(tr("Copy Failed\nCould not copy file to: %1").arg(fullFilename));
387  return;
388  }
389 
390  meta->setFilename(saveFilename);
391  meta->setHostname(url.host());
392  meta->setFileSize((quint64)QFileInfo(origFilename).size());
393 
394  // update the database
395  meta->dumpToDatabase();
396 
397  // find any albumart for this track
398  meta->getAlbumArtImages()->scanForImages();
400 
401  m_somethingWasImported = true;
402 
403  m_tracks->at(m_currentTrack)->isNewTune =
404  isNewTune(meta->Artist(), meta->Album(), meta->Title());
405 
406  // update the UI
407  fillWidgets();
408  }
409  else
410  ShowOkPopup(tr("This track is already in the database"));
411 }
412 
414 {
415  if (m_tracks->empty())
416  return;
417 
418  m_currentTrack = 0;
419  int newCount = 0;
420 
421  while (m_currentTrack < (int) m_tracks->size())
422  {
423  fillWidgets();
424  QCoreApplication::processEvents();
425 
426  if (m_tracks->at(m_currentTrack)->isNewTune)
427  {
428  addPressed();
429  newCount++;
430  }
431 
432  QCoreApplication::processEvents();
433 
434  m_currentTrack++;
435  }
436 
437  m_currentTrack--;
438 
439  ShowOkPopup(tr("%1 new tracks were added to the database").arg(newCount));
440 }
441 
443 {
444  if (m_tracks->empty())
445  return;
446 
447  uint track = m_currentTrack + 1;
448  while (track < m_tracks->size())
449  {
450  if (m_tracks->at(track)->isNewTune)
451  {
452  m_currentTrack = track;
453  fillWidgets();
454  break;
455  }
456  track++;
457  }
458 }
459 
460 bool ImportMusicDialog::copyFile(const QString &src, const QString &dst)
461 {
462  bool res = false;
463  QString host = QUrl(dst).host();
464 
465  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
466  auto *busy =
467  new MythUIBusyDialog(tr("Copying music file to the 'Music' storage group on %1").arg(host),
468  popupStack,
469  "scanbusydialog");
470 
471  if (busy->Create())
472  {
473  popupStack->AddScreen(busy, false);
474  }
475  else
476  {
477  delete busy;
478  busy = nullptr;
479  }
480 
481  auto *copy = new FileCopyThread(src, dst);
482  copy->start();
483 
484  while (!copy->isFinished())
485  {
486  const struct timespec halfms {0, 500000};
487  nanosleep(&halfms, nullptr);
488  QCoreApplication::processEvents();
489  }
490 
491  res = copy->GetResult();
492 
493  delete copy;
494 
495  if (busy)
496  busy->Close();
497 
498  return res;
499 }
500 
502 {
503  // sanity check - make sure the user isn't trying to import tracks from the music directory
504  QString location = m_locationEdit->GetText();
505  if (!location.endsWith('/'))
506  location.append('/');
507 
508  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
509  auto *busy = new MythUIBusyDialog(tr("Searching for music files"),
510  popupStack, "scanbusydialog");
511 
512  if (busy->Create())
513  {
514  popupStack->AddScreen(busy, false);
515  }
516  else
517  {
518  delete busy;
519  busy = nullptr;
520  }
521  auto *scanner = new FileScannerThread(this);
522  scanner->start();
523 
524  while (!scanner->isFinished())
525  {
526  const struct timespec halfms {0, 500000};
527  nanosleep(&halfms, nullptr);
528  QCoreApplication::processEvents();
529  }
530 
531  delete scanner;
532 
533  m_currentTrack = 0;
534  fillWidgets();
535 
536  if (busy)
537  busy->Close();
538 }
539 
541 {
542  m_tracks->clear();
543  m_sourceFiles.clear();
544  QString location = m_locationEdit->GetText();
545  scanDirectory(location, m_tracks);
546 }
547 
548 void ImportMusicDialog::scanDirectory(QString &directory, std::vector<TrackInfo*> *tracks)
549 {
550  QDir d(directory);
551 
552  if (!d.exists())
553  return;
554 
555  d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
556  const QFileInfoList list = d.entryInfoList();
557  if (list.isEmpty())
558  return;
559 
560  QFileInfoList::const_iterator it = list.begin();
561  while (it != list.end())
562  {
563  const QFileInfo *fi = &(*it);
564  ++it;
565  QString filename = fi->absoluteFilePath();
566  if (fi->isDir())
567  scanDirectory(filename, tracks);
568  else
569  {
571  if (tagger)
572  {
573  MusicMetadata *metadata = tagger->read(filename);
574  if (metadata)
575  {
576  auto * track = new TrackInfo;
577  track->metadata = metadata;
578  track->isNewTune = isNewTune(metadata->Artist(), metadata->Album(),
579  metadata->Title());
580  track->metadataHasChanged = false;
581  tracks->push_back(track);
582  m_sourceFiles.append(filename);
583  }
584 
585  delete tagger;
586  }
587  }
588  }
589 }
590 
592 {
593  if (m_tracks->empty())
594  return;
595 
596  MusicMetadata *editMeta = m_tracks->at(m_currentTrack)->metadata;
597 
599 
600  auto *editDialog = new EditMetadataDialog(mainStack, editMeta);
601 
602  if (!editDialog->Create())
603  {
604  delete editDialog;
605  return;
606  }
607 
608  editDialog->setSaveMetadataOnly();
609 
611 
612  mainStack->AddScreen(editDialog);
613 }
614 
616 {
617  MusicMetadata *editMeta = m_tracks->at(m_currentTrack)->metadata;
618  m_tracks->at(m_currentTrack)->metadataHasChanged = true;
619  m_tracks->at(m_currentTrack)->isNewTune =
620  isNewTune(editMeta->Artist(), editMeta->Album(), editMeta->Title());
621  fillWidgets();
622 }
623 
625 {
626  if (m_tracks->empty())
627  return;
628 
629  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
630 
631  auto *menu = new MythDialogBox("", popupStack, "importmusicmenu");
632 
633  if (menu->Create())
634  popupStack->AddScreen(menu);
635  else
636  {
637  delete menu;
638  return;
639  }
640 
641  menu->SetReturnEvent(this, "menu");
642  menu->AddButton(tr("Select Where To Save Tracks"), SLOT(chooseBackend()));
643  menu->AddButton(tr("Save Defaults"), SLOT(saveDefaults()));
644 
645  if (m_haveDefaults)
646  {
647  menu->AddButton(tr("Change Compilation Flag"), SLOT(setCompilation()));
648  menu->AddButton(tr("Change Compilation Artist"),
649  SLOT(setCompilationArtist()));
650  menu->AddButton(tr("Change Artist"), SLOT(setArtist()));
651  menu->AddButton(tr("Change Album"), SLOT(setAlbum()));
652  menu->AddButton(tr("Change Genre"), SLOT(setGenre()));
653  menu->AddButton(tr("Change Year"), SLOT(setYear()));
654  menu->AddButton(tr("Change Rating"), SLOT(setRating()));
655  }
656 }
657 
659 {
660  QStringList hostList;
661 
662  // get a list of hosts with a directory defined for the 'Music' storage group
664  QString sql = "SELECT DISTINCT hostname "
665  "FROM storagegroup "
666  "WHERE groupname = 'Music'";
667  if (!query.exec(sql) || !query.isActive())
668  MythDB::DBError("ImportMusicDialog::chooseBackend get host list", query);
669  else
670  {
671  while(query.next())
672  {
673  hostList.append(query.value(0).toString());
674  }
675  }
676 
677  if (hostList.isEmpty())
678  {
679  LOG(VB_GENERAL, LOG_ERR, "ImportMusicDialog::chooseBackend: No backends found");
680  return;
681  }
682 
683  QString msg = tr("Select where to save tracks");
684 
685  MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
686  auto *searchDlg = new MythUISearchDialog(popupStack, msg, hostList, false, "");
687 
688  if (!searchDlg->Create())
689  {
690  delete searchDlg;
691  return;
692  }
693 
695 
696  popupStack->AddScreen(searchDlg);
697 }
698 
699 void ImportMusicDialog::setSaveHost(const QString& host)
700 {
701  gCoreContext->SaveSetting("MythMusicLastImportHost", host);
702 
703  QStringList dirs = StorageGroup::getGroupDirs("Music", host);
704  if (dirs.count() > 0)
705  m_musicStorageDir = StorageGroup::getGroupDirs("Music", host).at(0);
706 
707 }
708 
710 {
711  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
714  m_defaultArtist = data->Artist();
715  m_defaultAlbum = data->Album();
716  m_defaultGenre = data->Genre();
717  m_defaultYear = data->Year();
718  m_defaultRating = data->Rating();
719 
720  m_haveDefaults = true;
721 }
722 
724 {
725  if (!m_haveDefaults)
726  return;
727 
728  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
729 
731  {
734  }
735  else
736  {
739  }
740 
741  fillWidgets();
742 }
743 
745 {
746  if (!m_haveDefaults)
747  return;
748 
749  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
751 
752  fillWidgets();
753 }
754 
756 {
757  if (!m_haveDefaults)
758  return;
759 
760  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
761  data->setArtist(m_defaultArtist);
762 
763  m_tracks->at(m_currentTrack)->isNewTune =
764  isNewTune(data->Artist(), data->Album(), data->Title());
765 
766  fillWidgets();
767 }
768 
770 {
771  if (!m_haveDefaults)
772  return;
773 
774  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
775  data->setAlbum(m_defaultAlbum);
776 
777  m_tracks->at(m_currentTrack)->isNewTune =
778  isNewTune(data->Artist(), data->Album(), data->Title());
779 
780  fillWidgets();
781 }
782 
784 {
785  if (!m_haveDefaults)
786  return;
787 
788  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
789  data->setYear(m_defaultYear);
790 
791  fillWidgets();
792 }
793 
795 {
796  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
797  data->setTrack(data->Track() + 100);
798 
799  fillWidgets();
800 }
801 
803 {
804  if (!m_haveDefaults)
805  return;
806 
807  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
808  data->setGenre(m_defaultGenre);
809 
810  fillWidgets();
811 }
812 
814 {
815  if (!m_haveDefaults)
816  return;
817 
818  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
819  data->setRating(m_defaultRating);
820 }
821 
823 {
824  QLocale locale = gCoreContext->GetQLocale();
825  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
826  QString title = locale.toLower(data->Title().simplified());
827  title[0] = title[0].toUpper();
828  data->setTitle(title);
829  fillWidgets();
830 }
831 
833 {
834  QLocale locale = gCoreContext->GetQLocale();
835  MusicMetadata *data = m_tracks->at(m_currentTrack)->metadata;
836  QString title = locale.toLower(data->Title().simplified());
837  QStringList title_words = title.split(' ');
838 
839  for (int x = 0; x < title_words.size(); ++x)
840  title_words[x][0] = title_words[x][0].toUpper();
841 
842  data->setTitle(title_words.join(' '));
843  fillWidgets();
844 }
845 
847 {
848  if (m_tracks->empty())
849  return;
850 
851  QFileInfo fi(m_sourceFiles.at(m_currentTrack));
852 
854 
855  auto *import = new ImportCoverArtDialog(mainStack,
856  fi.absolutePath(),
857  m_tracks->at(m_currentTrack)->metadata,
859 
860  if (import->Create())
861  mainStack->AddScreen(import);
862  else
863  delete import;
864 }
865 
867 {
868  if (auto *dce = dynamic_cast<DialogCompletionEvent*>(event))
869  {
870  if (dce->GetId() == "locationchange")
871  {
872  m_locationEdit->SetText(dce->GetResultText());
873  startScan();
874  }
875  }
876 }
877 
879 
881 {
882  if (GetFocusWidget() && GetFocusWidget()->keyPressEvent(event))
883  return true;
884 
885  QStringList actions;
886  bool handled = GetMythMainWindow()->TranslateKeyPress("Global", event, actions);
887 
888  for (int i = 0; i < actions.size() && !handled; i++)
889  {
890  QString action = actions[i];
891  handled = true;
892 
893  if (action == "LEFT")
894  {
895  m_prevButton->Push();
896  }
897  else if (action == "RIGHT")
898  {
899  m_nextButton->Push();
900  }
901  else
902  handled = false;
903  }
904 
905  if (!handled && MythScreenType::keyPressEvent(event))
906  handled = true;
907 
908  return handled;
909 }
910 
912 {
913  if (!LoadWindowFromXML("music-ui.xml", "import_coverart", this))
914  return false;
915 
916  bool err = false;
917  UIUtilE::Assign(this, m_filenameText, "file", &err);
918  UIUtilE::Assign(this, m_currentText, "position", &err);
919  UIUtilE::Assign(this, m_statusText, "status", &err);
920  UIUtilE::Assign(this, m_destinationText, "destination", &err);
921  UIUtilE::Assign(this, m_coverartImage, "coverart", &err);
922  UIUtilE::Assign(this, m_copyButton, "copy", &err);
923  UIUtilE::Assign(this, m_exitButton, "exit", &err);
924  UIUtilE::Assign(this, m_prevButton, "prev", &err);
925  UIUtilE::Assign(this, m_nextButton, "next", &err);
926  UIUtilE::Assign(this, m_typeList, "type", &err);
927 
928  if (err)
929  {
930  LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'import_coverart'");
931  return false;
932  }
933 
934  if (m_typeList)
935  {
936  new MythUIButtonListItem(m_typeList, tr("Front Cover"),
937  QVariant::fromValue((int)IT_FRONTCOVER));
938  new MythUIButtonListItem(m_typeList, tr("Back Cover"),
939  QVariant::fromValue((int)IT_BACKCOVER));
940  new MythUIButtonListItem(m_typeList, tr("CD"),
941  QVariant::fromValue((int)IT_CD));
942  new MythUIButtonListItem(m_typeList, tr("Inlay"),
943  QVariant::fromValue((int)IT_INLAY));
944  new MythUIButtonListItem(m_typeList, tr("<Unknown>"),
945  QVariant::fromValue((int)IT_UNKNOWN));
946 
949  }
950 
951  if (m_copyButton)
953 
954  if (m_exitButton)
956 
957  if (m_prevButton)
959 
960  if (m_nextButton)
962 
963  BuildFocusList();
964 
965  scanDirectory();
966 
967  return true;
968 }
969 
971 {
972  updateStatus();
973 }
974 
976 {
977  if (!m_filelist.empty())
978  {
980  {
981  //: %1 is the filename
982  ShowOkPopup(tr("Copy CoverArt Failed.\nCopying to %1").arg(m_saveFilename));
983  return;
984  }
985 
986  // add the file to the database
987  QString filename = m_saveFilename.section( '/', -1, -1);
988  AlbumArtImage image;
989  image.m_description = "";
990  image.m_embedded = false;
991  image.m_filename = filename;
992  image.m_hostname = m_metadata->Hostname();
993  image.m_imageType = (ImageType)m_typeList->GetItemCurrent()->GetData().toInt();
994 
997 
998  updateStatus();
999  }
1000 }
1001 
1003 {
1004  if (m_currentFile > 0)
1005  {
1006  m_currentFile--;
1008  updateStatus();
1009  }
1010 }
1011 
1013 {
1014  if (m_currentFile < m_filelist.size() - 1)
1015  {
1016  m_currentFile++;
1018  updateStatus();
1019  }
1020 }
1021 
1023 {
1024  QDir d(m_sourceDir);
1025 
1026  if (!d.exists())
1027  return;
1028 
1029  QString nameFilter = gCoreContext->GetSetting("AlbumArtFilter",
1030  "*.png;*.jpg;*.jpeg;*.gif;*.bmp");
1031 
1032  QFileInfoList list = d.entryInfoList(nameFilter.split(";"),
1033  QDir::Files | QDir::Dirs |
1034  QDir::NoDotAndDotDot);
1035  if (list.isEmpty())
1036  return;
1037 
1038  for (const auto & fi : qAsConst(list))
1039  {
1040  QString filename = fi.absoluteFilePath();
1041  if (!fi.isDir())
1042  {
1043  m_filelist.append(filename);
1044  }
1045  }
1046 
1047  m_currentFile = 0;
1049  updateStatus();
1050 }
1051 
1053 {
1054  if (!m_filelist.empty())
1055  {
1056  if (m_currentText)
1057  {
1058  //: %1 is the current position of the file being copied,
1059  //: %2 is the total number of files
1060  m_currentText->SetText(tr("%1 of %2", "Current file copied")
1061  .arg(m_currentFile + 1)
1062  .arg(m_filelist.size()));
1063  }
1066  m_coverartImage->Load();
1067 
1068  QString saveFilename = filenameFromMetadata(m_metadata);
1069  QString fullFilename;
1070 
1071  QUrl url(m_musicStorageDir);
1072  fullFilename = MythCoreContext::GenMythURL(url.host(), 0, saveFilename, "Music");
1073  QString dir = fullFilename.section( '/', 0, -2);
1074 
1075  QFileInfo fi(m_filelist[m_currentFile]);
1076  switch (m_typeList->GetItemCurrent()->GetData().toInt())
1077  {
1078  case IT_FRONTCOVER:
1079  saveFilename = "front." + fi.suffix();
1080  break;
1081  case IT_BACKCOVER:
1082  saveFilename = "back." + fi.suffix();
1083  break;
1084  case IT_CD:
1085  saveFilename = "cd." + fi.suffix();
1086  break;
1087  case IT_INLAY:
1088  saveFilename = "inlay." + fi.suffix();
1089  break;
1090  case IT_UNKNOWN:
1091  saveFilename = "unknown." + fi.suffix();
1092  break;
1093  default:
1094  saveFilename = fi.fileName();
1095  }
1096 
1097  m_saveFilename = dir + "/" + saveFilename;
1099 
1100  url.setUrl(m_saveFilename);
1101 
1102  if (!RemoteFile::FindFile(url.path(), "" , "Music").isEmpty())
1103  m_statusText->SetText(tr("File Already Exists"));
1104  else
1105  m_statusText->SetText(tr("New File"));
1106  }
1107  else
1108  {
1109  if (m_currentText)
1110  m_currentText->Reset();
1111  m_statusText->Reset();
1112  m_filenameText->Reset();
1115  }
1116 }
1117 
1119 {
1120  if (m_filelist.empty())
1121  return;
1122 
1123  QString filename = m_filelist[m_currentFile];
1124  QFileInfo fi(filename);
1125  filename = fi.fileName();
1126 
1127  if (filename.contains("front", Qt::CaseInsensitive))
1128  m_typeList->SetValue(tr("Front Cover"));
1129  else if (filename.contains("back", Qt::CaseInsensitive))
1130  m_typeList->SetValue(tr("Back Cover"));
1131  else if (filename.contains("inlay", Qt::CaseInsensitive))
1132  m_typeList->SetValue(tr("Inlay"));
1133  else if (filename.contains("cd", Qt::CaseInsensitive))
1134  m_typeList->SetValue(tr("CD"));
1135  else
1136  m_typeList->SetValue(tr("<Unknown>"));
1137 }
ImportMusicDialog::nextPressed
void nextPressed(void)
Definition: importmusic.cpp:336
ImportCoverArtDialog::m_prevButton
MythUIButton * m_prevButton
Definition: importmusic.h:210
MythUIButton::Clicked
void Clicked()
ImportMusicDialog::m_currentTrack
int m_currentTrack
Definition: importmusic.h:118
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:126
MythMainWindow::GetMainStack
MythScreenStack * GetMainStack()
Definition: mythmainwindow.cpp:321
ImportMusicDialog::m_albumText
MythUIText * m_albumText
Definition: importmusic.h:130
ImportCoverArtDialog::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: importmusic.cpp:880
MythUISearchDialog
Provide a dialog to quickly find an entry in a list.
Definition: mythdialogbox.h:349
MusicMetadata::Title
QString Title() const
Definition: musicmetadata.h:162
gPlayer
MusicPlayer * gPlayer
Definition: musicplayer.cpp:35
ImportMusicDialog::m_defaultAlbum
QString m_defaultAlbum
Definition: importmusic.h:153
MusicMetadata::Filename
QString Filename(bool find=true)
Definition: musicmetadata.cpp:966
MythUIButtonList::GetItemCurrent
MythUIButtonListItem * GetItemCurrent() const
Definition: mythuibuttonlist.cpp:1590
AlbumArtImage::m_imageType
ImageType m_imageType
Definition: musicmetadata.h:51
MythCoreContext::GetMasterHostName
QString GetMasterHostName(void)
Definition: mythcorecontext.cpp:824
ImportMusicDialog::setTitleWordCaps
void setTitleWordCaps(void)
Definition: importmusic.cpp:832
mythuitext.h
copy
long long copy(QFile &dst, QFile &src, uint block_size)
Copies src file to dst file.
Definition: mythmiscutil.cpp:305
ImportMusicDialog::setArtist
void setArtist(void)
Definition: importmusic.cpp:755
ImportMusicDialog::m_somethingWasImported
bool m_somethingWasImported
Definition: importmusic.h:115
MusicMetadata::Genre
QString Genre() const
Definition: musicmetadata.h:175
MythUIText::Reset
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitext.cpp:84
editmetadata.h
ImportMusicDialog::m_defaultYear
int m_defaultYear
Definition: importmusic.h:155
ShowOkPopup
MythConfirmationDialog * ShowOkPopup(const QString &message, QObject *parent, const char *slot, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
Definition: mythdialogbox.cpp:551
ImportMusicDialog::playPressed
void playPressed(void)
Definition: importmusic.cpp:317
ImportMusicDialog::importFinished
void importFinished(void)
ImportMusicDialog::nextNewPressed
void nextNewPressed(void)
Definition: importmusic.cpp:442
ImportCoverArtDialog::Create
bool Create(void) override
Definition: importmusic.cpp:911
ImportMusicDialog::setCompilationArtist
void setCompilationArtist(void)
Definition: importmusic.cpp:744
ImportMusicDialog::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: importmusic.cpp:134
MythScreenType::Close
virtual void Close()
Definition: mythscreentype.cpp:402
MusicMetadata::getAlbumArtImages
AlbumArtImages * getAlbumArtImages(void)
Definition: musicmetadata.cpp:1365
ImportMusicDialog::m_scanButton
MythUIButton * m_scanButton
Definition: importmusic.h:124
MetaIO::write
virtual bool write(const QString &filename, MusicMetadata *mdata)=0
Writes all metadata back to a file.
MusicMetadata::CompilationArtist
QString CompilationArtist() const
Definition: musicmetadata.h:138
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
ImportMusicDialog::addPressed
void addPressed(void)
Definition: importmusic.cpp:345
MetaIO::createTagger
static MetaIO * createTagger(const QString &filename)
Finds an appropriate tagger for the given file.
Definition: metaio.cpp:32
FileScannerThread
Definition: importmusic.h:32
MythMainWindow::TranslateKeyPress
bool TranslateKeyPress(const QString &context, QKeyEvent *e, QStringList &actions, bool allowJumps=true)
Get a list of actions for a keypress in the given context.
Definition: mythmainwindow.cpp:1139
ImportMusicDialog::m_genreText
MythUIText * m_genreText
Definition: importmusic.h:132
FileCopyThread::m_srcFile
QString m_srcFile
Definition: importmusic.h:52
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition: mythuiimage.cpp:968
MythUISearchDialog::haveResult
void haveResult(QString)
MusicMetadata::setTrack
void setTrack(int ltrack)
Definition: musicmetadata.h:200
MythUIButtonList::itemSelected
void itemSelected(MythUIButtonListItem *item)
ImportMusicDialog::m_statusText
MythUIText * m_statusText
Definition: importmusic.h:140
mythdialogbox.h
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
MythScreenStack
Definition: mythscreenstack.h:16
arg
arg(title).arg(filename).arg(doDelete))
mythdbcon.h
MetaIO
Definition: metaio.h:18
ImportCoverArtDialog::m_currentFile
int m_currentFile
Definition: importmusic.h:195
ImportCoverArtDialog::prevPressed
void prevPressed(void)
Definition: importmusic.cpp:1002
ImportMusicDialog::m_compilationCheck
MythUICheckBox * m_compilationCheck
Definition: importmusic.h:147
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
MusicMetadata::setAlbum
void setAlbum(const QString &lalbum, const QString &lalbum_sort=nullptr)
Definition: musicmetadata.h:152
ImportMusicDialog::m_sourceFiles
QStringList m_sourceFiles
Definition: importmusic.h:117
ImportCoverArtDialog::m_filenameText
MythUIText * m_filenameText
Definition: importmusic.h:201
MusicPlayer::isPlaying
bool isPlaying(void) const
Definition: musicplayer.h:102
MusicMetadata::Track
int Track() const
Definition: musicmetadata.h:199
genres.h
MusicMetadata::setRating
void setRating(int lrating)
Definition: musicmetadata.h:241
ImportMusicDialog::coverArtPressed
void coverArtPressed(void)
Definition: importmusic.cpp:312
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
MThread::RunProlog
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:198
ImportMusicDialog::m_defaultCompilation
bool m_defaultCompilation
Definition: importmusic.h:150
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
ImportMusicDialog::m_tracks
std::vector< TrackInfo * > * m_tracks
Definition: importmusic.h:116
ImportMusicDialog::startScan
void startScan(void)
Definition: importmusic.cpp:501
IT_BACKCOVER
@ IT_BACKCOVER
Definition: musicmetadata.h:32
ImportMusicDialog::locationPressed
void locationPressed(void)
Definition: importmusic.cpp:297
ImportCoverArtDialog::updateTypeSelector
void updateTypeSelector(void)
Definition: importmusic.cpp:1118
MusicMetadata
Definition: musicmetadata.h:81
ImportMusicDialog::Create
bool Create(void) override
Definition: importmusic.cpp:238
MythUITextEdit::GetText
QString GetText(void) const
Definition: mythuitextedit.h:47
ImportMusicDialog::m_defaultRating
int m_defaultRating
Definition: importmusic.h:156
ImportMusicDialog::ShowMenu
void ShowMenu(void) override
Definition: importmusic.cpp:624
MythUIImage::Reset
void Reset(void) override
Reset the image back to the default defined in the theme.
Definition: mythuiimage.cpp:645
ImportCoverArtDialog::m_copyButton
MythUIButton * m_copyButton
Definition: importmusic.h:211
MusicMetadata::Artist
QString Artist() const
Definition: musicmetadata.h:126
ImportCoverArtDialog::m_currentText
MythUIText * m_currentText
Definition: importmusic.h:202
menu
static MythThemedMenu * menu
Definition: mythtv/programs/mythtv-setup/main.cpp:53
MythMainWindow::GetStack
MythScreenStack * GetStack(const QString &stackname)
Definition: mythmainwindow.cpp:326
mythuibuttonlist.h
mythuiimage.h
musicutils.h
mythprogressdialog.h
ImportMusicDialog::m_addButton
MythUIButton * m_addButton
Definition: importmusic.h:143
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition: mythscreentype.cpp:112
isNewTune
bool isNewTune(const QString &artist, const QString &album, const QString &title)
try to find a track in the db using the given artist, album and title
Definition: musicutils.cpp:139
MusicPlayer::getCurrentMetadata
MusicMetadata * getCurrentMetadata(void)
get the metadata for the current track in the playlist
Definition: musicplayer.cpp:1157
ImportMusicDialog::setRating
void setRating(void)
Definition: importmusic.cpp:813
ImportMusicDialog::setTitleInitialCap
void setTitleInitialCap(void)
Definition: importmusic.cpp:822
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
MythUITextEdit::SetText
void SetText(const QString &text, bool moveCursor=true)
Definition: mythuitextedit.cpp:216
ImportMusicDialog::m_titleText
MythUIText * m_titleText
Definition: importmusic.h:131
ImportMusicDialog::metadataChanged
void metadataChanged(void)
Definition: importmusic.cpp:615
ImportCoverArtDialog::m_metadata
MusicMetadata * m_metadata
Definition: importmusic.h:194
ImportCoverArtDialog::nextPressed
void nextPressed(void)
Definition: importmusic.cpp:1012
mythlogging.h
ImportCoverArtDialog::m_musicStorageDir
QString m_musicStorageDir
Definition: importmusic.h:193
MusicMetadata::setHostname
void setHostname(const QString &host)
Definition: musicmetadata.h:230
MythCoreContext::GenMythURL
static QString GenMythURL(const QString &host=QString(), int port=0, QString path=QString(), const QString &storageGroup=QString())
Definition: mythcorecontext.cpp:777
ImportMusicDialog::setTrack
void setTrack(void)
Definition: importmusic.cpp:794
MythCoreContext::GetQLocale
QLocale GetQLocale(void)
Definition: mythcorecontext.cpp:1851
ImportMusicDialog::m_playingMetaData
MusicMetadata * m_playingMetaData
Definition: importmusic.h:119
ImportMusicDialog::m_prevButton
MythUIButton * m_prevButton
Definition: importmusic.h:137
ImportMusicDialog::~ImportMusicDialog
~ImportMusicDialog() override
Definition: importmusic.cpp:68
remotefile.h
FileCopyThread
Definition: importmusic.h:42
MythDialogBox
Basic menu dialog, message and a list of options.
Definition: mythdialogbox.h:138
filenameFromMetadata
QString filenameFromMetadata(MusicMetadata *track)
create a filename using the template in the settings and a MusicMetadata object
Definition: musicutils.cpp:77
ImportMusicDialog::m_nextButton
MythUIButton * m_nextButton
Definition: importmusic.h:136
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
ImportMusicDialog::showEditMetadataDialog
void showEditMetadataDialog(void)
Definition: importmusic.cpp:591
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
ImportMusicDialog::doScan
void doScan(void)
Definition: importmusic.cpp:540
MusicMetadata::setGenre
void setGenre(const QString &lgenre)
Definition: musicmetadata.h:176
ImportMusicDialog::m_artistText
MythUIText * m_artistText
Definition: importmusic.h:129
ImportMusicDialog::m_compartistText
MythUIText * m_compartistText
Definition: importmusic.h:128
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition: mythscreentype.cpp:222
ImportMusicDialog::m_nextnewButton
MythUIButton * m_nextnewButton
Definition: importmusic.h:145
MusicMetadata::setTitle
void setTitle(const QString &ltitle, const QString &ltitle_sort=nullptr)
Definition: musicmetadata.h:164
MusicMetadata::setFileSize
void setFileSize(uint64_t lfilesize)
Definition: musicmetadata.h:233
ImportCoverArtDialog::m_filelist
QStringList m_filelist
Definition: importmusic.h:191
AlbumArtImages::scanForImages
void scanForImages(void)
Definition: musicmetadata.cpp:2025
EditMetadataDialog
Definition: editvideometadata.h:20
ImportCoverArtDialog::m_exitButton
MythUIButton * m_exitButton
Definition: importmusic.h:212
StorageGroup::getGroupDirs
static QStringList getGroupDirs(const QString &groupname, const QString &host)
Definition: storagegroup.cpp:817
ImportCoverArtDialog::selectorChanged
void selectorChanged(void)
Definition: importmusic.cpp:970
MythUIButton::Push
void Push(bool lock=false)
Definition: mythuibutton.cpp:172
ImportMusicDialog::setYear
void setYear(void)
Definition: importmusic.cpp:783
ImportMusicDialog::ImportMusicDialog
ImportMusicDialog(MythScreenStack *parent)
Definition: importmusic.cpp:58
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
MThread::RunEpilog
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:211
ImportMusicDialog::saveDefaults
void saveDefaults(void)
Definition: importmusic.cpp:709
TrackInfo
Definition: importmusic.h:25
RemoteFile::FindFile
static QString FindFile(const QString &filename, const QString &host, const QString &storageGroup, bool useRegex=false, bool allowFallback=false)
Search all BE's for a file in the give storage group.
Definition: remotefile.cpp:1282
ImportMusicDialog::m_filenameText
MythUIText * m_filenameText
Definition: importmusic.h:127
storagegroup.h
MythUIBusyDialog
Definition: mythprogressdialog.h:37
mythuifilebrowser.h
MusicMetadata::setFilename
void setFilename(const QString &lfilename)
Definition: musicmetadata.cpp:960
ImportMusicDialog::scanDirectory
void scanDirectory(QString &directory, std::vector< TrackInfo * > *tracks)
Definition: importmusic.cpp:548
MythUIButtonListItem::GetData
QVariant GetData()
Definition: mythuibuttonlist.cpp:3580
origFilename
QString origFilename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1168
uint
unsigned int uint
Definition: compat.h:140
IT_CD
@ IT_CD
Definition: musicmetadata.h:33
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:56
ImportMusicDialog::doExit
void doExit(bool ok)
Definition: importmusic.cpp:291
RemoteFile::CopyFile
static bool CopyFile(const QString &src, const QString &dst, bool overwrite=false, bool verify=false)
Definition: remotefile.cpp:587
FileCopyThread::m_dstFile
QString m_dstFile
Definition: importmusic.h:53
FileCopyThread::m_result
bool m_result
Definition: importmusic.h:54
ImportCoverArtDialog::updateStatus
void updateStatus(void)
Definition: importmusic.cpp:1052
MythUIFileBrowser
Definition: mythuifilebrowser.h:81
ImportMusicDialog::chooseBackend
void chooseBackend(void) const
Definition: importmusic.cpp:658
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27
ImportMusicDialog::fillWidgets
void fillWidgets()
Definition: importmusic.cpp:85
ImportMusicDialog::m_locationEdit
MythUITextEdit * m_locationEdit
Definition: importmusic.h:122
MusicMetadata::Album
QString Album() const
Definition: musicmetadata.h:150
ImportMusicDialog::m_locationButton
MythUIButton * m_locationButton
Definition: importmusic.h:123
ImportCoverArtDialog::copyPressed
void copyPressed(void)
Definition: importmusic.cpp:975
MusicMetadata::setCompilationArtist
void setCompilationArtist(const QString &lcompilation_artist, const QString &lcompilation_artist_sort=nullptr)
Definition: musicmetadata.h:140
ImportMusicDialog::m_musicStorageDir
QString m_musicStorageDir
Definition: importmusic.h:114
AlbumArtImage::m_hostname
QString m_hostname
Definition: musicmetadata.h:50
ImportMusicDialog
Definition: importmusic.h:58
IT_UNKNOWN
@ IT_UNKNOWN
Definition: musicmetadata.h:30
ImportCoverArtDialog::m_typeList
MythUIButtonList * m_typeList
Definition: importmusic.h:207
MusicMetadata::dumpToDatabase
void dumpToDatabase(void)
Definition: musicmetadata.cpp:672
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:414
MusicMetadata::setArtist
void setArtist(const QString &lartist, const QString &lartist_sort=nullptr)
Definition: musicmetadata.h:128
MusicMetadata::Hostname
QString Hostname(void)
Definition: musicmetadata.h:229
ImportCoverArtDialog
Definition: importmusic.h:163
ImportMusicDialog::m_addallnewButton
MythUIButton * m_addallnewButton
Definition: importmusic.h:144
ImportCoverArtDialog::scanDirectory
void scanDirectory(void)
Definition: importmusic.cpp:1022
ImportMusicDialog::m_playButton
MythUIButton * m_playButton
Definition: importmusic.h:142
mythuitextedit.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition: xmlparsebase.cpp:692
MythUICheckBox::SetCheckState
void SetCheckState(MythUIStateType::StateType state)
Definition: mythuicheckbox.cpp:66
dir
QDir dir
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1174
metaio.h
ImportMusicDialog::m_defaultCompArtist
QString m_defaultCompArtist
Definition: importmusic.h:151
FileScannerThread::m_parent
ImportMusicDialog * m_parent
Definition: importmusic.h:38
FileCopyThread::run
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: importmusic.cpp:48
DialogCompletionEvent
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
Definition: mythdialogbox.h:42
ImportMusicDialog::m_haveDefaults
bool m_haveDefaults
Definition: importmusic.h:157
ImportMusicDialog::m_defaultArtist
QString m_defaultArtist
Definition: importmusic.h:152
importmusic.h
AlbumArtImage
Definition: musicmetadata.h:40
MusicMetadata::Compilation
bool Compilation() const
Definition: musicmetadata.h:251
MythUIText::SetText
virtual void SetText(const QString &text)
Definition: mythuitext.cpp:134
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1086
mythcontext.h
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
ImportCoverArtDialog::m_coverartImage
MythUIImage * m_coverartImage
Definition: importmusic.h:206
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition: mythmainwindow.cpp:105
ImportMusicDialog::setAlbum
void setAlbum(void)
Definition: importmusic.cpp:769
ImportMusicDialog::copyFile
static bool copyFile(const QString &src, const QString &dst)
Definition: importmusic.cpp:460
ImportCoverArtDialog::m_destinationText
MythUIText * m_destinationText
Definition: importmusic.h:204
build_compdb.action
action
Definition: build_compdb.py:9
ImportMusicDialog::m_coverartButton
MythUIButton * m_coverartButton
Definition: importmusic.h:125
ImportMusicDialog::m_currentText
MythUIText * m_currentText
Definition: importmusic.h:139
ImportCoverArtDialog::m_statusText
MythUIText * m_statusText
Definition: importmusic.h:203
IT_FRONTCOVER
@ IT_FRONTCOVER
Definition: musicmetadata.h:31
mythuibutton.h
ImportMusicDialog::m_yearText
MythUIText * m_yearText
Definition: importmusic.h:133
MusicMetadata::setYear
void setYear(int lyear)
Definition: musicmetadata.h:197
ImportCoverArtDialog::m_saveFilename
QString m_saveFilename
Definition: importmusic.h:196
ImportMusicDialog::m_trackText
MythUIText * m_trackText
Definition: importmusic.h:134
MusicMetadata::Rating
int Rating() const
Definition: musicmetadata.h:238
ImportMusicDialog::setSaveHost
void setSaveHost(const QString &host)
Definition: importmusic.cpp:699
ImportMusicDialog::showImportCoverArtDialog
void showImportCoverArtDialog()
Definition: importmusic.cpp:846
MusicPlayer::playFile
void playFile(const MusicMetadata &mdata)
Definition: musicplayer.cpp:223
MythThemedMenuState::Create
bool Create(void) override
Definition: myththemedmenu.cpp:36
MetaIO::read
virtual MusicMetadata * read(const QString &filename)=0
Reads MusicMetadata from a file.
TrackInfo::metadata
MusicMetadata * metadata
Definition: importmusic.h:26
ImportMusicDialog::setCompilation
void setCompilation(void)
Definition: importmusic.cpp:723
MusicMetadata::setCompilation
void setCompilation(bool state)
Definition: musicmetadata.h:252
ImportMusicDialog::m_defaultGenre
QString m_defaultGenre
Definition: importmusic.h:154
MusicPlayer::stop
void stop(bool stopAll=false)
Definition: musicplayer.cpp:237
ImportMusicDialog::prevPressed
void prevPressed(void)
Definition: importmusic.cpp:327
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
ImportCoverArtDialog::m_nextButton
MythUIButton * m_nextButton
Definition: importmusic.h:209
EditMetadataCommon::metadataChanged
void metadataChanged(void)
MythCoreContext::SaveSetting
void SaveSetting(const QString &key, int newValue)
Definition: mythcorecontext.cpp:898
ImportCoverArtDialog::m_sourceDir
QString m_sourceDir
Definition: importmusic.h:192
mythuicheckbox.h
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:676
MythUIButtonList::SetValue
virtual void SetValue(int value)
Definition: mythuibuttonlist.h:166
IT_INLAY
@ IT_INLAY
Definition: musicmetadata.h:34
AlbumArtImage::m_description
QString m_description
Definition: musicmetadata.h:52
AlbumArtImages::addImage
void addImage(const AlbumArtImage *newImage)
Definition: musicmetadata.cpp:2225
ImportMusicDialog::setGenre
void setGenre(void)
Definition: importmusic.cpp:802
AlbumArtImages::dumpToDatabase
void dumpToDatabase(void)
saves or updates the image details in the DB
Definition: musicmetadata.cpp:2258
MythScreenStack::AddScreen
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Definition: mythscreenstack.cpp:49
query
MSqlQuery query(MSqlQuery::InitCon())
ImportMusicDialog::customEvent
void customEvent(QEvent *event) override
Definition: importmusic.cpp:866
ImageType
ImageType
Definition: musicmetadata.h:29
musicmetadata.h
MusicMetadata::Year
int Year() const
Definition: musicmetadata.h:196
FileScannerThread::run
void run() override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: importmusic.cpp:39
FileScannerThread::FileScannerThread
FileScannerThread(ImportMusicDialog *parent)
Definition: importmusic.cpp:34
MythCoreContext::GetSetting
QString GetSetting(const QString &key, const QString &defaultval="")
Definition: mythcorecontext.cpp:915
AlbumArtImage::m_filename
QString m_filename
Definition: musicmetadata.h:49
musicplayer.h
AlbumArtImage::m_embedded
bool m_embedded
Definition: musicmetadata.h:53
ImportMusicDialog::addAllNewPressed
void addAllNewPressed(void)
Definition: importmusic.cpp:413