mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-16 15:41:13 +02:00
2022-11-07 Fred Gleason <fredg@paravelsystems.com>
* Added a dependency for ImageMagick's 'Magick++' library interface. * Added a 'FEED_IMAGES.DATA_MID_THUMB' field to the database. * Added a 'FEED_IMAGES.DATA_SMALL_THUMB' field to the database. * Incremented the database version to 365. * Optimized loading of thumbnail image data in rdadmin(1), rdcastmanager(1) and rdcatch(1). * Re-enabled uploads to RSS feeds in rdcatch(1). Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
##
|
||||
## Use automake to process this into a Makefile.in
|
||||
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -Wno-strict-aliasing -std=c++11 -fPIC -I/usr/include/taglib
|
||||
AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" @QT5_CFLAGS@ @MUSICBRAINZ_CFLAGS@ -Wno-strict-aliasing -std=c++11 -fPIC -I/usr/include/taglib @IMAGEMAGICK_CFLAGS@
|
||||
MOC = @QT_MOC@
|
||||
CWRAP = ../helpers/cwrap
|
||||
|
||||
@@ -156,6 +156,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdhostvarlistmodel.cpp rdhostvarlistmodel.h\
|
||||
rdidvalidator.cpp rdidvalidator.h\
|
||||
rdiconengine.cpp rdiconengine.h\
|
||||
rdimagemagick.cpp rdimagemagick.h\
|
||||
rdimagepickerbox.cpp rdimagepickerbox.h\
|
||||
rdimagepickermodel.cpp rdimagepickermodel.h\
|
||||
rdimport_audio.cpp rdimport_audio.h\
|
||||
|
@@ -24,7 +24,7 @@
|
||||
/*
|
||||
* Current Database Version
|
||||
*/
|
||||
#define RD_VERSION_DATABASE 364
|
||||
#define RD_VERSION_DATABASE 365
|
||||
|
||||
|
||||
#endif // DBVERSION_H
|
||||
|
@@ -120,6 +120,7 @@ SOURCES += rdhash.cpp
|
||||
SOURCES += rdhostvarlistmodel.cpp
|
||||
SOURCES += rdidvalidator.cpp
|
||||
SOURCES += rdiconengine.cpp
|
||||
SOURCES += rdimagemagick.cpp
|
||||
SOURCES += rdimagepickerbox.cpp
|
||||
SOURCES += rdimagepickermodel.cpp
|
||||
SOURCES += rdimport_audio.cpp
|
||||
@@ -310,6 +311,7 @@ HEADERS += rdhash.h
|
||||
HEADERS += rdhostvarlistmodel.h
|
||||
HEADERS += rdiconengine.h
|
||||
HEADERS += rdidvalidator.h
|
||||
HEADERS += rdimagemagick.h
|
||||
HEADERS += rdimagepickerbox.h
|
||||
HEADERS += rdimagepickermodel.h
|
||||
HEADERS += rdimport_audio.h
|
||||
|
6
lib/rd.h
6
lib/rd.h
@@ -654,6 +654,12 @@
|
||||
#define RD_LISTWIDGET_ITEM_HEIGHT 25
|
||||
#define RD_LISTWIDGET_ITEM_WIDTH_PADDING 20
|
||||
|
||||
/*
|
||||
* Thumbnail image sizes
|
||||
*/
|
||||
#define RD_MID_THUMB_SIZE QSize(32,32)
|
||||
#define RD_SMALL_THUMB_SIZE QSize(22,22)
|
||||
|
||||
/*
|
||||
* Date/Time Formats
|
||||
*/
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include "rddelete.h"
|
||||
#include "rdescape_string.h"
|
||||
#include "rdfeed.h"
|
||||
#include "rdimagemagick.h"
|
||||
#include "rdlibrary_conf.h"
|
||||
#include "rdlog.h"
|
||||
#include "rdpodcast.h"
|
||||
@@ -754,10 +755,6 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
|
||||
desc=tr("Imported from")+" "+pathname;
|
||||
}
|
||||
|
||||
//
|
||||
// FIXME: Upload to remote file store here...
|
||||
//
|
||||
|
||||
//
|
||||
// Write it to the DB
|
||||
//
|
||||
@@ -770,10 +767,14 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
|
||||
QString::asprintf("`DEPTH`=%d,",img->depth())+
|
||||
"`DESCRIPTION`='"+RDEscapeString(desc)+"',"+
|
||||
"`FILE_EXTENSION`='"+RDEscapeString(f0.last().toLower())+"',"+
|
||||
"`DATA`="+RDEscapeBlob(data);
|
||||
"`DATA`="+RDEscapeBlob(data)+","+
|
||||
"`DATA_MID_THUMB`="+
|
||||
RDEscapeBlob(RDIMResizeImage(data,RD_MID_THUMB_SIZE))+","+
|
||||
"`DATA_SMALL_THUMB`="+
|
||||
RDEscapeBlob(RDIMResizeImage(data,RD_SMALL_THUMB_SIZE));
|
||||
ret=RDSqlQuery::run(sql,&ok).toInt();
|
||||
if(!ok) {
|
||||
*err_msg="Unable to write to database";
|
||||
*err_msg="Unable to write images to database";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -563,9 +563,12 @@ void RDFeedListModel::updateRow(int row,RDSqlQuery *q)
|
||||
applicationIcon(RDIconEngine::RdCastManager,32);
|
||||
}
|
||||
else {
|
||||
d_icons[row][0]=QImage::fromData(q->value(12).toByteArray());
|
||||
/*
|
||||
d_icons[row][0]=
|
||||
QImage::fromData(q->value(12).toByteArray()).
|
||||
scaled(32,32,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
|
||||
*/
|
||||
}
|
||||
d_texts[row][1]=q->value(2); // Title
|
||||
if(q->value(4).toString()=="Y") {
|
||||
@@ -646,7 +649,7 @@ QString RDFeedListModel::sqlFields() const
|
||||
"`PODCASTS`.`ITEM_TITLE`,"+ // 09
|
||||
"`PODCASTS`.`STATUS`,"+ // 10
|
||||
"`PODCASTS`.`ORIGIN_DATETIME`,"+ // 11
|
||||
"`FEED_IMAGES`.`DATA` "+ // 12
|
||||
"`FEED_IMAGES`.`DATA_MID_THUMB` "+ // 12
|
||||
"from `FEEDS` left join `FEED_IMAGES` "+
|
||||
"on `FEEDS`.`CHANNEL_IMAGE_ID`=`FEED_IMAGES`.`ID` left join `PODCASTS` "+
|
||||
"on `FEEDS`.`ID`=`PODCASTS`.`FEED_ID` ";
|
||||
|
35
lib/rdimagemagick.cpp
Normal file
35
lib/rdimagemagick.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// rdimagemagick.cpp
|
||||
//
|
||||
// ImageMagick operations for Rivendell
|
||||
//
|
||||
// (C) Copyright 2022 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <Magick++.h>
|
||||
|
||||
#include "rdimagemagick.h"
|
||||
|
||||
QByteArray RDIMResizeImage(const QByteArray &src_image,const QSize &size)
|
||||
{
|
||||
Magick::Image img(Magick::Blob(src_image.constData(),src_image.size()));
|
||||
Magick::Geometry dst_size(size.width(),size.height());
|
||||
Magick::Blob dst_blob;
|
||||
|
||||
img.zoom(Magick::Geometry(size.width(),size.height()));
|
||||
img.write(&dst_blob);
|
||||
|
||||
return QByteArray((const char *)dst_blob.data(),dst_blob.length());
|
||||
}
|
30
lib/rdimagemagick.h
Normal file
30
lib/rdimagemagick.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// rdimagemagick.h
|
||||
//
|
||||
// ImageMagick operations for Rivendell
|
||||
//
|
||||
// (C) Copyright 2022 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
// published by the Free Software Foundation.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public
|
||||
// License along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#ifndef RDIMAGEMAGICK_H
|
||||
#define RDIMAGEMAGICK_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QSize>
|
||||
|
||||
QByteArray RDIMResizeImage(const QByteArray &src_image,const QSize &size);
|
||||
|
||||
|
||||
#endif // RDIMAGEMAGICK_H
|
Reference in New Issue
Block a user