1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

improve m3u channel list parsing

This commit is contained in:
Luke Pulverenti 2016-12-07 15:03:00 -05:00
parent 835ed1dfae
commit dcb44815ed
9 changed files with 59 additions and 109 deletions

View file

@ -669,23 +669,53 @@
}); });
}; };
self.detectBitrate = function () { function normalizeReturnBitrate(bitrate) {
// First try a small amount so that we don't hang up their mobile connection if (!bitrate) {
return self.getDownloadSpeed(1000000).then(function (bitrate) { return Promise.reject();
}
if (bitrate < 1000000) {
return Math.round(bitrate * 0.8); return Math.round(bitrate * 0.8);
}
function detectBitrateInternal(tests, index, currentBitrate) {
if (index >= tests.length) {
return normalizeReturnBitrate(currentBitrate);
}
var test = tests[0];
return self.getDownloadSpeed(test.bytes).then(function (bitrate) {
if (bitrate < test.threshold) {
return normalizeReturnBitrate(bitrate);
} else { } else {
return detectBitrateInternal(tests, index + 1, bitrate);
}
// If that produced a fairly high speed, try again with a larger size to get a more accurate result }, function () {
return self.getDownloadSpeed(2400000).then(function (bitrate) { return normalizeReturnBitrate(currentBitrate);
return Math.round(bitrate * 0.8);
}); });
} }
}); self.detectBitrate = function () {
return detectBitrateInternal([
{
bytes: 100000,
threshold: 5000000
},
{
bytes: 1000000,
threshold: 50000000
},
{
bytes: 3000000,
threshold: 50000000
}], 0);
}; };
/** /**

View file

@ -240,7 +240,7 @@ define(['browser'], function (browser) {
return function (options) { return function (options) {
options = options || {}; options = options || {};
var physicalAudioChannels = options.audioChannels || 2; var physicalAudioChannels = options.audioChannels || (browser.tv || browser.xboxOne || browser.ps4 ? 6 : 2);
var bitrateSetting = getMaxBitrate(); var bitrateSetting = getMaxBitrate();

View file

@ -310,7 +310,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
textlines.push(displayName); textlines.push(displayName);
} }
if (options.artist !== false) { if (options.artist !== false && (options.artist === true || item.AlbumArtist !== options.containerAlbumArtist)) {
if (item.ArtistItems && item.Type !== 'MusicAlbum') { if (item.ArtistItems && item.Type !== 'MusicAlbum') {
textlines.push(item.ArtistItems.map(function (a) { textlines.push(item.ArtistItems.map(function (a) {
return a.Name; return a.Name;
@ -318,7 +319,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
}).join(', ')); }).join(', '));
} }
if (item.AlbumArtist && item.Type === 'MusicAlbum') { else if (item.AlbumArtist && item.Type === 'MusicAlbum') {
textlines.push(item.AlbumArtist); textlines.push(item.AlbumArtist);
} }
} }

View file

@ -60,7 +60,6 @@
<div style="display: inline-block;"> <div style="display: inline-block;">
<select data-mini="true" data-inline="true" id="selectViewType"> <select data-mini="true" data-inline="true" id="selectViewType">
<option value="ReportData">${OptionReportList}</option> <option value="ReportData">${OptionReportList}</option>
<option value="ReportStatistics">${OptionReportStatistics}</option>
<option value="ReportActivities">${OptionReportActivities}</option> <option value="ReportActivities">${OptionReportActivities}</option>
</select> </select>
</div> </div>

View file

@ -273,7 +273,8 @@
}, { }, {
playFromHere: true, playFromHere: true,
action: 'playallfromhere', action: 'playallfromhere',
smallIcon: true smallIcon: true,
artist: true
}); });
break; break;

View file

@ -119,7 +119,7 @@
if (dom.getWindowSize().innerWidth >= 800) { if (dom.getWindowSize().innerWidth >= 800) {
backdrop.setBackdrops([item], { backdrop.setBackdrops([item], {
blur: 27 blur: 24
}, false); }, false);
} else { } else {
backdrop.clear(); backdrop.clear();
@ -1162,7 +1162,8 @@
playFromHere: true, playFromHere: true,
action: 'playallfromhere', action: 'playallfromhere',
image: false, image: false,
artist: false artist: 'auto',
containerAlbumArtist: item.AlbumArtist
}); });
isList = true; isList = true;
} }
@ -1261,7 +1262,7 @@
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderEpisodes'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderEpisodes');
} }
else if (item.Type == "Episode") { else if (item.Type == "Episode") {
page.querySelector('#childrenTitle').innerHTML = item.SeriesName + ' - ' + item.SeasonName; page.querySelector('#childrenTitle').innerHTML = item.SeasonName;
} }
else if (item.Type == "Series") { else if (item.Type == "Series") {
page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderSeasons'); page.querySelector('#childrenTitle').innerHTML = globalize.translate('HeaderSeasons');

View file

@ -200,65 +200,6 @@
return html; return html;
} }
function getStats(result) {
var html = '';
html += '<div class="detailSection" >';
//html += '<div class="detailSectionHeader">If you like Africa Fever II, check these out...</div>';
html += '<div class="detailSectionContent">';
result.Groups.map(function (group) {
//html += '<div class="card transparentCard detailPageSquareCard" style="vertical-align: top;">';
//html += '<div class="card transparentCard horizontalBackdropCard" style="vertical-align: top;">';
//html += '<div class="card transparentCard backdropCard" style="vertical-align: top;">';
html += '<div class="card transparentCard bannerCard" style="vertical-align: top;">';
//html += '<div class="card transparentCard cardImage" style="vertical-align: top;">';
html += '<div class="visualCardBox">';
html += '<div class="cardBox " >';
html += '<div class="detailSection">'
html += '<div class="detailSectionHeader">';
html += '<span>' + group.Header + '&nbsp;' + '</span>';
html += '</div>';
html += '<div class="detailSectionContent">';
html += '<div class="childrenItemsContainer itemsContainer" style="text-align: left;">';
html += '<ul class="itemsListview ui-listview" >';
var l = group.Items.length - 1;
for (var j = 0; j < topItems ; j++) {
html += '<li class="ui-li listItem ui-li-has-alt ui-first-child">';
if (j <= l) {
var rItem = group.Items[j];
html += '<a class="item ui-btn"';
if (rItem.Id > "")
html += ' href="itemdetails.html?id=' + rItem.Id + '"';
html += '>' + rItem.Name + '&nbsp;' + '</a>';
html += '<a title="" class="listviewMenuButton ui-btn ui-btn-inline">' + rItem.Value + '&nbsp;' + '</a>';
}
else
html += '<a class="item ui-btn">' + '&nbsp;' + '</a>';
html += '</li>';
}
html += '</ul>';
html += '</div>';
html += '</div>';
html += '</div>';
html += '</div>';
html += '</div>';
html += '</div>';
});
html += '</div>';
//html += '</div>';
html += '</div>';
return html;
}
function ExportReport(page, e) { function ExportReport(page, e) {
query.UserId = Dashboard.getCurrentUserId(); query.UserId = Dashboard.getCurrentUserId();
@ -302,7 +243,7 @@
window.scrollTo(0, 0); window.scrollTo(0, 0);
var html = ''; var html = '';
if (query.ReportView === "ReportData" || query.ReportView === "ReportStatistics") { if (query.ReportView === "ReportData") {
$('#selectIncludeItemTypesBox', page).show(); $('#selectIncludeItemTypesBox', page).show();
$('#tabFilter', page).show(); $('#tabFilter', page).show();
} }
@ -380,25 +321,6 @@
reloadItems(page); reloadItems(page);
}); });
} }
else {
$('.listTopPaging', page).html(pagingHtml).trigger('create');
// page.querySelector('.listTopPaging').innerHTML = pagingHtml;
$('.listTopPaging', page).show();
$('.listBottomPaging', page).hide();
$('.btnNextPage', page).hide();
$('.btnPreviousPage', page).hide();
$('#btnReportExport', page).hide();
$('#selectPageSizeBox', page).hide();
$('#selectReportGroupingBox', page).hide();
$('#grpReportsColumns', page).hide();
html += getStats(result);
$('.reporContainer', page).html(html).trigger('create');
}
$('#GroupStatus', page).hide(); $('#GroupStatus', page).hide();
$('#GroupAirDays', page).hide(); $('#GroupAirDays', page).hide();
@ -429,11 +351,6 @@
query.HasQueryLimit = true; query.HasQueryLimit = true;
url = ApiClient.getUrl("Reports/Items", query); url = ApiClient.getUrl("Reports/Items", query);
break; break;
case "ReportStatistics":
query.TopItems = topItems;
query.HasQueryLimit = false;
url = ApiClient.getUrl("Reports/Statistics", query);
break;
case "ReportActivities": case "ReportActivities":
query.HasQueryLimit = true; query.HasQueryLimit = true;
url = ApiClient.getUrl("Reports/Activities", query); url = ApiClient.getUrl("Reports/Activities", query);

View file

@ -72,7 +72,8 @@
var html = listView.getListViewHtml({ var html = listView.getListViewHtml({
items: result.Items, items: result.Items,
action: 'playallfromhere', action: 'playallfromhere',
smallIcon: true smallIcon: true,
artist: true
}); });
var i, length; var i, length;

View file

@ -231,9 +231,9 @@
require(['actionsheet'], function (actionsheet) { require(['actionsheet'], function (actionsheet) {
var card = $(elem).parents('.card'); var card = $(elem).parents('.card')[0];
var page = $(elem).parents('.page'); var page = $(elem).parents('.page')[0];
var id = card.attr('data-id'); var id = card.getAttribute('data-id');
actionsheet.show({ actionsheet.show({
items: menuItems, items: menuItems,