diff options
-rw-r--r-- | lib/class/song.class.php | 37 | ||||
-rw-r--r-- | play/index.php | 1 |
2 files changed, 25 insertions, 13 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php index c6b1f0b2..fe264bc1 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -972,21 +972,9 @@ class Song extends database_object implements media { if ($this->_transcoded) { return false; } $conf_var = 'transcode_' . $this->type; - $conf_type = 'transcode_' . $this->type . '_target'; - $conf_cmd = 'transcode_cmd_' . $this->type; if (Config::get($conf_var)) { - $this->_transcoded = true; - $this->transcoded_from = $this->type; - $this->_transcode_cmd = Config::get($conf_cmd); - - $this->format_type(Config::get($conf_type)); - if ($this->type == $this->transcoded_from) { - $this->_resampled = true; - } - - debug_event('transcode', 'Transcoding from ' . - $this->transcoded_from . ' to ' . $this->type, 5); + $this->set_transcode(); return false; } @@ -995,6 +983,29 @@ class Song extends database_object implements media { } // end native_stream /** + * set_transcode + * + * We want to transcode, set up the variables correctly + */ + public function set_transcode() { + if ($this->_transcoded) { return; } + + $conf_type = 'transcode_' . $this->type . '_target'; + $conf_cmd = 'transcode_cmd_' . $this->type; + + $this->_transcoded = true; + $this->transcoded_from = $this->type; + $this->_transcode_cmd = Config::get($conf_cmd); + $this->format_type(Config::get($conf_type)); + if ($this->type == $this->transcoded_from) { + $this->_resampled = true; + } + + debug_event('transcode', 'Transcoding from ' . + $this->transcoded_from . ' to ' . $this->type, 5); + } + + /** * stream_cmd * * test if the song type streams natively and diff --git a/play/index.php b/play/index.php index 3e0945ba..8e41cbc5 100644 --- a/play/index.php +++ b/play/index.php @@ -316,6 +316,7 @@ if (((Config::get('transcode') == 'always' AND !$video) || 'Decided to transcode. Transcode:' . Config::get('transcode') . ' Native Stream: ' . ($media->native_stream() ? 'true' : 'false') . ' Remote: ' . ($remote ? 'true' : 'false'), 5); + $media->set_transcode(); $fp = Stream::start_transcode($media, $media_name, $start); $media_name = $media->f_artist_full . " - " . $media->title . "." . $media->type; $transcoded = true; |