assert isinstance(serviceref, ServiceReference)
- self.service_ref = serviceref
+ if serviceref.getType() == eServiceReference.idDVB and serviceref.getPath() == "":
+ self.service_ref = serviceref
+ else:
+ self.service_ref = ServiceReference(None)
self.eit = eit
self.dontSave = False
self.name = name
def list(self):
return self.serviceHandler.list(self.ref)
+
+ def getType(self):
+ return self.ref.type
+
+ def getPath(self):
+ return self.ref.getPath()
def __list__(self):
if self.type == choicesList.LIST_TYPE_LIST:
- ret = [not isinstance(x, tuple) and x or x[0] for x in self.choices]
+ ret = [not isinstance(x, tuple) and x or len(x) > 0 and x[0] or len(x) == 0 and x for x in self.choices]
else:
ret = self.choices.keys()
return ret or [""]
config.mediaplayer.savePlaylistOnExit = ConfigYesNo(default=True)
config.mediaplayer.saveDirOnExit = ConfigYesNo(default=False)
config.mediaplayer.defaultDir = ConfigDirectory()
+config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
+config.mediaplayer.alternateUserAgent = ConfigText(default="")
class DirectoryBrowser(Screen, HelpableScreen):
from Screens.MovieSelection import getPreferredTagEditor
from Screens.LocationBox import MovieLocationBox
from Screens.ChoiceBox import ChoiceBox
+from Screens.MessageBox import MessageBox
from RecordTimer import AFTEREVENT
-from enigma import eEPGCache
+from enigma import eEPGCache, eServiceReference
from time import localtime, mktime, time, strftime
from datetime import datetime
self.timerentry_service_ref = ServiceReference(args[0])
self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName())
self["config"].invalidate(self.channelEntry)
-
+
def getTimestamp(self, date, mytime):
d = localtime(date)
dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
end += 86400
return begin, end
- def keyGo(self):
+ def selectChannelSelector(self, *args):
+ self.session.openWithCallback(
+ self.finishedChannelSelectionCorrection,
+ ChannelSelection.SimpleChannelSelection,
+ _("Select channel to record from")
+ )
+
+ def finishedChannelSelectionCorrection(self, *args):
+ if args:
+ self.finishedChannelSelection(*args)
+ self.keyGo()
+
+ def keyGo(self, result = None):
+ if self.timerentry_service_ref.getType() != eServiceReference.idDVB or self.timerentry_service_ref.getPath() != "":
+ self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
+ return
self.timer.name = self.timerentry_name.value
self.timer.description = self.timerentry_description.value
self.timer.justplay = self.timerentry_justplay.value == "zap"
uri = g_strdup_printf ("%s", filename);
m_streamingsrc_timeout = eTimer::create(eApp);;
CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout);
+
+ std::string config_str;
+ if( ePythonConfigQuery::getConfigValue("config.mediaplayer.useAlternateUserAgent", config_str) == 0 )
+ {
+ if ( config_str == "True" )
+ ePythonConfigQuery::getConfigValue("config.mediaplayer.alternateUserAgent", m_useragent);
+ }
+ if ( m_useragent.length() == 0 )
+ m_useragent = "Dream Multimedia Dreambox Enigma2 Mediaplayer";
}
else if ( m_sourceinfo.containertype == ctCDA )
{
subs.language_code = std::string("und");
m_subtitleStreams.push_back(subs);
}
+ if ( m_sourceinfo.is_streaming )
+ {
+ g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (gstHTTPSourceSetAgent), this);
+ }
} else
{
m_event((iPlayableService*)this, evUser+12);
return GST_BUS_PASS;
}
+void eServiceMP3::gstHTTPSourceSetAgent(GObject *object, GParamSpec *unused, gpointer user_data)
+{
+ eServiceMP3 *_this = (eServiceMP3*)user_data;
+ GstElement *source;
+ g_object_get(_this->m_gst_playbin, "source", &source, NULL);
+ g_object_set (G_OBJECT (source), "user-agent", _this->m_useragent.c_str(), NULL);
+ gst_object_unref(source);
+}
+
audiotype_t eServiceMP3::gstCheckAudioPad(GstStructure* structure)
{
if (!structure)
static void gstCBsubtitleAvail(GstElement *element, gpointer user_data);
GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type);
void gstPoll(const int&);
+ static void gstHTTPSourceSetAgent(GObject *source, GParamSpec *unused, gpointer user_data);
std::list<ePangoSubtitlePage> m_subtitle_pages;
ePtr<eTimer> m_subtitle_sync_timer;
RESULT seekToImpl(pts_t to);
gint m_aspect, m_width, m_height, m_framerate, m_progressive;
+ std::string m_useragent;
RESULT trickSeek(gdouble ratio);
};
#endif