Skip to content

Commit

Permalink
mythmusic: make qtwebkit an optional dependency
Browse files Browse the repository at this point in the history
It is used only to search for various types of art work, so if it is not
available we simply build without it.
  • Loading branch information
ijc authored and linuxdude42 committed Apr 2, 2021
1 parent f07b903 commit fc25c42
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mythplugins/configure
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ if enabled browser; then
if test "$WEBKIT" != "CONFIG_QTWEBKIT=yes"; then
disable browser
echo "MythBrowser requires QtWebkit."
else
append CCONFIG "using_browser"
fi
fi

Expand Down Expand Up @@ -687,13 +689,6 @@ if test x"$icc" != x ; then
fi

if enabled music ; then
if [ $qt_version -lt $(version2num "6.0.0") ]; then
if test "$WEBKIT" != "CONFIG_QTWEBKIT=yes"; then
disable music
echo "MythMusic requires QtWebkit."
fi
fi

if ! check_lib vorbis/codec.h vorbis_info_init -lvorbis || ! check_lib vorbis/vorbisenc.h vorbis_encode_setup_vbr -lvorbisenc -lvorbis -logg ; then
disable vorbis
echo "MythMusic requires vorbis."
Expand Down Expand Up @@ -872,6 +867,10 @@ if enabled music ; then
echo "#undef HAVE_STDINT_H" >> ./mythmusic/mythmusic/config.h
fi

if enabled browser ; then
echo "#define HAVE_BROWSER 1" >> ./mythmusic/mythmusic/config.h
fi

if enabled cdio ; then
echo "#define HAVE_CDIO 1" >> ./mythmusic/mythmusic/config.h
if enabled cdparanoia_subdir ; then
Expand Down
20 changes: 20 additions & 0 deletions mythplugins/mythmusic/mythmusic/editmetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#include <remotefile.h>
#include <mthreadpool.h>

#if HAVE_BROWSER
#include <mythuiwebbrowser.h>
#endif

// mythmusic
#include "musicdata.h"
#include "decoder.h"
Expand Down Expand Up @@ -259,6 +263,8 @@ bool EditMetadataCommon::hasMetadataChanged(void)
return changed;
}

#if HAVE_BROWSER

/// search Google for images
void EditMetadataCommon::searchForAlbumImages(void)
{
Expand All @@ -275,6 +281,8 @@ void EditMetadataCommon::searchForAlbumImages(void)
GetMythMainWindow()->HandleMedia("WebBrowser", url.toString(), GetConfDir() + "/MythMusic/", "front.jpg");
}

#endif // HAVE_BROWSER

void EditMetadataCommon::scanForImages(void)
{
s_metadata->getAlbumArtImages()->scanForImages();
Expand Down Expand Up @@ -485,9 +493,11 @@ void EditMetadataDialog::showMenu(void )
menu->SetReturnEvent(this, "optionsmenu");

menu->AddButton(tr("Edit Albumart Images"));
#if HAVE_BROWSER
menu->AddButton(tr("Search Internet For Artist Image"));
menu->AddButton(tr("Search Internet For Album Image"));
menu->AddButton(tr("Search Internet For Genre Image"));
#endif
menu->AddButton(tr("Check Track Length"));

popupStack->AddScreen(menu);
Expand Down Expand Up @@ -708,6 +718,8 @@ void EditMetadataDialog::genreLostFocus(void)
updateGenreImage();
}

#if HAVE_BROWSER

/// search flickr for genre images
void EditMetadataDialog::searchForGenreImages(void)
{
Expand All @@ -732,6 +744,8 @@ void EditMetadataDialog::searchForArtistImages(void)
GetMythMainWindow()->HandleMedia("WebBrowser", url.toString(), GetConfDir() + "/MythMusic/", "artist.jpg");
}

#endif

void EditMetadataDialog::customEvent(QEvent *event)
{
if (event->type() == DialogCompletionEvent::kEventType)
Expand All @@ -749,6 +763,7 @@ void EditMetadataDialog::customEvent(QEvent *event)
{
if (resulttext == tr("Edit Albumart Images"))
switchToAlbumArt();
#if HAVE_BROWSER
else if (resulttext == tr("Search Internet For Genre Image"))
{
updateMetadata();
Expand All @@ -764,6 +779,7 @@ void EditMetadataDialog::customEvent(QEvent *event)
updateMetadata();
searchForAlbumImages();
}
#endif
else if (resulttext == tr("Check Track Length"))
{
QStringList strList;
Expand Down Expand Up @@ -1052,7 +1068,9 @@ void EditAlbumartDialog::showMenu(void )
menu->AddButton(tr("Rescan For Images"));


#if HAVE_BROWSER
menu->AddButton(tr("Search Internet For Images"));
#endif

MetaIO *tagger = MetaIO::createTagger(s_metadata->Filename(false));

Expand Down Expand Up @@ -1148,8 +1166,10 @@ void EditAlbumartDialog::customEvent(QEvent *event)
switchToMetadata();
else if (resulttext == tr("Rescan For Images"))
rescanForImages();
#if HAVE_BROWSER
else if (resulttext == tr("Search Internet For Images"))
searchForAlbumImages();
#endif
else if (resulttext == tr("Change Image Type"))
showTypeMenu();
else if (resulttext == tr("Copy Selected Image To Tag"))
Expand Down
6 changes: 6 additions & 0 deletions mythplugins/mythmusic/mythmusic/editmetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <mythscreentype.h>
#include <musicmetadata.h>

#include "config.h"

class MythUIStateType;
class MythUIImage;
class MythUIButton;
Expand Down Expand Up @@ -44,7 +46,9 @@ class EditMetadataCommon : public MythScreenType
protected:
static bool hasMetadataChanged(void);
void updateMetadata(void);
#if HAVE_BROWSER
void searchForAlbumImages(void);
#endif
static void scanForImages(void);

static bool s_metadataOnly;
Expand Down Expand Up @@ -103,8 +107,10 @@ class EditMetadataDialog : public EditMetadataCommon

void updateRating(void);

#if HAVE_BROWSER
void searchForArtistImages(void);
void searchForGenreImages(void);
#endif

//
// GUI stuff
Expand Down

0 comments on commit fc25c42

Please sign in to comment.