Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package minitube for openSUSE:Factory checked in at 2021-02-21 22:14:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/minitube (Old) and /work/SRC/openSUSE:Factory/.minitube.new.28504 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "minitube" Sun Feb 21 22:14:48 2021 rev:23 rq:874140 version:3.8 Changes: -------- --- /work/SRC/openSUSE:Factory/minitube/minitube.changes 2020-12-30 17:21:31.264208509 +0100 +++ /work/SRC/openSUSE:Factory/.minitube.new.28504/minitube.changes 2021-02-21 22:14:57.222139993 +0100 @@ -1,0 +2,11 @@ +Fri Feb 19 17:12:50 UTC 2021 - Carsten Ziepke <kiel...@gmail.com> + +- Update to version 3.8: + - Fix crash + - Smaller duration font + - View reworking + - Import subscriptions + - Fix related videos thumbs + - Translations + +------------------------------------------------------------------- Old: ---- minitube-3.7.tar.xz New: ---- minitube-3.8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ minitube.spec ++++++ --- /var/tmp/diff_new_pack.vk7ymw/_old 2021-02-21 22:14:58.398141234 +0100 +++ /var/tmp/diff_new_pack.vk7ymw/_new 2021-02-21 22:14:58.402141238 +0100 @@ -1,7 +1,7 @@ # # spec file for package minitube # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: minitube -Version: 3.7 +Version: 3.8 Release: 0 Summary: Native YouTube Client License: GPL-3.0-or-later ++++++ _service ++++++ --- /var/tmp/diff_new_pack.vk7ymw/_old 2021-02-21 22:14:58.430141268 +0100 +++ /var/tmp/diff_new_pack.vk7ymw/_new 2021-02-21 22:14:58.434141272 +0100 @@ -4,7 +4,7 @@ <param name="url">https://github.com/flaviotordini/minitube.git</param> <param name="filename">minitube</param> <param name="versionformat">@PARENT_TAG@</param> - <param name="revision">3.7</param> + <param name="revision">3.8</param> </service> <service mode="disabled" name="recompress"> <param name="file">*.tar</param> ++++++ minitube-3.7.tar.xz -> minitube-3.8.tar.xz ++++++ Binary files old/minitube-3.7/icons/dark/128/import_active.png and new/minitube-3.8/icons/dark/128/import_active.png differ Binary files old/minitube-3.7/icons/dark/128/import_act...@2x.png and new/minitube-3.8/icons/dark/128/import_act...@2x.png differ Binary files old/minitube-3.7/icons/dark/128/import_disabled.png and new/minitube-3.8/icons/dark/128/import_disabled.png differ Binary files old/minitube-3.7/icons/dark/128/import_disab...@2x.png and new/minitube-3.8/icons/dark/128/import_disab...@2x.png differ Binary files old/minitube-3.7/icons/dark/128/import_normal.png and new/minitube-3.8/icons/dark/128/import_normal.png differ Binary files old/minitube-3.7/icons/dark/128/import_nor...@2x.png and new/minitube-3.8/icons/dark/128/import_nor...@2x.png differ Binary files old/minitube-3.7/icons/dark/32/close_active.png and new/minitube-3.8/icons/dark/32/close_active.png differ Binary files old/minitube-3.7/icons/dark/32/close_act...@2x.png and new/minitube-3.8/icons/dark/32/close_act...@2x.png differ Binary files old/minitube-3.7/icons/dark/32/close_disabled.png and new/minitube-3.8/icons/dark/32/close_disabled.png differ Binary files old/minitube-3.7/icons/dark/32/close_disab...@2x.png and new/minitube-3.8/icons/dark/32/close_disab...@2x.png differ Binary files old/minitube-3.7/icons/dark/32/close_normal.png and new/minitube-3.8/icons/dark/32/close_normal.png differ Binary files old/minitube-3.7/icons/dark/32/close_nor...@2x.png and new/minitube-3.8/icons/dark/32/close_nor...@2x.png differ Binary files old/minitube-3.7/icons/light/128/import_active.png and new/minitube-3.8/icons/light/128/import_active.png differ Binary files old/minitube-3.7/icons/light/128/import_act...@2x.png and new/minitube-3.8/icons/light/128/import_act...@2x.png differ Binary files old/minitube-3.7/icons/light/128/import_disabled.png and new/minitube-3.8/icons/light/128/import_disabled.png differ Binary files old/minitube-3.7/icons/light/128/import_disab...@2x.png and new/minitube-3.8/icons/light/128/import_disab...@2x.png differ Binary files old/minitube-3.7/icons/light/128/import_normal.png and new/minitube-3.8/icons/light/128/import_normal.png differ Binary files old/minitube-3.7/icons/light/128/import_nor...@2x.png and new/minitube-3.8/icons/light/128/import_nor...@2x.png differ Binary files old/minitube-3.7/icons/light/32/close_active.png and new/minitube-3.8/icons/light/32/close_active.png differ Binary files old/minitube-3.7/icons/light/32/close_act...@2x.png and new/minitube-3.8/icons/light/32/close_act...@2x.png differ Binary files old/minitube-3.7/icons/light/32/close_disabled.png and new/minitube-3.8/icons/light/32/close_disabled.png differ Binary files old/minitube-3.7/icons/light/32/close_disab...@2x.png and new/minitube-3.8/icons/light/32/close_disab...@2x.png differ Binary files old/minitube-3.7/icons/light/32/close_normal.png and new/minitube-3.8/icons/light/32/close_normal.png differ Binary files old/minitube-3.7/icons/light/32/close_nor...@2x.png and new/minitube-3.8/icons/light/32/close_nor...@2x.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/locale/de_DE.ts new/minitube-3.8/locale/de_DE.ts --- old/minitube-3.7/locale/de_DE.ts 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/locale/de_DE.ts 2021-02-19 09:53:32.000000000 +0100 @@ -852,7 +852,7 @@ </message> <message> <source>Rewind %1 seconds</source> - <translation type="unfinished"/> + <translation>%1 Sekunden zur??ck</translation> </message> <message> <source>Fast forward %1 seconds</source> @@ -860,7 +860,7 @@ </message> <message> <source>channel</source> - <translation type="unfinished"/> + <translation>Kanal</translation> </message> </context> <context> @@ -1038,7 +1038,7 @@ </message> <message> <source>This year</source> - <translation type="unfinished"/> + <translation>Dieses Jahr</translation> </message> <message> <source>HD</source> @@ -1099,11 +1099,11 @@ </message> <message> <source>Remove</source> - <translation type="unfinished"/> + <translation>Entfernen</translation> </message> <message> <source>Need a remote control for %1? Try %2!</source> - <translation type="unfinished"/> + <translation>Ben??tigen Sie eine Fernbedinung f??r %1? Versuchen Sie %2!</translation> </message> <message> <source>I keep improving %1 to make it the best I can. Support this work!</source> @@ -1171,19 +1171,19 @@ </message> <message> <source>Music</source> - <translation type="unfinished"/> + <translation>Musik</translation> </message> <message> <source>News</source> - <translation type="unfinished"/> + <translation>Nachrichten</translation> </message> <message> <source>Movies</source> - <translation type="unfinished"/> + <translation>Filme</translation> </message> <message> <source>Gaming</source> - <translation type="unfinished"/> + <translation>Spiele</translation> </message> </context> <context> @@ -1201,7 +1201,7 @@ <name>Updater</name> <message> <source>Check for Updates...</source> - <translation type="unfinished"/> + <translation>Auf Updates ??berpr??fen...</translation> </message> <message> <source>Version %1 is available...</source> @@ -1461,7 +1461,7 @@ <name>updater::DefaultUpdater</name> <message> <source>There are currently no updates available.</source> - <translation type="unfinished"/> + <translation>Momentan stehen keine Updates zur Verf??gung.</translation> </message> </context> <context> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/locale/hu.ts new/minitube-3.8/locale/hu.ts --- old/minitube-3.7/locale/hu.ts 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/locale/hu.ts 2021-02-19 09:53:32.000000000 +0100 @@ -3,7 +3,7 @@ <name>AboutView</name> <message> <source>There's life outside the browser!</source> - <translation>Van ??let a b??ng??sz??n k??v??l.</translation> + <translation>Van ??let a b??ng??sz??n k??v??l!</translation> </message> <message> <source>Version %1</source> @@ -15,7 +15,7 @@ </message> <message> <source>%1 is Free Software but its development takes precious time.</source> - <translation>A %1 szabad szoftver, de a fejleszt??se ??rt??kes id??t em??szt fel.</translation> + <translation>A %1 egy ingyenes szoftver, de a fejleszt??se ??rt??kes id??t em??szt fel.</translation> </message> <message> <source>Please <a href='%1'>donate</a> to support the continued development of %2.</source> @@ -85,7 +85,7 @@ </message> <message> <source>Enter License</source> - <translation>Liszensz beg??pel??se</translation> + <translation>Liszensz megad??sa</translation> </message> <message> <source>Buy License</source> @@ -107,7 +107,7 @@ </message> <message numerus="yes"> <source>You have %n new video(s)</source> - <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> + <translation><numerusform>%n ??j vide??d van</numerusform><numerusform>%n ??j vide??d van</numerusform></translation> </message> </context> <context> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/locale/pt_BR.ts new/minitube-3.8/locale/pt_BR.ts --- old/minitube-3.7/locale/pt_BR.ts 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/locale/pt_BR.ts 2021-02-19 09:53:32.000000000 +0100 @@ -223,7 +223,7 @@ </message> <message numerus="yes"> <source>%n year(s) ago</source> - <translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation> + <translation><numerusform>%n ano atr??s</numerusform><numerusform>%n anos atr??s</numerusform></translation> </message> </context> <context> @@ -1111,7 +1111,7 @@ </message> <message> <source>An update is ready to be installed. Quit and install update.</source> - <translation type="unfinished"/> + <translation>Uma atualiza????o est?? pronta para ser instalada. Sair e instalar a atualiza????o.</translation> </message> </context> <context> @@ -1167,7 +1167,7 @@ </message> <message> <source>Trending</source> - <translation type="unfinished"/> + <translation>Popular</translation> </message> <message> <source>Music</source> @@ -1213,15 +1213,15 @@ </message> <message> <source>Restart to Update</source> - <translation type="unfinished"/> + <translation>Reiniciar para atualizar</translation> </message> <message> <source>Version %1 download failed</source> - <translation type="unfinished"/> + <translation>O download da vers??o %1 falhou</translation> </message> <message> <source>Check for Updates</source> - <translation type="unfinished"/> + <translation>Verificar se h?? atualiza????es</translation> </message> <message> <source>Download Update</source> @@ -1233,11 +1233,11 @@ </message> <message> <source>Retry Update Download</source> - <translation type="unfinished"/> + <translation>Tentar baixar novamente a atualiza????o</translation> </message> <message> <source>You have the latest version.</source> - <translation type="unfinished"/> + <translation>Voc?? possui a ??ltima vers??o.</translation> </message> <message> <source>Version %1 is available.</source> @@ -1245,7 +1245,7 @@ </message> <message> <source>An update has been downloaded and is ready to be installed.</source> - <translation type="unfinished"/> + <translation>Uma atualiza????o foi baixada e est?? pronta para ser instalada.</translation> </message> </context> <context> @@ -1461,14 +1461,14 @@ <name>updater::DefaultUpdater</name> <message> <source>There are currently no updates available.</source> - <translation type="unfinished"/> + <translation>N??o h?? atualiza????es dispon??veis no momento.</translation> </message> </context> <context> <name>updater::Dialog</name> <message> <source>You already have the latest version</source> - <translation type="unfinished"/> + <translation>Voc?? j?? possui a ??ltima vers??o</translation> </message> <message> <source>Downloading %1 %2...</source> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/minitube.pro new/minitube-3.8/minitube.pro --- old/minitube-3.7/minitube.pro 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/minitube.pro 2021-02-19 09:53:32.000000000 +0100 @@ -1,7 +1,7 @@ CONFIG += c++17 exceptions_off rtti_off object_parallel_to_source TEMPLATE = app -VERSION = 3.7 +VERSION = 3.8 DEFINES += APP_VERSION="$$VERSION" APP_NAME = Minitube @@ -52,6 +52,7 @@ src/spacer.h \ src/constants.h \ src/playlistitemdelegate.h \ + src/subscriptionimportview.h \ src/updateutils.h \ src/videoapi.h \ src/videomimedata.h \ @@ -128,6 +129,7 @@ SOURCES += src/main.cpp \ src/messagebar.cpp \ src/spacer.cpp \ + src/subscriptionimportview.cpp \ src/updateutils.cpp \ src/video.cpp \ src/videomimedata.cpp \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/org.tordini.flavio.minitube.metainfo.xml new/minitube-3.8/org.tordini.flavio.minitube.metainfo.xml --- old/minitube-3.7/org.tordini.flavio.minitube.metainfo.xml 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/org.tordini.flavio.minitube.metainfo.xml 2021-02-19 09:53:32.000000000 +0100 @@ -36,7 +36,7 @@ <url type="donation">https://flavio.tordini.org/donate</url> <url type="translate">https://www.transifex.com/flaviotordini/minitube/</url> <releases> - <release version="3.6.1" date="2020-09-10"/> + <release version="3.7" date="2020-12-30"/> </releases> <content_rating type="oars-1.1"> <content_attribute id="violence-cartoon">intense</content_attribute> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/aboutview.h new/minitube-3.8/src/aboutview.h --- old/minitube-3.7/src/aboutview.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/aboutview.h 2021-02-19 09:53:32.000000000 +0100 @@ -32,10 +32,7 @@ public: AboutView(QWidget *parent); void appear(); - const QString &getTitle() { - static const QString s = tr("About"); - return s; - } + QString getTitle() { return tr("About"); } private: QPushButton *closeButton; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/channelaggregator.cpp new/minitube-3.8/src/channelaggregator.cpp --- old/minitube-3.7/src/channelaggregator.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/channelaggregator.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -81,9 +81,6 @@ updatedChannels.clear(); updatedChannels.squeeze(); - if (!Database::instance().getConnection().transaction()) - qWarning() << "Transaction failed" << __PRETTY_FUNCTION__; - processNextChannel(); } @@ -175,9 +172,6 @@ void ChannelAggregator::finish() { currentChannel = 0; - QSqlDatabase db = Database::instance().getConnection(); - if (!db.commit()) qWarning() << "Commit failed" << __PRETTY_FUNCTION__; - #ifdef Q_OS_MAC if (newVideoCount > 0 && unwatchedCount > 0 && mac::canNotify()) { QString channelNames; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/channelview.cpp new/minitube-3.8/src/channelview.cpp --- old/minitube-3.7/src/channelview.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/channelview.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -74,6 +74,8 @@ void ChannelView::setupActions() { QSettings settings; + statusActions << MainWindow::instance()->getAction("importSubscriptions"); + sortBy = static_cast<SortBy>(settings.value(sortByKey, SortByName).toInt()); QMenu *sortMenu = new QMenu(this); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/downloadview.h new/minitube-3.8/src/downloadview.h --- old/minitube-3.7/src/downloadview.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/downloadview.h 2021-02-19 09:53:32.000000000 +0100 @@ -37,10 +37,7 @@ DownloadView(QWidget *parent); void appear(); void disappear(); - const QString &getTitle() { - static const QString s = tr("Downloads"); - return s; - } + QString getTitle() { return tr("Downloads"); } public slots: void itemEntered(const QModelIndex &index); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/homeview.h new/minitube-3.8/src/homeview.h --- old/minitube-3.7/src/homeview.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/homeview.h 2021-02-19 09:53:32.000000000 +0100 @@ -36,10 +36,6 @@ public: HomeView(QWidget *parent = 0); void disappear(); - const QString &getDescription() { - static const QString s = tr("Make yourself comfortable"); - return s; - } void showWidget(QWidget *widget); QWidget *currentWidget() { return stackedWidget->currentWidget(); } SearchView *getSearchView() { return searchView; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/main.cpp new/minitube-3.8/src/main.cpp --- old/minitube-3.7/src/main.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/main.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -140,7 +140,7 @@ QNetworkProxyFactory::setUseSystemConfiguration(true); - IconUtils::setSizes({16, 24, 32, 88}); + IconUtils::setSizes({16, 24, 32, 88, 128}); UpdateUtils::init(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/mainwindow.cpp new/minitube-3.8/src/mainwindow.cpp --- old/minitube-3.7/src/mainwindow.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/mainwindow.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -93,6 +93,8 @@ #include "updater.h" #endif +#include "subscriptionimportview.h" + namespace { MainWindow *mainWindowInstance; } @@ -172,6 +174,7 @@ JS::instance().getNamFactory().setRequestHeaders( {{"User-Agent", HttpUtils::stealthUserAgent()}}); JS::instance().initialize(QUrl(QLatin1String(Constants::WEBSITE) + "-ws/bundle2.js")); + /// JS::instance().initialize(QUrl("http://localhost:8000/bundle-test.js")); Invidious::instance().initServers(); } @@ -194,7 +197,8 @@ searchParams->setKeywords(query); showMedia(searchParams); } - } + } else + showMessage(tr("Make yourself comfortable")); // Global shortcuts GlobalShortcuts &shortcuts = GlobalShortcuts::instance(); @@ -685,6 +689,17 @@ connect(action, SIGNAL(triggered()), SLOT(toggleToolbarMenu())); actionMap.insert("toolbarMenu", action); + action = new QAction(tr("Import Subscriptions..."), this); + action->setMenuRole(QAction::ApplicationSpecificRole); + connect(action, &QAction::triggered, this, [this] { + if (!subscriptionImportView) { + subscriptionImportView = new SubscriptionImportView(this); + views->addWidget(subscriptionImportView); + } + showView(subscriptionImportView); + }); + actionMap.insert("importSubscriptions", action); + #ifdef APP_MAC_STORE action = new QAction(tr("&Love %1? Rate it!").arg(Constants::NAME), this); actionMap.insert("appStore", action); @@ -1066,16 +1081,20 @@ // call hide method on the current view View *oldView = qobject_cast<View *>(views->currentWidget()); if (oldView) { + oldView->willDisappear(); oldView->disappear(); oldView->setEnabled(false); oldView->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); } else qDebug() << "Cannot cast old view"; + view->willAppear(); view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); view->setEnabled(true); views->setCurrentWidget(view); view->appear(); + view->didAppear(); + if (oldView) oldView->didDisappear(); QString title = view->getTitle(); if (title.isEmpty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/mainwindow.h new/minitube-3.8/src/mainwindow.h --- old/minitube-3.7/src/mainwindow.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/mainwindow.h 2021-02-19 09:53:32.000000000 +0100 @@ -174,6 +174,7 @@ View *aboutView; View *downloadView; View *regionsView; + View *subscriptionImportView = nullptr; // actions QAction *backAct; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/mediaview.cpp new/minitube-3.8/src/mediaview.cpp --- old/minitube-3.7/src/mediaview.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/mediaview.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -229,9 +229,6 @@ source->setVideoId(videoId); setVideoSource(source); - VideoSource *singleVideoSource = nullptr; - setVideoSource(singleVideoSource); - QTime tstamp = YTSearch::videoTimestampFromUrl(searchParams->keywords()); pauseTime = QTime(0, 0).msecsTo(tstamp); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/playlistitemdelegate.cpp new/minitube-3.8/src/playlistitemdelegate.cpp --- old/minitube-3.7/src/playlistitemdelegate.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/playlistitemdelegate.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -295,6 +295,7 @@ painter->save(); painter->setPen(Qt::white); + painter->setFont(smallerFont); painter->drawText(textBox, Qt::AlignCenter, time); painter->restore(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/subscriptionimportview.cpp new/minitube-3.8/src/subscriptionimportview.cpp --- old/minitube-3.7/src/subscriptionimportview.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/minitube-3.8/src/subscriptionimportview.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -0,0 +1,79 @@ +#include "subscriptionimportview.h" +#include "fontutils.h" +#include "iconutils.h" +#include "ytchannel.h" + +#include "homeview.h" +#include "mainwindow.h" + +QAction *SubscriptionImportView::buildAction(QWidget *parent) { + auto a = new QAction("Import subscriptions...", parent); + a->setMenuRole(QAction::ApplicationSpecificRole); + connect(a, &QAction::triggered, parent, [parent] { + auto dialog = new SubscriptionImportView(parent); + dialog->show(); + }); + return a; +} + +SubscriptionImportView::SubscriptionImportView(QWidget *parent) : View(parent) { + auto layout = new QVBoxLayout(this); + layout->setSpacing(fontMetrics().xHeight() * 4); + layout->setAlignment(Qt::AlignCenter); + + auto closeButton = new QToolButton(); + closeButton->setIcon(IconUtils::icon("close")); + closeButton->setIconSize({32, 32}); + closeButton->setShortcut(Qt::Key_Escape); + closeButton->setStyleSheet("border:0"); + connect(closeButton, &QToolButton::clicked, this, [] { MainWindow::instance()->goBack(); }); + layout->addWidget(closeButton, 0, Qt::AlignRight); + + auto icon = new QLabel(); + icon->setPixmap(IconUtils::icon("import").pixmap(128, 128)); + layout->addWidget(icon, 0, Qt::AlignHCenter); + + QString url = "https://takeout.google.com/takeout/custom/youtube"; + QString msg = + "Follow these steps to import your YouTube subscriptions:<ul>" + "<li style='line-height:1.5'>Visit <a href='%1'>%2</a>" + "<li style='line-height:1.5'>Click <i>All YouTube data included</i>, deselect all " + "and select only subscriptions" + "<li style='line-height:1.5'>Download the zip file and extract it"; + msg = msg.arg(url, "Google Takeout"); + auto tip = new QLabel(msg); + tip->setOpenExternalLinks(true); + tip->setFont(FontUtils::medium()); + layout->addWidget(tip); + + auto button = new QPushButton("Open subscriptions.json"); + button->setDefault(true); + connect(this, &View::didAppear, button, [button] { button->setFocus(); }); + button->setFocus(); + button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + connect(button, &QPushButton::clicked, this, [this] { + auto dir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open subscriptions.json"), dir, + tr("JSON Files (*.json)")); + if (!fileName.isEmpty()) { + auto w = MainWindow::instance(); + QString msg; + QFile file(fileName); + if (file.open(QFile::ReadOnly)) { + int count = 0; + const auto array = QJsonDocument::fromJson(file.readAll()).array(); + for (const auto &i : array) { + auto id = i["snippet"]["resourceId"]["channelId"].toString(); + qDebug() << "Subscribing to" << id; + if (YTChannel::subscribe(id)) count++; + } + msg = tr("Subscribed to %n channel(s)", "", count); + w->showHome(); + w->getHomeView()->showChannels(); + } else + msg = tr("Cannot open file"); + if (!msg.isEmpty()) QTimer::singleShot(0, w, [w, msg] { w->showMessage(msg); }); + } + }); + layout->addWidget(button, 0, Qt::AlignHCenter); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/subscriptionimportview.h new/minitube-3.8/src/subscriptionimportview.h --- old/minitube-3.7/src/subscriptionimportview.h 1970-01-01 01:00:00.000000000 +0100 +++ new/minitube-3.8/src/subscriptionimportview.h 2021-02-19 09:53:32.000000000 +0100 @@ -0,0 +1,17 @@ +#ifndef SUBSCRIPTIONIMPORTVIEW_H +#define SUBSCRIPTIONIMPORTVIEW_H + +#include <QtWidgets> + +#include "view.h" + +class SubscriptionImportView : public View { + Q_OBJECT + +public: + static QAction *buildAction(QWidget *parent); + explicit SubscriptionImportView(QWidget *parent = nullptr); + +}; + +#endif // SUBSCRIPTIONIMPORTVIEW_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/view.h new/minitube-3.8/src/view.h --- old/minitube-3.7/src/view.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/view.h 2021-02-19 09:53:32.000000000 +0100 @@ -21,25 +21,23 @@ #ifndef VIEW_H #define VIEW_H -#include <QHash> -#include <QString> -#include <QVariant> -#include <QWidget> - -namespace { -static const QString nullString; -} +#include <QtWidgets> class View : public QWidget { Q_OBJECT public: View(QWidget *parent = 0) : QWidget(parent) {} - virtual const QString &getTitle() { return nullString; } - virtual const QString &getDescription() { return nullString; } + virtual QString getTitle() { return QString(); } + virtual QString getDescription() { return QString(); } virtual void appear() {} virtual void disappear() {} - // QVector<QAction*> getViewActions() { return QVector<QAction*>(); } + +signals: + void willAppear(); + void didAppear(); + void willDisappear(); + void didDisappear(); }; #endif // VIEW_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/yt/ytjs/ytjssinglevideosource.cpp new/minitube-3.8/src/yt/ytjs/ytjssinglevideosource.cpp --- old/minitube-3.7/src/yt/ytjs/ytjssinglevideosource.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/yt/ytjs/ytjssinglevideosource.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -45,8 +45,17 @@ if (desc.isEmpty()) desc = i["desc"].toString(); video->setDescription(desc); - QString thumb = i["video_thumbnail"].toString(); - video->setThumbnailUrl(thumb); + const auto thumbs = i["thumbnails"].toArray(); + for (const auto &thumb : thumbs) { + QString url = thumb["url"].toString(); + int width = thumb["width"].toInt(); + if (width >= 336) + video->setLargeThumbnailUrl(url); + else if (width >= 246) + video->setMediumThumbnailUrl(url); + else if (width >= 168) + video->setThumbnailUrl(url); + } int views = i["view_count"].toInt(); video->setViewCount(views); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/ytchannel.cpp new/minitube-3.8/src/ytchannel.cpp --- old/minitube-3.7/src/ytchannel.cpp 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/ytchannel.cpp 2021-02-19 09:53:32.000000000 +0100 @@ -229,8 +229,8 @@ loadThumbnail(); } -void YTChannel::subscribe(const QString &channelId) { - if (channelId.isEmpty()) return; +bool YTChannel::subscribe(const QString &channelId) { + if (channelId.isEmpty()) return false; uint now = QDateTime::currentDateTime().toTime_t(); @@ -244,6 +244,7 @@ query.bindValue(2, now); bool success = query.exec(); if (!success) qWarning() << query.lastQuery() << query.lastError().text(); + return success; // This will call maybeLoadFromApi YTChannel::forId(channelId); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/minitube-3.7/src/ytchannel.h new/minitube-3.8/src/ytchannel.h --- old/minitube-3.7/src/ytchannel.h 2020-12-29 17:00:35.000000000 +0100 +++ new/minitube-3.8/src/ytchannel.h 2021-02-19 09:53:32.000000000 +0100 @@ -30,7 +30,7 @@ public: static YTChannel* forId(const QString &channelId); - static void subscribe(const QString &channelId); + static bool subscribe(const QString &channelId); static void unsubscribe(const QString &channelId); static bool isSubscribed(const QString &channelId);