diff --git a/admin.php b/admin.php index 6ac0043..1e03990 100644 --- a/admin.php +++ b/admin.php @@ -73,6 +73,9 @@ if (file_exists('premium_content.json')) {
  • Premium Content
  • +
  • + Upload Channels +
  • App Settings
  • diff --git a/admin_upload.php b/admin_upload.php new file mode 100644 index 0000000..1aa464c --- /dev/null +++ b/admin_upload.php @@ -0,0 +1,169 @@ + $attributes['title'], + 'category' => $attributes['group-title'] ?? 'General', + 'poster_url' => $attributes['tvg-logo'] ?? '', + 'stream_url' => $stream_url, + ]; + $i++; // Skip the next line as it's the URL + } else { + $malformed_entries++; + } + } + } + + if (!empty($new_channels)) { + $content_file = 'premium_content.json'; + $existing_channels = []; + if (!$overwrite && file_exists($content_file)) { + $existing_content = json_decode(file_get_contents($content_file), true); + if (is_array($existing_content)) { + $existing_channels = $existing_content; + } + } + + $last_id = 0; + if (!empty($existing_channels)) { + $last_item = end($existing_channels); + $last_id = $last_item['id'] ?? 0; + } + + foreach($new_channels as &$channel) { + $last_id++; + $channel['id'] = $last_id; + } + + $all_channels = array_merge($existing_channels, $new_channels); + + if (json_encode($all_channels, JSON_PRETTY_PRINT)) { + file_put_contents($content_file, json_encode($all_channels, JSON_PRETTY_PRINT)); + $message = 'Successfully uploaded and processed ' . count($new_channels) . ' new channels.'; + if ($malformed_entries > 0) { + $error = $malformed_entries . ' entries in your file were malformed and could not be imported.'; + } + } else { + $error = 'Failed to encode data to JSON. Check for special characters.'; + } + + } else { + $error = 'No valid channel data found in the uploaded M3U file.'; + if ($malformed_entries > 0) { + $error .= ' All entries appear to be malformed.'; + } + } + } + } else { + $error = 'File upload failed with error code: ' . $file['error']; + } +} +?> + + + + + + Admin - Upload M3U Playlist + + + + + +
    +

    Upload Premium Channels

    + + +
    + + +
    + + +
    +
    +
    Upload an M3U Playlist File
    +

    + The file should be a valid M3U playlist (starting with #EXTM3U). The parser will attempt to extract channel information from #EXTINF lines. +

    +
    +
    + + +
    +
    + + + If checked, all current premium channels will be replaced by the ones in this file. If unchecked, new channels will be added to the existing list. +
    + +
    +
    +
    + +
    + Back to Admin +
    + +
    + + + + diff --git a/assets/img/icon-192.png b/assets/img/icon-192.png new file mode 100644 index 0000000..4f255bd Binary files /dev/null and b/assets/img/icon-192.png differ diff --git a/assets/img/icon-512.png b/assets/img/icon-512.png new file mode 100644 index 0000000..7d77195 Binary files /dev/null and b/assets/img/icon-512.png differ diff --git a/index.php b/index.php index 1f19c40..5bc14e5 100644 --- a/index.php +++ b/index.php @@ -34,9 +34,19 @@ height: 70px; } + + +
    + + + watch latest movies + + +
    +