Skip to content

Commit

Permalink
Replace the old/broken/confusing video_url override code with per-ses…
Browse files Browse the repository at this point in the history
…sion settings to enable use of myth:// (for windows) and file:// overrides for file downloads

git-svn-id: http://svn.mythtv.org/svn/trunk@11703 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
ex-nerd committed Nov 9, 2006
1 parent c2a71ec commit 85875af
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 97 deletions.
6 changes: 6 additions & 0 deletions includes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*
/**/

// Wipe out old/unused settings
$db->query('DELETE FROM settings WHERE value="WebVideo_URL"'); /** @todo: Delete this line after 0.21 has been released */

// Prefer channum over callsign?
if (empty($_SESSION['prefer_channum']))
$_SESSION['prefer_channum'] = setting('WebPrefer_Channum');
Expand All @@ -35,6 +38,9 @@
if (!$_SESSION['date_channel_jump']) $_SESSION['date_channel_jump'] = t('generic_date');
if (!$_SESSION['time_format']) $_SESSION['time_format'] = t('generic_time');

// Use myth:// URI for recordings if browsing from a windows box?
if (!isset($_SESSION['use_myth_uri'])) $_SESSION['use_myth_uri'] = true;

// Show pixmaps on the recorded programs page?
if (!isset($_SESSION['recorded_pixmaps'])) {
$_SESSION['recorded_pixmaps'] = (tmpl == 'default') ? true : false;
Expand Down
83 changes: 42 additions & 41 deletions includes/mythbackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,48 +232,49 @@ function generate_preview_pixmap($show) {
$pngpath = cache_dir . '/' . basename($fileurl) . '.png';
$host = $GLOBALS['Master_Host'];
$port = $GLOBALS['Master_Port'];
$cmd = array('QUERY_PIXMAP_LASTMODIFIED', // 00 command
' ', // 01 title
' ', // 02 subtitle
' ', // 03 description
' ', // 04 category
$show->chanid, // 05 chanid
' ', // 06 chanstr
' ', // 07 chansign
' ', // 08 channame
$show->filename, // 09 filename
'0', // 10 upper 32 bits
'0', // 11 lower 32 bits
$show->starttime, // 12 starttime
$show->endtime, // 13 endtime
'0', // 14 conflicting
'1', // 15 recording
'0', // 16 duplicate
$show->hostname, // 17 hostname
'-1', // 18 sourceid
'-1', // 19 cardid
'-1', // 20 inputid
' ', // 21 recpriority
' ', // 22 recstatus
' ', // 23 recordid
' ', // 24 rectype
'15', // 25 dupin
'6', // 26 dupmethod
$show->recstartts, // 27 recstarttime
$show->recendts, // 28 recendtime
' ', // 29 repeat
' ', // 30 program flags
' ', // 31 recgroup
' ', // 32 commfree
' ', // 33 chanoutputfilters
$show->seriesid, // 34 seriesid
$show->programid, // 35 programid
$show->starttime, // 36 dummy lastmodified
'0', // 37 dummy stars
$show->starttime, // 38 dummy org airdate
'', // 39 dummy timestretch
$cmd = array('QUERY_PIXMAP_LASTMODIFIED', // command
' ', // 00 title
' ', // 01 subtitle
' ', // 02 description
' ', // 03 category
$show->chanid, // 04 chanid
' ', // 05 chanstr
' ', // 06 chansign
' ', // 07 channame
$show->filename, // 08 pathname
'0', // 09 filesize upper 32 bits
'0', // 10 filesize lower 32 bits
$show->starttime, // 11 startts
$show->endtime, // 12 endts
'0', // 13 duplicate
'1', // 14 shareable
'0', // 15 findid
$show->hostname, // 16 hostname
'-1', // 17 sourceid
'-1', // 18 cardid
'-1', // 19 inputid
' ', // 20 recpriority
' ', // 21 recstatus
' ', // 22 recordid
' ', // 23 rectype
'15', // 24 dupin
'6', // 25 dupmethod
$show->recstartts, // 26 recstartts
$show->recendts, // 27 recendts
' ', // 28 repeat
' ', // 29 programflags
' ', // 30 recgroup
' ', // 31 chancommfree
' ', // 32 chanOutputFilters
$show->seriesid, // 33 seriesid
$show->programid, // 34 programid
$show->starttime, // 35 lastmodified
'0', // 36 stars
$show->starttime, // 37 originalAirDate
'', // 38 hasAirDate
' ', // 39 playgroup
' ', // 40 recpriority2
' ', // 41 parentid
'', // 41 parentid
'', // 42 trailing separator
);
$lastmodified = strtotime(backend_command($cmd));
Expand Down
3 changes: 2 additions & 1 deletion includes/programs.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class Program {
var $max_newest = 0;
var $max_episodes = 0;
var $group = '';
var $playgroup = 'Default';

var $has_commflag = 0;
var $has_cutlist = 0;
Expand Down Expand Up @@ -330,7 +331,7 @@ function Program($data) {
$this->recpriority = $data[36];
$this->airdate = date('Y-m-d', $data[37]);
$this->hasairdate = $data[38];
$this->timestretch = $data[39];
$this->playgroup = $data[39];
$this->recpriority2 = $data[40];
// Is this a previously-recorded program?
if (!empty($this->filename)) {
Expand Down
13 changes: 7 additions & 6 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,13 @@ function _or($this, $or_this, $gt = false) {
* @return string URL to access recordings
/**/
function video_url($show) {
// Global override?
$video_url = setting('WebVideo_URL');
if ($video_url)
return $video_url.str_replace('%2F', '/', rawurlencode(basename($show->filename)));
// Mac and Linux just get a link to the streaming module
if (preg_match('/\b(?:linux|macintosh|mac\s+os\s*x)\b/i', $_SERVER['HTTP_USER_AGENT']))
// URL override?
if ($_SESSION['file_url_override'])
return 'file://'.$_SESSION['file_url_override'].str_replace('%2F', '/', rawurlencode(basename($show->filename)));
// Mac and Linux just get a link to the streaming module, along with any
// session marked to not use the myth:// URI
if (preg_match('/\b(?:linux|macintosh|mac\s+os\s*x)\b/i', $_SERVER['HTTP_USER_AGENT'])
|| !$_SESSION['use_myth_uri'])
return root."pl/stream/$show->chanid/$show->recstartts";
// Windows likely gets a myth:// url -- grab the master host and port
global $Master_Host, $Master_Port;
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Czech.lang
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
"Don't Record"
Nenahrávat
"Don't record this program."
"Download URL override"
"Dup Method"
"Duplicate Check method"
Metoda kontroly duplicit
Expand Down Expand Up @@ -642,6 +643,7 @@
"Update Recording Settings"
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
"UV High"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Danish.lang
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
Optag ikke
"Don't record this program."
Optag IKKE dette program
"Download URL override"
"Dup Method"
Dubletkontrol metode
"Duplicate Check method"
Expand Down Expand Up @@ -858,6 +859,7 @@
Brug kaldenavn
"Use date/time"
Brug dato/tid
"Use myth:// URI for Windows"
"useonairguide"
brug onairguide
"UV Extreme"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Dutch.lang
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
Niet Opnemen
"Don't record this program."
Dit programma niet opnemen
"Download URL override"
"Dup Method"
Dubbels Methode
"Duplicate Check method"
Expand Down Expand Up @@ -848,6 +849,7 @@
Zender gebruiken
"Use date/time"
Datum/tijd gebruiken
"Use myth:// URI for Windows"
"useonairguide"
gebruikepg
"UV Extreme"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/English.lang
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"Displaying"
"Don't Record"
"Don't record this program."
"Download URL override"
"Dup Method"
"Duplicate Check method"
"Duplicates"
Expand Down Expand Up @@ -560,6 +561,7 @@
"Update Recording Settings"
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
"UV High"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/English_GB.lang
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
"Don't Record"
"Don't record this program."
Don't record this programme.
"Download URL override"
"Dup Method"
"Duplicate Check method"
"Duplicates"
Expand Down Expand Up @@ -576,6 +577,7 @@
"Update Recording Settings"
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
"UV High"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Finnish.lang
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
Älä Nauhoita
"Don't record this program."
Älä nauhoita ohjelmaa.
"Download URL override"
"Dup Method"
Metodi
"Duplicate Check method"
Expand Down Expand Up @@ -827,6 +828,7 @@
Päivitä Nauhoitusasetukset
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
Käytä Ohjelmavirran Opasta
"UV Extreme"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/French.lang
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
Ne pas enregistrer
"Don't record this program."
Ne pas enregistrer cette émission
"Download URL override"
"Dup Method"
méthode de dup
"Duplicate Check method"
Expand Down Expand Up @@ -728,6 +729,7 @@
Actualiser les paramètres d´enregistrement
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
Indice UV Extrème
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/German.lang
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
Nicht aufnehmen
"Don't record this program."
Diese Sendung nicht aufnehmen
"Download URL override"
"Dup Method"
Methode für Wdhgn.
"Duplicate Check method"
Expand Down Expand Up @@ -847,6 +848,7 @@
Kurzname verwenden
"Use date/time"
Datum/Uhrzeit verwenden
"Use myth:// URI for Windows"
"useonairguide"
DVB-EPG Daten verwenden
"UV Extreme"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Japanese.lang
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
録画停止
"Don't record this program."
録画しない
"Download URL override"
"Dup Method"
重複検知
"Duplicate Check method"
Expand Down Expand Up @@ -868,6 +869,7 @@
コールサインを使用する
"Use date/time"
日時を使用する
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
UV 非常に強い
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Slovenian.lang
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
Ne snemaj
"Don't record this program."
Ne snemaj tega programa.
"Download URL override"
"Dup Method"
Metoda duplikatov
"Duplicate Check method"
Expand Down Expand Up @@ -720,6 +721,7 @@
Posodobi snemalne nastavitve
"Use callsign"
"Use date/time"
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
UV ektremen
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Spanish.lang
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
No grabar
"Don't record this program."
No borrar este programa
"Download URL override"
"Dup Method"
Método duplicado
"Duplicate Check method"
Expand Down Expand Up @@ -896,6 +897,7 @@
Usar nombre canal
"Use date/time"
Usar fecha/hora
"Use myth:// URI for Windows"
"useonairguide"
usar guía emitida
"UV Extreme"
Expand Down
2 changes: 2 additions & 0 deletions modules/_shared/lang/Swedish.lang
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
Spela ej in
"Don't record this program."
Spela inte in detta program.
"Download URL override"
"Dup Method"
Dubblettmetod
"Duplicate Check method"
Expand Down Expand Up @@ -901,6 +902,7 @@
Använd kanalnamn
"Use date/time"
Använd datum/tid
"Use myth:// URI for Windows"
"useonairguide"
"UV Extreme"
UV-strålning extrem
Expand Down
6 changes: 0 additions & 6 deletions modules/settings/mythweb.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
if ($_POST['save']) {
// Some global mythweb settings
$_SESSION['prefer_channum'] = setting('WebPrefer_Channum', null, $_POST['prefer_channum'] ? 1 : 0);
// Video URL needs some special checking
$_POST['video_url'] = trim($_POST['video_url']);
if (empty($_POST['video_url']) || preg_match('#^\w+://#', $_POST['video_url']))
setting('WebVideo_URL', null, $_POST['video_url']);
else
add_warning('Video URL needs a URI indicator like myth:// or file://');
// Video artwork directory
$_POST['video_artwork_dir'] = trim($_POST['video_artwork_dir']);
if (!empty($_POST['video_artwork_dir'])) {
Expand Down
28 changes: 15 additions & 13 deletions modules/settings/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,29 @@
if ($_POST['save']) {
$redirect = false;
// Save the date formats
if ($_POST['date_statusbar']) $_SESSION['date_statusbar'] = $_POST['date_statusbar'];
if ($_POST['date_scheduled']) $_SESSION['date_scheduled'] = $_POST['date_scheduled'];
if ($_POST['date_scheduled_popup']) $_SESSION['date_scheduled_popup'] = $_POST['date_scheduled_popup'];
if ($_POST['date_recorded']) $_SESSION['date_recorded'] = $_POST['date_recorded'];
if ($_POST['date_search']) $_SESSION['date_search'] = $_POST['date_search'];
if ($_POST['date_listing_key']) $_SESSION['date_listing_key'] = $_POST['date_listing_key'];
if ($_POST['date_listing_jump']) $_SESSION['date_listing_jump'] = $_POST['date_listing_jump'];
if ($_POST['date_channel_jump']) $_SESSION['date_channel_jump'] = $_POST['date_channel_jump'];
if ($_POST['time_format']) $_SESSION['time_format'] = $_POST['time_format'];
if (isset($_POST['date_statusbar'])) $_SESSION['date_statusbar'] = $_POST['date_statusbar'];
if (isset($_POST['date_scheduled'])) $_SESSION['date_scheduled'] = $_POST['date_scheduled'];
if (isset($_POST['date_scheduled_popup'])) $_SESSION['date_scheduled_popup'] = $_POST['date_scheduled_popup'];
if (isset($_POST['date_recorded'])) $_SESSION['date_recorded'] = $_POST['date_recorded'];
if (isset($_POST['date_search'])) $_SESSION['date_search'] = $_POST['date_search'];
if (isset($_POST['date_listing_key'])) $_SESSION['date_listing_key'] = $_POST['date_listing_key'];
if (isset($_POST['date_listing_jump'])) $_SESSION['date_listing_jump'] = $_POST['date_listing_jump'];
if (isset($_POST['date_channel_jump'])) $_SESSION['date_channel_jump'] = $_POST['date_channel_jump'];
if (isset($_POST['time_format'])) $_SESSION['time_format'] = $_POST['time_format'];
// Save the template
if ($_POST['tmpl']) $_SESSION['tmpl'] = $_POST['tmpl'];
if (isset($_POST['tmpl'])) $_SESSION['tmpl'] = $_POST['tmpl'];
// Save the skin
if ($_POST['skin'] && $_POST['skin'] != $_SESSION['skin']) {
if (isset($_POST['skin']) && $_POST['skin'] != $_SESSION['skin']) {
$_SESSION['skin'] = $_POST['skin'];
$redirect = true;
}
// Use SI units?
if ($_POST['siunits']) $_SESSION['siunits'] = $_POST['siunits'];
// Recorded Programs
if (isset($_POST['siunits'])) $_SESSION['siunits'] = $_POST['siunits'];
// Recorded Programs (can't use isset() here because un-checked checkboxes don't show up in the request)
$_SESSION['recorded_descunder'] = $_POST['recorded_descunder'] ? true : false;
$_SESSION['recorded_pixmaps'] = $_POST['recorded_pixmaps'] ? true : false;
$_SESSION['use_myth_uri'] = $_POST['use_myth_uri'] ? true : false;
if (isset($_POST['file_url_override'])) $_SESSION['file_url_override'] = trim(preg_replace('#^file://#', '', $_POST['file_url_override']));
// Guide Settings
$_SESSION['guide_favonly'] = $_POST['guide_favonly'] ? true : false;
$_SESSION['timeslot_size'] = max(5, intVal($_POST['timeslot_size'])) * 60;
Expand Down
Loading

0 comments on commit 85875af

Please sign in to comment.