0
0
mirror of https://github.com/anthonyaxenov/iptv.git synced 2024-11-22 13:34:45 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
b02e68f635
wip 2024-09-22 02:07:47 +08:00
5 changed files with 15 additions and 55 deletions

View File

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

View File

@ -135,7 +135,6 @@ class Playlist
$result = [ $result = [
'attributes' => [], 'attributes' => [],
'channels' => [], 'channels' => [],
'groups' => [],
'encoding' => [ 'encoding' => [
'name' => 'unknown', 'name' => 'unknown',
'alert' => false, 'alert' => false,
@ -177,7 +176,6 @@ 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,
@ -206,22 +204,10 @@ class Playlist
} }
} }
// if ($groupped) { if ($groupped) {
$groups = [];
foreach ($result['channels'] as $channel) { $stop = 1;
$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,6 +21,7 @@
{% 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>
@ -57,40 +58,12 @@
<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>Список каналов</h4> <h4>Список каналов ({{ content.channelCount ?? 0 }})</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>