Merge commit 'dm/experimental' into vuplus_experimental
authorikseong <ikseong@vuplus>
Fri, 23 Jul 2010 05:54:32 +0000 (14:54 +0900)
committerikseong <ikseong@vuplus>
Fri, 23 Jul 2010 05:54:32 +0000 (14:54 +0900)
RecordTimer.py
ServiceReference.py
lib/python/Components/config.py
lib/python/Plugins/Extensions/MediaPlayer/settings.py
lib/python/Screens/TimerEntry.py
lib/service/servicemp3.cpp
lib/service/servicemp3.h

index f259e95..188aae5 100755 (executable)
@@ -102,7 +102,10 @@ class RecordTimerEntry(timer.TimerEntry, object):
                
                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
index 11e2878..5d11ae7 100644 (file)
@@ -20,3 +20,9 @@ class ServiceReference(eServiceReference):
 
        def list(self):
                return self.serviceHandler.list(self.ref)
+       
+       def getType(self):
+               return self.ref.type
+       
+       def getPath(self):
+               return self.ref.getPath()
index d7506e3..08dd374 100755 (executable)
@@ -179,7 +179,7 @@ class choicesList(object): # XXX: we might want a better name for this
 
        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 [""]
index 0b95812..7f42677 100755 (executable)
@@ -12,6 +12,8 @@ config.mediaplayer.repeat = ConfigYesNo(default=False)
 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):
 
index 64fa9f1..62faf9b 100644 (file)
@@ -13,8 +13,9 @@ from Components.UsageConfig import defaultMoviePath
 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
 
@@ -245,7 +246,7 @@ class TimerEntry(Screen, ConfigListScreen):
                        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])
@@ -264,7 +265,22 @@ class TimerEntry(Screen, ConfigListScreen):
                        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"
index b34b62f..9c24d4b 100644 (file)
@@ -292,6 +292,15 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
                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 )
        {
@@ -353,6 +362,10 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
                        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);
@@ -1410,6 +1423,15 @@ GstBusSyncReply eServiceMP3::gstBusSyncHandler(GstBus *bus, GstMessage *message,
        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)
index af68bd9..01f7cf7 100644 (file)
@@ -208,6 +208,7 @@ private:
        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;
@@ -224,6 +225,7 @@ private:
        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