Merge pull request #253 from vexorian/20210124_dev

20210124 dev
This commit is contained in:
vexorian 2021-01-24 21:37:31 -04:00 committed by GitHub
commit 1998d5c1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 68 additions and 59 deletions

View File

@ -627,6 +627,13 @@ function api(db, channelDB, fillerDB, xmltvInterval, guideService, _m3uService
}
function cleanUpChannel(channel) {
if (
(typeof(channel.groupTitle) === 'undefined')
||
(channel.groupTitle === '')
) {
channel.groupTitle = "dizqueTV";
}
channel.programs.forEach( cleanUpProgram );
delete channel.fillerContent;
delete channel.filler;

View File

@ -20,7 +20,7 @@
const path = require('path');
var fs = require('fs');
const TARGET_VERSION = 801;
const TARGET_VERSION = 802;
const STEPS = [
// [v, v2, x] : if the current version is v, call x(db), and version becomes v2
@ -41,6 +41,7 @@ const STEPS = [
// but we have to migrate it to 800 using the reAddIcon.
[ 702, 800, (db,channels,dir) => reAddIcon(dir) ],
[ 800, 801, (db) => addImageCache(db) ],
[ 801, 802, () => addGroupTitle() ],
]
const { v4: uuidv4 } = require('uuid');
@ -741,7 +742,7 @@ function migrateWatermark(db, channelDB) {
return channel;
}
console.log("Extracting fillers from channels...");
console.log("Migrating watermarks...");
let channels = path.join(process.env.DATABASE, 'channels');
let channelFiles = fs.readdirSync(channels);
for (let i = 0; i < channelFiles.length; i++) {
@ -811,6 +812,30 @@ function addImageCache(db) {
fs.writeFileSync( f, JSON.stringify( [xmltvSettings] ) );
}
function addGroupTitle() {
function migrateChannel(channel) {
channel.groupTitle= "dizqueTV";
return channel;
}
console.log("Adding group title to channels...");
let channels = path.join(process.env.DATABASE, 'channels');
let channelFiles = fs.readdirSync(channels);
for (let i = 0; i < channelFiles.length; i++) {
if (path.extname( channelFiles[i] ) === '.json') {
console.log("Adding group title to channel : " + channelFiles[i] +"..." );
let channelPath = path.join(channels, channelFiles[i]);
let channel = JSON.parse(fs.readFileSync(channelPath, 'utf-8'));
channel = migrateChannel(channel);
fs.writeFileSync( channelPath, JSON.stringify(channel), 'utf-8');
}
}
console.log("Done migrating group titles in channels.");
}
module.exports = {
initDB: initDB,

View File

@ -50,7 +50,7 @@ class M3uService {
for (var i = 0; i < channels.length; i++) {
if (channels[i].stealth !== true) {
data += `#EXTINF:0 tvg-id="${channels[i].number}" CUID="${channels[i].number}" tvg-chno="${channels[i].number}" tvg-name="${channels[i].name}" tvg-logo="${channels[i].icon}" group-title="dizqueTV",${channels[i].name}\n`
data += `#EXTINF:0 tvg-id="${channels[i].number}" CUID="${channels[i].number}" tvg-chno="${channels[i].number}" tvg-name="${channels[i].name}" tvg-logo="${channels[i].icon}" group-title="${channels[i].groupTitle}",${channels[i].name}\n`
data += `{{host}}/video?channel=${channels[i].number}\n`
}
}

View File

@ -15,7 +15,6 @@ app.directive('plexSettings', require('./directives/plex-settings'))
app.directive('ffmpegSettings', require('./directives/ffmpeg-settings'))
app.directive('xmltvSettings', require('./directives/xmltv-settings'))
app.directive('hdhrSettings', require('./directives/hdhr-settings'))
app.directive('cacheSettings', require('./directives/cache-settings'))
app.directive('plexLibrary', require('./directives/plex-library'))
app.directive('programConfig', require('./directives/program-config'))
app.directive('flexConfig', require('./directives/flex-config'))

View File

@ -1,23 +0,0 @@
module.exports = function (dizquetv) {
return {
restrict: 'E',
templateUrl: 'templates/cache-settings.html',
replace: true,
scope: {
},
link: function (scope, element, attrs) {
dizquetv.getAllSettings().then((settings) => {
console.warn(settings);
scope.settings = settings;
scope.$apply();
});
scope.updateSetting = (setting) => {
const {key, value} = setting;
dizquetv.putSetting(key, !value).then((response) => {
scope.settings = response;
scope.$apply();
});
};
}
}
}

View File

@ -60,6 +60,7 @@ module.exports = function ($timeout, $location, dizquetv, resolutionOptions) {
scope.channel.guideMinimumDurationSeconds = 5 * 60;
scope.isNewChannel = true
scope.channel.icon = `${$location.protocol()}://${location.host}/images/dizquetv.png`
scope.channel.groupTitle = "dizqueTV";
scope.channel.disableFillerOverlay = true;
scope.channel.iconWidth = 120
scope.channel.iconDuration = 60
@ -95,6 +96,14 @@ module.exports = function ($timeout, $location, dizquetv, resolutionOptions) {
scope.channel.watermark = defaultWatermark();
}
if (
(typeof(scope.channel.groupTitle) === 'undefined')
||
(scope.channel.groupTitle === '')
) {
scope.channel.groupTitle = "dizqueTV";
}
if (typeof(scope.channel.fillerRepeatCooldown) === 'undefined') {
scope.channel.fillerRepeatCooldown = 30 * 60 * 1000;
}

View File

@ -1,15 +0,0 @@
<div>
<h5>Cache</h5>
<div class="options col-sm-4">
<div class="option row" ng-repeat="setting in settings track by setting.key">
<div class="option__title col-sm-6">{{setting.title}}</div>
<div class="option__action col-sm-6">
<button class="pull-right btn btn-sm" ng-class="[{'btn-danger': setting.value, 'btn-success': !setting.value}]" ng-click="updateSetting(setting)">
{{(setting.value) ? 'Disable' : 'Enable'}}
</button>
</div>
</div>
</div>
</div>

View File

@ -21,16 +21,28 @@
</div>
<!-- ============= TAB: PROPERTIES ========================= -->
<div class="modal-body" ng-if="tab == 'basic'">
<div>
<span class="pull-right text-danger">{{error.number}}</span>
<label id="channelNumber" class="small">Ch. #</label>
<input for="channelNumber" class="form-control form-control-sm" type="number" ng-model="channel.number" />
<div class='form-group'>
<label class='form-label' >Channel Number:</label>
<input type="text" class='form-control' type='number' ng-model="channel.number" id='channelNumber' aria-describedby="channelNumberHelp" />
<small id='channelNumberHelp' class="text-danger" for='channelNumber'>{{error.number}}</small>
</div>
<div>
<span class="pull-right text-danger">{{error.name}}</span>
<label id="channelName" class="small">Channel Name</label>
<input for="channelName" class="form-control form-control-sm" type="text" ng-model="channel.name" />
<div class='form-group'>
<label class='form-label' >Channel Name:</label>
<input type="text" class='form-control' ng-model="channel.name" id='channelName' aria-describedby="channelNameHelp" />
<small id='channelNumberHelp' class="text-danger" for='channelNumber'>{{error.name}}</small>
</div>
<div class='form-group'>
<label class='form-label' >Channel Group:</label>
<input type="text" class='form-control' ng-model="channel.groupTitle" id='groupTitle' placeholder="dizqueTV" aria-describedby="groupTitleHelp" />
<small id='groupTitleHelp' class="text-muted" for='channelNumber'>This is used by iptv clients to categorize the channels. You can leave it as dizqueTV if you don&apos;t need this sort of classification.</small>
</div>
<div>
<span class="pull-right text-danger">{{error.icon}}</span>
<label for="channelIcon" class="small">Channel Icon</label>
@ -48,8 +60,9 @@
</div>
</div>
<br />
<div>
<h6>Channel Icon Preview</h6>
<h6>Preview</h6>
<img ng-if="channel.icon !== ''" ng-src="{{channel.icon}}" alt="{{channel.name}}" style="max-height: 120px;"/>
<span ng-if="channel.icon === ''">{{channel.name}}</span>
</div>
@ -793,14 +806,14 @@
<div class="form-group col-sm-auto">
<label for="channelBitrate">Video Bitrate (k:</label>
<label for="channelBitrate">Video Bitrate (K):</label>
<input id='channelBitrate' class='form-control' type='number' ng-model='channel.transcoding.videoBitrate' min=0 placeholder='{{videoRateDefault}}'>
</input>
<small class='text-muted form-text'>Leave unassigned to use the global setting</small>
</div>
<div class="form-group col-sm-auto">
<label for="channelBufsize">Video Buffer Size (k):</label>
<label for="channelBufsize">Video Buffer Size (K):</label>
<input id='channelBufsize' class='form-control' type='number' ng-model='channel.transcoding.videoBufSize' min=0 placeholder='{{videoBufSizeDefault}}'>
</input>
<small class='text-muted form-text'>Leave unassigned to use the global setting</small>

View File

@ -20,16 +20,10 @@
HDHR
</span>
</li>
<li class="nav-item">
<span class="nav-link btn btn-link {{ selected === 'cache' ? 'active' : ''}}" ng-click="selected = 'cache'">
Cache
</span>
</li>
</ul>
<br />
<plex-settings ng-if="selected == 'plex'"></plex-settings>
<ffmpeg-settings ng-if="selected == 'ffmpeg'"></ffmpeg-settings>
<xmltv-settings ng-if="selected == 'xmltv'"></xmltv-settings>
<cache-settings ng-if="selected == 'cache'"></cache-settings>
<hdhr-settings ng-if="selected == 'hdhr'"></hdhr-settings>
</div>