Compare commits

...
Sign in to create a new pull request.

2 commits
0.11 ... 0.13

Author SHA1 Message Date
1dee971812 0.13 2025-02-15 07:44:13 +01:00
2336452447 0.12 2025-02-15 07:43:27 +01:00
4 changed files with 60 additions and 39 deletions

View file

@ -6,7 +6,6 @@
#include <string>
#include <cstdlib>
#include <curl/curl.h>
#include <vlc/vlc.h>
#include <stdio.h>
@ -19,6 +18,7 @@
#include <QStringList>
#include <QTextStream>
#include <QMessageBox>
#include <QtNetwork>
player_gui::player_gui(QWidget *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;
}
int player_gui::sender_holen(void){
CURL *curl;
FILE *file;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl){
QString url = "http://" + ip + "/channels.m3u";
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);
manager = new QNetworkAccessManager();
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);
}
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){
@ -163,13 +170,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++){
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]);
}
}
}
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);
}

View file

@ -6,6 +6,7 @@
#include <QFile>
#include <QFrame>
#include <QListWidget>
#include <QtNetwork>
#include <vlc/vlc.h>
namespace Ui {
@ -36,8 +37,10 @@ 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;

View file

@ -80,8 +80,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1210</width>
<height>21</height>
<width>1160</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuProgramm">

View file

@ -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 += \
main.cpp \
player_gui.cpp
CONFIG += \
c++11 \
static
LIBS += -lcurl -lvlc
DEFINES += CURL_STATICLIB VLC_STATICLIB
DEFINES += \
VLC_STATICLIB \
QT_STATIC_BUILD
HEADERS += \
player_gui.h
LIBS += \
-lvlc.dll
#CONFIG+= static
SOURCES += \
main.cpp \
player_gui.cpp
FORMS += \
player_gui.ui
HEADERS += \
player_gui.h
FORMS += \
player_gui.ui