0
0
mirror of https://github.com/anthonyaxenov/iptv.git synced 2024-11-24 14:29:53 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
8656cbb506
wip 2024-09-22 11:34:52 +08:00
4585e46a2e
Bootstrap v5.2.3 2024-09-22 11:07:58 +08:00
5 changed files with 55 additions and 15 deletions

View File

@ -11,7 +11,6 @@ use App\Exceptions\PlaylistNotFoundException;
*/ */
class IniFile class IniFile
{ {
/** /**
* @var array * @var array
*/ */

View File

@ -135,6 +135,7 @@ class Playlist
$result = [ $result = [
'attributes' => [], 'attributes' => [],
'channels' => [], 'channels' => [],
'groups' => [],
'encoding' => [ 'encoding' => [
'name' => 'unknown', 'name' => 'unknown',
'alert' => false, 'alert' => false,
@ -176,6 +177,7 @@ class Playlist
$name = $exploded[1] ?? '(канал без названия)'; $name = $exploded[1] ?? '(канал без названия)';
} }
$channel = [ $channel = [
'_id' => md5($name . random_int(1, 99999)),
'name' => trim($name), 'name' => trim($name),
'url' => null, 'url' => null,
'group' => $attrs['group-title'] ?? null, 'group' => $attrs['group-title'] ?? null,
@ -204,10 +206,22 @@ class Playlist
} }
} }
if ($groupped) { // if ($groupped) {
$groups = [];
$stop = 1; foreach ($result['channels'] as $channel) {
} $name = $channel['group'] ?? '<ungroupped>';
$id = md5($name);
if (empty($groups[$id])) {
$groups[$id] = [
'_id' => $id,
'name' => $name,
'channels' => [],
];
}
$groups[$id]['channels'][] = $channel['_id'];
}
$result['groups'] = array_values($groups);
// }
return $this->parsedContent = $result; return $this->parsedContent = $result;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block header %} {% block header %}
<h2>{{ name }}</h2> <h2>О плейлисте {{ name }}</h2>
{% if (content.encoding.alert) %} {% if (content.encoding.alert) %}
<div class="alert alert-warning small" role="alert"> <div class="alert alert-warning small" role="alert">
Кодировка исходного плейлиста отличается от UTF-8. Кодировка исходного плейлиста отличается от UTF-8.
@ -21,7 +21,6 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<h4>О плейлисте</h4>
<table class="table table-dark table-hover small"> <table class="table table-dark table-hover small">
<tbody> <tbody>
<tr> <tr>
@ -58,12 +57,40 @@
<td>Источник</td> <td>Источник</td>
<td>{{ src }}</td> <td>{{ src }}</td>
</tr> </tr>
<tr>
<td>Количество каналов</td>
<td>{{ content.channelCount ?? 0 }}</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<h4>Список каналов ({{ content.channelCount ?? 0 }})</h4> <h4>Список каналов</h4>
{# <div class="accordion small bg-dark text-light" id="channels-list">#}
{# {% for group in content.groups %}#}
{# <div class="accordion-item small bg-dark text-light">#}
{# <h2 class="accordion-header small bg-dark text-light" id="heading{{ group._id }}">#}
{# <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ group._id }}" aria-expanded="true" aria-controls="collapse{{ group._id }}">#}
{# {{ group.name }}#}
{# </button>#}
{# </h2>#}
{# <div id="collapse{{ group._id }}" class="accordion-collapse collapse small bg-dark text-light" aria-labelledby="heading{{ group._id }}" data-bs-parent="#accordion{{ group._id }}">#}
{# <div class="accordion-body">#}
{# <ul class="list-group list-group-flush">#}
{# {% for group in content.channels %}#}
{# <li class="list-group-item">An item</li>#}
{# {% endfor %}#}
{# </ul>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# {% endfor %}#}
{# </div>#}
<div class="overflow-auto" style="max-height:500px"> <div class="overflow-auto" style="max-height:500px">
<table class="table table-dark table-hover small"> <table class="table table-dark table-hover small">
<tbody> <tbody>