Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
1dee971812 | |||
2336452447 |
4 changed files with 60 additions and 39 deletions
|
@ -6,7 +6,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <vlc/vlc.h>
|
#include <vlc/vlc.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -19,6 +18,7 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QtNetwork>
|
||||||
|
|
||||||
player_gui::player_gui(QWidget *parent) :
|
player_gui::player_gui(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -100,27 +100,34 @@ size_t player_gui::write_data(void *ptr, size_t size, size_t nmemb, void *stream
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
int player_gui::sender_holen(void){
|
int player_gui::sender_holen(void){
|
||||||
CURL *curl;
|
|
||||||
FILE *file;
|
manager = new QNetworkAccessManager();
|
||||||
CURLcode res;
|
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
QString url = "http://" + ip + "/channels.m3u";
|
||||||
curl = curl_easy_init();
|
QNetworkRequest request(url);
|
||||||
if(curl){
|
QNetworkReply *reply = manager->get(request);
|
||||||
QString url = "http://" + ip + "/channels.m3u";
|
|
||||||
std::string urls = url.toStdString();
|
connect(reply, &QNetworkReply::finished, [=]() {
|
||||||
const char *cstr = urls.c_str();
|
if(reply->error() == QNetworkReply::NoError)
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, cstr);
|
{
|
||||||
file = fopen("channels.m3u", "wb");
|
QByteArray response = reply->readAll();
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, this->write_data);
|
std::string Daten = response.toStdString();
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
|
std::cout << Daten << std::endl;
|
||||||
res = curl_easy_perform(curl);
|
// do something with the data...
|
||||||
if(res != CURLE_OK)
|
FILE *file = fopen("channels.m3u", "wb");
|
||||||
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
|
if (file!=NULL)
|
||||||
else
|
{
|
||||||
std::cout << "Sender holen und in channels.m3u speichern..." << std::endl;
|
std::fputs(response,file);
|
||||||
curl_easy_cleanup(curl);
|
}
|
||||||
}
|
fclose(file);
|
||||||
fclose(file);
|
}
|
||||||
|
else // handle error
|
||||||
|
{
|
||||||
|
ui->statusbar->showMessage(reply->errorString().toUtf8().constData());
|
||||||
|
std::cout << reply->errorString().toUtf8().constData() << std::endl;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int player_gui::sender_laden(void){
|
int player_gui::sender_laden(void){
|
||||||
|
@ -163,13 +170,13 @@ void player_gui::on_lineEdit_textChanged(const QString &arg1){
|
||||||
std::cout << "suchen" << std::endl;
|
std::cout << "suchen" << std::endl;
|
||||||
ui->listWidget->clear();
|
ui->listWidget->clear();
|
||||||
for(int x=1;x<=this->Sender;x++){
|
for(int x=1;x<=this->Sender;x++){
|
||||||
if(this->Name[x].contains(arg1)){
|
this->Name_tmp = this->Name[x].toLower();
|
||||||
|
if(this->Name_tmp.contains(arg1.toLower())){
|
||||||
ui->listWidget->addItem(this->Name[x]);
|
ui->listWidget->addItem(this->Name[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void player_gui::on_listWidget_itemClicked(QListWidgetItem *item)
|
void player_gui::on_listWidget_itemClicked(QListWidgetItem *item){
|
||||||
{
|
|
||||||
std::cout << item->text().toStdString() << std::endl;
|
std::cout << item->text().toStdString() << std::endl;
|
||||||
this->play(item);
|
this->play(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QtNetwork>
|
||||||
#include <vlc/vlc.h>
|
#include <vlc/vlc.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -36,8 +37,10 @@ private:
|
||||||
int sender_ausgeben(void);
|
int sender_ausgeben(void);
|
||||||
int Sender;
|
int Sender;
|
||||||
QString Name[10000];
|
QString Name[10000];
|
||||||
|
QString Name_tmp;
|
||||||
QString URL[10000];
|
QString URL[10000];
|
||||||
QString ip;
|
QString ip;
|
||||||
|
QNetworkAccessManager *manager;
|
||||||
QFrame *videoWidget;
|
QFrame *videoWidget;
|
||||||
libvlc_instance_t * inst;
|
libvlc_instance_t * inst;
|
||||||
libvlc_media_player_t *mp=0;
|
libvlc_media_player_t *mp=0;
|
||||||
|
|
|
@ -80,8 +80,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1210</width>
|
<width>1160</width>
|
||||||
<height>21</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuProgramm">
|
<widget class="QMenu" name="menuProgramm">
|
||||||
|
|
35
vlc-vdr.pro
35
vlc-vdr.pro
|
@ -1,19 +1,30 @@
|
||||||
|
QT += \
|
||||||
|
core \
|
||||||
|
gui \
|
||||||
|
widgets \
|
||||||
|
network
|
||||||
|
|
||||||
QT += core gui
|
QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) : QT += widgets
|
QMAKE_LFLAGS += -static -static-libgcc
|
||||||
|
|
||||||
SOURCES += \
|
CONFIG += \
|
||||||
main.cpp \
|
c++11 \
|
||||||
player_gui.cpp
|
static
|
||||||
|
|
||||||
LIBS += -lcurl -lvlc
|
DEFINES += \
|
||||||
DEFINES += CURL_STATICLIB VLC_STATICLIB
|
VLC_STATICLIB \
|
||||||
|
QT_STATIC_BUILD
|
||||||
|
|
||||||
HEADERS += \
|
LIBS += \
|
||||||
player_gui.h
|
-lvlc.dll
|
||||||
|
|
||||||
#CONFIG+= static
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
player_gui.cpp
|
||||||
|
|
||||||
FORMS += \
|
HEADERS += \
|
||||||
player_gui.ui
|
player_gui.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
player_gui.ui
|
||||||
|
|
Loading…
Add table
Reference in a new issue