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