diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
| commit | bce53d4a67d1655a496eebe5912c8573e880114e (patch) | |
| tree | 9b410fbcaf0f4a22f1cf3489b635e3e94e47a6d8 /lib | |
| parent | 166db5a9c9222c82939eede51d964c706039ebe8 (diff) | |
| parent | 54475ce18e43482b2ec1a150f7fa07c3464ec6d2 (diff) | |
| download | enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.tar.gz enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.zip | |
Merge commit 'origin/master' into tmbinc/FixTimingBugs
Diffstat (limited to 'lib')
138 files changed, 2650 insertions, 1333 deletions
diff --git a/lib/base/buffer.cpp b/lib/base/buffer.cpp index 3a0a6a3d..5dfdfad5 100644 --- a/lib/base/buffer.cpp +++ b/lib/base/buffer.cpp @@ -1,8 +1,9 @@ #include <lib/base/buffer.h> #include <lib/base/eerror.h> -#include <stdio.h> +#include <cerrno> +#include <cstdio> +#include <cstring> #include <unistd.h> -#include <errno.h> void eIOBuffer::removeblock() { diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 4c4d6551..35e46e05 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -1,8 +1,9 @@ #include <lib/base/eerror.h> #include <lib/base/elock.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> +#include <cstdarg> +#include <cstdio> +#include <cstdlib> +#include <cstring> #include <unistd.h> #include <string> diff --git a/lib/base/encoding.cpp b/lib/base/encoding.cpp index 5d6617d9..45fea102 100644 --- a/lib/base/encoding.cpp +++ b/lib/base/encoding.cpp @@ -1,3 +1,4 @@ +#include <cstdlib> #include <lib/base/encoding.h> #include <lib/base/eerror.h> diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index 5d15ddce..dcba7705 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -1,6 +1,7 @@ +#include <algorithm> +#include <cctype> +#include <climits> #include <string> -#include <ctype.h> -#include <limits.h> #include <lib/base/eerror.h> #include <lib/base/encoding.h> #include <lib/base/estring.h> @@ -633,3 +634,12 @@ void makeUpper(std::string &s) { std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper); } + +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol) +{ + std::string out = in; + std::string::size_type loc = 0; + while (( loc = out.find(entity, loc)) != std::string::npos ) + out.replace(loc, entity.length(), symbol); + return out; +} diff --git a/lib/base/estring.h b/lib/base/estring.h index 68e0970f..d61489eb 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -18,6 +18,7 @@ int isUTF8(const std::string &string); std::string removeDVBChars(const std::string &s); void makeUpper(std::string &s); +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1 { diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index e99e956c..b81aec5c 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -189,9 +189,13 @@ void eFilePushThread::thread() if (m_send_pvr_commit && !already_empty) { eDebug("sending PVR commit"); + + struct pollfd pfd[1] = {m_fd_dest, POLLHUP}; + poll(pfd, 1, 10000); + sleep(5); /* HACK to allow ES buffer to drain */ already_empty = 1; - if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR) - continue; +// if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR) +// continue; eDebug("commit done"); /* well check again */ continue; diff --git a/lib/driver/misc_options.cpp b/lib/driver/misc_options.cpp index c567878c..43e6dad3 100644 --- a/lib/driver/misc_options.cpp +++ b/lib/driver/misc_options.cpp @@ -1,3 +1,4 @@ +#include <cstring> #include <lib/driver/misc_options.h> #include <unistd.h> diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index e6108ab5..e4d9ad22 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -839,7 +839,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje PyDict_SetItem(tp_dict, sat_pos, tplist); for (ElementConstIterator it(sat_elements.begin()); it != sat_elements.end(); ++it) { -// eDebug("\telement: %s", (*it)->name().c_str()); + //eDebug("\telement: %s", (*it)->name().c_str()); const AttributeList &tp_attributes = (*it)->getAttributeList(); AttributeConstIterator end = tp_attributes.end(); modulation = eDVBFrontendParametersSatellite::Modulation_QPSK; @@ -856,8 +856,8 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje for (AttributeConstIterator it(tp_attributes.begin()); it != end; ++it) { - //eDebug("\t\tattr: %s", at->name().c_str()); at = *it; + //eDebug("\t\tattr: %s", at->name().c_str()); name = at->name(); if (name == "modulation") dest = &modulation; else if (name == "system") dest = &system; @@ -872,6 +872,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje else if (name == "onid") dest = &onid; if (dest) { + //eDebug("\t\t\tvalue: %s", at->value().c_str()); tmp = strtol(at->value().c_str(), &end_ptr, 10); if (!*end_ptr) *dest = tmp; @@ -1201,15 +1202,17 @@ RESULT eDVBDB::removeServices(eDVBChannelID chid, unsigned int orbpos) if ((unsigned int)sat.orbital_position != orbpos) remove=false; } - if ( remove && chid.dvbnamespace != eNs ) + if ( remove && chid.dvbnamespace != eNs ) // namespace given? { - if (system == iDVBFrontend::feCable && chid.dvbnamespace.get() == (int)0xFFFF0000) + if ( system == iDVBFrontend::feCable && chid.dvbnamespace.get() == (int)0xFFFF0000 ) ; - else if (system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == (int)0xEEEE0000) + else if ( system == iDVBFrontend::feTerrestrial && chid.dvbnamespace.get() == (int)0xEEEE0000 ) ; else if ( chid.dvbnamespace != ch.dvbnamespace ) remove=false; } + else if ( system == iDVBFrontend::feCable || system == iDVBFrontend::feTerrestrial ) + remove=false; if ( remove && chid.original_network_id != eOnid && chid.original_network_id != ch.original_network_id ) remove=false; if ( remove && chid.transport_stream_id != eTsid && chid.transport_stream_id != ch.transport_stream_id ) diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 55e008fb..11fb1ab1 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -51,11 +51,11 @@ public: RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &parm); - RESULT addService(const eServiceReferenceDVB &service, eDVBService *service); + RESULT addService(const eServiceReferenceDVB &referenc, eDVBService *service); RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service); RESULT flush(); - RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *query, const eServiceReference &source); + RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *q, const eServiceReference &source); RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet); ////// diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 4bbed519..1c4eef8a 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1026,11 +1026,6 @@ int eDVBChannelFilePush::filterRecordData(const unsigned char *_data, int len, s fts += 188; } - /* force payload only */ - ts[3] &= ~0x30; - ts[3] |= 0x10; - -// memset(ts + 4, 0xFF, (offset % 188) - 4); m_iframe_state = 1; } diff --git a/lib/dvb/dvbtime.cpp b/lib/dvb/dvbtime.cpp index d879cfac..a6830dc0 100644 --- a/lib/dvb/dvbtime.cpp +++ b/lib/dvb/dvbtime.cpp @@ -20,7 +20,7 @@ void setRTC(time_t time) FILE *f = fopen("/proc/stb/fp/rtc", "w"); if (f) { - if (fprintf(f, "%u", time)) + if (fprintf(f, "%u", (unsigned int)time)) prev_time = time; else eDebug("write /proc/stb/fp/rtc failed (%m)"); @@ -47,8 +47,11 @@ time_t getRTC() if (f) { // sanity check to detect corrupt atmel firmware - if (fscanf(f, "%u", &rtc_time) != 1) + unsigned int tmp; + if (fscanf(f, "%u", &tmp) != 1) eDebug("read /proc/stb/fp/rtc failed (%m)"); + else + rtc_time=tmp; fclose(f); } else @@ -145,7 +148,7 @@ eDVBLocalTimeHandler *eDVBLocalTimeHandler::instance; DEFINE_REF(eDVBLocalTimeHandler); eDVBLocalTimeHandler::eDVBLocalTimeHandler() - :m_time_ready(false), m_updateNonTunedTimer(eTimer::create(eApp)) + :m_use_dvb_time(false), m_updateNonTunedTimer(eTimer::create(eApp)), m_time_ready(false) { if ( !instance ) instance=this; @@ -214,6 +217,33 @@ void eDVBLocalTimeHandler::writeTimeOffsetData( const char* filename ) } } +void eDVBLocalTimeHandler::setUseDVBTime(bool b) +{ + if (m_use_dvb_time != b) { + if (m_use_dvb_time) { + eDebug("[eDVBLocalTimeHandler] disable sync local time with transponder time!"); + std::map<iDVBChannel*, channel_data>::iterator it = + m_knownChannels.begin(); + for (; it != m_knownChannels.end(); ++it) { + if (it->second.m_prevChannelState == iDVBChannel::state_ok) + it->second.tdt = 0; + } + } + else { + eDebug("[eDVBLocalTimeHandler] enable sync local time with transponder time!"); + std::map<iDVBChannel*, channel_data>::iterator it = + m_knownChannels.begin(); + for (; it != m_knownChannels.end(); ++it) { + if (it->second.m_prevChannelState == iDVBChannel::state_ok) { + it->second.tdt = new TDT(it->second.channel); + it->second.tdt->start(); + } + } + } + m_use_dvb_time = b; + } +} + void eDVBLocalTimeHandler::updateNonTuned() { updateTime(-1, 0, 0); @@ -440,8 +470,10 @@ void eDVBLocalTimeHandler::DVBChannelStateChanged(iDVBChannel *chan) case iDVBChannel::state_ok: eDebug("[eDVBLocalTimerHandler] channel %p running", chan); m_updateNonTunedTimer->stop(); - it->second.tdt = new TDT(it->second.channel); - it->second.tdt->start(); + if (m_use_dvb_time) { + it->second.tdt = new TDT(it->second.channel); + it->second.tdt->start(); + } break; case iDVBChannel::state_release: eDebug("[eDVBLocalTimerHandler] remove channel %p", chan); diff --git a/lib/dvb/dvbtime.h b/lib/dvb/dvbtime.h index 3f8d9b7d..3afff75e 100644 --- a/lib/dvb/dvbtime.h +++ b/lib/dvb/dvbtime.h @@ -54,6 +54,7 @@ class eDVBLocalTimeHandler: public Object ePtr<eConnection> m_stateChangedConn; int m_prevChannelState; }; + bool m_use_dvb_time; ePtr<eTimer> m_updateNonTunedTimer; friend class TDT; std::map<iDVBChannel*, channel_data> m_knownChannels; @@ -78,6 +79,8 @@ public: eDVBLocalTimeHandler(); ~eDVBLocalTimeHandler(); #endif + bool getUseDVBTime() { return m_use_dvb_time; } + void setUseDVBTime(bool b); PSignal0<void> m_timeUpdated; bool ready() const { return m_time_ready; } static eDVBLocalTimeHandler *getInstance() { return instance; } diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 5df17931..f2fc12b3 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -858,6 +858,8 @@ int eDVBFrontend::readFrontendData(int type) if (snr != 0) ret = 10 * (int)(-100 * (log10(snr) - log10(255))); } + else if (!strcmp(m_description, "BCM4506")) + ret = (snr * 100) >> 8; if (type == signalQuality) { diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index cfa98ecf..26ab5e53 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -385,13 +385,13 @@ public: virtual RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &parm)=0; - virtual RESULT addService(const eServiceReferenceDVB &service, eDVBService *service)=0; + virtual RESULT addService(const eServiceReferenceDVB &reference, eDVBService *service)=0; virtual RESULT getService(const eServiceReferenceDVB &reference, ePtr<eDVBService> &service)=0; virtual RESULT flush()=0; virtual RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet)=0; - virtual RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *query, const eServiceReference &source)=0; + virtual RESULT startQuery(ePtr<iDVBChannelListQuery> &query, eDVBChannelQuery *q, const eServiceReference &source)=0; }; #endif // SWIG diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 76c71011..379ab8e9 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -740,11 +740,20 @@ void eDVBScan::channelDone() } case iDVBFrontend::feTerrestrial: { + ePtr<iDVBFrontend> fe; eDVBFrontendParametersTerrestrial parm; m_ch_current->getDVBT(parm); snprintf(sname, 255, "%d SID 0x%02x", parm.frequency/1000, m_pmt_in_progress->first); + if (!m_channel->getFrontend(fe)) + { + ePyObject tp_dict = PyDict_New(); + fe->getTransponderData(tp_dict, false); + m_corrected_frequencys[m_chid_current] = + PyInt_AsLong(PyDict_GetItemString(tp_dict, "frequency")); + Py_DECREF(tp_dict); + } break; } case iDVBFrontend::feCable: @@ -765,7 +774,8 @@ void eDVBScan::channelDone() if (!(m_flags & scanOnlyFree) || !m_pmt_in_progress->second.scrambled) { SCAN_eDebug("add not scrambled!"); - std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service)); + std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = + m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service)); if (i.second) { m_last_service = i.first; @@ -922,6 +932,24 @@ void eDVBScan::insertInto(iDVBChannelList *db, bool dontRemoveOldFlags) for (std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> >::const_iterator ch(m_new_channels.begin()); ch != m_new_channels.end(); ++ch) { + int system; + ch->second->getSystem(system); + if (system == iDVBFrontend::feTerrestrial) + { + std::map<eDVBChannelID, unsigned int>::iterator it = m_corrected_frequencys.find(ch->first); + if (it != m_corrected_frequencys.end()) + { + eDVBFrontendParameters *p = (eDVBFrontendParameters*)&(*ch->second); + eDVBFrontendParametersTerrestrial parm; + p->getDVBT(parm); + eDebug("corrected freq for tsid %04x, onid %04x, ns %08x is %d, old was %d", + ch->first.transport_stream_id.get(), ch->first.original_network_id.get(), + ch->first.dvbnamespace.get(), it->second, parm.frequency); + parm.frequency = it->second; + p->setDVBT(parm); + m_corrected_frequencys.erase(it); + } + } if (m_flags & scanOnlyFree) { eDVBFrontendParameters *ptr = (eDVBFrontendParameters*)&(*ch->second); @@ -1036,7 +1064,8 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription } } - std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service)); + std::pair<std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator, bool> i = + m_new_services.insert(std::pair<eServiceReferenceDVB, ePtr<eDVBService> >(ref, service)); if (i.second) { diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 38ac784f..9f0dd6ef 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -50,7 +50,9 @@ class eDVBScan: public Object, public iObject /* scan state variables */ int m_channel_state; int m_ready, m_ready_all; - + + std::map<eDVBChannelID, unsigned int> m_corrected_frequencys; // yet just used for DVB-T + std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> > m_new_channels; std::map<eServiceReferenceDVB, ePtr<eDVBService> > m_new_services; std::map<eServiceReferenceDVB, ePtr<eDVBService> >::iterator m_last_service; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index ac1a2028..d14acc85 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -563,7 +563,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.tone = iDVBFrontend::toneOff; sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE_DISABLE_BEFORE_DISEQC]) ); if (diseqc13V) vlt = iDVBFrontend::voltage13; @@ -705,7 +705,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.tone = iDVBFrontend::toneOff; sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE_DISABLE_BEFORE_DISEQC]) ); compare.voltage = iDVBFrontend::voltageOff; compare.steps = +4; @@ -839,7 +839,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.tone = tone; sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_FINAL_CONT_TONE_CHANGE]) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); cmd.direction=1; // check for running rotor @@ -884,7 +884,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.tone = tone; sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_FINAL_CONT_TONE_CHANGE]) ); } sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_SWITCHPARMS) ); @@ -897,11 +897,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA compare.voltage = iDVBFrontend::voltageOff; sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50 ) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS] ) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage18_5) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) ); // wait 20 ms after voltage change eDVBDiseqcCommand diseqc; memset(diseqc.data, 0, MAX_DISEQC_LENGTH); diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 5bff6bf7..5d969328 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -271,7 +271,8 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl DECLARE_REF(eDVBSatelliteEquipmentControl); public: enum { - DELAY_AFTER_CONT_TONE=0, // delay after continuous tone change + DELAY_AFTER_CONT_TONE_DISABLE_BEFORE_DISEQC=0, // delay after continuous tone disable before diseqc command + DELAY_AFTER_FINAL_CONT_TONE_CHANGE, // delay after continuous tone change before tune DELAY_AFTER_FINAL_VOLTAGE_CHANGE, // delay after voltage change at end of complete sequence DELAY_BETWEEN_DISEQC_REPEATS, // delay between repeated diseqc commands DELAY_AFTER_LAST_DISEQC_CMD, // delay after last diseqc command diff --git a/lib/dvb/subtitle.cpp b/lib/dvb/subtitle.cpp index f4b5b7e4..642327bb 100644 --- a/lib/dvb/subtitle.cpp +++ b/lib/dvb/subtitle.cpp @@ -345,6 +345,8 @@ int eDVBSubtitleParser::subtitle_process_segment(__u8 *segment) } } + page->state = page_state; + //eDebug("page updated: old: %d, new: %d", page->page_version_number, page_version_number); // when acquisition point or mode change: remove all displayed pages. if ((page_state == 1) || (page_state == 2)) @@ -804,7 +806,8 @@ void eDVBSubtitleParser::subtitle_redraw_all() subtitle_page *page = m_pages; while(page) { - subtitle_redraw(page->page_id); + if (page->state != 0) + subtitle_redraw(page->page_id); page = page->next; } #else diff --git a/lib/dvb/subtitle.h b/lib/dvb/subtitle.h index fb9c51a2..09d6cd47 100644 --- a/lib/dvb/subtitle.h +++ b/lib/dvb/subtitle.h @@ -71,6 +71,7 @@ struct subtitle_page int page_id; time_t page_time_out; int page_version_number; + int state; int pcs_size; subtitle_page_region *page_regions; diff --git a/lib/dvb/teletext.cpp b/lib/dvb/teletext.cpp index ca0412e3..de4c6d75 100644 --- a/lib/dvb/teletext.cpp +++ b/lib/dvb/teletext.cpp @@ -127,7 +127,7 @@ unsigned int Latin_G2_set[6*16] = { // This is a very simple en300 706 telext decoder. // It can only decode a single page at a time, thus it's only used -// for subtitles. +// for subtitles. And it ONLY support LATIN Charsets yet! DEFINE_REF(eDVBTeletextParser); @@ -149,6 +149,15 @@ static inline unsigned char decode_hamming_84(unsigned char *b) static inline unsigned long decode_hamming_2418(unsigned char *b) { + static const unsigned char rev[16] = { + 0x00,0x08,0x04,0x0c, + 0x02,0x0a,0x06,0x0e, + 0x01,0x09,0x05,0x0d, + 0x03,0x0b,0x07,0x0f + }; + b[0] = rev[b[0] >> 4] | (rev[b[0] & 0xf] << 4); + b[1] = rev[b[1] >> 4] | (rev[b[1] & 0xf] << 4); + b[2] = rev[b[2] >> 4] | (rev[b[2] & 0xf] << 4); return ((b[0] & 0x04) >> 2) | ((b[0] & 0x70) >> 3) | ((b[1] & 0x7f) << 4) | ((b[2] & 0x7f) << 11); } @@ -258,7 +267,7 @@ void eDVBTeletextParser::processPESPacket(__u8 *pkt, int len) int M = magazine_and_packet_address & 7, Y = magazine_and_packet_address >> 3; // eDebug("line %d, framing code: %02x, M=%02x, Y=%02x", line_offset, framing_code, m_M, m_Y); - + if (Y == 0) /* page header */ { int X = decode_hamming_84(data + 1) * 0x10 + decode_hamming_84(data), @@ -315,19 +324,10 @@ void eDVBTeletextParser::processPESPacket(__u8 *pkt, int len) } else if (Y == 26 && m_page_open && M == m_page_M) { // int designation_code = decode_hamming_84(data); - static const unsigned char rev[16] = { - 0x00,0x08,0x04,0x0c, - 0x02,0x0a,0x06,0x0e, - 0x01,0x09,0x05,0x0d, - 0x03,0x0b,0x07,0x0f - }; int display_row=-1, display_column=-1; for (int a = 1; a < 40; a+=3) { int val; - data[a] = rev[data[a] >> 4] | (rev[data[a] & 0xf] << 4); - data[a+1] = rev[data[a+1] >> 4] | (rev[data[a+1] & 0xf] << 4); - data[a+2] = rev[data[a+2] >> 4] | (rev[data[a+2] & 0xf] << 4); if ((val=decode_hamming_2418(data+a)) >= 0) { unsigned char addr = val & 0x3F; @@ -401,12 +401,63 @@ void eDVBTeletextParser::processPESPacket(__u8 *pkt, int len) } } else if (Y > 29) /*eDebug("non handled packet 30, 31", Y, decode_hamming_84(data))*/; - else if (Y == 29) - eDebug("non handled packet M/%d/%d", Y, decode_hamming_84(data)); - else if (m_page_open) + else if (Y == 29 && M == m_page_M) { - if (M == m_page_M) - eDebug("non handled packet X/%d/%d", Y, decode_hamming_84(data)); + int designation_code = decode_hamming_84(data++); + if (designation_code == 0) // 29/0 + { + m_M29_t1 = decode_hamming_2418(data); + m_M29_t2 = decode_hamming_2418(data+3); + if ((m_M29_t1 & 0xF) == 0) // format1 + m_M29_0_valid = 1; + else + eDebug("non handled packet M/%d/0 format %d", Y, m_M29_t1 & 0xF); + } + else + eDebug("non handled packet M/%d/%d", Y, designation_code); + } + else if (m_page_open && M == m_page_M) + { + int designation_code = decode_hamming_84(data++); + if (Y == 28 && designation_code == 0) // 28/0 + { +#if 1 + m_X28_t1 = decode_hamming_2418(data); + m_X28_t2 = decode_hamming_2418(data+3); + if ((m_X28_t1 & 0xF) == 0) // format1 + m_X28_0_valid = 1; + else + eDebug("non handled packet X/%d/0 format %d", Y, m_X28_t1 & 0xF); +#else + int i=0; + for (; i < 39; i+=3) + { + int tripletX = decode_hamming_2418(data+i); + if (tripletX >= 0) + { + if (i == 0) + { + if ((m_X28_t1 & 0xF) == 0) // format1 + m_X28_0_valid = 1; + m_X28_t1 = tripletX; + } + else if (i == 1) + m_X28_t2 = tripletX; + + char *c = get_bits(tripletX, 18); + int x=0; + for (; x < 18; ++x) + eDebugNoNewLine("%c", c[x]); + eDebug(""); + } + else + eDebug("decode_hamming_2418 failed!\n"); + data += 3; + } +#endif + } + else + eDebug("non handled packet X/%d/%d", Y, designation_code); } } } @@ -430,6 +481,7 @@ void eDVBTeletextParser::handlePageStart() { m_subtitle_page.clear(); m_modifications.clear(); + m_X28_0_valid = 0; // eDebug("erase page!"); } // else @@ -463,28 +515,46 @@ void eDVBTeletextParser::handleLine(unsigned char *data, int len) nat_opts = (m_C & (1<<14) ? 1 : 0) | (m_C & (1<<13) ? 2 : 0) | (m_C & (1<<12) ? 4 : 0), - nat_subset = NationalOptionSubsetsLookup[Gtriplet*8+nat_opts]; -/* eDebug("nat_opts = %d, nat_subset = %d, C121314 = %d%d%d", - nat_opts, nat_subset, - (m_C & (1<<12))?1:0, - (m_C & (1<<13))?1:0, - (m_C & (1<<14))?1:0);*/ + nat_subset_2 = NationalOptionSubsetsLookup[Gtriplet*8+nat_opts], + nat_subset = nat_subset_2, + second_G0_set = 0; + + if (m_X28_0_valid) + { + nat_subset = NationalOptionSubsetsLookup[(m_X28_t1 >> 7) & 0x7F]; + nat_subset_2 = NationalOptionSubsetsLookup[((m_X28_t1 >> 14) & 0xF) | ((m_X28_t2 & 7) << 4)]; +// eDebug("X/28/0 nat_subset %d, nat_subset2 %d", nat_subset, nat_subset_2); + } + else if (m_M29_0_valid) + { + nat_subset = NationalOptionSubsetsLookup[(m_M29_t1 >> 7) & 0x7F]; + nat_subset_2 = NationalOptionSubsetsLookup[((m_M29_t1 >> 14) & 0xF) | ((m_M29_t2 & 7) << 4)]; +// eDebug("M/29/0 nat_subset %d, nat_subset2 %d", nat_subset, nat_subset_2); + } +/* else + eDebug("nat_opts = %d, nat_subset = %d, C121314 = %d%d%d", + nat_opts, nat_subset, + (m_C & (1<<12))?1:0, + (m_C & (1<<13))?1:0, + (m_C & (1<<14))?1:0);*/ // eDebug("handle subtitle line: %d len", len); for (int i=0; i<len; ++i) { + unsigned char b = decode_odd_parity(data + i); std::map<int,unsigned int>::iterator it = m_modifications.find((m_Y<<16)|i); + if (it != m_modifications.end()) { unsigned int utf8_code = it->second; +// eDebugNoNewLine("%c[%d]", b, b); if (utf8_code < 0x10) { int mode = utf8_code; - unsigned char ch = decode_odd_parity(data + i); - if (ch > 96 && ch < 123) - utf8_code = diacr_lower_cmap[(ch-97)*15+mode-1]; - else if (ch > 64 && ch < 91) - utf8_code = diacr_upper_cmap[(ch-65)*15+mode-1]; + if (b > 96 && b < 123) + utf8_code = diacr_lower_cmap[(b-97)*15+mode-1]; + else if (b > 64 && b < 91) + utf8_code = diacr_upper_cmap[(b-65)*15+mode-1]; } if (utf8_code > 0xFFFFFF) out[outidx++]=(utf8_code&0xFF000000)>>24; @@ -498,8 +568,6 @@ void eDVBTeletextParser::handleLine(unsigned char *data, int len) continue; } - unsigned char b = decode_odd_parity(data + i); - if (b < 0x10) /* spacing attribute */ { if (b < 8) /* colors */ @@ -522,17 +590,11 @@ void eDVBTeletextParser::handleLine(unsigned char *data, int len) /* ignore other attributes */ } else if (m_box_open>1) { - //eDebugNoNewLine("%c", b); +// eDebugNoNewLine("%c(%d)", b, b); /* no more than one whitespace, only printable chars */ if (((!last_was_white) || (b != ' ')) && (b >= 0x20)) { - int cur_nat_subset = nat_subset; - - if (b == 0x24) // workaround for currency sign.. the only on non latin1 char in G0 set - { - cur_nat_subset = 9; - b = 36; - } + int cur_nat_subset = second_G0_set ? nat_subset_2 : nat_subset; unsigned char offs = NationalReplaceMap[b]; if (offs) @@ -551,9 +613,11 @@ void eDVBTeletextParser::handleLine(unsigned char *data, int len) out[outidx++] = b; last_was_white = b == ' '; } + else if (b == 0x1b) // ESC ... switch between default G0 and second G0 charset + second_G0_set ^= 1; } } - //eDebug(""); +// eDebug(""); addSubtitleString(color, std::string((const char*)out, outidx)); } @@ -575,6 +639,7 @@ void eDVBTeletextParser::setPageAndMagazine(int page, int magazine) eDebug("enable teletext subtitle page %x%02x", magazine, page); else eDebug("disable teletext subtitles"); + m_M29_0_valid = 0; m_page_M = magazine; /* magazine to look for */ if (magazine != -1) m_page_M &= 7; diff --git a/lib/dvb/teletext.h b/lib/dvb/teletext.h index a07c6aea..880fa569 100644 --- a/lib/dvb/teletext.h +++ b/lib/dvb/teletext.h @@ -50,7 +50,9 @@ private: eDVBTeletextSubtitlePage m_subtitle_page; int m_C, m_Y, m_pid, m_page_M, m_page_X, m_page_open, m_double_height, m_box_open; - + int m_X28_0_valid, m_X28_t1, m_X28_t2; + int m_M29_0_valid, m_M29_t1, m_M29_t2; + void handlePageStart(); void handleLine(unsigned char *line, int len); void handlePageEnd(int have_pts, const pts_t &pts); diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 75250404..ce1f7d66 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -18,6 +18,14 @@ #include <dvbsi++/ca_program_map_section.h> +//#define CIDEBUG 1 + +#ifdef CIDEBUG + #define eDebugCI(x...) eDebug(x) +#else + #define eDebugCI(x...) +#endif + eDVBCIInterfaces *eDVBCIInterfaces::instance = 0; eDVBCIInterfaces::eDVBCIInterfaces() @@ -101,9 +109,6 @@ int eDVBCIInterfaces::reset(int slotid) if( (slot = getSlot(slotid)) == 0 ) return -1; - eDVBCISession::deleteSessions(slot); - ciRemoved(slot); - return slot->reset(); } @@ -195,11 +200,13 @@ int eDVBCIInterfaces::cancelEnq(int slotid) void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot) { + eDebug("CI Slot %d: removed... usecount %d", slot->getSlotID(), slot->use_count); for (PMTHandlerList::iterator it(m_pmt_handlers.begin()); it != m_pmt_handlers.end(); ++it) { eServiceReferenceDVB ref; it->pmthandler->getServiceReference(ref); + eDebugCI("check %s cislot %p %d\n", ref.toString().c_str(), it->cislot, it->cislot?it->cislot->getSlotID() : -1); slot->removeService(ref.getServiceID().get()); if (slot->use_count && !--slot->use_count) { @@ -209,9 +216,13 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot) setInputSource(slot->current_tuner, slot->current_source); if (it->cislot == slot) // remove the base slot + { it->cislot = slot->linked_next; + eDebugCI("base removed.. so slot is now %p", it->cislot); + } else { + eDebugCI("not base removed.. %d", it->cislot->getSlotID()); eDVBCISlot *tmp = it->cislot; while(tmp->linked_next != slot) tmp = tmp->linked_next; @@ -222,8 +233,10 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot) tmp->linked_next = 0; } slot->linked_next=0; + slot->user_mapped=false; } } + recheckPMTHandlers(); } static bool canDescrambleMultipleServices(int slotid) @@ -245,22 +258,50 @@ static bool canDescrambleMultipleServices(int slotid) void eDVBCIInterfaces::recheckPMTHandlers() { -// eDebug("recheckPMTHAndlers()"); + eDebugCI("recheckPMTHAndlers()"); for (PMTHandlerList::iterator it(m_pmt_handlers.begin()); it != m_pmt_handlers.end(); ++it) { CAID_LIST caids; ePtr<eDVBService> service; eServiceReferenceDVB ref; + eDVBCISlot *tmp = it->cislot; eDVBServicePMTHandler *pmthandler = it->pmthandler; eDVBServicePMTHandler::program p; + bool first_plugged_cis_exist = false; pmthandler->getServiceReference(ref); pmthandler->getService(service); + + eDebugCI("recheck %p %s", pmthandler, ref.toString().c_str()); + for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it) + if (ci_it->first_plugged && ci_it->getCAManager()) + { + eDebug("Slot %d first plugged", ci_it->getSlotID()); + ci_it->first_plugged = false; + first_plugged_cis_exist = true; + } + + // check if this pmt handler has already assigned CI(s) .. and this CI(s) are already running + if (!first_plugged_cis_exist) + { + while(tmp) + { + if (!tmp->running_services.empty()) + break; + tmp=tmp->linked_next; + } + if (tmp) // we dont like to change tsmux for running services + { + eDebugCI("already assigned and running CI!\n"); + continue; + } + } + if (!pmthandler->getProgramInfo(p)) { int cnt=0; - for (std::set<uint16_t>::reverse_iterator x(p.caids.rbegin()); x != p.caids.rend(); ++x, ++cnt) + for (caidSet::reverse_iterator x(p.caids.rbegin()); x != p.caids.rend(); ++x, ++cnt) caids.push_front(*x); if (service && cnt) service->m_ca = caids; @@ -274,50 +315,67 @@ void eDVBCIInterfaces::recheckPMTHandlers() for (eSmartPtrList<eDVBCISlot>::iterator ci_it(m_slots.begin()); ci_it != m_slots.end(); ++ci_it) { + eDebugCI("check Slot %d", ci_it->getSlotID()); bool useThis=false; + bool user_mapped=true; eDVBCICAManagerSession *ca_manager = ci_it->getCAManager(); + if (ca_manager) { int mask=0; if (!ci_it->possible_services.empty()) { mask |= 1; - std::set<eServiceReference>::iterator it = ci_it->possible_services.find(ref); + serviceSet::iterator it = ci_it->possible_services.find(ref); if (it != ci_it->possible_services.end()) { eDebug("'%s' is in service list of slot %d... so use it", ref.toString().c_str(), ci_it->getSlotID()); useThis = true; } + else // check parent + { + eServiceReferenceDVB parent_ref = ref.getParentServiceReference(); + if (parent_ref) + { + it = ci_it->possible_services.find(ref); + if (it != ci_it->possible_services.end()) + { + eDebug("parent '%s' of '%s' is in service list of slot %d... so use it", + parent_ref.toString().c_str(), ref.toString().c_str(), ci_it->getSlotID()); + useThis = true; + } + } + } } if (!useThis && !ci_it->possible_providers.empty()) { - bool parent=false; + eDVBNamespace ns = ref.getDVBNamespace(); mask |= 2; if (!service) // subservice? { eServiceReferenceDVB parent_ref = ref.getParentServiceReference(); eDVBDB::getInstance()->getService(parent_ref, service); - parent=true; } if (service) { - std::set<std::string>::iterator it = ci_it->possible_providers.find(service->m_provider_name); + providerSet::iterator it = ci_it->possible_providers.find(providerPair(service->m_provider_name, ns.get())); if (it != ci_it->possible_providers.end()) { - eDebug("'%s' is in provider list of slot %d... so use it", service->m_provider_name.c_str(), ci_it->getSlotID()); + eDebug("'%s/%08x' is in provider list of slot %d... so use it", service->m_provider_name.c_str(), ns.get(), ci_it->getSlotID()); useThis = true; } } } if (!useThis && !ci_it->possible_caids.empty()) { + mask |= 4; for (CAID_LIST::iterator ca(caids.begin()); ca != caids.end(); ++ca) { - std::set<uint16_t>::iterator it = ci_it->possible_caids.find(*ca); + caidSet::iterator it = ci_it->possible_caids.find(*ca); if (it != ci_it->possible_caids.end()) { eDebug("caid '%04x' is in caid list of slot %d... so use it", *ca, ci_it->getSlotID()); - useThis=true; + useThis = true; break; } } @@ -332,7 +390,8 @@ void eDVBCIInterfaces::recheckPMTHandlers() if ( z != ci_caids.end() && *z == *ca ) { eDebug("The CI in Slot %d has said it can handle caid %04x... so use it", ci_it->getSlotID(), *z); - useThis=true; + useThis = true; + user_mapped = false; break; } } @@ -341,47 +400,74 @@ void eDVBCIInterfaces::recheckPMTHandlers() if (useThis) { + // check if this CI is already assigned to this pmthandler + eDVBCISlot *tmp = it->cislot; + while(tmp) + { + if (tmp == ci_it) + break; + tmp=tmp->linked_next; + } + if (tmp) // ignore already assigned cislots... + { + eDebugCI("already assigned!"); + continue; + } + eDebugCI("current slot %d usecount %d", ci_it->getSlotID(), ci_it->use_count); if (ci_it->use_count) // check if this CI can descramble more than one service { + bool found = false; useThis = false; PMTHandlerList::iterator tmp = m_pmt_handlers.begin(); - while (tmp != m_pmt_handlers.end()) + while (!found && tmp != m_pmt_handlers.end()) { - if ( tmp->cislot == ci_it && it != tmp ) + eDebugCI("."); + eDVBCISlot *tmp_cislot = tmp->cislot; + while (!found && tmp_cislot) { + eDebugCI(".."); eServiceReferenceDVB ref2; tmp->pmthandler->getServiceReference(ref2); - eDVBChannelID s1, s2; - if (ref != ref2) + if ( tmp_cislot == ci_it && it->pmthandler != tmp->pmthandler ) { - ref.getChannelID(s1); - ref2.getChannelID(s2); - } - if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(ci_it->getSlotID()))) - { - useThis = true; - break; + eDebugCI("check pmthandler %s for same service/tp", ref2.toString().c_str()); + eDVBChannelID s1, s2; + if (ref != ref2) + { + eDebugCI("different services!"); + ref.getChannelID(s1); + ref2.getChannelID(s2); + } + if (ref == ref2 || (s1 == s2 && canDescrambleMultipleServices(tmp_cislot->getSlotID()))) + { + found = true; + eDebugCI("found!"); + eDVBCISlot *tmpci = it->cislot = tmp->cislot; + while(tmpci) + { + ++tmpci->use_count; + eDebug("(2)CISlot %d, usecount now %d", tmpci->getSlotID(), tmpci->use_count); + tmpci=tmpci->linked_next; + } + } } + tmp_cislot=tmp_cislot->linked_next; } + eDebugCI("..."); ++tmp; } } + if (useThis) { - // check if this CI is already assigned to this pmthandler - eDVBCISlot *tmp = it->cislot; - while(tmp) + if (ci_it->user_mapped) // we dont like to link user mapped CIs { - if (tmp == ci_it) - break; - tmp=tmp->linked_next; - } - - if (tmp) // ignore already assigned cislots... + eDebugCI("user mapped CI already in use... dont link!"); continue; + } ++ci_it->use_count; -// eDebug("usecount now %d", ci_it->use_count); + eDebug("(1)CISlot %d, usecount now %d", ci_it->getSlotID(), ci_it->use_count); data_source ci_source=CI_A; switch(ci_it->getSlotID()) @@ -432,8 +518,15 @@ void eDVBCIInterfaces::recheckPMTHandlers() ci_it->linked_next->setSource(ci_source); } it->cislot = ci_it; + eDebugCI("assigned!"); gotPMT(pmthandler); } + + if (it->cislot && user_mapped) // CI assigned to this pmthandler in this run.. and user mapped? then we break here.. we dont like to link other CIs to user mapped CIs + { + eDebugCI("user mapped CI assigned... dont link CIs!"); + break; + } } } } @@ -520,9 +613,10 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler) else tmp->linked_next = 0; } - slot->linked_next=0; + slot->linked_next = 0; + slot->user_mapped = false; } -// eDebug("use_count is now %d", slot->use_count); + eDebug("(3) slot %d usecount is now %d", slot->getSlotID(), slot->use_count); slot = next; } // check if another service is waiting for the CI @@ -539,7 +633,9 @@ void eDVBCIInterfaces::gotPMT(eDVBServicePMTHandler *pmthandler) eDVBCISlot *tmp = it->cislot; while(tmp) { - tmp->sendCAPMT(pmthandler); + eDebugCI("check slot %d %d %d", tmp->getSlotID(), tmp->running_services.empty(), canDescrambleMultipleServices(tmp->getSlotID())); + if (tmp->running_services.empty() || canDescrambleMultipleServices(tmp->getSlotID())) + tmp->sendCAPMT(pmthandler); tmp = tmp->linked_next; } } @@ -551,7 +647,7 @@ int eDVBCIInterfaces::getMMIState(int slotid) if( (slot = getSlot(slotid)) == 0 ) return -1; - + return slot->getMMIState(); } @@ -659,25 +755,28 @@ PyObject *eDVBCIInterfaces::getDescrambleRules(int slotid) ePyObject caid_list = PyList_New(caids); ePyObject service_list = PyList_New(services); ePyObject provider_list = PyList_New(providers); - std::set<uint16_t>::iterator caid_it(slot->possible_caids.begin()); + caidSet::iterator caid_it(slot->possible_caids.begin()); while(caids) { --caids; - PyTuple_SET_ITEM(caid_list, caids, PyLong_FromLong(*caid_it)); + PyList_SET_ITEM(caid_list, caids, PyLong_FromLong(*caid_it)); ++caid_it; } - std::set<eServiceReference>::iterator ref_it(slot->possible_services.begin()); + serviceSet::iterator ref_it(slot->possible_services.begin()); while(services) { --services; - PyTuple_SET_ITEM(service_list, services, PyString_FromString(ref_it->toString().c_str())); + PyList_SET_ITEM(service_list, services, PyString_FromString(ref_it->toString().c_str())); ++ref_it; } - std::set<std::string>::iterator provider_it(slot->possible_providers.begin()); + providerSet::iterator provider_it(slot->possible_providers.begin()); while(providers) { + ePyObject tuple = PyTuple_New(2); + PyTuple_SET_ITEM(tuple, 0, PyString_FromString(provider_it->first.c_str())); + PyTuple_SET_ITEM(tuple, 1, PyLong_FromUnsignedLong(provider_it->second)); --providers; - PyTuple_SET_ITEM(provider_list, providers, PyString_FromString(provider_it->c_str())); + PyList_SET_ITEM(provider_list, providers, tuple); ++provider_it; } PyTuple_SET_ITEM(tuple, 0, service_list); @@ -712,7 +811,7 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) { const char *errstr = "eDVBCIInterfaces::setDescrambleRules not enough entrys in argument tuple!!\n" "first argument should be a pythonlist with possible services\n" - "second argument should be a pythonlist with possible providers\n" + "second argument should be a pythonlist with possible providers/dvbnamespace tuples\n" "third argument should be a pythonlist with possible caids"; PyErr_SetString(PyExc_StandardError, errstr); return -1; @@ -757,33 +856,55 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) while(size) { --size; - ePyObject str = PyList_GET_ITEM(provider_list, size); - if (!PyString_Check(str)) + ePyObject tuple = PyList_GET_ITEM(provider_list, size); + if (!PyTuple_Check(tuple)) { char buf[255]; - snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in provider list is not a string it is '%s'!!", PyObject_TypeStr(str)); + snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in provider list is not a tuple it is '%s'!!", PyObject_TypeStr(tuple)); PyErr_SetString(PyExc_StandardError, buf); return -1; } - char *tmpstr = PyString_AS_STRING(str); + if (PyTuple_Size(tuple) != 2) + { + char buf[255]; + snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules provider tuple has %d instead of 2 entries!!", PyTuple_Size(tuple)); + PyErr_SetString(PyExc_StandardError, buf); + return -1; + } + if (!PyString_Check(PyTuple_GET_ITEM(tuple, 0))) + { + char buf[255]; + snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules 1st entry in provider tuple is not a string it is '%s'", PyObject_TypeStr(PyTuple_GET_ITEM(tuple, 0))); + PyErr_SetString(PyExc_StandardError, buf); + return -1; + } + if (!PyLong_Check(PyTuple_GET_ITEM(tuple, 1))) + { + char buf[255]; + snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules 2nd entry in provider tuple is not a long it is '%s'", PyObject_TypeStr(PyTuple_GET_ITEM(tuple, 1))); + PyErr_SetString(PyExc_StandardError, buf); + return -1; + } + char *tmpstr = PyString_AS_STRING(PyTuple_GET_ITEM(tuple, 0)); + uint32_t orbpos = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(tuple, 1)); if (strlen(tmpstr)) - slot->possible_providers.insert(tmpstr); + slot->possible_providers.insert(std::pair<std::string, uint32_t>(tmpstr, orbpos)); else - eDebug("eDVBCIInterfaces::setDescrambleRules ignore invalid entry in provider name list!!"); + eDebug("eDVBCIInterfaces::setDescrambleRules ignore invalid entry in provider tuple (string is empty)!!"); }; size = PyList_Size(caid_list); while(size) { --size; ePyObject caid = PyList_GET_ITEM(caid_list, size); - if (!PyInt_Check(caid)) + if (!PyLong_Check(caid)) { char buf[255]; snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in caid list is not a long it is '%s'!!", PyObject_TypeStr(caid)); PyErr_SetString(PyExc_StandardError, buf); return -1; } - int tmpcaid = PyInt_AsLong(caid); + int tmpcaid = PyLong_AsLong(caid); if (tmpcaid > 0 && tmpcaid < 0x10000) slot->possible_caids.insert(tmpcaid); else @@ -792,6 +913,39 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) return 0; } +PyObject *eDVBCIInterfaces::readCICaIds(int slotid) +{ + eDVBCISlot *slot = getSlot(slotid); + if (!slot) + { + char tmp[255]; + snprintf(tmp, 255, "eDVBCIInterfaces::readCICaIds try to get CAIds for CI Slot %d... but just %d slots are available", slotid, m_slots.size()); + PyErr_SetString(PyExc_StandardError, tmp); + } + else + { + int idx=0; + eDVBCICAManagerSession *ca_manager = slot->getCAManager(); + const std::vector<uint16_t> *ci_caids = ca_manager ? &ca_manager->getCAIDs() : 0; + ePyObject list = PyList_New(ci_caids ? ci_caids->size() : 0); + if (ci_caids) + { + for (std::vector<uint16_t>::const_iterator it = ci_caids->begin(); it != ci_caids->end(); ++it) + PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it)); + } + return list; + } + return 0; +} + +int eDVBCIInterfaces::setCIClockRate(int slotid, int rate) +{ + eDVBCISlot *slot = getSlot(slotid); + if (slot) + return slot->setClockRate(rate); + return -1; +} + int eDVBCISlot::send(const unsigned char *data, size_t len) { int res=0; @@ -817,17 +971,17 @@ int eDVBCISlot::send(const unsigned char *data, size_t len) void eDVBCISlot::data(int what) { + eDebugCI("CISlot %d what %d\n", getSlotID(), what); if(what == eSocketNotifier::Priority) { if(state != stateRemoved) { state = stateRemoved; - eDebug("ci removed"); while(sendqueue.size()) { delete [] sendqueue.top().data; sendqueue.pop(); } - eDVBCIInterfaces::getInstance()->ciRemoved(this); eDVBCISession::deleteSessions(this); + eDVBCIInterfaces::getInstance()->ciRemoved(this); notifier->setRequested(eSocketNotifier::Read); eDVBCI_UI::getInstance()->setState(getSlotID(),0); } @@ -838,7 +992,7 @@ void eDVBCISlot::data(int what) reset(); if(state != stateInserted) { - eDebug("ci inserted"); + eDebug("ci inserted in slot %d", getSlotID()); state = stateInserted; eDVBCI_UI::getInstance()->setState(getSlotID(),1); notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Priority); @@ -886,14 +1040,20 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr) ca_manager = 0; use_count = 0; linked_next = 0; + user_mapped = false; + first_plugged = true; slotid = nr; sprintf(filename, "/dev/ci%d", nr); +// possible_caids.insert(0x1702); +// possible_providers.insert(providerPair("PREMIERE", 0xC00000)); +// possible_services.insert(eServiceReference("1:0:1:2A:4:85:C00000:0:0:0:")); + fd = ::open(filename, O_RDWR | O_NONBLOCK); - eDebug("eDVBCISlot has fd %d", fd); + eDebugCI("CI Slot %d has fd %d", getSlotID(), fd); state = stateInvalid; if (fd >= 0) @@ -908,6 +1068,7 @@ eDVBCISlot::eDVBCISlot(eMainloop *context, int nr) eDVBCISlot::~eDVBCISlot() { + eDVBCISession::deleteSessions(this); } void eDVBCISlot::setAppManager( eDVBCIApplicationManagerSession *session ) @@ -932,7 +1093,7 @@ int eDVBCISlot::getSlotID() int eDVBCISlot::reset() { - eDebug("edvbcislot: reset requested"); + eDebug("CI Slot %d: reset requested", getSlotID()); if (state == stateInvalid) { @@ -955,7 +1116,7 @@ int eDVBCISlot::reset() int eDVBCISlot::startMMI() { - eDebug("edvbcislot: startMMI()"); + eDebug("CI Slot %d: startMMI()", getSlotID()); if(application_manager) application_manager->startMMI(); @@ -965,7 +1126,7 @@ int eDVBCISlot::startMMI() int eDVBCISlot::stopMMI() { - eDebug("edvbcislot: stopMMI()"); + eDebug("CI Slot %d: stopMMI()", getSlotID()); if(mmi_session) mmi_session->stopMMI(); @@ -975,7 +1136,7 @@ int eDVBCISlot::stopMMI() int eDVBCISlot::answerText(int answer) { - eDebug("edvbcislot: answerText(%d)", answer); + eDebug("CI Slot %d: answerText(%d)", getSlotID(), answer); if(mmi_session) mmi_session->answerText(answer); @@ -993,7 +1154,7 @@ int eDVBCISlot::getMMIState() int eDVBCISlot::answerEnq(char *value) { - eDebug("edvbcislot: answerENQ(%s)", value); + eDebug("CI Slot %d: answerENQ(%s)", getSlotID(), value); if(mmi_session) mmi_session->answerEnq(value); @@ -1003,7 +1164,7 @@ int eDVBCISlot::answerEnq(char *value) int eDVBCISlot::cancelEnq() { - eDebug("edvbcislot: cancelENQ"); + eDebug("CI Slot %d: cancelENQ", getSlotID()); if(mmi_session) mmi_session->cancelEnq(); @@ -1146,7 +1307,7 @@ int eDVBCISlot::setSource(data_source source) fprintf(ci, "D"); break; default: - eDebug("setSource %d failed!!!\n", (int)source); + eDebug("CI Slot %d: setSource %d failed!!!\n", getSlotID(), (int)source); break; } fclose(ci); @@ -1161,13 +1322,30 @@ int eDVBCISlot::setSource(data_source source) return 0; } if (source != TUNER_A && source != TUNER_B) - eDebug("setSource %d failed!!!\n", (int)source); + eDebug("CI Slot %d: setSource %d failed!!!\n", getSlotID(), (int)source); else fprintf(ci, "%s", source==TUNER_A ? "A" : "B"); // configure CI data source (TunerA, TunerB) fclose(ci); } - eDebug("eDVBCISlot->setSource(%d)", (int)source); + eDebug("CI Slot %d setSource(%d)", getSlotID(), (int)source); return 0; } +int eDVBCISlot::setClockRate(int rate) +{ + char buf[64]; + snprintf(buf, 64, "/proc/stb/tsmux/ci%d_tsclk", slotid); + FILE *ci = fopen(buf, "wb"); + if (ci) + { + if (rate) + fprintf(ci, "high"); + else + fprintf(ci, "normal"); + fclose(ci); + return 0; + } + return -1; +} + eAutoInitP0<eDVBCIInterfaces> init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots"); diff --git a/lib/dvb_ci/dvbci.h b/lib/dvb_ci/dvbci.h index 4e3fcce2..cdaaf904 100644 --- a/lib/dvb_ci/dvbci.h +++ b/lib/dvb_ci/dvbci.h @@ -38,6 +38,11 @@ enum data_source TUNER_A, TUNER_B, TUNER_C, TUNER_D, CI_A, CI_B, CI_C, CI_D }; +typedef std::pair<std::string, uint32_t> providerPair; +typedef std::set<providerPair> providerSet; +typedef std::set<uint16_t> caidSet; +typedef std::set<eServiceReference> serviceSet; + class eDVBCISlot: public iObject, public Object { friend class eDVBCIInterfaces; @@ -51,14 +56,16 @@ class eDVBCISlot: public iObject, public Object eDVBCICAManagerSession *ca_manager; eDVBCIMMISession *mmi_session; std::priority_queue<queueData> sendqueue; - std::set<uint16_t> possible_caids; - std::set<eServiceReference> possible_services; - std::set<std::string> possible_providers; + caidSet possible_caids; + serviceSet possible_services; + providerSet possible_providers; int use_count; eDVBCISlot *linked_next; // needed for linked CI handling data_source current_source; int current_tuner; + bool user_mapped; void data(int); + bool first_plugged; public: enum {stateRemoved, stateInserted, stateInvalid, stateResetted}; eDVBCISlot(eMainloop *context, int nr); @@ -87,6 +94,7 @@ public: void removeService(uint16_t program_number=0xFFFF); int getNumOfServices() { return running_services.size(); } int setSource(data_source source); + int setClockRate(int); }; struct CIPmtHandler @@ -139,6 +147,7 @@ public: int getMMIState(int slot); int sendCAPMT(int slot); int setInputSource(int tunerno, data_source source); + int setCIClockRate(int slot, int rate); #ifdef SWIG public: #endif @@ -146,6 +155,7 @@ public: int getNumOfSlots() { return m_slots.size(); } PyObject *getDescrambleRules(int slotid); RESULT setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject) ); + PyObject *readCICaIds(int slotid); }; #endif diff --git a/lib/dvb_ci/dvbci_ui.cpp b/lib/dvb_ci/dvbci_ui.cpp index af613c43..b1bfdc25 100644 --- a/lib/dvb_ci/dvbci_ui.cpp +++ b/lib/dvb_ci/dvbci_ui.cpp @@ -71,5 +71,10 @@ int eDVBCI_UI::getMMIState(int slot) return eDVBCIInterfaces::getInstance()->getMMIState(slot); } +int eDVBCI_UI::setClockRate(int slot, int rate) +{ + return eDVBCIInterfaces::getInstance()->setCIClockRate(slot, rate); +} + //FIXME: correct "run/startlevel" eAutoInitP0<eDVBCI_UI> init_dvbciui(eAutoInitNumbers::rc, "DVB-CI UI"); diff --git a/lib/dvb_ci/dvbci_ui.h b/lib/dvb_ci/dvbci_ui.h index b53ab02d..65b0f95d 100644 --- a/lib/dvb_ci/dvbci_ui.h +++ b/lib/dvb_ci/dvbci_ui.h @@ -13,6 +13,7 @@ class eDVBCI_UI: public eMMI_UI #endif void stateChanged(int val) { ciStateChanged(val); } public: + enum { rateNormal, rateHigh }; PSignal1<void,int> ciStateChanged; #ifndef SWIG eDVBCI_UI(); @@ -26,6 +27,7 @@ public: int answerMenu(int slot, int answer); int answerEnq(int slot, char *val); int cancelEnq(int slot); + int setClockRate(int slot, int rate); }; #endif diff --git a/lib/gdi/accel.cpp b/lib/gdi/accel.cpp index 27b4abcc..d9c80e2e 100644 --- a/lib/gdi/accel.cpp +++ b/lib/gdi/accel.cpp @@ -1,3 +1,4 @@ +#include <cstring> #include <lib/base/init.h> #include <lib/base/init_num.h> #include <lib/gdi/accel.h> diff --git a/lib/gdi/font.cpp b/lib/gdi/font.cpp index 450269f0..6a6007ee 100644 --- a/lib/gdi/font.cpp +++ b/lib/gdi/font.cpp @@ -510,7 +510,12 @@ int eTextPara::renderString(const char *string, int rflags) if (!current_font) return -1; - + + if (!current_face) + eFatal("eTextPara::renderString: no current_face"); + if (!current_face->size) + eFatal("eTextPara::renderString: no current_face->size"); + if (cursor.y()==-1) { cursor=ePoint(area.x(), area.y()+(current_face->size->metrics.ascender>>6)); diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 315c18d1..e01e5e43 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -1,3 +1,5 @@ +#include <cstdlib> +#include <cstring> #include <lib/gdi/gpixmap.h> #include <lib/gdi/region.h> #include <lib/gdi/accel.h> diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 44973af7..bf183f99 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -779,6 +779,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c if (PyInt_Check(pstring) && data) /* if the string is in fact a number, it refers to the 'data' list. */ pstring = PyTuple_GetItem(data, PyInt_AsLong(pstring)); + /* don't do anything if we have 'None' as string */ + if (pstring == Py_None) + continue; + const char *string = (PyString_Check(pstring)) ? PyString_AsString(pstring) : "<not-a-string>"; int x = PyInt_AsLong(px) + offset.x(); int y = PyInt_AsLong(py) + offset.y(); @@ -945,6 +949,10 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c if (PyInt_Check(ppixmap) && data) /* if the pixemap is in fact a number, it refers to the 'data' list. */ ppixmap = PyTuple_GetItem(data, PyInt_AsLong(ppixmap)); + /* don't do anything if we have 'None' as pixmap */ + if (ppixmap == Py_None) + continue; + int x = PyInt_AsLong(px) + offset.x(); int y = PyInt_AsLong(py) + offset.y(); int width = PyInt_AsLong(pwidth); diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index 64699013..6bb45590 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -73,7 +73,7 @@ public: void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected); int currentCursorSelectable(); void setList(SWIG_PYOBJECT(ePyObject) list); - void setFont(int fnt, gFont *fnt); + void setFont(int fnt, gFont *font); void setBuildFunc(SWIG_PYOBJECT(ePyObject) func); void setSelectableFunc(SWIG_PYOBJECT(ePyObject) func); void setItemHeight(int height); diff --git a/lib/gui/esubtitle.cpp b/lib/gui/esubtitle.cpp index 085a749a..ca5c20d7 100644 --- a/lib/gui/esubtitle.cpp +++ b/lib/gui/esubtitle.cpp @@ -114,15 +114,6 @@ void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed) invalidate(changed); } -std::string eSubtitleWidget::replace_all(const std::string &in, const std::string &entity, const std::string &symbol) -{ - std::string out = in; - std::string::size_type loc = 0; - while (( loc = out.find(entity, loc)) != std::string::npos ) - out.replace(loc, entity.length(), symbol); - return out; -} - int eSubtitleWidget::event(int event, void *data, void *data2) { switch (event) diff --git a/lib/gui/esubtitle.h b/lib/gui/esubtitle.h index 1635e6de..c88df0e6 100644 --- a/lib/gui/esubtitle.h +++ b/lib/gui/esubtitle.h @@ -58,7 +58,6 @@ private: gRegion m_visible_region; ePtr<gPixmap> m_pixmap; // pixmap to paint on next evtPaint - std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); }; #endif diff --git a/lib/python/Components/AVSwitch.py b/lib/python/Components/AVSwitch.py index 3188469a..8f4255b8 100644 --- a/lib/python/Components/AVSwitch.py +++ b/lib/python/Components/AVSwitch.py @@ -1,4 +1,5 @@ -from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigSubsection, ConfigBoolean +from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \ + ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigNumber from enigma import eAVSwitch, getDesktop from SystemInfo import SystemInfo @@ -110,6 +111,8 @@ def InitAVSwitch(): config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal") config.av.wss = ConfigEnableDisable(default = True) config.av.defaultac3 = ConfigYesNo(default = False) + config.av.generalAC3delay = ConfigNumber(default = 0) + config.av.generalPCMdelay = ConfigNumber(default = 0) config.av.vcrswitch = ConfigEnableDisable(default = False) iAVSwitch = AVSwitch() diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py index 796ac330..4043a1be 100644 --- a/lib/python/Components/Converter/FrontendInfo.py +++ b/lib/python/Components/Converter/FrontendInfo.py @@ -29,7 +29,7 @@ class FrontendInfo(Converter, object): @cached def getText(self): - assert self.type not in [self.LOCK, self.SLOT_NUMBER], "the text output of FrontendInfo cannot be used for lock info" + assert self.type not in (self.LOCK, self.SLOT_NUMBER), "the text output of FrontendInfo cannot be used for lock info" percent = None if self.type == self.BER: # as count count = self.source.ber @@ -54,7 +54,7 @@ class FrontendInfo(Converter, object): @cached def getBool(self): - assert self.type in [self.LOCK, self.BER], "the boolean output of FrontendInfo can only be used for lock or BER info" + assert self.type in (self.LOCK, self.BER), "the boolean output of FrontendInfo can only be used for lock or BER info" if self.type == self.LOCK: lock = self.source.lock if lock is None: diff --git a/lib/python/Components/Converter/RdsInfo.py b/lib/python/Components/Converter/RdsInfo.py index 3a7b2be3..f3f2b673 100644 --- a/lib/python/Components/Converter/RdsInfo.py +++ b/lib/python/Components/Converter/RdsInfo.py @@ -9,18 +9,12 @@ class RdsInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) - self.type = { - "RadioText": self.RADIO_TEXT_CHANGED, - "RtpText": self.RTP_TEXT_CHANGED, - "RasInteractiveAvailable": self.RASS_INTERACTIVE_AVAILABLE + self.type, self.interesting_events = { + "RadioText": (self.RADIO_TEXT_CHANGED, (iPlayableService.evUpdatedRadioText,)), + "RtpText": (self.RTP_TEXT_CHANGED, (iPlayableService.evUpdatedRtpText,)), + "RasInteractiveAvailable": (self.RASS_INTERACTIVE_AVAILABLE, (iPlayableService.evUpdatedRassInteractivePicMask,)) }[type] - self.interesting_events = { - self.RADIO_TEXT_CHANGED: [iPlayableService.evUpdatedRadioText], - self.RTP_TEXT_CHANGED: [iPlayableService.evUpdatedRtpText], - self.RASS_INTERACTIVE_AVAILABLE: [iPlayableService.evUpdatedRassInteractivePicMask] - }[self.type] - @cached def getText(self): decoder = self.source.decoder diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py index 71180254..d4054f0c 100644 --- a/lib/python/Components/Converter/ServiceInfo.py +++ b/lib/python/Components/Converter/ServiceInfo.py @@ -13,26 +13,16 @@ class ServiceInfo(Converter, object): def __init__(self, type): Converter.__init__(self, type) - self.type = { - "HasTelext": self.HAS_TELETEXT, - "IsMultichannel": self.IS_MULTICHANNEL, - "IsCrypted": self.IS_CRYPTED, - "IsWidescreen": self.IS_WIDESCREEN, - "SubservicesAvailable": self.SUBSERVICES_AVAILABLE, - "VideoWidth": self.XRES, - "VideoHeight": self.YRES, + self.type, self.interesting_events = { + "HasTelext": (self.HAS_TELETEXT, (iPlayableService.evUpdatedInfo,)), + "IsMultichannel": (self.IS_MULTICHANNEL, (iPlayableService.evUpdatedInfo,)), + "IsCrypted": (self.IS_CRYPTED, (iPlayableService.evUpdatedInfo,)), + "IsWidescreen": (self.IS_WIDESCREEN, (iPlayableService.evVideoSizeChanged,)), + "SubservicesAvailable": (self.SUBSERVICES_AVAILABLE, (iPlayableService.evUpdatedEventInfo,)), + "VideoWidth": (self.XRES, (iPlayableService.evVideoSizeChanged,)), + "VideoHeight": (self.YRES, (iPlayableService.evVideoSizeChanged,)), }[type] - self.interesting_events = { - self.HAS_TELETEXT: [iPlayableService.evUpdatedInfo], - self.IS_MULTICHANNEL: [iPlayableService.evUpdatedInfo], - self.IS_CRYPTED: [iPlayableService.evUpdatedInfo], - self.IS_WIDESCREEN: [iPlayableService.evVideoSizeChanged], - self.SUBSERVICES_AVAILABLE: [iPlayableService.evUpdatedEventInfo], - self.XRES: [iPlayableService.evVideoSizeChanged], - self.YRES: [iPlayableService.evVideoSizeChanged], - }[self.type] - def getServiceInfoString(self, info, what): v = info.getInfo(what) if v == -1: @@ -56,16 +46,18 @@ class ServiceInfo(Converter, object): audio = service.audioTracks() if audio: n = audio.getNumberOfTracks() - for x in range(n): - i = audio.getTrackInfo(x) + idx = 0 + while idx < n: + i = audio.getTrackInfo(idx) description = i.getDescription(); - if description.find("AC3") != -1 or description.find("DTS") != -1: + if "AC3" in description or "DTS" in description: return True + idx += 1 return False elif self.type == self.IS_CRYPTED: return info.getInfo(iServiceInformation.sIsCrypted) == 1 elif self.type == self.IS_WIDESCREEN: - return info.getInfo(iServiceInformation.sAspect) in [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10] + return info.getInfo(iServiceInformation.sAspect) in (3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10) elif self.type == self.SUBSERVICES_AVAILABLE: subservices = service.subServices() return subservices and subservices.getNumberOfSubservices() > 0 diff --git a/lib/python/Components/Converter/ServiceName.py b/lib/python/Components/Converter/ServiceName.py index 18b1f2a5..210c1aab 100644 --- a/lib/python/Components/Converter/ServiceName.py +++ b/lib/python/Components/Converter/ServiceName.py @@ -47,5 +47,5 @@ class ServiceName(Converter, object): text = property(getText) def changed(self, what): - if what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evStart]: + if what[0] != self.CHANGED_SPECIFIC or what[1] in (iPlayableService.evStart,): Converter.changed(self, what) diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index 2bcc5492..b92af40b 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -35,7 +35,7 @@ class ServicePosition(Converter, Poll, object): elif type == "Gauge": self.type = self.TYPE_GAUGE else: - raise ElementError("type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}") + raise ElementError("type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|ShowNoSeconds} for ServicePosition converter") self.poll_enabled = self.type != self.TYPE_LENGTH @@ -128,8 +128,8 @@ class ServicePosition(Converter, Poll, object): value = property(getValue) def changed(self, what): - cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in [iPlayableService.evCuesheetChanged] - time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in [iPlayableService.evCuesheetChanged] + cutlist_refresh = what[0] != self.CHANGED_SPECIFIC or what[1] in (iPlayableService.evCuesheetChanged,) + time_refresh = what[0] == self.CHANGED_POLL or what[0] == self.CHANGED_SPECIFIC and what[1] in (iPlayableService.evCuesheetChanged,) if cutlist_refresh: if self.type == self.TYPE_GAUGE: diff --git a/lib/python/Components/Converter/ServiceTime.py b/lib/python/Components/Converter/ServiceTime.py index 89965067..d30839c6 100644 --- a/lib/python/Components/Converter/ServiceTime.py +++ b/lib/python/Components/Converter/ServiceTime.py @@ -16,7 +16,7 @@ class ServiceTime(Converter, object): elif type == "Duration": self.type = self.DURATION else: - raise ElementError("'%s' is not <StartTime|EndTime|Duration> for eEventTime converter" % type) + raise ElementError("'%s' is not <StartTime|EndTime|Duration> for ServiceTime converter" % type) @cached def getTime(self): diff --git a/lib/python/Components/Converter/Streaming.py b/lib/python/Components/Converter/Streaming.py index 2746ee84..0c0d274c 100644 --- a/lib/python/Components/Converter/Streaming.py +++ b/lib/python/Components/Converter/Streaming.py @@ -9,9 +9,6 @@ from Components.Element import cached # "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type class Streaming(Converter): - def __init__(self, type): - Converter.__init__(self, type) - @cached def getText(self): service = self.source.service diff --git a/lib/python/Components/Converter/StringList.py b/lib/python/Components/Converter/StringList.py index 226247c4..d0886620 100644 --- a/lib/python/Components/Converter/StringList.py +++ b/lib/python/Components/Converter/StringList.py @@ -55,4 +55,5 @@ class StringList(Converter): index = property(getIndex, setIndex) def entry_changed(self, index): - self.downstream_elements.entry_changed(index) + if self.content: + self.content.invalidateEntry(index) diff --git a/lib/python/Components/DreamInfoHandler.py b/lib/python/Components/DreamInfoHandler.py index c5f82629..2f2e757c 100644 --- a/lib/python/Components/DreamInfoHandler.py +++ b/lib/python/Components/DreamInfoHandler.py @@ -31,7 +31,7 @@ class InfoHandler(xml.sax.ContentHandler): def startElement(self, name, attrs): #print name, ":", attrs.items() self.elements.append(name) - if name in ["hardware", "bcastsystem", "satellite", "tag"]: + if name in ("hardware", "bcastsystem", "satellite", "tag"): if not attrs.has_key("type"): self.printError(str(name) + " tag with no type attribute") if self.elements[-3] == "default": diff --git a/lib/python/Components/Element.py b/lib/python/Components/Element.py index f4a8f127..509a1c8d 100644 --- a/lib/python/Components/Element.py +++ b/lib/python/Components/Element.py @@ -18,10 +18,10 @@ def cached(f): class ElementError(Exception): def __init__(self, message): - self.message = message + self.msg = message def __str__(self): - return self.message + return self.msg class Element(object): CHANGED_DEFAULT = 0 # initial "pull" state diff --git a/lib/python/Components/EpgList.py b/lib/python/Components/EpgList.py index 2494ca08..fa60400f 100644 --- a/lib/python/Components/EpgList.py +++ b/lib/python/Components/EpgList.py @@ -297,6 +297,8 @@ class EPGList(HTMLComponent, GUIComponent): return x and x[1] def moveToService(self,serviceref): + if not serviceref: + return index = 0 refstr = serviceref.toString() for x in self.list: @@ -306,6 +308,8 @@ class EPGList(HTMLComponent, GUIComponent): index += 1 def moveToEventId(self, eventId): + if not eventId: + return index = 0 for x in self.list: if x[1] == eventId: diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index 75d68fad..ad6c1a3b 100755 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -44,8 +44,8 @@ class Harddisk: self.timer.callback.remove(self.runIdle) def bus(self): - ide_cf = self.device.find("hd") == 0 and self.devidex2.find("host0") == -1 # 7025 specific - internal = self.device.find("hd") == 0 + ide_cf = self.device[:2] == "hd" and "host0" not in self.devidex2 # 7025 specific + internal = self.device[:2] == "hd" if ide_cf: ret = "External (CF)" elif internal: @@ -73,14 +73,14 @@ class Harddisk: return "%d.%03d GB" % (cap/1024, cap%1024) def model(self): - if self.device.find("hd") == 0: + if self.device[:2] == "hd": procfile = tryOpen("/proc/ide/"+self.device+"/model") if procfile == "": return "" line = procfile.readline() procfile.close() return line.strip() - elif self.device.find("sd") == 0: + elif self.device[:2] == "sd": procfile = tryOpen("/sys/block/"+self.device+"/device/vendor") if procfile == "": return "" @@ -230,9 +230,8 @@ class Harddisk: # we set the hdd into standby. def readStats(self): l = open("/sys/block/%s/stat" % self.device).read() - nr_read = int(l[:8].strip()) - nr_write = int(l[4*9:4*9+8].strip()) - return nr_read, nr_write + (nr_read, _, _, _, nr_write) = l.split()[:5] + return int(nr_read), int(nr_write) def startIdle(self): self.last_access = time.time() @@ -358,8 +357,7 @@ class HarddiskManager: ("/", _("Internal Flash")) ] - for x in p: - self.partitions.append(Partition(mountpoint = x[0], description = x[1])) + self.partitions.extend([ Partition(mountpoint = x[0], description = x[1]) for x in p ]) def getBlockDevInfo(self, blockdev): devpath = "/sys/block/" + blockdev @@ -371,14 +369,14 @@ class HarddiskManager: try: removable = bool(int(open(devpath + "/removable").read())) dev = int(open(devpath + "/dev").read().split(':')[0]) - if dev in [7, 31]: # loop, mtdblock + if dev in (7, 31): # loop, mtdblock blacklisted = True if blockdev[0:2] == 'sr': is_cdrom = True if blockdev[0:2] == 'hd': try: media = open("/proc/ide/%s/media" % blockdev).read() - if media.find("cdrom") != -1: + if "cdrom" in media: is_cdrom = True except IOError: error = True @@ -457,11 +455,10 @@ class HarddiskManager: self.on_partition_list_change("remove", x) l = len(device) if l and not device[l-1].isdigit(): - idx = 0 for hdd in self.hdd: if hdd.device == device: - self.hdd[x].stop() - del self.hdd[idx] + hdd.stop() + self.hdd.remove(hdd) break SystemInfo["Harddisk"] = len(self.hdd) > 0 diff --git a/lib/python/Components/HelpMenuList.py b/lib/python/Components/HelpMenuList.py index ddf871a7..66139dfb 100755 --- a/lib/python/Components/HelpMenuList.py +++ b/lib/python/Components/HelpMenuList.py @@ -17,8 +17,6 @@ class HelpMenuList(GUIComponent): l = [ ] for (actionmap, context, actions) in helplist: for (action, help) in actions: - entry = [ ] - buttons = queryKeyBinding(context, action) # do not display entries which are not accessible from keys @@ -36,13 +34,15 @@ class HelpMenuList(GUIComponent): if flags & 8: # for long keypresses, prepend l_ into the key name. name = (name[0], "long") - entry.append( (actionmap, context, action, name ) ) - + entry = [ (actionmap, context, action, name ) ] + if isinstance(help, list): self.extendedHelp = True print "extendedHelpEntry found" - entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 26, 0, 0, help[0]) ) - entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 28, 400, 20, 1, 0, help[1]) ) + entry.extend(( + (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 26, 0, 0, help[0]), + (eListboxPythonMultiContent.TYPE_TEXT, 0, 28, 400, 20, 1, 0, help[1]) + )) else: entry.append( (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 400, 28, 0, 0, help) ) diff --git a/lib/python/Components/Language.py b/lib/python/Components/Language.py index 74dd67d8..268fdb21 100644 --- a/lib/python/Components/Language.py +++ b/lib/python/Components/Language.py @@ -64,18 +64,17 @@ class Language: self.activateLanguage(self.langlist[index]) def getLanguageList(self): - list = [] - for x in self.langlist: - list.append((x, self.lang[x])) - return list + return [ (x, self.lang[x]) for x in self.langlist ] def getActiveLanguage(self): return self.activeLanguage def getActiveLanguageIndex(self): - for count in range(len(self.langlist)): - if self.langlist[count] == self.activeLanguage: - return count + idx = 0 + for x in self.langlist: + if x == self.activeLanguage: + return idx + idx += 1 return None def getLanguage(self): diff --git a/lib/python/Components/MediaPlayer.py b/lib/python/Components/MediaPlayer.py index 87ba977c..12f2727f 100644 --- a/lib/python/Components/MediaPlayer.py +++ b/lib/python/Components/MediaPlayer.py @@ -25,7 +25,7 @@ def PlaylistEntryComponent(serviceref, state): text = serviceref.getName() if text is "": text = path.split(serviceref.getPath().split('/')[-1])[1] - res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 0, 470, 32, 0, RT_VALIGN_CENTER, text)) + res.append((eListboxPythonMultiContent.TYPE_TEXT,25, 1, 470, 22, 0, RT_VALIGN_CENTER, text)) png = None if state == STATE_PLAY: png = PlayIcon @@ -39,7 +39,7 @@ def PlaylistEntryComponent(serviceref, state): png = ForwardIcon if png is not None: - res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 16, 16, png)) + res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 3, 16, 16, png)) return res @@ -47,7 +47,7 @@ class PlayList(MenuList): def __init__(self, enableWrapAround = False): MenuList.__init__(self, [], enableWrapAround, eListboxPythonMultiContent) self.l.setFont(0, gFont("Regular", 18)) - self.l.setItemHeight(22) + self.l.setItemHeight(23) self.currPlaying = -1 self.oldCurrPlaying = -1 self.serviceHandler = eServiceCenter.getInstance() diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py index 64b3aa6c..5f7095c4 100755 --- a/lib/python/Components/Network.py +++ b/lib/python/Components/Network.py @@ -3,6 +3,8 @@ from re import compile as re_compile, search as re_search from socket import * from enigma import eConsoleAppContainer from Components.Console import Console +from Components.PluginComponent import plugins +from Plugins.Plugin import PluginDescriptor class Network: def __init__(self): @@ -22,6 +24,7 @@ class Network: self.activateConsole = Console() self.resetNetworkConsole = Console() self.DnsConsole = Console() + self.config_ready = None self.getInterfaces() def getInterfaces(self, callback = None): @@ -222,6 +225,8 @@ class Network: self.loadNameserverConfig() print "read configured interfac:", ifaces print "self.ifaces after loading:", self.ifaces + self.config_ready = True + self.msgPlugins() if callback is not None: callback(True) @@ -418,6 +423,8 @@ class Network: def restartNetwork(self,callback = None): self.restartConsole = Console() + self.config_ready = False + self.msgPlugins() self.commands = [] self.commands.append("/etc/init.d/avahi-daemon stop") for iface in self.ifaces.keys(): @@ -448,24 +455,34 @@ class Network: def stopLinkStateConsole(self): if self.LinkConsole is not None: - self.LinkConsole = None - + if len(self.LinkConsole.appContainers): + for name in self.LinkConsole.appContainers.keys(): + self.LinkConsole.kill(name) + def stopDNSConsole(self): if self.DnsConsole is not None: - self.DnsConsole = None - + if len(self.DnsConsole.appContainers): + for name in self.DnsConsole.appContainers.keys(): + self.DnsConsole.kill(name) + def stopRestartConsole(self): if self.restartConsole is not None: - self.restartConsole = None - + if len(self.restartConsole.appContainers): + for name in self.restartConsole.appContainers.keys(): + self.restartConsole.kill(name) + def stopGetInterfacesConsole(self): if self.Console is not None: - self.Console = None - + if len(self.Console.appContainers): + for name in self.Console.appContainers.keys(): + self.Console.kill(name) + def stopDeactivateInterfaceConsole(self): - if self.deactivateInterfaceConsole: - self.deactivateInterfaceConsole = None - + if self.deactivateInterfaceConsole is not None: + if len(self.deactivateInterfaceConsole.appContainers): + for name in self.deactivateInterfaceConsole.appContainers.keys(): + self.deactivateInterfaceConsole.kill(name) + def checkforInterface(self,iface): if self.getAdapterAttribute(iface, 'up') is True: return True @@ -547,6 +564,11 @@ class Network: netmask = str(inet_ntoa(pack('>L', nm))) return netmask + def msgPlugins(self): + if self.config_ready is not None: + for p in plugins.getPlugins(PluginDescriptor.WHERE_NETWORKCONFIG_READ): + p(reason=self.config_ready) + iNetwork = Network() def InitNetwork(): diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 6dc49dcf..aa915937 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -112,7 +112,7 @@ class SecConfigure: def getRoot(self, slotid, connto): visited = [] - while (self.NimManager.getNimConfig(connto).configMode.value in ["satposdepends", "equal", "loopthrough"]): + while (self.NimManager.getNimConfig(connto).configMode.value in ("satposdepends", "equal", "loopthrough")): connto = int(self.NimManager.getNimConfig(connto).connectedTo.value) if connto in visited: # prevent endless loop return slotid @@ -168,7 +168,7 @@ class SecConfigure: hw = HardwareInfo() if slot.isCompatible("DVB-S"): print "slot: " + str(x) + " configmode: " + str(nim.configMode.value) - if nim.configMode.value in [ "loopthrough", "satposdepends", "nothing" ]: + if nim.configMode.value in ( "loopthrough", "satposdepends", "nothing" ): pass else: sec.setSlotNotLinked(x) @@ -389,20 +389,20 @@ class SecConfigure: else: sec.setLoDirection(rotorParam.WEST) - if currLnb.powerMeasurement.value: - sec.setUseInputpower(True) - sec.setInputpowerDelta(currLnb.powerThreshold.value) - turn_speed_dict = { "fast": rotorParam.FAST, "slow": rotorParam.SLOW } - if turn_speed_dict.has_key(currLnb.turningSpeed.value): - turning_speed = turn_speed_dict[currLnb.turningSpeed.value] + if currLnb.powerMeasurement.value: + sec.setUseInputpower(True) + sec.setInputpowerDelta(currLnb.powerThreshold.value) + turn_speed_dict = { "fast": rotorParam.FAST, "slow": rotorParam.SLOW } + if turn_speed_dict.has_key(currLnb.turningSpeed.value): + turning_speed = turn_speed_dict[currLnb.turningSpeed.value] + else: + beg_time = localtime(currLnb.fastTurningBegin.value) + end_time = localtime(currLnb.fastTurningEnd.value) + turning_speed = ((beg_time.tm_hour + 1) * 60 + beg_time.tm_min + 1) << 16 + turning_speed |= (end_time.tm_hour + 1) * 60 + end_time.tm_min + 1 + sec.setRotorTurningSpeed(turning_speed) else: - beg_time = localtime(currLnb.fastTurningBegin.value) - end_time = localtime(currLnb.fastTurningEnd.value) - turning_speed = ((beg_time.tm_hour + 1) * 60 + beg_time.tm_min + 1) << 16 - turning_speed |= (end_time.tm_hour + 1) * 60 + end_time.tm_min + 1 - sec.setRotorTurningSpeed(turning_speed) - else: - sec.setUseInputpower(False) + sec.setUseInputpower(False) sec.setLNBSlotMask(tunermask) @@ -447,7 +447,7 @@ class NIM(object): def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None): self.slot = slot - if type not in ["DVB-S", "DVB-C", "DVB-T", "DVB-S2", None]: + if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None): print "warning: unknown NIM type %s, not using." % type type = None @@ -458,20 +458,20 @@ class NIM(object): def isCompatible(self, what): compatible = { - None: [None], - "DVB-S": ["DVB-S", None], - "DVB-C": ["DVB-C", None], - "DVB-T": ["DVB-T", None], - "DVB-S2": ["DVB-S", "DVB-S2", None] + None: (None,), + "DVB-S": ("DVB-S", None), + "DVB-C": ("DVB-C", None), + "DVB-T": ("DVB-T", None), + "DVB-S2": ("DVB-S", "DVB-S2", None) } return what in compatible[self.type] def connectableTo(self): connectable = { - "DVB-S": ["DVB-S", "DVB-S2"], - "DVB-C": ["DVB-C"], - "DVB-T": ["DVB-T"], - "DVB-S2": ["DVB-S", "DVB-S2"] + "DVB-S": ("DVB-S", "DVB-S2"), + "DVB-C": ("DVB-C",), + "DVB-T": ("DVB-T",), + "DVB-S2": ("DVB-S", "DVB-S2") } return connectable[self.type] @@ -781,10 +781,10 @@ class NimManager: if configMode == "simple": dm = nim.diseqcMode.value - if dm in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if dm in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nim.diseqcA.orbital_position != 3601: list.append(self.satList[nim.diseqcA.index-1]) - if dm in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if dm in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nim.diseqcB.orbital_position != 3601: list.append(self.satList[nim.diseqcB.index-1]) if dm == "diseqc_a_b_c_d": @@ -835,9 +835,13 @@ class NimManager: def InitSecParams(): config.sec = ConfigSubsection() - x = ConfigInteger(default=15, limits = (0, 9999)) - x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_CONT_TONE, configElement.value)) - config.sec.delay_after_continuous_tone_change = x + x = ConfigInteger(default=25, limits = (0, 9999)) + x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_CONT_TONE_DISABLE_BEFORE_DISEQC, configElement.value)) + config.sec.delay_after_continuous_tone_disable_before_diseqc = x + + x = ConfigInteger(default=10, limits = (0, 9999)) + x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_FINAL_CONT_TONE_CHANGE, configElement.value)) + config.sec.delay_after_final_continuous_tone_change = x x = ConfigInteger(default=10, limits = (0, 9999)) x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_FINAL_VOLTAGE_CHANGE, configElement.value)) @@ -922,57 +926,58 @@ def InitNimManager(nimmgr): "unicable": _("Unicable"), "c_band": _("C-Band"), "user_defined": _("User defined")} + lnb_choices_default = "universal_lnb" unicablelnbproducts = { - "Humax": {"150 SCR":["1210","1420","1680","2040"]}, - "Inverto": {"IDLP-40UNIQD+S":["1680","1420","2040","1210"]}, - "Kathrein": {"UAS481":["1400","1516","1632","1748"]}, - "Kreiling": {"KR1440":["1680","1420","2040","1210"]}, - "Radix": {"Unicable LNB":["1680","1420","2040","1210"]}, - "Wisi": {"OC 05":["1210","1420","1680","2040"]}} + "Humax": {"150 SCR":("1210","1420","1680","2040")}, + "Inverto": {"IDLP-40UNIQD+S":("1680","1420","2040","1210")}, + "Kathrein": {"UAS481":("1400","1516","1632","1748")}, + "Kreiling": {"KR1440":("1680","1420","2040","1210")}, + "Radix": {"Unicable LNB":("1680","1420","2040","1210")}, + "Wisi": {"OC 05":("1210","1420","1680","2040")}} UnicableLnbManufacturers = unicablelnbproducts.keys() UnicableLnbManufacturers.sort() unicablematrixproducts = { "Ankaro": { - "UCS 51440":["1400","1632","1284","1516"], - "UCS 51820":["1400","1632","1284","1516","1864","2096","1748","1980"], - "UCS 51840":["1400","1632","1284","1516","1864","2096","1748","1980"], - "UCS 52240":["1400","1632"], - "UCS 52420":["1400","1632","1284","1516"], - "UCS 52440":["1400","1632","1284","1516"], - "UCS 91440":["1400","1632","1284","1516"], - "UCS 91820":["1400","1632","1284","1516","1864","2096","1748","1980"], - "UCS 91840":["1400","1632","1284","1516","1864","2096","1748","1980"], - "UCS 92240":["1400","1632"], - "UCS 92420":["1400","1632","1284","1516"], - "UCS 92440":["1400","1632","1284","1516"]}, + "UCS 51440":("1400","1632","1284","1516"), + "UCS 51820":("1400","1632","1284","1516","1864","2096","1748","1980"), + "UCS 51840":("1400","1632","1284","1516","1864","2096","1748","1980"), + "UCS 52240":("1400","1632"), + "UCS 52420":("1400","1632","1284","1516"), + "UCS 52440":("1400","1632","1284","1516"), + "UCS 91440":("1400","1632","1284","1516"), + "UCS 91820":("1400","1632","1284","1516","1864","2096","1748","1980"), + "UCS 91840":("1400","1632","1284","1516","1864","2096","1748","1980"), + "UCS 92240":("1400","1632"), + "UCS 92420":("1400","1632","1284","1516"), + "UCS 92440":("1400","1632","1284","1516")}, "DCT Delta": { - "SUM518":["1284","1400","1516","1632","1748","1864","1980","2096"], - "SUM918":["1284","1400","1516","1632","1748","1864","1980","2096"], - "SUM928":["1284","1400","1516","1632","1748","1864","1980","2096"]}, + "SUM518":("1284","1400","1516","1632","1748","1864","1980","2096"), + "SUM918":("1284","1400","1516","1632","1748","1864","1980","2096"), + "SUM928":("1284","1400","1516","1632","1748","1864","1980","2096")}, "Inverto": { - "IDLP-UST11O-CUO1O-8PP":["1076","1178","1280","1382","1484","1586","1688","1790"]}, + "IDLP-UST11O-CUO1O-8PP":("1076","1178","1280","1382","1484","1586","1688","1790")}, "Kathrein": { - "EXR501":["1400","1516","1632","1748"], - "EXR551":["1400","1516","1632","1748"], - "EXR552":["1400","1516"]}, + "EXR501":("1400","1516","1632","1748"), + "EXR551":("1400","1516","1632","1748"), + "EXR552":("1400","1516")}, "ROTEK": { - "EKL2/1":["1400","1516"], - "EKL2/1E":["0","0","1632","1748"]}, + "EKL2/1":("1400","1516"), + "EKL2/1E":("0","0","1632","1748")}, "Smart": { - "DPA 51":["1284","1400","1516","1632","1748","1864","1980","2096"]}, + "DPA 51":("1284","1400","1516","1632","1748","1864","1980","2096")}, "Technisat": { - "TechniRouter 5/1x8 G":["1284","1400","1516","1632","1748","1864","1980","2096"], - "TechniRouter 5/1x8 K":["1284","1400","1516","1632","1748","1864","1980","2096"], - "TechniRouter 5/2x4 G":["1284","1400","1516","1632"], - "TechniRouter 5/2x4 K":["1284","1400","1516","1632"]}, + "TechniRouter 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), + "TechniRouter 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), + "TechniRouter 5/2x4 G":("1284","1400","1516","1632"), + "TechniRouter 5/2x4 K":("1284","1400","1516","1632")}, "Telstar": { - "SCR 5/1x8 G":["1284","1400","1516","1632","1748","1864","1980","2096"], - "SCR 5/1x8 K":["1284","1400","1516","1632","1748","1864","1980","2096"], - "SCR 5/2x4 G":["1284","1400","1516","1632"], - "SCR 5/2x4 K":["1284","1400","1516","1632"]}} + "SCR 5/1x8 G":("1284","1400","1516","1632","1748","1864","1980","2096"), + "SCR 5/1x8 K":("1284","1400","1516","1632","1748","1864","1980","2096"), + "SCR 5/2x4 G":("1284","1400","1516","1632"), + "SCR 5/2x4 K":("1284","1400","1516","1632")}} UnicableMatrixManufacturers = unicablematrixproducts.keys() UnicableMatrixManufacturers.sort() @@ -982,59 +987,9 @@ def InitNimManager(nimmgr): "unicable_user": "Unicable "+_("User defined")} unicable_choices_default = "unicable_lnb" - unicableLnb = ConfigSubDict() - for y in unicablelnbproducts: - products = unicablelnbproducts[y].keys() - products.sort() - unicableLnb[y] = ConfigSubsection() - unicableLnb[y].product = ConfigSelection(choices = products, default = products[0]) - unicableLnb[y].scr = ConfigSubDict() - unicableLnb[y].vco = ConfigSubDict() - for z in products: - scrlist = [] - vcolist = unicablelnbproducts[y][z] - unicableLnb[y].vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - vcofreq = int(vcolist[cnt-1]) - unicableLnb[y].vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - unicableLnb[y].scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - - unicableMatrix = ConfigSubDict() - - for y in unicablematrixproducts: - products = unicablematrixproducts[y].keys() - products.sort() - unicableMatrix[y] = ConfigSubsection() - unicableMatrix[y].product = ConfigSelection(choices = products, default = products[0]) - unicableMatrix[y].scr = ConfigSubDict() - unicableMatrix[y].vco = ConfigSubDict() - for z in products: - scrlist = [] - vcolist = unicablematrixproducts[y][z] - unicableMatrix[y].vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)): - vcofreq = int(vcolist[cnt-1]) - if vcofreq == 0: - scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) - else: - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - unicableMatrix[y].vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - unicableMatrix[y].scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - advanced_lnb_satcruser_choices = [ ("1", "SatCR 1"), ("2", "SatCR 2"), ("3", "SatCR 3"), ("4", "SatCR 4"), ("5", "SatCR 5"), ("6", "SatCR 6"), ("7", "SatCR 7"), ("8", "SatCR 8")] - satcrvcouser = ConfigSubList() - satcrvcouser.append(ConfigInteger(default=1284, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1400, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1516, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1632, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1748, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1864, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=1980, limits = (0, 9999))) - satcrvcouser.append(ConfigInteger(default=2096, limits = (0, 9999))) - prio_list = [ ("-1", _("Auto")) ] prio_list += [(str(prio), str(prio)) for prio in range(65)+range(14000,14065)+range(19000,19065)] @@ -1073,26 +1028,174 @@ def InitNimManager(nimmgr): advanced_lnb_diseqc_repeat_choices = [("none", _("None")), ("one", _("One")), ("two", _("Two")), ("three", _("Three"))] advanced_lnb_fast_turning_btime = mktime(datetime(1970, 1, 1, 7, 0).timetuple()); advanced_lnb_fast_turning_etime = mktime(datetime(1970, 1, 1, 19, 0).timetuple()); + + def configLOFChanged(configElement): + if configElement.value == "unicable": + x = configElement.slot_id + lnb = configElement.lnb_id + nim = config.Nims[x] + lnbs = nim.advanced.lnb + section = lnbs[lnb] + if isinstance(section.unicable, ConfigNothing): + if lnb == 1: + section.unicable = ConfigSelection(unicable_choices, unicable_choices_default) + elif lnb == 2: + section.unicable = ConfigSelection(choices = {"unicable_matrix": _("Unicable Martix"),"unicable_user": "Unicable "+_("User defined")}, default = "unicable_matrix") + else: + section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") + + if lnb < 3: + section.unicableMatrix = ConfigSubDict() + section.unicableMatrixManufacturer = ConfigSelection(choices = UnicableMatrixManufacturers, default = UnicableMatrixManufacturers[0]) + for y in unicablematrixproducts: + products = unicablematrixproducts[y].keys() + products.sort() + tmp = ConfigSubsection() + tmp.product = ConfigSelection(choices = products, default = products[0]) + tmp.scr = ConfigSubDict() + tmp.vco = ConfigSubDict() + for z in products: + scrlist = [] + vcolist = unicablematrixproducts[y][z] + tmp.vco[z] = ConfigSubList() + for cnt in range(1,1+len(vcolist)): + vcofreq = int(vcolist[cnt-1]) + if vcofreq == 0: + scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) + else: + scrlist.append(("%d" %cnt,"SCR %d" %cnt)) + tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) + tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + section.unicableMatrix[y] = tmp + + if lnb < 2: + section.unicableLnb = ConfigSubDict() + section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) + for y in unicablelnbproducts: + products = unicablelnbproducts[y].keys() + products.sort() + tmp = ConfigSubsection() + tmp.product = ConfigSelection(choices = products, default = products[0]) + tmp.scr = ConfigSubDict() + tmp.vco = ConfigSubDict() + for z in products: + scrlist = [] + vcolist = unicablelnbproducts[y][z] + tmp.vco[z] = ConfigSubList() + for cnt in range(1,1+len(vcolist)): + scrlist.append(("%d" %cnt,"SCR %d" %cnt)) + vcofreq = int(vcolist[cnt-1]) + tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) + tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) + section.unicableLnb[y] = tmp + + section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") + tmp = ConfigSubList() + tmp.append(ConfigInteger(default=1284, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1400, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1516, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1632, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1748, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1864, limits = (0, 9999))) + tmp.append(ConfigInteger(default=1980, limits = (0, 9999))) + tmp.append(ConfigInteger(default=2096, limits = (0, 9999))) + section.satcrvcouser = tmp + + def configDiSEqCModeChanged(configElement): + section = configElement.section + if configElement.value == "1_2" and isinstance(section.longitude, ConfigNothing): + section.longitude = ConfigFloat(default = [5,100], limits = [(0,359),(0,999)]) + section.longitudeOrientation = ConfigSelection(longitude_orientation_choices, "east") + section.latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) + section.latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") + section.powerMeasurement = ConfigYesNo(default=True) + section.powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) + section.turningSpeed = ConfigSelection(turning_speed_choices, "fast") + section.fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600) + section.fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600) + + def configLNBChanged(configElement): + x = configElement.slot_id + nim = config.Nims[x] + if isinstance(configElement.value, tuple): + lnb = int(configElement.value[0]) + else: + lnb = int(configElement.value) + lnbs = nim.advanced.lnb + if lnb and lnb not in lnbs: + section = lnbs[lnb] = ConfigSubsection() + section.lofl = ConfigInteger(default=9750, limits = (0, 99999)) + section.lofh = ConfigInteger(default=10600, limits = (0, 99999)) + section.threshold = ConfigInteger(default=11700, limits = (0, 99999)) +# section.output_12v = ConfigSelection(choices = [("0V", _("0 V")), ("12V", _("12 V"))], default="0V") + section.increased_voltage = ConfigYesNo(False) + section.toneburst = ConfigSelection(advanced_lnb_toneburst_choices, "none") + section.longitude = ConfigNothing() + if lnb > 32: + tmp = ConfigSelection(advanced_lnb_allsat_diseqcmode_choices, "1_2") + tmp.section = section + configDiSEqCModeChanged(tmp) + else: + tmp = ConfigSelection(advanced_lnb_diseqcmode_choices, "none") + tmp.section = section + tmp.addNotifier(configDiSEqCModeChanged) + section.diseqcMode = tmp + section.commitedDiseqcCommand = ConfigSelection(advanced_lnb_csw_choices) + section.fastDiseqc = ConfigYesNo(False) + section.sequenceRepeat = ConfigYesNo(False) + section.commandOrder1_0 = ConfigSelection(advanced_lnb_commandOrder1_0_choices, "ct") + section.commandOrder = ConfigSelection(advanced_lnb_commandOrder_choices, "ct") + section.uncommittedDiseqcCommand = ConfigSelection(advanced_lnb_ucsw_choices) + section.diseqcRepeats = ConfigSelection(advanced_lnb_diseqc_repeat_choices, "none") + section.prio = ConfigSelection(prio_list, "-1") + section.unicable = ConfigNothing() + tmp = ConfigSelection(lnb_choices, lnb_choices_default) + tmp.slot_id = x + tmp.lnb_id = lnb + tmp.addNotifier(configLOFChanged, initial_call = False) + section.lof = tmp + + def configModeChanged(configMode): + slot_id = configMode.slot_id + nim = config.Nims[slot_id] + if configMode.value == "advanced" and isinstance(nim.advanced, ConfigNothing): + # advanced config: + nim.advanced = ConfigSubsection() + nim.advanced.sat = ConfigSubDict() + nim.advanced.sats = getConfigSatlist(192, advanced_satlist_choices) + nim.advanced.lnb = ConfigSubDict() + nim.advanced.lnb[0] = ConfigNothing() + for x in nimmgr.satList: + tmp = ConfigSubsection() + tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization") + tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band") + tmp.usals = ConfigYesNo(True) + tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255)) + lnb = ConfigSelection(advanced_lnb_choices, "0") + lnb.slot_id = slot_id + lnb.addNotifier(configLNBChanged, initial_call = False) + tmp.lnb = lnb + nim.advanced.sat[x[0]] = tmp + for x in range(3601, 3605): + tmp = ConfigSubsection() + tmp.voltage = ConfigSelection(advanced_voltage_choices, "polarization") + tmp.tonemode = ConfigSelection(advanced_tonemode_choices, "band") + tmp.usals = ConfigYesNo(default=True) + tmp.rotorposition = ConfigInteger(default=1, limits=(1, 255)) + lnbnum = 33+x-3601 + lnb = ConfigSelection([("0", "not available"), (str(lnbnum), "LNB %d"%(lnbnum))], "0") + lnb.slot_id = slot_id + lnb.addNotifier(configLNBChanged, initial_call = False) + tmp.lnb = lnb + nim.advanced.sat[x] = tmp + for slot in nimmgr.nim_slots: x = slot.slot nim = config.Nims[x] - if slot.isCompatible("DVB-S"): - config_mode_choices = [ ("nothing", _("nothing connected")), - ("simple", _("simple")), ("advanced", _("advanced"))] - if len(nimmgr.getNimListOfType(slot.type, exception = x)) > 0: - config_mode_choices.append(("equal", _("equal to"))) - config_mode_choices.append(("satposdepends", _("second cable of motorized LNB"))) - if len(nimmgr.canConnectTo(x)) > 0: - config_mode_choices.append(("loopthrough", _("loopthrough to"))) - nim.configMode = ConfigSelection(config_mode_choices, "nothing") - nim.diseqc13V = ConfigYesNo(False) - nim.diseqcMode = ConfigSelection(diseqc_mode_choices, "diseqc_a_b") - nim.connectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) - nim.simpleSingleSendDiSEqC = ConfigYesNo(False) nim.simpleDiSEqCSetVoltageTone = ConfigYesNo(True) nim.simpleDiSEqCOnlyOnSatChange = ConfigYesNo(False) @@ -1112,75 +1215,18 @@ def InitNimManager(nimmgr): nim.fastTurningBegin = ConfigDateTime(default = mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 900) etime = datetime(1970, 1, 1, 19, 0); nim.fastTurningEnd = ConfigDateTime(default = mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 900) - - # advanced config: - nim.advanced = ConfigSubsection() - nim.advanced.sats = getConfigSatlist(192, advanced_satlist_choices) - nim.advanced.sat = ConfigSubDict() - - for x in nimmgr.satList: - nim.advanced.sat[x[0]] = ConfigSubsection() - nim.advanced.sat[x[0]].voltage = ConfigSelection(advanced_voltage_choices, "polarization") - nim.advanced.sat[x[0]].tonemode = ConfigSelection(advanced_tonemode_choices, "band") - nim.advanced.sat[x[0]].usals = ConfigYesNo(True) - nim.advanced.sat[x[0]].rotorposition = ConfigInteger(default=1, limits=(1, 255)) - nim.advanced.sat[x[0]].lnb = ConfigSelection(advanced_lnb_choices, "0") - - for x in range(3601, 3605): - nim.advanced.sat[x] = ConfigSubsection() - nim.advanced.sat[x].voltage = ConfigSelection(advanced_voltage_choices, "polarization") - nim.advanced.sat[x].tonemode = ConfigSelection(advanced_tonemode_choices, "band") - nim.advanced.sat[x].usals = ConfigYesNo(default=True) - nim.advanced.sat[x].rotorposition = ConfigInteger(default=1, limits=(1, 255)) - lnbnum = 33+x-3601 - nim.advanced.sat[x].lnb = ConfigSelection([("0", "not available"), (str(lnbnum), "LNB %d"%(lnbnum))], "0") - - nim.advanced.lnb = ConfigSubList() - nim.advanced.lnb.append(ConfigNothing()) - - for x in range(1, 37): - nim.advanced.lnb.append(ConfigSubsection()) - nim.advanced.lnb[x].lof = ConfigSelection(lnb_choices, lnb_choices_default) - - nim.advanced.lnb[x].lofl = ConfigInteger(default=9750, limits = (0, 99999)) - nim.advanced.lnb[x].lofh = ConfigInteger(default=10600, limits = (0, 99999)) - nim.advanced.lnb[x].threshold = ConfigInteger(default=11700, limits = (0, 99999)) - - nim.advanced.lnb[x].unicable = ConfigSelection(unicable_choices, unicable_choices_default) - - nim.advanced.lnb[x].unicableLnb = unicableLnb # is this okay? all lnb use the same ConfigSubDict ? ! ? - nim.advanced.lnb[x].unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - - nim.advanced.lnb[x].unicableMatrix = unicableMatrix # is this okay? all lnb use the same ConfigSubDict ? ! ? - nim.advanced.lnb[x].unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) - - nim.advanced.lnb[x].satcruser = ConfigSelection(advanced_lnb_satcruser_choices, "1") - nim.advanced.lnb[x].satcrvcouser = satcrvcouser # is this okay? all lnb use the same ConfigSubDict ? ! ? - -# nim.advanced.lnb[x].output_12v = ConfigSelection(choices = [("0V", _("0 V")), ("12V", _("12 V"))], default="0V") - nim.advanced.lnb[x].increased_voltage = ConfigYesNo(False) - nim.advanced.lnb[x].toneburst = ConfigSelection(advanced_lnb_toneburst_choices, "none") - if x > 32: - nim.advanced.lnb[x].diseqcMode = ConfigSelection(advanced_lnb_allsat_diseqcmode_choices, "1_2") - else: - nim.advanced.lnb[x].diseqcMode = ConfigSelection(advanced_lnb_diseqcmode_choices, "none") - nim.advanced.lnb[x].commitedDiseqcCommand = ConfigSelection(advanced_lnb_csw_choices) - nim.advanced.lnb[x].fastDiseqc = ConfigYesNo(False) - nim.advanced.lnb[x].sequenceRepeat = ConfigYesNo(False) - nim.advanced.lnb[x].commandOrder1_0 = ConfigSelection(advanced_lnb_commandOrder1_0_choices, "ct") - nim.advanced.lnb[x].commandOrder = ConfigSelection(advanced_lnb_commandOrder_choices, "ct") - nim.advanced.lnb[x].uncommittedDiseqcCommand = ConfigSelection(advanced_lnb_ucsw_choices) - nim.advanced.lnb[x].diseqcRepeats = ConfigSelection(advanced_lnb_diseqc_repeat_choices, "none") - nim.advanced.lnb[x].longitude = ConfigFloat(default = [5,100], limits = [(0,359),(0,999)]) - nim.advanced.lnb[x].longitudeOrientation = ConfigSelection(longitude_orientation_choices, "east") - nim.advanced.lnb[x].latitude = ConfigFloat(default = [50,767], limits = [(0,359),(0,999)]) - nim.advanced.lnb[x].latitudeOrientation = ConfigSelection(latitude_orientation_choices, "north") - nim.advanced.lnb[x].powerMeasurement = ConfigYesNo(default=True) - nim.advanced.lnb[x].powerThreshold = ConfigInteger(default=hw.get_device_name() == "dm8000" and 15 or 50, limits=(0, 100)) - nim.advanced.lnb[x].turningSpeed = ConfigSelection(turning_speed_choices, "fast") - nim.advanced.lnb[x].fastTurningBegin = ConfigDateTime(default=advanced_lnb_fast_turning_btime, formatstring = _("%H:%M"), increment = 600) - nim.advanced.lnb[x].fastTurningEnd = ConfigDateTime(default=advanced_lnb_fast_turning_etime, formatstring = _("%H:%M"), increment = 600) - nim.advanced.lnb[x].prio = ConfigSelection(prio_list, "-1") + config_mode_choices = [ ("nothing", _("nothing connected")), + ("simple", _("simple")), ("advanced", _("advanced"))] + if len(nimmgr.getNimListOfType(slot.type, exception = x)) > 0: + config_mode_choices.append(("equal", _("equal to"))) + config_mode_choices.append(("satposdepends", _("second cable of motorized LNB"))) + if len(nimmgr.canConnectTo(x)) > 0: + config_mode_choices.append(("loopthrough", _("loopthrough to"))) + nim.advanced = ConfigNothing() + tmp = ConfigSelection(config_mode_choices, "nothing") + tmp.slot_id = x + tmp.addNotifier(configModeChanged, initial_call = False) + nim.configMode = tmp elif slot.isCompatible("DVB-C"): nim.configMode = ConfigSelection( choices = { diff --git a/lib/python/Components/ParentalControl.py b/lib/python/Components/ParentalControl.py index 8c8a3305..d68e01ff 100644 --- a/lib/python/Components/ParentalControl.py +++ b/lib/python/Components/ParentalControl.py @@ -33,7 +33,7 @@ def InitParentalControl(): config.ParentalControl.servicepin = ConfigSubList() - for i in range(3): + for i in (0, 1, 2): config.ParentalControl.servicepin.append(ConfigPIN(default = -1)) #config.ParentalControl.servicepin.append(configElement("config.ParentalControl.servicepin.level" + str(i), configSequence, "0000", configSequenceArg().get("PINCODE", (4, "")))) @@ -117,10 +117,7 @@ class ParentalControl: return -1 def getPinList(self): - pinList = [] - for x in config.ParentalControl.servicepin: - pinList.append(x.value) - return pinList + return [ x.value for x in config.ParentalControl.servicepin ] def servicePinEntered(self, service, result): # levelNeeded = 0 diff --git a/lib/python/Components/ParentalControlList.py b/lib/python/Components/ParentalControlList.py index 71912620..128e6d3e 100644 --- a/lib/python/Components/ParentalControlList.py +++ b/lib/python/Components/ParentalControlList.py @@ -8,8 +8,10 @@ from Tools.LoadPixmap import LoadPixmap lockPicture = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock.png")) def ParentalControlEntryComponent(service, name, locked = True): - res = [ (service, name, locked) ] - res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name)) + res = [ + (service, name, locked), + (eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name) + ] if locked: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture)) return res diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index 6e357cd0..fff5c475 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -96,9 +96,9 @@ class PluginComponent: res = [ ] for x in where: - for p in self.plugins.get(x, [ ]): - res.append(p) - return res + res.extend(self.plugins.get(x, [ ])) + + return res def getPluginsForMenu(self, menuid): res = [ ] diff --git a/lib/python/Components/PluginList.py b/lib/python/Components/PluginList.py index 63136cce..39c60ff7 100644 --- a/lib/python/Components/PluginList.py +++ b/lib/python/Components/PluginList.py @@ -7,40 +7,38 @@ from enigma import eListboxPythonMultiContent, gFont from Tools.LoadPixmap import LoadPixmap def PluginEntryComponent(plugin): - res = [ plugin ] - - res.append(MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=plugin.name)) - res.append(MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description)) - if plugin.icon is None: png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/plugin.png")) else: png = plugin.icon - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(100, 40), png = png)) - - return res + + return [ + plugin, + MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=plugin.name), + MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description), + MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(100, 40), png = png) + ] def PluginCategoryComponent(name, png): - res = [ name ] - - res.append(MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name)) - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png)) - - return res + return [ + name, + MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name), + MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png) + ] def PluginDownloadComponent(plugin, name): - res = [ plugin ] - - res.append(MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name)) - res.append(MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description)) - if plugin.icon is None: png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/plugin.png")) else: png = plugin.icon - res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png)) + + return [ + plugin, + MultiContentEntryText(pos=(120, 5), size=(320, 25), font=0, text=name), + MultiContentEntryText(pos=(120, 26), size=(320, 17), font=1, text=plugin.description), + MultiContentEntryPixmapAlphaTest(pos=(10, 0), size=(100, 50), png = png) + ] - return res class PluginList(MenuList): def __init__(self, list, enableWrapAround=False): diff --git a/lib/python/Components/Renderer/FrontpanelLed.py b/lib/python/Components/Renderer/FrontpanelLed.py index cd329b56..dcb9cd2f 100644 --- a/lib/python/Components/Renderer/FrontpanelLed.py +++ b/lib/python/Components/Renderer/FrontpanelLed.py @@ -2,9 +2,6 @@ from Components.Element import Element # this is not a GUI renderer. class FrontpanelLed(Element): - def __init__(self): - Element.__init__(self) - def changed(self, *args, **kwargs): if self.source.value or 1: pattern = 0x55555555 diff --git a/lib/python/Components/Renderer/Picon.py b/lib/python/Components/Renderer/Picon.py index de19c9aa..5ae43ed8 100644 --- a/lib/python/Components/Renderer/Picon.py +++ b/lib/python/Components/Renderer/Picon.py @@ -6,9 +6,9 @@ from enigma import ePixmap from Tools.Directories import fileExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename class Picon(Renderer): - searchPaths = ['/usr/share/enigma2/%s/', + searchPaths = ('/usr/share/enigma2/%s/', '/media/cf/%s/', - '/media/usb/%s/'] + '/media/usb/%s/') def __init__(self): Renderer.__init__(self) diff --git a/lib/python/Components/Scanner.py b/lib/python/Components/Scanner.py index 17c4aaa8..813c09f8 100644 --- a/lib/python/Components/Scanner.py +++ b/lib/python/Components/Scanner.py @@ -114,13 +114,10 @@ def scanDevice(mountpoint): # ...then remove with_subdir=False when same path exists # with with_subdirs=True - for p in set(paths_to_scan): + for p in paths_to_scan: if p.with_subdirs == True and ScanPath(path=p.path) in paths_to_scan: paths_to_scan.remove(ScanPath(path=p.path)) - # convert to list - paths_to_scan = list(paths_to_scan) - from Components.Harddisk import harddiskmanager blockdev = mountpoint.rstrip("/").rsplit('/',1)[-1] error, blacklisted, removable, is_cdrom, partitions, medium_found = harddiskmanager.getBlockDevInfo(blockdev) diff --git a/lib/python/Components/SelectionList.py b/lib/python/Components/SelectionList.py index a4f1d71a..08af7d02 100644 --- a/lib/python/Components/SelectionList.py +++ b/lib/python/Components/SelectionList.py @@ -6,8 +6,10 @@ from Tools.LoadPixmap import LoadPixmap selectionpng = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/selectioncross.png")) def SelectionEntryComponent(description, value, index, selected): - res = [ (description, value, index, selected) ] - res.append((eListboxPythonMultiContent.TYPE_TEXT, 30, 3, 500, 30, 0, RT_HALIGN_LEFT, description)) + res = [ + (description, value, index, selected), + (eListboxPythonMultiContent.TYPE_TEXT, 30, 3, 500, 30, 0, RT_HALIGN_LEFT, description) + ] if selected: res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 30, 30, selectionpng)) return res @@ -23,13 +25,11 @@ class SelectionList(MenuList): self.setList(self.list) def toggleSelection(self): - item = self.list[self.getSelectedIndex()][0] - self.list[self.getSelectedIndex()] = SelectionEntryComponent(item[0], item[1], item[2], not item[3]) + idx = self.getSelectedIndex() + item = self.list[idx][0] + self.list[idx] = SelectionEntryComponent(item[0], item[1], item[2], not item[3]) self.setList(self.list) def getSelectionsList(self): - list = [] - for item in self.list: - if item[0][3]: - list.append((item[0][0], item[0][1], item[0][2])) - return list + return [ (item[0][0], item[0][1], item[0][2]) for item in self.list if item[0][3] ] + diff --git a/lib/python/Components/Sources/List.py b/lib/python/Components/Sources/List.py index dbe442d1..1eab32b2 100644 --- a/lib/python/Components/Sources/List.py +++ b/lib/python/Components/Sources/List.py @@ -27,7 +27,7 @@ to generate HTML.""" def entry_changed(self, index): if not self.disable_callbacks: - self.downstream_elements.entry_changed(self, index) + self.downstream_elements.entry_changed(index) def modifyEntry(self, index, data): self.__list[index] = data diff --git a/lib/python/Components/Sources/RdsDecoder.py b/lib/python/Components/Sources/RdsDecoder.py index 3ec9a25d..26a3e5a7 100644 --- a/lib/python/Components/Sources/RdsDecoder.py +++ b/lib/python/Components/Sources/RdsDecoder.py @@ -23,7 +23,7 @@ class RdsDecoder(PerServiceBase, Source, object): decoder = property(getDecoder) def gotEvent(self, what): - if what in [iPlayableService.evStart, iPlayableService.evEnd]: + if what in (iPlayableService.evStart, iPlayableService.evEnd): self.changed((self.CHANGED_CLEAR,)) else: self.changed((self.CHANGED_SPECIFIC, what)) diff --git a/lib/python/Components/TimerList.py b/lib/python/Components/TimerList.py index a237c364..44a7eb4f 100644 --- a/lib/python/Components/TimerList.py +++ b/lib/python/Components/TimerList.py @@ -21,7 +21,7 @@ class TimerList(HTMLComponent, GUIComponent, object): res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 30, width, 20, 1, RT_HALIGN_LEFT|RT_VALIGN_CENTER, timer.name)) repeatedtext = "" - days = [ _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ] + days = ( _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat"), _("Sun") ) if timer.repeated: flags = timer.repeated count = 0 @@ -93,7 +93,7 @@ class TimerList(HTMLComponent, GUIComponent, object): def getCurrentIndex(self): return self.instance.getCurrentIndex() - currentIndex = property(moveToIndex, getCurrentIndex) + currentIndex = property(getCurrentIndex, moveToIndex) currentSelection = property(getCurrent) def moveDown(self): diff --git a/lib/python/Components/TimerSanityCheck.py b/lib/python/Components/TimerSanityCheck.py index cf505022..c0ca10fa 100644 --- a/lib/python/Components/TimerSanityCheck.py +++ b/lib/python/Components/TimerSanityCheck.py @@ -135,8 +135,7 @@ class TimerSanityCheck: self.nrep_eventlist.extend([(new_event_begin, self.bflag, event[1]),(new_event_end, self.eflag, event[1])]) else: offset_0 = 345600 # the Epoch begins on Thursday - weeks = 2 # test two weeks to take care of Sunday-Monday transitions - for cnt in range(weeks): + for cnt in (0, 1): # test two weeks to take care of Sunday-Monday transitions for event in self.rep_eventlist: if event[1] == -1: # -1 is the identifier of the changed timer event_begin = self.newtimer.begin diff --git a/lib/python/Components/Timezones.py b/lib/python/Components/Timezones.py index f3e24ee6..7f709159 100644 --- a/lib/python/Components/Timezones.py +++ b/lib/python/Components/Timezones.py @@ -52,11 +52,8 @@ class Timezones: e_tzset() def getTimezoneList(self): - list = [] - for x in self.timezones: - list.append(str(x[0])) - return list - + return [ str(x[0]) for x in self.timezones ] + def getDefaultTimezone(self): # TODO return something more useful - depending on country-settings? t = "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Vienna" diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py index de7b0098..e3b7d9e3 100644 --- a/lib/python/Components/TuneTest.py +++ b/lib/python/Components/TuneTest.py @@ -4,8 +4,8 @@ class Tuner: def __init__(self, frontend): self.frontend = frontend - # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation) - # 0 1 2 3 4 5 6 7 + # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation, rolloff, pilot, tsid, onid) + # 0 1 2 3 4 5 6 7 8 9 10 11 def tune(self, transponder): if self.frontend: print "tuning to transponder with data", transponder @@ -102,8 +102,8 @@ class TuneTest: pidsFailed = False if self.checkPIDs: if self.currTuned is not None: - if self.tsid != self.currTuned[8] or self.onid != self.currTuned[9]: - self.failedTune.append([self.currTuned, self.oldTuned, "pids_failed", {"real": (self.tsid, self.onid), "expected": (self.currTuned[8], self.currTuned[9])}]) + if self.tsid != self.currTuned[10] or self.onid != self.currTuned[11]: + self.failedTune.append([self.currTuned, self.oldTuned, "pids_failed", {"real": (self.tsid, self.onid), "expected": (self.currTuned[10], self.currTuned[11])}]) pidsFailed = True else: self.successfullyTune.append([self.currTuned, self.oldTuned]) @@ -140,7 +140,7 @@ class TuneTest: # check for tsid != -1 and onid != -1 print "index:", index print "len(self.transponderlist):", len(self.transponderlist) - while (index < len(self.transponderlist) and (self.transponderlist[index][8] == -1 or self.transponderlist[index][9] == -1)): + while (index < len(self.transponderlist) and (self.transponderlist[index][10] == -1 or self.transponderlist[index][11] == -1)): index += 1 print "FirstTransponder final index:", index return index @@ -153,7 +153,7 @@ class TuneTest: # check for tsid != -1 and onid != -1 print "index:", index print "len(self.transponderlist):", len(self.transponderlist) - while (index < len(self.transponderlist) and (self.transponderlist[index][8] == -1 or self.transponderlist[index][9] == -1)): + while (index < len(self.transponderlist) and (self.transponderlist[index][10] == -1 or self.transponderlist[index][11] == -1)): index += 1 print "next transponder index:", index @@ -203,8 +203,8 @@ class TuneTest: self.progressCallback((self.getProgressLength(), self.tuningtransponder, self.STATUS_START, self.currTuned)) self.timer.start(100, True) - # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, <system>, <modulation>, <tsid>, <onid>) - # 0 1 2 3 4 5 6 7 8 9 + # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, <system>, <modulation>, <rolloff>, <pilot>, <tsid>, <onid>) + # 0 1 2 3 4 5 6 7 8 9 10 11 def addTransponder(self, transponder): self.transponderlist.append(transponder) diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index a6d34152..c810e14b 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -279,8 +279,8 @@ class ConfigSelection(ConfigElement): if default is None: default = self.choices.default() + self._descr = None self.default = self._value = self.last_value = default - self.changed() def setChoices(self, choices, default = None): self.choices = choicesList(choices) @@ -296,6 +296,7 @@ class ConfigSelection(ConfigElement): self._value = value else: self._value = self.default + self._descr = None self.changed() def tostring(self, val): @@ -307,7 +308,7 @@ class ConfigSelection(ConfigElement): def setCurrentText(self, text): i = self.choices.index(self.value) self.choices[i] = text - self.description[text] = text + self._descr = self.description[text] = text self._value = text value = property(getValue, setValue) @@ -336,13 +337,18 @@ class ConfigSelection(ConfigElement): self.value = self.choices[(i + 1) % nchoices] def getText(self): - descr = self.description[self.value] + if self._descr is not None: + return self._descr + descr = self._descr = self.description[self.value] if descr: return _(descr) return descr def getMulti(self, selected): - descr = self.description[self.value] + if self._descr is not None: + descr = self._descr + else: + descr = self._descr = self.description[self.value] if descr: return ("text", _(descr)) return ("text", descr) @@ -378,7 +384,7 @@ class ConfigBoolean(ConfigElement): self.value = self.last_value = self.default = default def handleKey(self, key): - if key in [KEY_LEFT, KEY_RIGHT]: + if key in (KEY_LEFT, KEY_RIGHT): self.value = not self.value elif key == KEY_HOME: self.value = False @@ -1022,6 +1028,13 @@ class ConfigNumber(ConfigText): value = property(getValue, setValue) _value = property(getValue, setValue) + def isChanged(self): + sv = self.saved_value + strv = self.tostring(self.value) + if sv is None and strv == self.default: + return False + return strv != sv + def conform(self): pos = len(self.text) - self.marked_pos self.text = self.text.lstrip("0") @@ -1180,7 +1193,7 @@ class ConfigSet(ConfigElement): self.pos = -1 else: self.pos += 1 - elif key in [KEY_HOME, KEY_END]: + elif key in (KEY_HOME, KEY_END): self.pos = -1 def genString(self, lst): @@ -1345,7 +1358,7 @@ class ConfigLocations(ConfigElement): self.pos += 1 if self.pos >= len(self.value): self.pos = -1 - elif key in [KEY_HOME, KEY_END]: + elif key in (KEY_HOME, KEY_END): self.pos = -1 def getText(self): @@ -1607,8 +1620,9 @@ class Config(ConfigSubsection): self.setSavedValue(tree["config"]) def saveToFile(self, filename): + text = self.pickle() f = open(filename, "w") - f.write(self.pickle()) + f.write(text) f.close() def loadFromFile(self, filename): diff --git a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml index 741d9eb6..ae4fbb4b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml +++ b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml @@ -33,7 +33,7 @@ <map context="CutListEditorActions"> <!-- <key id="KEY_NEXT" mapto="setIn" flags="m" /> <key id="KEY_PREVIOUS" mapto="setOut" flags="m" /> --> - <key id="KEY_0" mapto="setMark" flags="m" /> +<!-- <key id="KEY_0" mapto="setMark" flags="m" /> --> <!-- <key id="KEY_CHANNELUP" mapto="addMark" flags="m" /> <key id="KEY_CHANNELDOWN" mapto="removeMark" flags="m" /> --> <key id="KEY_EXIT" mapto="leave" flags="m" /> diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 1ef15a53..ed7cfb70 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -317,7 +317,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_ENDCUT: # remove in/out marks between the new cut for (where, what) in self.cut_list[:]: - if self.cut_start <= where <= self.context_position and what in [0,1]: + if self.cut_start <= where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) bisect.insort(self.cut_list, (self.cut_start, 1)) @@ -350,7 +350,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEBEFORE: # remove in/out marks before current position for (where, what) in self.cut_list[:]: - if where <= self.context_position and what in [0,1]: + if where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'in' point bisect.insort(self.cut_list, (self.context_position, 0)) @@ -358,7 +358,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEAFTER: # remove in/out marks after current position for (where, what) in self.cut_list[:]: - if where >= self.context_position and what in [0,1]: + if where >= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'out' point bisect.insort(self.cut_list, (self.context_position, 1)) diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index d0c9d3c6..6d9a4491 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -372,11 +372,11 @@ class CheckDiskspaceTask(Task): self.finish(aborted = True) def run(self, callback): + self.callback = callback failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) return - self.callback = callback Task.processFinished(self, 0) class PreviewTask(Task): diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index 7407263d..a8888da3 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -18,11 +18,12 @@ class FileBrowser(Screen, HelpableScreen): <screen name="FileBrowser" position="100,100" size="520,376" title="DVD File Browser" > <widget name="filelist" position="0,0" size="520,376" scrollbarMode="showOnDemand" /> </screen>""" - def __init__(self, session, scope, settings): + def __init__(self, session, scope, configRef): Screen.__init__(self, session) HelpableScreen.__init__(self) self.scope = scope pattern = "" + self.configRef = configRef currDir = "/" if self.scope == "project": currDir = self.getDir() @@ -31,19 +32,19 @@ class FileBrowser(Screen, HelpableScreen): currDir = self.getDir() pattern = "(?i)^.*\.(ddvdm\.xml)" if self.scope == "menubg": - currDir = self.getDir(settings.menubg) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)" elif self.scope == "menuaudio": - currDir = self.getDir(settings.menuaudio) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mp2|m2a|ac3)" elif self.scope == "vmgm": - currDir = self.getDir(settings.vmgm) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mpg|mpeg)" elif self.scope == "font_face": - currDir = self.getDir(settings.font_face, resolveFilename(SCOPE_FONTS)) + currDir = self.getDir(configRef.getValue(), resolveFilename(SCOPE_FONTS)) pattern = "(?i)^.*\.(ttf)" elif self.scope == "isopath": - currDir = settings.isopath.getValue() + currDir = configRef.getValue() elif self.scope == "image": currDir = resolveFilename(SCOPE_HDD) pattern = "(?i)^.*\.(iso)" @@ -57,11 +58,9 @@ class FileBrowser(Screen, HelpableScreen): "cancel": self.exit }) - def getDir(self, key=None, defaultDir=None): - if key: - settingDir = key.getValue() - if len(settingDir) > 1: - return (settingDir.rstrip("/").rsplit("/",1))[0] + def getDir(self, currentVal=None, defaultDir=None): + if currentVal: + return (currentVal.rstrip("/").rsplit("/",1))[0] return defaultDir or (resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") def ok(self): @@ -70,15 +69,15 @@ class FileBrowser(Screen, HelpableScreen): if self.scope == "image": path = self["filelist"].getCurrentDirectory() or "" if fileExists(path+"VIDEO_TS"): - self.close(path,self.scope) + self.close(path,self.scope,self.configRef) else: ret = self["filelist"].getCurrentDirectory() + '/' + self["filelist"].getFilename() - self.close(ret,self.scope) + self.close(ret,self.scope,self.configRef) def exit(self): if self.scope == "isopath": - self.close(self["filelist"].getCurrentDirectory(),self.scope) - self.close(None,False) + self.close(self["filelist"].getCurrentDirectory(),self.scope,self.configRef) + self.close(None,False,None) class ProjectSettings(Screen,ConfigListScreen): skin = """ @@ -102,18 +101,21 @@ class ProjectSettings(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText(_("Load")) - self["key_blue"] = StaticText(_("Save")) + if config.usage.setup_level.index >= 2: # expert+ + self["key_blue"] = StaticText(_("Save")) + else: + self["key_blue"] = StaticText() - infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + if config.usage.setup_level.index >= 2: # expert+ + infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + else: + infotext = "" self["info"] = StaticText(infotext) + self.keydict = {} self.settings = project.settings ConfigListScreen.__init__(self, []) self.initConfigList() - - self.keydict = {} - for key, val in self.settings.dict().iteritems(): - self.keydict[val] = key self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], { @@ -141,9 +143,10 @@ class ProjectSettings(Screen,ConfigListScreen): self.list.append(getConfigListEntry(_("ISO path"), self.settings.isopath)) if authormode.startswith("menu"): self.list.append(getConfigListEntry(_("Menu")+' '+_("template file"), self.settings.menutemplate)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("headline")+' '+_("color"), self.settings.color_headline)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("text")+' '+_("color"), self.settings.color_button)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("highlighted button")+' '+_("color"), self.settings.color_highlight)) @@ -151,14 +154,20 @@ class ProjectSettings(Screen,ConfigListScreen): #self.list.append(getConfigListEntry(_("Font size")+' ('+_("headline")+', '+_("Title")+', '+_("Subtitles")+')', self.settings.font_size)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("spaces (top, between rows, left)"), self.settings.space)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("Audio"), self.settings.menuaudio)) - if authormode != "data_ts": - self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) - if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": - self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) - else: - self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) + if config.usage.setup_level.index >= 2: # expert+ + if authormode != "data_ts": + self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) + if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": + self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) + else: + self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) self["config"].setList(self.list) + self.keydict = {} + for key, val in self.settings.dict().iteritems(): + self.keydict[val] = key + for key, val in self.project.menutemplate.settings.dict().iteritems(): + self.keydict[val] = key def keyLeft(self): ConfigListScreen.keyLeft(self) @@ -182,8 +191,9 @@ class ProjectSettings(Screen,ConfigListScreen): def ok(self): key = self.keydict[self["config"].getCurrent()[1]] - if key in self.project.filekeys: - self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self.settings) + from DVDProject import ConfigFilename + if type(self["config"].getCurrent()[1]) == ConfigFilename: + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self["config"].getCurrent()[1]) def cancel(self): self.close(False) @@ -192,26 +202,30 @@ class ProjectSettings(Screen,ConfigListScreen): self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, "project", self.settings) def saveProject(self): - self.applySettings() - ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") - if ret.startswith: - text = _("Save")+' '+_('OK')+':\n'+ret - self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) - else: - text = _("Save")+' '+_('Error') - self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) + if config.usage.setup_level.index >= 2: # expert+ + self.applySettings() + ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") + if ret.startswith: + text = _("Save")+' '+_('OK')+':\n'+ret + self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) + else: + text = _("Save")+' '+_('Error') + self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) - def FileBrowserClosed(self, path, scope): + def FileBrowserClosed(self, path, scope, configRef): if scope == "menutemplate": - if not self.project.menutemplate.loadTemplate(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) - else: + if self.project.menutemplate.loadTemplate(path): print "[ProjectSettings] menu template loaded" - - if scope in self.project.filekeys: - self.settings.dict()[scope].setValue(path) - elif scope == "project": - if not self.project.loadProject(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + configRef.setValue(path) + self.initConfigList() else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope == "project": + if self.project.loadProject(path): + configRef.setValue(path) self.initConfigList() + else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope: + configRef.setValue(path) + self.initConfigList() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 749f80eb..fd4c7134 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -44,7 +44,7 @@ class TitleList(Screen, HelpableScreen): "titleProperties": (self.titleProperties, _("Properties of current title"), _("Title properties")), "removeCurrentTitle": (self.removeCurrentTitle, _("Remove currently selected title"), _("Remove title")), "settings": (self.settings, _("Collection settings"), _("Settings")), - "burnProject": (self.burnProject, _("Burn DVD"), _("Burn DVD")), + "burnProject": (self.askBurnProject, _("Burn DVD"), _("Burn DVD")), }) self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions", @@ -57,9 +57,9 @@ class TitleList(Screen, HelpableScreen): "cancel": self.leave }) - self["key_red"] = StaticText(_("Remove title")) + self["key_red"] = StaticText() self["key_green"] = StaticText(_("Add title")) - self["key_yellow"] = StaticText(_("Title properties")) + self["key_yellow"] = StaticText() self["key_blue"] = StaticText(_("Settings")) self["title_label"] = StaticText() @@ -74,6 +74,7 @@ class TitleList(Screen, HelpableScreen): self["titles"] = List(list = [ ], enableWrapAround = True, item_height=30, fonts = [gFont("Regular", 20)]) self.updateTitleList() + self.previous_size = 0 def checkBackgroundJobs(self): for job in job_manager.getPendingJobs(): @@ -90,19 +91,16 @@ class TitleList(Screen, HelpableScreen): if self.backgroundJob: j = self.backgroundJob menu.append(("%s: %s (%d%%)" % (j.getStatustext(), j.name, int(100*j.progress/float(j.end))), self.showBackgroundJob)) + menu.append((_("DVD media toolbox"), self.toolbox)) + menu.append((_("Preview menu"), self.previewMenu)) if self.project.settings.output.getValue() == "dvd": - menu.append((_("Burn DVD"), self.burnProject)) + if len(self["titles"].list): + menu.append((_("Burn DVD"), self.burnProject)) elif self.project.settings.output.getValue() == "iso": menu.append((_("Create DVD-ISO"), self.burnProject)) menu.append((_("Burn existing image to DVD"), self.selectImage)) - menu.append((_("DVD media toolbox"), self.toolbox)) - menu.append((_("Preview menu"), self.previewMenu)) - menu.append((_("Collection settings"), self.settings)) - menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Edit chapters of current title"), self.editTitle)) - menu.append((_("Properties of current title"), self.titleProperties)) - menu.append((_("Add a new title"), self.addTitle)) - menu.append((_("Remove title"), self.removeCurrentTitle)) + menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Exit"), self.leave)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) @@ -199,7 +197,13 @@ class TitleList(Screen, HelpableScreen): self["error_label"].show() return False - def burnProject(self): + def askBurnProject(self): + if len(self["titles"].list): + self.session.openWithCallback(self.burnProject,MessageBox,text = _("Do you want to burn this collection to DVD medium?"), type = MessageBox.TYPE_YESNO) + + def burnProject(self, answer=True): + if not answer: + return if self.project.settings.authormode.getValue() == "data_ts": job = Process.DVDdataJob(self.project) job_manager.AddJob(job) @@ -211,7 +215,7 @@ class TitleList(Screen, HelpableScreen): job_manager.in_background = False self.session.openWithCallback(self.JobViewCB, JobView, job) - def burnISO(self, path, scope): + def burnISO(self, path, scope, configRef): if path: job = Process.DVDisoJob(self.project, path) job_manager.AddJob(job) @@ -235,6 +239,12 @@ class TitleList(Screen, HelpableScreen): totalsize += title.estimatedDiskspace self["titles"].list = res self.updateSize(totalsize) + if len(res): + self["key_red"].text = _("Remove title") + self["key_yellow"].text = _("Title properties") + else: + self["key_red"].text = "" + self["key_yellow"].text = "" def updateSize(self, totalsize): size = int((totalsize/1024)/1024) @@ -244,14 +254,19 @@ class TitleList(Screen, HelpableScreen): percent = 100 * size / float(max_DL) self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + if self.previous_size < max_DL: + self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > max_SL: percent = 100 * size / float(max_DL) self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + if self.previous_size < max_SL: + self.session.open(MessageBox,text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), type = MessageBox.TYPE_INFO) elif size < max_SL: percent = 100 * size / float(max_SL) self["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + self.previous_size = size def getCurrentTitle(self): t = self["titles"].getCurrent() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 63ae6c1f..1c2099fb 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -72,19 +72,19 @@ class TitleProperties(Screen,ConfigListScreen): self.list.append(getConfigListEntry("DVD " + _("Track"), self.properties.position)) self.list.append(getConfigListEntry("DVD " + _("Title"), self.properties.menutitle)) self.list.append(getConfigListEntry("DVD " + _("Description"), self.properties.menusubtitle)) - for audiotrack in self.properties.audiotracks: - DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() - self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) - if audiotrack.active.getValue(): - self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) - self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) - - self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) - if self.properties.aspect.getValue() == "16:9": - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) - else: - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) - + if config.usage.setup_level.index >= 2: # expert+ + for audiotrack in self.properties.audiotracks: + DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() + self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) + if audiotrack.active.getValue(): + self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) + self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) + + self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) + if self.properties.aspect.getValue() == "16:9": + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) + else: + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) if len(title.chaptermarks) == 0: self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.properties.autochapter)) infotext = "DVB " + _("Title") + ': ' + title.DVBname + "\n" + _("Description") + ': ' + title.DVBdescr + "\n" + _("Channel") + ': ' + title.DVBchannel + '\n' + _("Begin time") + title.formatDVDmenuText(": $D.$M.$Y, $T\n", self.title_idx+1) @@ -154,7 +154,7 @@ class LanguageChoices(): if len(key) == 2: self.langdict[key] = val[0] for key, val in self.langdict.iteritems(): - if key not in [syslang, 'en']: + if key not in (syslang, 'en'): self.langdict[key] = val self.choices.append((key, val)) self.choices.sort() @@ -164,8 +164,7 @@ class LanguageChoices(): def getLanguage(self, DVB_lang): DVB_lang = DVB_lang.lower() - stripwords = ["stereo", "audio", "description", "2ch", "dolby digital"] - for word in stripwords: + for word in ("stereo", "audio", "description", "2ch", "dolby digital"): DVB_lang = DVB_lang.replace(word,"").strip() for key, val in LanguageCodes.iteritems(): if DVB_lang.find(key.lower()) == 0: @@ -183,4 +182,4 @@ class LanguageChoices(): return key return "nolang" -languageChoices = LanguageChoices()
\ No newline at end of file +languageChoices = LanguageChoices() diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 29076cea..45f438da 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -12,5 +12,6 @@ def main_add(session, service, **kwargs): dvdburn.selectedSource(service) def Plugins(**kwargs): - return [PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), - PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] + descr = _("Burn to DVD...") + return [PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), + PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 8e2a9f3a..ebcf4f81 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -14,6 +14,7 @@ from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.config import config from Tools.Directories import pathExists, fileExists from Components.Harddisk import harddiskmanager +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier import servicedvd # load c++ part of dvd player plugin @@ -345,28 +346,15 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP }) self.onClose.append(self.__onClose) - self.physicalDVD = False - self.dvd_device = None + hotplugNotifier.append(self.hotplugCB) + if dvd_device: - self.dvd_device = dvd_device - self.physicalDVD = True + self.physicalDVD = True else: - devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) - if pathExists(devicepath): - from Components.Scanner import scanDevice - res = scanDevice(devicepath) - list = [ (r.description, r, res[r], self.session) for r in res ] - if list: - (desc, scanner, files, session) = list[0] - for file in files: - print file - if file.mimetype == "video/x-dvd": - self.dvd_device = devicepath - print "physical dvd found:", self.dvd_device - self.physicalDVD = True + self.scanHotplug() self.dvd_filelist = dvd_filelist - self.onFirstExecBegin.append(self.showFileBrowser) + self.onFirstExecBegin.append(self.opened) self.service = None self.in_menu = False @@ -511,8 +499,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def askLeavePlayer(self): choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] - if not self.physicalDVD: + if True or not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) + if self.physicalDVD and not self.session.nav.getCurrentlyPlayingServiceReference().toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): + choices.insert(0,(_("Play DVD"), "playPhysical" )) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) def sendKey(self, key): @@ -581,23 +571,22 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def keyCancel(self): self.askLeavePlayer() - def showFileBrowser(self): - if self.physicalDVD and len(self.dvd_filelist) == 0: - if self.dvd_device == harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()): - self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) - else: - self.DVDdriveCB(True) - elif len(self.dvd_filelist) == 1: + def opened(self): + if len(self.dvd_filelist) == 1: + # opened via autoplay self.FileBrowserClosed(self.dvd_filelist[0]) + elif self.physicalDVD: + # opened from menu with dvd in drive + self.session.openWithCallback(self.playPhysicalCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) else: + # opened from menu without dvd in drive self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist) - - def DVDdriveCB(self, answer): + + def playPhysicalCB(self, answer): if answer == True: - self.FileBrowserClosed(self.dvd_device) + self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) - self.physicalDVD = False def FileBrowserClosed(self, val): curref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -627,13 +616,18 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP #else if self.service: self.service = None - self.showFileBrowser() + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) + if answer[1] == "playPhysical": + if self.service: + self.service = None + self.playPhysicalCB(True) else: pass def __onClose(self): self.restore_infobar_seek_config() self.session.nav.playService(self.oldService) + hotplugNotifier.remove(self.hotplugCB) def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point @@ -660,6 +654,30 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def calcRemainingTime(self): return 0 + def hotplugCB(self, dev, media_state): + print "[hotplugCB]", dev, media_state + if dev == harddiskmanager.getCD(): + if media_state == "1": + self.scanHotplug() + else: + self.physicalDVD = False + + def scanHotplug(self): + devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) + if pathExists(devicepath): + from Components.Scanner import scanDevice + res = scanDevice(devicepath) + list = [ (r.description, r, res[r], self.session) for r in res ] + if list: + (desc, scanner, files, session) = list[0] + for file in files: + print file + if file.mimetype == "video/x-dvd": + print "physical dvd found:", devicepath + self.physicalDVD = True + return + self.physicalDVD = False + def main(session, **kwargs): session.open(DVDPlayer) @@ -705,7 +723,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "DVD", - description = "Play DVD", + description = _("Play DVD"), openfnc = filescan_open, )] diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index c2590af5..e35f2807 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -103,7 +103,10 @@ eServiceDVD::eServiceDVD(const char *filename): // create handle ddvd_set_dvd_path(m_ddvdconfig, filename); ddvd_set_ac3thru(m_ddvdconfig, 0); - ddvd_set_language(m_ddvdconfig, "de"); + + std::string ddvd_language; + if (!ePythonConfigQuery::getConfigValue("config.osd.language", ddvd_language)) + ddvd_set_language(m_ddvdconfig, (ddvd_language.substr(0,2)).c_str()); int fd = open("/proc/stb/video/aspect", O_RDONLY); if (fd > -1) diff --git a/lib/python/Plugins/Extensions/FileManager/plugin.py b/lib/python/Plugins/Extensions/FileManager/plugin.py index 12389813..62c9e7b2 100644 --- a/lib/python/Plugins/Extensions/FileManager/plugin.py +++ b/lib/python/Plugins/Extensions/FileManager/plugin.py @@ -59,5 +59,6 @@ def main(session, **kwargs): session.open(FileManager) def Plugins(**kwargs): - return [PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), - PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] + descr = _("Lets you view/edit files in your Dreambox") + return [PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 3e023841..e8504ff0 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -148,7 +148,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.player.show() return NumberActionMap.action(self, contexts, action) - self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { "ok": (self.ok, _("add file to playlist")), @@ -224,7 +223,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, - iPlayableService.evUser+11: self.__evDecodeError, + iPlayableService.evUser+10: self.__evAudioDecodeError, + iPlayableService.evUser+11: self.__evVideoDecodeError, iPlayableService.evUser+12: self.__evPluginError, iPlayableService.evUser+13: self["coverArt"].embeddedCoverArt }) @@ -268,11 +268,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB print "[__evUpdatedInfo] title %d of %d (%s)" % (currenttitle, totaltitles, sTitle) self.readTitleInformation() - def __evDecodeError(self): + def __evAudioDecodeError(self): + currPlay = self.session.nav.getCurrentService() + sAudioType = currPlay.info().getInfoString(iServiceInformation.sUser+10) + print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sAudioType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sAudioType, type = MessageBox.TYPE_INFO,timeout = 20 ) + + def __evVideoDecodeError(self): currPlay = self.session.nav.getCurrentService() sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType) - print "[__evDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) - self.session.open(MessageBox, _("This Dreambox can't decode %s video streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) + print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) def __evPluginError(self): currPlay = self.session.nav.getCurrentService() @@ -379,7 +385,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.updateCurrentInfo() def showAfterSeek(self): - self.show() + pass def showAfterCuesheetOperation(self): self.show() @@ -984,7 +990,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Movie", - description = "View Movies...", + description = _("View Movies..."), openfnc = filescan_open, ), Scanner(mimetypes = ["video/x-vcd"], @@ -994,7 +1000,7 @@ def filescan(**kwargs): ScanPath(path = "MPEGAV", with_subdirs = False), ], name = "Video CD", - description = "View Video CD...", + description = _("View Video CD..."), openfnc = filescan_open, ), Scanner(mimetypes = ["audio/mpeg", "audio/x-wav", "application/ogg", "audio/x-flac"], @@ -1003,7 +1009,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Music", - description = "Play Music...", + description = _("Play Music..."), openfnc = filescan_open, )] try: @@ -1015,7 +1021,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Audio-CD", - description = "Play Audio-CD...", + description = _("Play Audio-CD..."), openfnc = audioCD_open, )) return mediatypes diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index 2c31197d..0cefa353 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -23,16 +23,16 @@ def mountpoint_choosen(option): list = [ (r.description, r, res[r], session) for r in res ] - if list == [ ]: + if not list: from Screens.MessageBox import MessageBox if access(mountpoint, F_OK|R_OK): - session.open(MessageBox, "No displayable files on this medium found!", MessageBox.TYPE_ERROR) + session.open(MessageBox, _("No displayable files on this medium found!"), MessageBox.TYPE_ERROR) else: print "ignore", mountpoint, "because its not accessible" return session.openWithCallback(execute, ChoiceBox, - title = "The following files were found...", + title = _("The following files were found..."), list = list) def scan(session): @@ -41,7 +41,7 @@ def scan(session): from Components.Harddisk import harddiskmanager parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] - if len(parts): + if parts: for x in parts: if not access(x[1], F_OK|R_OK): parts.remove(x) @@ -91,7 +91,7 @@ def autostart(reason, **kwargs): def Plugins(**kwargs): return [ - PluginDescriptor(name="MediaScanner", description="Scan Files...", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="MediaScanner", description=_("Scan Files..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), # PluginDescriptor(where = PluginDescriptor.WHERE_MENU, fnc=menuHook), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index 05adb633..10e4e514 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -586,7 +586,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Pictures", - description = "View Photos...", + description = _("View Photos..."), openfnc = filescan_open, ) diff --git a/lib/python/Plugins/Extensions/SocketMMI/plugin.py b/lib/python/Plugins/Extensions/SocketMMI/plugin.py index 4eadf2ea..387c8306 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/plugin.py +++ b/lib/python/Plugins/Extensions/SocketMMI/plugin.py @@ -22,6 +22,6 @@ def autostart(reason, **kwargs): socketHandler = SocketMMIMessageHandler() def Plugins(**kwargs): - return [ PluginDescriptor(name = "SocketMMI", description = "Python frontend for /tmp/mmi.socket", where = PluginDescriptor.WHERE_MENU, fnc = menu), + return [ PluginDescriptor(name = "SocketMMI", description = _("Python frontend for /tmp/mmi.socket"), where = PluginDescriptor.WHERE_MENU, fnc = menu), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ] diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index 53e7b0b8..d7fc6898 100644..100755 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -49,6 +49,9 @@ class PluginDescriptor: # or return a function which is called with session and the interface name for extended setup of this interface WHERE_EVENTINFO = 11 + # reason (True: Networkconfig read finished, False: Networkconfig reload initiated ) + WHERE_NETWORKCONFIG_READ = 12 + def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False): self.name = name self.internal = internal diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE new file mode 100644 index 00000000..99700593 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE @@ -0,0 +1,12 @@ +This plugin is licensed under the Creative Commons +Attribution-NonCommercial-ShareAlike 3.0 Unported +License. To view a copy of this license, visit +http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + +Alternatively, this plugin may be distributed and executed on hardware which +is licensed by Dream Multimedia GmbH. + +This plugin is NOT free software. It is open source, you are allowed to +modify it (if you keep the license), but it may not be commercially +distributed other than under the conditions noted above. diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am new file mode 100644 index 00000000..562b1491 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am @@ -0,0 +1,6 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/CommonInterfaceAssignment + +install_PYTHON = \ + __init__.py \ + plugin.py + diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py new file mode 100644 index 00000000..4c8167d4 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py @@ -0,0 +1,630 @@ +from Screens.Screen import Screen +from Screens.ChannelSelection import * +from Components.ActionMap import HelpableActionMap, ActionMap, NumberActionMap +from Components.Sources.List import List +from Components.Sources.StaticText import StaticText +from Components.config import ConfigNothing +from Components.ConfigList import ConfigList +from Components.Label import Label +from Components.SelectionList import SelectionList +from Components.MenuList import MenuList +from ServiceReference import ServiceReference +from Plugins.Plugin import PluginDescriptor +from xml.etree.cElementTree import parse as ci_parse +from Tools.XMLTools import elementsWithTag, mergeText, stringToXML +from enigma import eDVBCI_UI, eDVBCIInterfaces + +from os import system, path as os_path + +class CIselectMainMenu(Screen): + skin = """ + <screen position="205,150" size="310,270" title="CI Assignment" > + <widget name="CiList" position="10,10" size="290,200" scrollbarMode="showOnDemand" /> + <ePixmap position="10,210" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,220" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,220" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, args = 0): + self.skin = CIselectMainMenu.skin + Screen.__init__(self, session) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Config")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "ok": self.greenPressed, + "cancel": self.cancel + }, -1) + + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + + print "[CI_Wizzard] FOUND %d CI Slots " % NUM_CI + + self.dlg = None + self.state = { } + self.list = [ ] + if NUM_CI > 0: + for slot in range(NUM_CI): + state = eDVBCI_UI.getInstance().getState(slot) + if state == 0: + appname = _("Slot %d") %(slot+1) + " - " + _("no module") + elif state == 1: + appname = _("Slot %d") %(slot+1) + " - " + _("init modules") + elif state == 2: + appname = _("Slot %d") %(slot+1) + " - " + eDVBCI_UI.getInstance().getAppName(slot) + self.list.append( (appname, ConfigNothing(), 0, slot) ) + else: + self.list.append( (_("no CI slots found") , ConfigNothing(), 1, -1) ) + + menuList = ConfigList(self.list) + menuList.list = self.list + menuList.l.setList(self.list) + self["CiList"] = menuList + + def greenPressed(self): + cur = self["CiList"].getCurrent() + if cur and len(cur) > 2: + action = cur[2] + slot = cur[3] + if action == 1: + print "[CI_Wizzard] there is no CI Slot in your receiver" + else: + print "[CI_Wizzard] selected CI Slot : %d" % slot + if config.usage.setup_level.index > 1: # advanced + self.session.open(CIconfigMenu, slot) + else: + self.session.open(easyCIconfigMenu, slot) + + def yellowPressed(self): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Check] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + for ci in range(NUM_CI): + print eDVBCIInterfaces.getInstance().getDescrambleRules(ci) +# else: +# print "no ci found" + + def redPressed(self): + print "[CI_Config] RED BUTTON not implemented yet - only use self.cancel()" + self.cancel() + + def cancel(self): + self.close() + +class CIconfigMenu(Screen): + skin = """ + <screen position="60,80" size="595,436" title="CI Assignment" > + <widget name="CAidList.desc" position="10,10" size="575,22" font="Regular;20" /> + <widget name="CAidList" position="10,40" size="575,45" font="Regular;20" /> + <widget name="ServiceList.desc" position="10,90" size="575,22" font="Regular;20" /> + <widget name="ServiceList" position="10,120" size="575,250" scrollbarMode="showOnDemand" /> + <ePixmap position="10,380" size="575,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="155,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="445,390" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="155,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="300,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_blue" render="Label" position="445,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + self.skin = CIconfigMenu.skin + Screen.__init__(self, session) + self.ci_slot=ci_slot + self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml" + + self["key_red"] = StaticText(_("delete")) + self["key_green"] = StaticText(_("add Service")) + self["key_yellow"] = StaticText(_("add Provider")) + self["key_blue"] = StaticText(_("select CAId")) + self["CAidList.desc"] = Label(_("assigned CAIds")) + self["ServiceList.desc"] = Label(_("assigned Services/Provider")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + print "[CI_Wizzard_Config] Configuring CI Slots : %d " % self.ci_slot + + i=0 + self.caidlist=[] + print eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot) + for caid in eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot): + i+=1 + self.caidlist.append((str(hex(int(caid))),str(caid),i)) + + print "[CI_Wizzard_Config_CI%d] read following CAIds from CI: %s" %(self.ci_slot, self.caidlist) + self.selectedcaid =[] + self.servicelist = [] + self.caids=_("no CAId selected") + self["CAidList"] = Label(self.caids) + + serviceList = ConfigList(self.servicelist) + serviceList.list = self.servicelist + serviceList.l.setList(self.servicelist) + self["ServiceList"] = serviceList + + self.loadXML() + # if config mode !=advanced autoselect any caid + if config.usage.setup_level.index <= 1: # advanced + self.selectedcaid=self.caidlist + + def redPressed(self): + self.delete() + + def greenPressed(self): + self.session.openWithCallback( self.finishedChannelSelection, myChannelSelection, None) + + def yellowPressed(self): + self.session.openWithCallback( self.finishedProviderSelection, myProviderSelection, None) + + def bluePressed(self): + self.session.openWithCallback(self.finishedCAidSelection, CAidSelect, self.caidlist, self.selectedcaid) + + def okPressed(self): + print "[CI_Config_CI%d] OK BUTTON not implemented yet" %self.ci_slot + + def cancel(self): + self.saveXML() + activate_all(self) + self.close() + + def delete(self): + cur = self["ServiceList"].getCurrent() + if cur and len(cur) > 2: + self.servicelist.remove(cur) + self["ServiceList"].l.setList(self.servicelist) + + def finishedChannelSelection(self, *args): + if len(args): + ref=args[0] + service_ref = ServiceReference(ref) + service_name = service_ref.getServiceName() + if find_in_list(self.servicelist, service_name, 0)==False: + split_ref=service_ref.ref.toString().split(":") + if split_ref[0] == "1": #== dvb service und nicht muell von None + self.servicelist.append( (service_name , ConfigNothing(), 0, service_ref.ref.toString()) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedProviderSelection(self, *args): + if len(args)>1: # bei nix selected kommt nur 1 arg zurueck (==None) + name=args[0] + dvbnamespace=args[1] + if find_in_list(self.servicelist, name, 0)==False: + self.servicelist.append( (name , ConfigNothing(), 1, dvbnamespace) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedCAidSelection(self, *args): + if len(args): + self.selectedcaid=args[0] + self.caids="" + for item in self.selectedcaid: + if len(self.caids): + self.caids+= ", " + item[0] + else: + self.caids=item[0] + else: + self.selectedcaid=[] + self.caids=_("no CAId selected") + self["CAidList"].setText(self.caids) + + def saveXML(self): + try: + fp = file(self.filename, 'w') + fp.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n") + fp.write("<ci>\n") + fp.write("\t<slot>\n") + fp.write("\t\t<id>%s</id>\n" % self.ci_slot) + for item in self.selectedcaid: + if len(self.selectedcaid): + fp.write("\t\t<caid id=\"%s\" />\n" % item[0]) + for item in self.servicelist: + if len(self.servicelist): + if item[2]==1: + fp.write("\t\t<provider name=\"%s\" dvbnamespace=\"%s\" />\n" % (item[0], item[3])) + else: + fp.write("\t\t<service name=\"%s\" ref=\"%s\" />\n" % (item[0], item[3])) + fp.write("\t</slot>\n") + fp.write("</ci>\n") + fp.close() + except: + print "[CI_Config_CI%d] xml not written" %self.ci_slot + os.unlink(self.filename) + + def loadXML(self): + if not os_path.exists(self.filename): + return + + def getValue(definitions, default): + ret = "" + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + try: + tree = ci_parse(self.filename).getroot() + self.read_services=[] + self.read_providers=[] + self.usingcaid=[] + self.ci_config=[] +# for ci in tree.findall("ci"): + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + print "ci " + read_slot + + i=0 + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + self.selectedcaid.append((str(read_caid),str(read_caid),i)) + self.usingcaid.append(long(read_caid,16)) + i+=1 + + for service in slot.findall("service"): + read_service_name = service.get("name").encode("UTF-8") + read_service_ref = service.get("ref").encode("UTF-8") + self.read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + self.read_providers.append((read_provider_name,read_provider_dvbname)) + + self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid))) + except: + print "[CI_Config_CI%d] error parsing xml..." %self.ci_slot + + for item in self.read_services: + if len(item): + self.finishedChannelSelection(item) + + for item in self.read_providers: + if len(item): + self.finishedProviderSelection(item[0],item[1]) + + print self.ci_config + self.finishedCAidSelection(self.selectedcaid) + self["ServiceList"].l.setList(self.servicelist) + +class easyCIconfigMenu(CIconfigMenu): + skin = """ + <screen position="80,80" size="470,420" title="CI Assignment" > + <widget name="ServiceList.desc" position="10,10" size="420,22" font="Regular;20" /> + <widget name="ServiceList" position="10,40" size="450,340" scrollbarMode="showOnDemand" /> + <ePixmap position="10,360" size="450,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="310,370" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="310,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + ci=ci_slot + CIconfigMenu.__init__(self, session, ci_slot) + self.skin = easyCIconfigMenu.skin + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + def bluePressed(self): + print "do nothing" + +class CAidSelect(Screen): + skin = """ + <screen position="210,140" size="310,290" title="select CAId's" > + <widget name="list" position="10,10" size="290,210" scrollbarMode="showOnDemand" /> + <ePixmap position="10,230" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,240" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,240" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, list, selected_caids): + self.skin = CAidSelect.skin + Screen.__init__(self, session) + + self.list = SelectionList() + self["list"] = self.list + + for listindex in range(len(list)): + if find_in_list(selected_caids,list[listindex][0],0): + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True) + else: + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "ok": self.list.toggleSelection, + "cancel": self.cancel, + "green": self.greenPressed, + "red": self.cancel + }, -1) + + def greenPressed(self): + list = self.list.getSelectionsList() + print list + self.close(list) + + def cancel(self): + self.close() + +class myProviderSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select provider to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + + self["actions"] = ActionMap(["OkCancelActions", "ChannelSelectBaseActions"], + { + "showFavourites": self.doNothing, + "showAllServices": self.doNothing, + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + }) + self["key_red"] = StaticText(_("")) + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + self["key_blue"] = StaticText(_("")) + + def doNothing(self): + print "nothing to do..." + + def __onExecCallback(self): + self.showSatellites() + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + splited_ref=ref.toString().split(":") + if ref.flags == 7 and splited_ref[6] != "0": + self.dvbnamespace=splited_ref[6] + self.enterPath(ref) + else: + self.close(ref.getName(), self.dvbnamespace) + + def showSatellites(self): + if not self.pathChangeDisabled: + refstr = '%s FROM SATELLITES ORDER BY satellitePosition'%(self.service_types) + if not self.preEnterPath(refstr): + ref = eServiceReference(refstr) + justSet=False + prev = None + + if self.isBasePathEqual(ref): + if self.isPrevPathEqual(ref): + justSet=True + prev = self.pathUp(justSet) + else: + currentRoot = self.getRoot() + if currentRoot is None or currentRoot != ref: + justSet=True + self.clearPath() + self.enterPath(ref, True) + if justSet: + serviceHandler = eServiceCenter.getInstance() + servicelist = serviceHandler.list(ref) + if not servicelist is None: + while True: + service = servicelist.getNext() + if not service.valid(): #check if end of list + break + unsigned_orbpos = service.getUnsignedData(4) >> 16 + orbpos = service.getData(4) >> 16 + if orbpos < 0: + orbpos += 3600 + if service.getPath().find("FROM PROVIDER") != -1: + service_type = _("Providers") + try: + # why we need this cast? + service_name = str(nimmanager.getSatDescription(orbpos)) + except: + if unsigned_orbpos == 0xFFFF: #Cable + service_name = _("Cable") + elif unsigned_orbpos == 0xEEEE: #Terrestrial + service_name = _("Terrestrial") + else: + if orbpos > 1800: # west + orbpos = 3600 - orbpos + h = _("W") + else: + h = _("E") + service_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10) + service.setName("%s - %s" % (service_name, service_type)) + self.servicelist.addService(service) + self.servicelist.finishFill() + if prev is not None: + self.setCurrentSelection(prev) + + def cancel(self): + self.close(None) + +class myChannelSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select service to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + service = self.session.nav.getCurrentService() + if service: + info = service.info() + if info: + refstr = info.getInfoString(iServiceInformation.sServiceref) + self.servicelist.setPlayableIgnoreService(eServiceReference(refstr)) + + self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions", "ChannelSelectBaseActions"], + { + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + "keyRadio": self.setModeRadio, + "keyTV": self.setModeTv + }) + + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + + def __onExecCallback(self): + self.setModeTv() + + def doNothing(self): + print "nothing to do..." + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + if (ref.flags & 7) == 7: + self.enterPath(ref) + elif not (ref.flags & eServiceReference.isMarker): + ref = self.getCurrentSelection() + self.close(ref) + + def setModeTv(self): + self.setTvMode() + self.showFavourites() + + def setModeRadio(self): + self.setRadioMode() + self.showFavourites() + + def cancel(self): + self.close(None) + +def activate_all(session): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Activate] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + ci_config=[] + def getValue(definitions, default): + # Initialize Output + ret = "" + # How many definitions are present + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + for ci in range(NUM_CI): + filename="/etc/enigma2/ci"+str(ci)+".xml" + + if not os_path.exists(filename): + print "[CI_Activate_Config_CI%d] no config file found" %ci + + try: + tree = ci_parse(filename).getroot() + read_services=[] + read_providers=[] + usingcaid=[] + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + usingcaid.append(long(read_caid,16)) + + for service in slot.findall("service"): + read_service_ref = service.get("ref").encode("UTF-8") + read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + read_providers.append((read_provider_name,long(read_provider_dvbname,16))) + + ci_config.append((int(read_slot), (read_services, read_providers, usingcaid))) + except: + print "[CI_Activate_Config_CI%d] error parsing xml..." %ci + + for item in ci_config: + print "[CI_Activate] activate CI%d with following settings:" %item[0] + print item[0] + print item[1] + try: + eDVBCIInterfaces.getInstance().setDescrambleRules(item[0],item[1]) + except: + print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." %item[0] + +def find_in_list(list, search, listpos=0): + for item in list: + if item[listpos]==search: + return True + return False + +global_session = None + +def sessionstart(reason, session): + global global_session + global_session = session + +def autostart(reason, **kwargs): + global global_session + if reason == 0: + print "[CI_Assignment] activating ci configs:" + activate_all(global_session) + elif reason == 1: + global_session = None + +def main(session, **kwargs): + session.open(CIselectMainMenu) + +def menu(menuid, **kwargs): + if menuid == "setup" and eDVBCIInterfaces.getInstance().getNumOfSlots(): + return [(_("Common Interface Assignment"), main, "ci_assign", 11)] + return [ ] + +def Plugins(**kwargs): + if config.usage.setup_level.index > 1: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers/caids to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] + else: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py index 07861954..bb4df74a 100644 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py @@ -78,6 +78,14 @@ class ResultParser: text += " ==> " text += str(transponder[0]) text += "\n" + if reason == "pids_failed": + text += "(tsid, onid): " + text += str(transponder[3]['real']) + text += "(read from sat) != " + text += str(transponder[3]['expected']) + text += "(read from file)" + text += "\n" + text += "\n" if countsuccessful > 0: text += "\n" text += "Successfully tuned transponders' previous planes:\n" @@ -265,7 +273,7 @@ class DiseqcTester(Screen, TuneTest, ResultParser): for sat in nimmanager.getSatListForNim(self.feid): for transponder in nimmanager.getTransponders(sat[0]): #print transponder - mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[5], sat[0], None, None, transponder[10], transponder[11]) + mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[7], sat[0], transponder[5], transponder[6], transponder[8], transponder[9], transponder[10], transponder[11]) self.analyseTransponder(mytransponder) def getIndexForTransponder(self, transponder): @@ -623,7 +631,7 @@ class DiseqcTesterNimSelection(NimSelection): def showNim(self, nim): nimConfig = nimmanager.getNimConfig(nim.slot) if nim.isCompatible("DVB-S"): - if nimConfig.configMode.value in ["loopthrough", "equal", "satposdepends", "nothing"]: + if nimConfig.configMode.value in ("loopthrough", "equal", "satposdepends", "nothing"): return False if nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value == "positioner": diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 10151f2c..634c7f42 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -1 +1,3 @@ -SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug DefaultServicesScanner NFIFlash DiseqcTester +SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ + SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \ + DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py index ec223d3e..ec472e72 100644 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py @@ -25,7 +25,8 @@ class SecParameterSetup(Screen, ConfigListScreen): list = [ ("Delay after diseqc reset command", config.sec.delay_after_diseqc_reset_cmd), ("Delay after diseqc peripherial poweron command", config.sec.delay_after_diseqc_peripherial_poweron_cmd), - ("Delay after continuous tone change", config.sec.delay_after_continuous_tone_change), + ("Delay after continuous tone disable before diseqc", config.sec.delay_after_continuous_tone_disable_before_diseqc), + ("Delay after final continuous tone change", config.sec.delay_after_final_continuous_tone_change), ("Delay after last voltage change", config.sec.delay_after_final_voltage_change), ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats), ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command), diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index 947452e9..327f08ed 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -308,5 +308,3 @@ class RestoreScreen(Screen, ConfigListScreen): def runAsync(self, finished_cb): self.finished_cb = finished_cb self.doRestore() - -
\ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 09b61bd5..3eefa47d 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -19,7 +19,7 @@ from Components.SelectionList import SelectionList from Components.PluginComponent import plugins from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK @@ -82,7 +82,7 @@ class UpdatePluginMenu(Screen): <widget source="menu" render="Listbox" position="280,10" size="230,300" scrollbarMode="showNever" selectionDisabled="1"> <convert type="TemplatedMultiContent"> {"template": [ - MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 0 is the MenuText, + MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, ], "fonts": [gFont("Regular", 20)], "itemHeight": 230 @@ -157,7 +157,8 @@ class UpdatePluginMenu(Screen): if (current == "ipkg-manager"): self.session.open(PacketManager, self.skin_path) elif (current == "ipkg-source"): - self.session.open(IPKGSource) + self.session.open(IPKGMenu, self.skin_path) + #self.session.open(IPKGSource) elif (current == "ipkg-install"): try: from Plugins.Extensions.MediaScanner.plugin import main @@ -223,34 +224,123 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class IPKGMenu(Screen): + skin = """ + <screen name="IPKGMenu" position="135,144" size="450,320" title="Select IPKG source......" > + <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,290" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,290" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> + </screen>""" + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["closetext"] = Label(_("Close")) + self["edittext"] = Label(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select IPKG source to edit...")) + + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + class IPKGSource(Screen): skin = """ - <screen position="100,100" size="550,60" title="IPKG source" > - <widget name="text" position="0,0" size="550,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <screen name="IPKGSource" position="100,100" size="550,80" title="IPKG source" > + <widget name="text" position="10,10" size="530,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,50" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,50" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> </screen>""" - def __init__(self, session, args = None): + def __init__(self, session, configfile = None): Screen.__init__(self, session) self.session = session - - #FIXMEEEE add handling for more than one feed conf file! + self.configfile = configfile text = "" - try: - fp = file('/etc/ipkg/official-feed.conf', 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + #print "[IPKGSource] mainscreen: current desktop size: %dx%d" % (x,y) + + self["closetext"] = Label(_("Cancel")) + self["edittext"] = Label(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], { "ok": self.go, "back": self.close, + "red": self.close, + "green": self.go, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, @@ -268,12 +358,22 @@ class IPKGSource(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit IPKG source URL...")) def go(self): text = self["text"].getText() if text: - fp = file('/etc/ipkg/official-feed.conf', 'w') - fp.write() + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") fp.close() self.close() @@ -715,7 +815,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Ipkg", - description = "Install software updates...", + description = _("Install software updates..."), openfnc = filescan_open, ) def UpgradeMain(session, **kwargs): diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 6a85c4da..64f79e04 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -67,7 +67,7 @@ class VideoHardware: else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: @@ -283,7 +283,7 @@ class VideoHardware: force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" policy2 = "policy" # use main policy diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 1d7ce7b5..8f8bea09 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -13,8 +13,8 @@ config.misc.showtestcard = ConfigBoolean(default = False) class VideoWizardSummary(WizardSummary): skin = """ <screen position="0,0" size="132,64"> - <widget name="text" position="6,4" size="120,42" font="Regular;14" transparent="1" /> - <widget source="parent.list" render="Label" position="6,25" size="120,21" font="Regular;16"> + <widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" /> + <widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14"> <convert type="StringListSelection" /> </widget> <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/--> @@ -165,7 +165,7 @@ class VideoWizard(WizardLanguage, Rc): config.misc.showtestcard.value = False def keyNumberGlobal(self, number): - if number in [1,2,3]: + if number in (1,2,3): if number == 1: self.hw.saveMode("DVI", "720p", "multi") elif number == 2: diff --git a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py index 30bdf796..6b6d5045 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py @@ -52,8 +52,9 @@ class VideoSetup(Screen, ConfigListScreen): def createSetup(self): level = config.usage.setup_level.index - self.list = [ ] - self.list.append(getConfigListEntry(_("Video Output"), config.av.videoport)) + self.list = [ + getConfigListEntry(_("Video Output"), config.av.videoport) + ] # if we have modes for this port: if config.av.videoport.value in config.av.videomode: @@ -76,9 +77,11 @@ class VideoSetup(Screen, ConfigListScreen): if not force_wide: self.list.append(getConfigListEntry(_("Aspect Ratio"), config.av.aspect)) - if force_wide or config.av.aspect.value in ["16_9", "16_10"]: - self.list.append(getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43)) - self.list.append(getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169)) + if force_wide or config.av.aspect.value in ("16_9", "16_10"): + self.list.extend(( + getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43), + getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169) + )) elif config.av.aspect.value == "4_3": self.list.append(getConfigListEntry(_("Display 16:9 content as"), config.av.policy_169)) @@ -95,6 +98,10 @@ class VideoSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3)) if SystemInfo["CanDownmixAC3"]: self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3)) + self.list.extend(( + getConfigListEntry(_("General AC3 Delay"), config.av.generalAC3delay), + getConfigListEntry(_("General PCM Delay"), config.av.generalPCMdelay) + )) if SystemInfo["CanChangeOsdAlpha"]: self.list.append(getConfigListEntry(_("OSD visibility"), config.av.osd_alpha)) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml index 2a592aae..29ac4297 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml @@ -1,7 +1,7 @@ <wizard> - <step id="inputselection" nextstep="modeselection" timeout="10" timeoutaction="selectnext"> + <step id="inputselection" nextstep="modeselection" timeout="20" timeoutaction="selectnext"> <text value="Video input selection\n\nPlease press OK if you can see this page on your TV (or select a different input port).\n\nThe next input port will be automatically probed in 10 seconds." /> - <displaytext value="Select video input" /> + <displaytext value="Select video input with up/down buttons" /> <list type="dynamic" source="listInputChannels" evaluation="inputSelectionMade" onselect="inputSelectionMoved" /> <code> self["portpic"].show() @@ -9,7 +9,7 @@ self.clearSelectedKeys() self.selectKey("OK") </code> </step> - <step id="modeselection" nextstep="rateselection" timeout="10" timeoutaction="selectnext"> + <step id="modeselection" nextstep="rateselection" timeout="20" timeoutaction="selectnext"> <text value="Video mode selection." /> <displaytext value="Select video mode" /> <list type="dynamic" source="listModes" evaluation="modeSelectionMade" onselect="modeSelectionMoved" /> @@ -20,7 +20,7 @@ self.selectKey("DOWN") self["portpic"].hide() </code> </step> - <step id="rateselection" nextstep="dvirateintroduction" timeout="10" timeoutaction="selectnext"> + <step id="rateselection" nextstep="dvirateintroduction" timeout="20" timeoutaction="selectnext"> <condition> self.condition = (self.port != "DVI" or self.mode == "PC") </condition> @@ -46,7 +46,7 @@ self.selectKey("DOWN") self.rateSelect("60Hz") </code> </step> - <step id="dvirateselection" timeout="10" timeoutaction="changestep" timeoutstep="notworking50Hz"> + <step id="dvirateselection" timeout="20" timeoutaction="changestep" timeoutstep="notworking50Hz"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> @@ -77,7 +77,7 @@ self.selectKey("UP") self.selectKey("DOWN") </code> </step> - <step id="working50Hz" nextstep="end" timeout="10" timeoutaction="nextstep"> + <step id="working50Hz" nextstep="end" timeout="20" timeoutaction="nextstep"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> diff --git a/lib/python/Screens/About.py b/lib/python/Screens/About.py index e184512b..6cf0f7b4 100644 --- a/lib/python/Screens/About.py +++ b/lib/python/Screens/About.py @@ -25,7 +25,7 @@ class About(Screen): self["FPVersion"] = StaticText(fp_version) nims = nimmanager.nimList() - for count in range(4): + for count in (0, 1, 2, 3): if count < len(nims): self["Tuner" + str(count)] = StaticText(nims[count]) else: @@ -33,7 +33,7 @@ class About(Screen): self["HDDHeader"] = StaticText(_("Detected HDD:")) hddlist = harddiskmanager.HDDList() - hdd = len(hddlist) > 0 and hddlist[0][1] or None + hdd = hddlist and hddlist[0][1] or None if hdd is not None and hdd.model() != "": self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free())) else: diff --git a/lib/python/Screens/ChannelSelection.py b/lib/python/Screens/ChannelSelection.py index ebfbe812..0ff4042b 100644 --- a/lib/python/Screens/ChannelSelection.py +++ b/lib/python/Screens/ChannelSelection.py @@ -95,7 +95,7 @@ class ChannelContextMenu(Screen): inBouquet = csel.getMutableList() is not None haveBouquets = config.usage.multibouquet.value - if not (len(current_sel_path) or current_sel_flags & (eServiceReference.isDirectory|eServiceReference.isMarker)): + if not (current_sel_path or current_sel_flags & (eServiceReference.isDirectory|eServiceReference.isMarker)): append_when_current_valid(current, menu, (_("show transponder info"), self.showServiceInformations), level = 2) if csel.bouquet_mark_edit == OFF and not csel.movemode: if not inBouquetRootList: @@ -317,11 +317,24 @@ class ChannelSelectionEPG: def showEPGList(self): ref=self.getCurrentSelection() - ptr=eEPGCache.getInstance() - if ptr.startTimeQuery(ref) != -1: - self.session.open(EPGSelection, ref) - else: - print 'no epg for service', ref.toString() + if ref: + self.savedService = ref + self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB=self.changeServiceCB) + + def SingleServiceEPGClosed(self, ret=False): + self.setCurrentSelection(self.savedService) + + def changeServiceCB(self, direction, epg): + beg = self.getCurrentSelection() + while True: + if direction > 0: + self.moveDown() + else: + self.moveUp() + cur = self.getCurrentSelection() + if cur == beg or not (cur.flags & eServiceReference.isMarker): + break + epg.setService(ServiceReference(self.getCurrentSelection())) class ChannelSelectionEdit: def __init__(self): @@ -558,7 +571,7 @@ class ChannelSelectionEdit: del self.servicePath[:] # remove all elements self.servicePath += self.savedPath # add saved elements del self.savedPath - self.setRoot(self.servicePath[len(self.servicePath)-1]) + self.setRoot(self.servicePath[-1]) def clearMarks(self): self.servicelist.clearMarks() @@ -781,13 +794,13 @@ class ChannelSelectionBase(Screen): def getServiceName(self, ref): str = self.removeModeStr(ServiceReference(ref).getServiceName()) - if not len(str): + if not str: pathstr = ref.getPath() - if pathstr.find('FROM PROVIDERS') != -1: + if 'FROM PROVIDERS' in pathstr: return _("Provider") - if pathstr.find('FROM SATELLITES') != -1: + if 'FROM SATELLITES' in pathstr: return _("Satellites") - if pathstr.find(') ORDER BY name') != -1: + if ') ORDER BY name' in pathstr: return _("All") return str @@ -831,9 +844,8 @@ class ChannelSelectionBase(Screen): def pathUp(self, justSet=False): prev = self.servicePath.pop() - length = len(self.servicePath) - if length: - current = self.servicePath[length-1] + if self.servicePath: + current = self.servicePath[-1] self.setRoot(current, justSet) if not justSet: self.setCurrentSelection(prev) @@ -961,7 +973,7 @@ class ChannelSelectionBase(Screen): self.enterPath(ref) def inBouquet(self): - if len(self.servicePath) > 0 and self.servicePath[0] == self.bouquet_root: + if self.servicePath and self.servicePath[0] == self.bouquet_root: return True return False @@ -1235,8 +1247,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect del self.servicePath[:] self.servicePath += path self.saveRoot() - plen = len(path) - root = path[plen-1] + root = path[-1] cur_root = self.getRoot() if cur_root and cur_root != root: self.setRoot(root) @@ -1249,7 +1260,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect for i in self.servicePath: path += i.toString() path += ';' - if len(path) and path != self.lastroot.value: + if path and path != self.lastroot.value: self.lastroot.value = path self.lastroot.save() @@ -1259,7 +1270,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect tmp = re.findall(self.lastroot.value) cnt = 0 for i in tmp: - self.servicePath.append(eServiceReference(i[:len(i)-1])) + self.servicePath.append(eServiceReference(i[:-1])) cnt += 1 if cnt: path = self.servicePath.pop() @@ -1269,7 +1280,7 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.saveRoot() def preEnterPath(self, refstr): - if len(self.servicePath) and self.servicePath[0] != eServiceReference(refstr): + if self.servicePath and self.servicePath[0] != eServiceReference(refstr): pathstr = self.lastroot.value if pathstr is not None and pathstr.find(refstr) == 0: self.restoreRoot() @@ -1289,16 +1300,14 @@ class ChannelSelection(ChannelSelectionBase, ChannelSelectionEdit, ChannelSelect self.lastservice.save() def setCurrentServicePath(self, path): - hlen = len(self.history) - if hlen > 0: + if self.history: self.history[self.history_pos] = path else: self.history.append(path) self.setHistoryPath() def getCurrentServicePath(self): - hlen = len(self.history) - if hlen > 0: + if self.history: return self.history[self.history_pos] return None @@ -1411,7 +1420,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS for i in self.servicePathRadio: path += i.toString() path += ';' - if len(path) and path != config.radio.lastroot.value: + if path and path != config.radio.lastroot.value: config.radio.lastroot.value = path config.radio.lastroot.save() @@ -1421,7 +1430,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS tmp = re.findall(config.radio.lastroot.value) cnt = 0 for i in tmp: - self.servicePathRadio.append(eServiceReference(i[:len(i)-1])) + self.servicePathRadio.append(eServiceReference(i[:-1])) cnt += 1 if cnt: path = self.servicePathRadio.pop() @@ -1431,7 +1440,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS self.saveRoot() def preEnterPath(self, refstr): - if len(self.servicePathRadio) and self.servicePathRadio[0] != eServiceReference(refstr): + if self.servicePathRadio and self.servicePathRadio[0] != eServiceReference(refstr): pathstr = config.radio.lastroot.value if pathstr is not None and pathstr.find(refstr) == 0: self.restoreRoot() diff --git a/lib/python/Screens/ChoiceBox.py b/lib/python/Screens/ChoiceBox.py index 4739b7e1..7c8b1427 100644 --- a/lib/python/Screens/ChoiceBox.py +++ b/lib/python/Screens/ChoiceBox.py @@ -5,9 +5,13 @@ from Components.ChoiceList import ChoiceEntryComponent, ChoiceList from Components.Sources.StaticText import StaticText class ChoiceBox(Screen): - def __init__(self, session, title = "", list = [], keys = None, selection = 0): + def __init__(self, session, title = "", list = [], keys = None, selection = 0, skin_name = []): Screen.__init__(self, session) + if isinstance(skin_name, str): + skin_name = [skin_name] + self.skinName = skin_name + ["ChoiceBox"] + self["text"] = Label(title) self.list = [] self.summarylist = [] diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index 5028301e..0fb0feeb 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -12,11 +12,21 @@ from enigma import eTimer, eDVBCI_UI, eDVBCIInterfaces MAX_NUM_CI = 4 +def setCIBitrate(configElement): + if configElement.value == "no": + eDVBCI_UI.getInstance().setClockRate(configElement.slotid, eDVBCI_UI.rateNormal) + else: + eDVBCI_UI.getInstance().setClockRate(configElement.slotid, eDVBCI_UI.rateHigh) + def InitCiConfig(): config.ci = ConfigSubList() for slot in range(MAX_NUM_CI): config.ci.append(ConfigSubsection()) config.ci[slot].canDescrambleMultipleServices = ConfigSelection(choices = [("auto", _("Auto")), ("no", _("No")), ("yes", _("Yes"))], default = "auto") + if SystemInfo["CommonInterfaceSupportsHighBitrates"]: + config.ci[slot].canHandleHighBitrates = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "no") + config.ci[slot].canHandleHighBitrates.slotid = slot + config.ci[slot].canHandleHighBitrates.addNotifier(setCIBitrate) class MMIDialog(Screen): def __init__(self, session, slotid, action, handler = eDVBCI_UI.getInstance(), wait_text = _("wait for ci...") ): @@ -121,7 +131,7 @@ class MMIDialog(Screen): elif self.tag == "WAIT": self.handler.stopMMI(self.slotid) self.closeMmi() - elif self.tag in [ "MENU", "LIST" ]: + elif self.tag in ( "MENU", "LIST" ): print "cancel list" self.handler.answerMenu(self.slotid, 0) self.showWait() @@ -226,7 +236,13 @@ class CiMessageHandler: self.ci = { } self.dlgs = { } eDVBCI_UI.getInstance().ciStateChanged.get().append(self.ciStateChanged) - SystemInfo["CommonInterface"]= eDVBCIInterfaces.getInstance().getNumOfSlots() > 0 + SystemInfo["CommonInterface"] = eDVBCIInterfaces.getInstance().getNumOfSlots() > 0 + try: + file = open("/proc/stb/tsmux/ci0_tsclk", "r") + file.close() + SystemInfo["CommonInterfaceSupportsHighBitrates"] = True + except: + SystemInfo["CommonInterfaceSupportsHighBitrates"] = False def setSession(self, session): self.session = session @@ -285,7 +301,7 @@ class CiSelection(Screen): def selectionChanged(self): cur_idx = self["entries"].getCurrentIndex() - self["text"].setText(_("Slot %d")%((cur_idx / 4)+1)) + self["text"].setText(_("Slot %d")%((cur_idx / 5)+1)) def keyConfigEntry(self, key): try: @@ -315,6 +331,8 @@ class CiSelection(Screen): self.list.append( (appname, ConfigNothing(), 2, slot) ) self.list.append(getConfigListEntry(_("Multiple service support"), config.ci[slot].canDescrambleMultipleServices)) + if SystemInfo["CommonInterfaceSupportsHighBitrates"]: + self.list.append(getConfigListEntry(_("High bitrate support"), config.ci[slot].canHandleHighBitrates)) def updateState(self, slot): state = eDVBCI_UI.getInstance().getState(slot) diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py index c6b156cf..2058c041 100644 --- a/lib/python/Screens/Console.py +++ b/lib/python/Screens/Console.py @@ -11,7 +11,6 @@ class Console(Screen): </screen>""" def __init__(self, session, title = "Console", cmdlist = None, finishedCallback = None, closeOnSuccess = False): - self.skin = Console.skin Screen.__init__(self, session) self.finishedCallback = finishedCallback @@ -68,4 +67,4 @@ class Console(Screen): self.container.dataAvail.remove(self.dataAvail) def dataAvail(self, str): - self["text"].setText(self["text"].getText() + str)
\ No newline at end of file + self["text"].setText(self["text"].getText() + str) diff --git a/lib/python/Screens/DefaultWizard.py b/lib/python/Screens/DefaultWizard.py index 9883dc8e..73b07acf 100644 --- a/lib/python/Screens/DefaultWizard.py +++ b/lib/python/Screens/DefaultWizard.py @@ -96,8 +96,6 @@ def filescan_open(list, session, **kwargs): def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath - from mimetypes import add_type - add_type("application/x-dream-package", "dmpkg") return \ Scanner(mimetypes = ["application/x-dream-package"], paths_to_scan = @@ -106,7 +104,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Dream-Package", - description = "Install settings, skins, software...", + description = _("Install settings, skins, software..."), openfnc = filescan_open, ) print "add dreampackage scanner plugin" diff --git a/lib/python/Screens/EpgSelection.py b/lib/python/Screens/EpgSelection.py index e7388fc2..d09ed004 100644 --- a/lib/python/Screens/EpgSelection.py +++ b/lib/python/Screens/EpgSelection.py @@ -25,12 +25,14 @@ class EPGSelection(Screen): ZAP = 1 - def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None): + def __init__(self, session, service, zapFunc=None, eventid=None, bouquetChangeCB=None, serviceChangeCB=None): Screen.__init__(self, session) self.bouquetChangeCB = bouquetChangeCB + self.serviceChangeCB = serviceChangeCB self.ask_time = -1 #now self["key_red"] = Button("") self.closeRecursive = False + self.saved_title = None if isinstance(service, str) and eventid != None: self.type = EPG_TYPE_SIMILAR self["key_yellow"] = Button() @@ -68,7 +70,7 @@ class EPGSelection(Screen): self["key_green"] = Button(_("Add timer")) self.key_green_choice = self.ADD_TIMER self.key_red_choice = self.EMPTY - self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = self.session.nav.RecordTimer) + self["list"] = EPGList(type = self.type, selChangedCB = self.onSelectionChanged, timer = session.nav.RecordTimer) self["actions"] = ActionMap(["EPGSelectActions", "OkCancelActions"], { @@ -80,11 +82,12 @@ class EPGSelection(Screen): "info": self.infoKeyPressed, "red": self.zapTo, "input_date_time": self.enterDateTime, - "nextBouquet": self.nextBouquet, - "prevBouquet": self.prevBouquet + "nextBouquet": self.nextBouquet, # just used in multi epg yet + "prevBouquet": self.prevBouquet, # just used in multi epg yet + "nextService": self.nextService, # just used in single epg yet + "prevService": self.prevService, # just used in single epg yet }) self["actions"].csel = self - self.onLayoutFinish.append(self.onCreate) def nextBouquet(self): @@ -95,6 +98,14 @@ class EPGSelection(Screen): if self.bouquetChangeCB: self.bouquetChangeCB(-1, self) + def nextService(self): + if self.serviceChangeCB: + self.serviceChangeCB(1, self) + + def prevService(self): + if self.serviceChangeCB: + self.serviceChangeCB(-1, self) + def enterDateTime(self): if self.type == EPG_TYPE_MULTI: global mepg_config_initialized @@ -129,6 +140,10 @@ class EPGSelection(Screen): self.services = services self.onCreate() + def setService(self, service): + self.currentService = service + self.onCreate() + #just used in multipeg def onCreate(self): l = self["list"] @@ -137,7 +152,12 @@ class EPGSelection(Screen): l.fillMultiEPG(self.services, self.ask_time) l.moveToService(self.session.nav.getCurrentlyPlayingServiceReference()) elif self.type == EPG_TYPE_SINGLE: - l.fillSingleEPG(self.currentService) + service = self.currentService + if self.saved_title is None: + self.saved_title = self.instance.getTitle() + title = self.saved_title + ' - ' + service.getServiceName() + self.instance.setTitle(title) + l.fillSingleEPG(service) else: l.fillSimilarList(self.currentService, self.eventid) diff --git a/lib/python/Screens/EventView.py b/lib/python/Screens/EventView.py index 6aed1e11..c1ffb585 100644 --- a/lib/python/Screens/EventView.py +++ b/lib/python/Screens/EventView.py @@ -20,7 +20,7 @@ class EventViewBase: self.similarEPGCB = similarEPGCB self.cbFunc = callback self.currentService=Ref - self.isRecording = (not Ref.ref.flags & eServiceReference.isGroup) and len(Ref.ref.getPath()) + self.isRecording = (not Ref.ref.flags & eServiceReference.isGroup) and Ref.ref.getPath() self.event = Event self["epg_description"] = ScrollLabel() self["datetime"] = Label() @@ -71,6 +71,8 @@ class EventViewBase: self.key_green_choice = self.ADD_TIMER def timerAdd(self): + if self.isRecording: + return event = self.event serviceref = self.currentService if event is None: @@ -134,12 +136,12 @@ class EventViewBase: text = event.getEventName() short = event.getShortDescription() ext = event.getExtendedDescription() - if len(short) > 0 and short != text: - text = text + '\n\n' + short - if len(ext) > 0: - if len(text) > 0: - text = text + '\n\n' - text = text + ext + if short and short != text: + text += '\n\n' + short + if ext: + if text: + text += '\n\n' + text += ext self.setTitle(event.getEventName()) self["epg_description"].setText(text) @@ -189,7 +191,7 @@ class EventViewBase: self["key_red"].setText(_("Similar")) def openSimilarList(self): - if self.similarEPGCB is not None and len(self["key_red"].getText()): + if self.similarEPGCB is not None and self["key_red"].getText(): id = self.event and self.event.getEventId() refstr = str(self.currentService) if id is not None: diff --git a/lib/python/Screens/HarddiskSetup.py b/lib/python/Screens/HarddiskSetup.py index 19a674ec..c9f069fe 100644 --- a/lib/python/Screens/HarddiskSetup.py +++ b/lib/python/Screens/HarddiskSetup.py @@ -39,7 +39,7 @@ class HarddiskSetup(Screen): Screen.__init__(self, session) self.hdd = hdd - if type not in [self.HARDDISK_INITIALIZE, self.HARDDISK_CHECK]: + if type not in (self.HARDDISK_INITIALIZE, self.HARDDISK_CHECK): self.type = self.HARDDISK_INITIALIZE else: self.type = type diff --git a/lib/python/Screens/HelpMenu.py b/lib/python/Screens/HelpMenu.py index abef38db..74882a35 100644 --- a/lib/python/Screens/HelpMenu.py +++ b/lib/python/Screens/HelpMenu.py @@ -29,13 +29,13 @@ class HelpMenu(Screen, Rc): #arrow = self["arrowup"] print "selection:", selection - if selection and len(selection) > 1 and selection[1] == "SHIFT": - self.selectKey("SHIFT") - - if selection and len(selection) > 1 and selection[1] == "long": - self["long_key"].setText(_("Long Keypress")) - else: - self["long_key"].setText("") + longText = "" + if selection and len(selection) > 1: + if selection[1] == "SHIFT": + self.selectKey("SHIFT") + elif selection[1] == "long": + longText = _("Long Keypress") + self["long_key"].setText(longText) self.selectKey(selection[0]) #if selection is None: @@ -55,6 +55,6 @@ class HelpableScreen: self.session.openWithCallback(self.callHelpAction, HelpMenu, self.helpList) def callHelpAction(self, *args): - if len(args): + if args: (actionmap, context, action) = args actionmap.action(context, action) diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index bd9ea182..4d92bd39 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -148,8 +148,8 @@ class MoviePlayer(InfoBarBase, InfoBarShowHide, \ InfoBarPlugins: x.__init__(self) - self.lastservice = self.session.nav.getCurrentlyPlayingServiceReference() - self.session.nav.playService(service) + self.lastservice = session.nav.getCurrentlyPlayingServiceReference() + session.nav.playService(service) self.returning = False self.onClose.append(self.__onClose) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index a50c10be..c1618184 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -369,25 +369,66 @@ class InfoBarSimpleEventView: }) def openEventView(self): - self.epglist = [ ] + epglist = [ ] + self.epglist = epglist service = self.session.nav.getCurrentService() ref = self.session.nav.getCurrentlyPlayingServiceReference() info = service.info() ptr=info.getEvent(0) if ptr: - self.epglist.append(ptr) + epglist.append(ptr) ptr=info.getEvent(1) if ptr: - self.epglist.append(ptr) - if len(self.epglist) > 0: - self.session.open(EventViewSimple, self.epglist[0], ServiceReference(ref), self.eventViewCallback) + epglist.append(ptr) + if epglist: + self.session.open(EventViewSimple, epglist[0], ServiceReference(ref), self.eventViewCallback) def eventViewCallback(self, setEvent, setService, val): #used for now/next displaying - if len(self.epglist) > 1: - tmp = self.epglist[0] - self.epglist[0]=self.epglist[1] - self.epglist[1]=tmp - setEvent(self.epglist[0]) + epglist = self.epglist + if len(epglist) > 1: + tmp = epglist[0] + epglist[0] = epglist[1] + epglist[1] = tmp + setEvent(epglist[0]) + +class SimpleServicelist: + def __init__(self, services): + self.services = services + self.length = len(services) + self.current = 0 + + def selectService(self, service): + if not self.length: + self.current = -1 + return False + else: + self.current = 0 + while self.services[self.current].ref != service: + self.current += 1 + if self.current >= self.length: + return False + return True + + def nextService(self): + if not self.length: + return + if self.current+1 < self.length: + self.current += 1 + else: + self.current = 0 + + def prevService(self): + if not self.length: + return + if self.current-1 > -1: + self.current -= 1 + else: + self.current = self.length - 1 + + def currentService(self): + if not self.length or self.current >= self.length: + return None + return self.services[self.current] class InfoBarEPG: """ EPG - Opens an EPG list when the showEPGList action fires """ @@ -440,7 +481,7 @@ class InfoBarEPG: def openBouquetEPG(self, bouquet, withCallback=True): services = self.getBouquetServices(bouquet) - if len(services): + if services: self.epg_bouquet = bouquet if withCallback: self.dlg_stack.append(self.session.openWithCallback(self.closed, EPGSelection, services, self.zapToService, None, self.changeBouquetCB)) @@ -455,7 +496,7 @@ class InfoBarEPG: self.bouquetSel.up() bouquet = self.bouquetSel.getCurrent() services = self.getBouquetServices(bouquet) - if len(services): + if services: self.epg_bouquet = bouquet epg.setServices(services) @@ -485,19 +526,40 @@ class InfoBarEPG: elif cnt == 1: self.openBouquetEPG(bouquets[0][1], withCallback) + def changeServiceCB(self, direction, epg): + if self.serviceSel: + if direction > 0: + self.serviceSel.nextService() + else: + self.serviceSel.prevService() + epg.setService(self.serviceSel.currentService()) + + def SingleServiceEPGClosed(self, ret=False): + self.serviceSel = None + def openSingleServiceEPG(self): ref=self.session.nav.getCurrentlyPlayingServiceReference() - self.session.open(EPGSelection, ref) + if ref: + if self.servicelist.getMutableList() is not None: # bouquet in channellist + current_path = self.servicelist.getRoot() + services = self.getBouquetServices(current_path) + self.serviceSel = SimpleServicelist(services) + if self.serviceSel.selectService(ref): + self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref, serviceChangeCB = self.changeServiceCB) + else: + self.session.openWithCallback(self.SingleServiceEPGClosed, EPGSelection, ref) + else: + self.session.open(EPGSelection, ref) def showEventInfoPlugins(self): list = [(p.name, boundFunction(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EVENTINFO)] if list: list.append((_("show single service EPG..."), self.openSingleServiceEPG)) - self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list) + self.session.openWithCallback(self.EventInfoPluginChosen, ChoiceBox, title=_("Please choose an extension..."), list = list, skin_name = "EPGExtensionsList") else: self.openSingleServiceEPG() - + def runPlugin(self, plugin): plugin(session = self.session, servicelist = self.servicelist) @@ -621,11 +683,6 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) - self.eofState = 0 - self.eofTimer = eTimer() - self.eofTimer.timeout.get().append(self.doEof) - self.eofInhibitTimer = eTimer() - self.eofInhibitTimer.timeout.get().append(self.inhibitEof) self.minSpeedBackward = useSeekBackHack and 16 or 0 @@ -642,9 +699,9 @@ class InfoBarSeek: return 1 elif action[:8] == "seekdef:": key = int(action[8:]) - time = [-config.seek.selfdefined_13.value, False, config.seek.selfdefined_13.value, + time = (-config.seek.selfdefined_13.value, False, config.seek.selfdefined_13.value, -config.seek.selfdefined_46.value, False, config.seek.selfdefined_46.value, - -config.seek.selfdefined_79.value, False, config.seek.selfdefined_79.value][key-1] + -config.seek.selfdefined_79.value, False, config.seek.selfdefined_79.value)[key-1] self.screen.doSeekRelative(time * 90000) return 1 else: @@ -761,9 +818,6 @@ class InfoBarSeek: def __serviceStarted(self): self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() - if self.eofState != 0: - self.eofTimer.stop() - self.eofState = 0 def setSeekState(self, state): service = self.session.nav.getCurrentService() @@ -772,7 +826,7 @@ class InfoBarSeek: return False if not self.isSeekable(): - if state not in [self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE]: + if state not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): state = self.SEEK_STATE_PLAY pauseable = service.pause() @@ -834,16 +888,6 @@ class InfoBarSeek: seekable = self.getSeek() if seekable is None: return - prevstate = self.seekstate - if self.eofState == 1: - self.eofState = 2 - self.inhibitEof() - if self.seekstate == self.SEEK_STATE_EOF: - if prevstate == self.SEEK_STATE_PAUSE: - self.setSeekState(self.SEEK_STATE_PAUSE) - else: - self.setSeekState(self.SEEK_STATE_PLAY) - self.eofInhibitTimer.start(200, True) seekable.seekTo(pts) def doSeekRelative(self, pts): @@ -851,15 +895,12 @@ class InfoBarSeek: if seekable is None: return prevstate = self.seekstate - if self.eofState == 1: - self.eofState = 2 - self.inhibitEof() + if self.seekstate == self.SEEK_STATE_EOF: if prevstate == self.SEEK_STATE_PAUSE: self.setSeekState(self.SEEK_STATE_PAUSE) else: self.setSeekState(self.SEEK_STATE_PLAY) - self.eofInhibitTimer.start(200, True) seekable.seekRelative(pts<0 and -1 or 1, abs(pts)) if abs(pts) > 100 and config.usage.show_infobar_on_skip.value: self.showAfterSeek() @@ -894,30 +935,31 @@ class InfoBarSeek: self.setSeekState(self.makeStateSlowMotion(speed)) def seekBack(self): - if self.seekstate == self.SEEK_STATE_PLAY: + seekstate = self.seekstate + if seekstate == self.SEEK_STATE_PLAY: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) - elif self.seekstate == self.SEEK_STATE_EOF: + elif seekstate == self.SEEK_STATE_EOF: self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) self.doSeekRelative(-6) - elif self.seekstate == self.SEEK_STATE_PAUSE: + elif seekstate == self.SEEK_STATE_PAUSE: self.doSeekRelative(-3) - elif self.isStateForward(self.seekstate): - speed = self.seekstate[1] - if self.seekstate[2]: - speed /= self.seekstate[2] + elif self.isStateForward(seekstate): + speed = seekstate[1] + if seekstate[2]: + speed /= seekstate[2] speed = self.getLower(speed, config.seek.speeds_forward.value) if speed: self.setSeekState(self.makeStateForward(speed)) else: self.setSeekState(self.SEEK_STATE_PLAY) - elif self.isStateBackward(self.seekstate): - speed = -self.seekstate[1] - if self.seekstate[2]: - speed /= self.seekstate[2] + elif self.isStateBackward(seekstate): + speed = -seekstate[1] + if seekstate[2]: + speed /= seekstate[2] speed = self.getHigher(speed, config.seek.speeds_backward.value) or config.seek.speeds_backward.value[-1] self.setSeekState(self.makeStateBackward(speed)) - elif self.isStateSlowMotion(self.seekstate): - speed = self.getHigher(self.seekstate[2], config.seek.speeds_slowmotion.value) + elif self.isStateSlowMotion(seekstate): + speed = self.getHigher(seekstate[2], config.seek.speeds_slowmotion.value) if speed: self.setSeekState(self.makeStateSlowMotion(speed)) else: @@ -970,44 +1012,19 @@ class InfoBarSeek: return False def __evEOF(self): - if self.eofState == 0 and self.seekstate != self.SEEK_STATE_EOF: - self.eofState = 1 - time = self.calcRemainingTime() - if not time: - time = 3000 # Failed to calc, use default - elif time == 0: - time = 300 # Passed end, shortest wait - elif time > 15000: - self.eofState = -2 # Too long, block eof - time = 15000 - else: - time += 1000 # Add margin - self.eofTimer.start(time, True) - - def inhibitEof(self): - if self.eofState >= 1: - self.eofState = -self.eofState - self.eofTimer.stop() - self.doEof() - - def doEof(self): if self.seekstate == self.SEEK_STATE_EOF: return - if self.eofState == -2 or self.isStateBackward(self.seekstate): - self.eofState = 0 - return - # if we are seeking, we try to end up ~1s before the end, and pause there. - eofstate = self.eofState + # if we are seeking forward, we try to end up ~1s before the end, and pause there. seekstate = self.seekstate - self.eofState = 0 - if not self.seekstate == self.SEEK_STATE_PAUSE: + if self.seekstate != self.SEEK_STATE_PAUSE: self.setSeekState(self.SEEK_STATE_EOF) - if eofstate == -1 or not seekstate in [self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE]: + + if seekstate not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): # if we are seeking seekable = self.getSeek() if seekable is not None: seekable.seekTo(-1) - if eofstate == 1 and seekstate == self.SEEK_STATE_PLAY: + if seekstate == self.SEEK_STATE_PLAY: # regular EOF self.doEofInternal(True) else: self.doEofInternal(False) @@ -1284,7 +1301,7 @@ class InfoBarExtensions: list.extend([(x[0](), x) for x in extensionsList]) keys += [""] * len(extensionsList) - self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys) + self.session.openWithCallback(self.extensionCallback, ChoiceBox, title=_("Please choose an extension..."), list = list, keys = keys, skin_name = "ExtensionsList") def extensionCallback(self, answer): if answer is not None: @@ -1302,7 +1319,9 @@ class InfoBarPlugins: return name def getPluginList(self): - return [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)] + list = [((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None, p.name) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU)] + list.sort(key = lambda e: e[2]) # sort by name + return list def runPlugin(self, plugin): if isinstance(self, InfoBarChannelSelection): @@ -1489,7 +1508,7 @@ class InfoBarInstantRecord: def isInstantRecordRunning(self): print "self.recording:", self.recording - if len(self.recording) > 0: + if self.recording: for x in self.recording: if x.isRunning(): return True @@ -1532,7 +1551,7 @@ class InfoBarInstantRecord: print "after:\n", self.recording def setEndtime(self, entry): - if entry is not None: + if entry is not None and entry >= 0: self.selectedEntry = entry self.endtime=ConfigClock(default = self.recording[self.selectedEntry].end) dlg = self.session.openWithCallback(self.TimeDateInputClosed, TimeDateInput, self.endtime) @@ -1549,7 +1568,7 @@ class InfoBarInstantRecord: self.session.nav.RecordTimer.timeChanged(self.recording[self.selectedEntry]) def changeDuration(self, entry): - if entry is not None: + if entry is not None and entry >= 0: self.selectedEntry = entry self.session.openWithCallback(self.inputCallback, InputBox, title=_("How many minutes do you want to record?"), text="5", maxSize=False, type=Input.NUMBER) @@ -1640,16 +1659,16 @@ class InfoBarAudioSelection: break if SystemInfo["CanDownmixAC3"]: - tlist = [(_("AC3 downmix") + " - " +[_("Off"), _("On")][config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), - ([_("Left"), _("Stereo"), _("Right")][self.audioChannel.getCurrentChannel()], "mode"), + tlist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), + ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist keys = [ "red", "green", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n selection += 3 else: - tlist = [([_("Left"), _("Stereo"), _("Right")][self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist + tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n selection += 2 - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys) + self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") else: del self.audioTracks @@ -1658,7 +1677,7 @@ class InfoBarAudioSelection: list = choicelist.list t = list[0][1] list[0][1]=(t[0], t[1], t[2], t[3], t[4], t[5], t[6], - _("AC3 downmix") + " - " +[_("On"), _("Off")][config.av.downmix_ac3.value and 1 or 0]) + _("AC3 downmix") + " - " + (_("On"), _("Off"))[config.av.downmix_ac3.value and 1 or 0]) choicelist.setList(list) if config.av.downmix_ac3.value: config.av.downmix_ac3.value = False @@ -1673,7 +1692,7 @@ class InfoBarAudioSelection: keys = ["red", "green", "yellow"] selection = self.audioChannel.getCurrentChannel() tlist = ((_("left"), 0), (_("stereo"), 1), (_("right"), 2)) - self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys) + self.session.openWithCallback(self.modeSelected, ChoiceBox, title=_("Select audio mode"), list = tlist, selection = selection, keys = keys, skin_name ="AudioModeSelection") else: del self.audioChannel if self.session.nav.getCurrentService().audioTracks().getNumberOfTracks() > audio[1]: @@ -1774,7 +1793,7 @@ class InfoBarSubserviceSelection: keys = ["red", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n selection += 2 - self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = selection, keys = keys) + self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = selection, keys = keys, skin_name = "SubserviceSelection") def subserviceSelected(self, service): del self.bouquets @@ -2089,9 +2108,6 @@ class InfoBarSummary(Screen): # <convert type="ServiceName">Reference</convert> # </widget> - def __init__(self, session, parent): - Screen.__init__(self, session, parent = parent) - class InfoBarSummarySupport: def __init__(self): pass @@ -2117,9 +2133,6 @@ class InfoBarMoviePlayerSummary(Screen): </widget> </screen>""" - def __init__(self, session, parent): - Screen.__init__(self, session) - class InfoBarMoviePlayerSummarySupport: def __init__(self): pass @@ -2220,7 +2233,7 @@ class InfoBarServiceErrorPopupSupport: else: self.last_error = error - errors = { + error = { eDVBServicePMTHandler.eventNoResources: _("No free tuner!"), eDVBServicePMTHandler.eventTuneFailed: _("Tune failed!"), eDVBServicePMTHandler.eventNoPAT: _("No data on transponder!\n(Timeout reading PAT)"), @@ -2231,9 +2244,7 @@ class InfoBarServiceErrorPopupSupport: eDVBServicePMTHandler.eventSOF: None, eDVBServicePMTHandler.eventEOF: None, eDVBServicePMTHandler.eventMisconfiguration: _("Service unavailable!\nCheck tuner configuration!"), - } - - error = errors.get(error) #this returns None when the key not exist in the dict + }.get(error) #this returns None when the key not exist in the dict if error is not None: Notifications.AddPopup(text = error, type = MessageBox.TYPE_ERROR, timeout = 5, id = "ZapError") diff --git a/lib/python/Screens/LanguageSelection.py b/lib/python/Screens/LanguageSelection.py index 94ede08c..082daa55 100644 --- a/lib/python/Screens/LanguageSelection.py +++ b/lib/python/Screens/LanguageSelection.py @@ -76,21 +76,22 @@ class LanguageSelection(Screen): print "ok" def updateList(self): - first_time = len(self.list) == 0 + first_time = not self.list - self.list = [] - if len(language.getLanguageList()) == 0: # no language available => display only english - self.list.append(LanguageEntryComponent("en", _cached("en_EN"), "en_EN")) + languageList = language.getLanguageList() + if not languageList: # no language available => display only english + list = [ LanguageEntryComponent("en", _cached("en_EN"), "en_EN") ] else: - for x in language.getLanguageList(): - self.list.append(LanguageEntryComponent(file = x[1][2].lower(), name = _cached("%s_%s" % x[1][1:3]), index = x[0])) - #self.list.sort(key=lambda x: x[1][7]) + list = [ LanguageEntryComponent(file = x[1][2].lower(), name = _cached("%s_%s" % x[1][1:3]), index = x[0]) for x in languageList] + self.list = list + + #list.sort(key=lambda x: x[1][7]) print "updateList" if first_time: - self["languages"].list = self.list + self["languages"].list = list else: - self["languages"].updateList(self.list) + self["languages"].updateList(list) print "done" def changed(self): diff --git a/lib/python/Screens/LocationBox.py b/lib/python/Screens/LocationBox.py index fa47b1f2..61d7105d 100644 --- a/lib/python/Screens/LocationBox.py +++ b/lib/python/Screens/LocationBox.py @@ -163,11 +163,11 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): }) # Run some functions when shown - self.onShown.extend([ + self.onShown.extend(( boundFunction(self.setTitle, windowTitle), self.updateTarget, self.showHideRename, - ]) + )) self.onLayoutFinish.append(self.switchToFileListOnStart) @@ -241,7 +241,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): ) def createDirCallback(self, res): - if res is not None and len(res): + if res: path = os.path.join(self["filelist"].current_directory, res) if not pathExists(path): if not createDir(path): @@ -454,7 +454,7 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): def selectByStart(self): # Don't do anything on initial call - if not len(self.quickselect): + if not self.quickselect: return # Don't select if no dir @@ -503,16 +503,12 @@ class LocationBox(Screen, NumericalTextInput, HelpableScreen): return str(type(self)) + "(" + self.text + ")" class MovieLocationBox(LocationBox): - skinName = "LocationBox" - def __init__(self, session, text, dir, minFree = None): inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"] LocationBox.__init__(self, session, text = text, currDir = dir, bookmarks = config.movielist.videodirs, autoAdd = True, editDir = True, inhibitDirs = inhibitDirs, minFree = minFree) + self.skinName = "LocationBox" class TimeshiftLocationBox(LocationBox): - - skinName = "LocationBox" # XXX: though we could use a custom skin or inherit the hardcoded one we stick with the original :-) - def __init__(self, session): inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/lib", "/proc", "/sbin", "/sys", "/usr", "/var"] LocationBox.__init__( @@ -524,8 +520,9 @@ class TimeshiftLocationBox(LocationBox): autoAdd = True, editDir = True, inhibitDirs = inhibitDirs, - minFree = 1024 # XXX: the same requirement is hardcoded in servicedvb.cpp + minFree = 1024 # the same requirement is hardcoded in servicedvb.cpp ) + self.skinName = "LocationBox" def cancel(self): config.usage.timeshift_path.cancel() diff --git a/lib/python/Screens/Menu.py b/lib/python/Screens/Menu.py index 93f23dfb..5f2032f1 100644 --- a/lib/python/Screens/Menu.py +++ b/lib/python/Screens/Menu.py @@ -61,9 +61,6 @@ class MenuSummary(Screen): </widget> </screen>""" - def __init__(self, session, parent): - Screen.__init__(self, session, parent) - class Menu(Screen): ALLOW_SUSPEND = True @@ -118,7 +115,7 @@ class Menu(Screen): self.menuClosed(*res) def menuClosed(self, *res): - if len(res) and res[0]: + if res and res[0]: self.close(True) def addItem(self, destList, node): diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py index 8a5989c7..10485680 100644 --- a/lib/python/Screens/MessageBox.py +++ b/lib/python/Screens/MessageBox.py @@ -43,7 +43,7 @@ class MessageBox(Screen): else: self.list = [ (_("no"), 1), (_("yes"), 0) ] - if len(self.list): + if self.list: self["selectedChoice"].setText(self.list[0][0]) self["list"] = MenuList(self.list) @@ -134,7 +134,7 @@ class MessageBox(Screen): if self.close_on_any_key: self.close(True) self["list"].instance.moveSelection(direction) - if len(self.list): + if self.list: self["selectedChoice"].setText(self["list"].getCurrent()[0]) self.stopTimer() diff --git a/lib/python/Screens/MovieSelection.py b/lib/python/Screens/MovieSelection.py index 5951653f..174a4f07 100644 --- a/lib/python/Screens/MovieSelection.py +++ b/lib/python/Screens/MovieSelection.py @@ -65,20 +65,20 @@ class MovieContextMenu(Screen): }) menu = [(_("delete..."), self.delete)] - - for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST): - menu.append((p.description, boundFunction(self.execPlugin, p))) - + menu.extend([(p.description, boundFunction(self.execPlugin, p)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)]) + if config.movielist.moviesort.value == MovieList.SORT_ALPHANUMERIC: menu.append((_("sort by date"), boundFunction(self.sortBy, MovieList.SORT_RECORDED))) else: menu.append((_("alphabetic sort"), boundFunction(self.sortBy, MovieList.SORT_ALPHANUMERIC))) - menu.append((_("list style default"), boundFunction(self.listType, MovieList.LISTTYPE_ORIGINAL))) - menu.append((_("list style compact with description"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT_DESCRIPTION))) - menu.append((_("list style compact"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT))) - menu.append((_("list style single line"), boundFunction(self.listType, MovieList.LISTTYPE_MINIMAL))) - + menu.extend(( + (_("list style default"), boundFunction(self.listType, MovieList.LISTTYPE_ORIGINAL)), + (_("list style compact with description"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT_DESCRIPTION)), + (_("list style compact"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT)), + (_("list style single line"), boundFunction(self.listType, MovieList.LISTTYPE_MINIMAL)) + )) + if config.movielist.description.value == MovieList.SHOW_DESCRIPTION: menu.append((_("hide extended description"), boundFunction(self.showDescription, MovieList.HIDE_DESCRIPTION))) else: diff --git a/lib/python/Screens/Mute.py b/lib/python/Screens/Mute.py index f64be901..f80267ad 100644 --- a/lib/python/Screens/Mute.py +++ b/lib/python/Screens/Mute.py @@ -1,6 +1,5 @@ from Screen import Screen class Mute(Screen): - def __init__(self, session): - Screen.__init__(self, session) + pass diff --git a/lib/python/Screens/NetworkSetup.py b/lib/python/Screens/NetworkSetup.py index ea2d17e6..50f8c41b 100755 --- a/lib/python/Screens/NetworkSetup.py +++ b/lib/python/Screens/NetworkSetup.py @@ -28,8 +28,10 @@ class InterfaceList(MenuList): self.l.setItemHeight(30) def InterfaceEntryComponent(index,name,default,active ): - res = [ (index) ] - res.append(MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name)) + res = [ + (index), + MultiContentEntryText(pos=(80, 5), size=(430, 25), font=0, text=name) + ] num_configured_if = len(iNetwork.getConfiguredAdapters()) if num_configured_if >= 2: if default is True: @@ -62,7 +64,7 @@ class NetworkAdapterSelection(Screen,HelpableScreen): self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()] - if len(self.adapters) == 0: + if not self.adapters: self.onFirstExecBegin.append(self.NetworkFallback) self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", @@ -232,17 +234,16 @@ class NameserverSetup(Screen, ConfigListScreen, HelpableScreen): def createConfig(self): self.nameservers = iNetwork.getNameserverList() - self.nameserverEntries = [] - - for nameserver in self.nameservers: - self.nameserverEntries.append(NoSave(ConfigIP(default=nameserver))) + self.nameserverEntries = [ NoSave(ConfigIP(default=nameserver)) for nameserver in self.nameservers] def createSetup(self): self.list = [] - - for i in range(len(self.nameserverEntries)): - self.list.append(getConfigListEntry(_("Nameserver %d") % (i + 1), self.nameserverEntries[i])) - + + i = 1 + for x in self.nameserverEntries: + self.list.append(getConfigListEntry(_("Nameserver %d") % (i), x)) + i += 1 + self["config"].list = self.list self["config"].l.setList(self.list) diff --git a/lib/python/Screens/NumericalTextInputHelpDialog.py b/lib/python/Screens/NumericalTextInputHelpDialog.py index 39c644b9..e0979587 100644 --- a/lib/python/Screens/NumericalTextInputHelpDialog.py +++ b/lib/python/Screens/NumericalTextInputHelpDialog.py @@ -4,7 +4,7 @@ from Components.Label import Label class NumericalTextInputHelpDialog(Screen): def __init__(self, session, textinput): Screen.__init__(self, session) - for x in range(1, 10): + for x in (1, 2, 3, 4, 5, 6, 7, 8, 9): self["key%d" % x] = Label(text=textinput.mapping[x].encode("utf-8")) self.last_marked = 0 diff --git a/lib/python/Screens/PVRState.py b/lib/python/Screens/PVRState.py index 8b90c420..891379ca 100644 --- a/lib/python/Screens/PVRState.py +++ b/lib/python/Screens/PVRState.py @@ -8,5 +8,5 @@ class PVRState(Screen): self["state"] = Label(text="") class TimeshiftState(PVRState): - def __init__(self, session): - PVRState.__init__(self, session) + pass + diff --git a/lib/python/Screens/ParentalControlSetup.py b/lib/python/Screens/ParentalControlSetup.py index 6ae12cae..4c63dd5c 100644 --- a/lib/python/Screens/ParentalControlSetup.py +++ b/lib/python/Screens/ParentalControlSetup.py @@ -215,9 +215,7 @@ class ParentalControlEditor(Screen): if result is not None: print "result:", result self.currentLetter = result[1] - self.list = [] - for x in self.servicesList[result[1]]: - self.list.append(ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1)) + self.list = [ParentalControlEntryComponent(x[0], x[1], parentalControl.getProtectionLevel(x[0]) != -1) for x in self.servicesList[result[1]]] self.servicelist.setList(self.list) else: parentalControl.save() diff --git a/lib/python/Screens/PluginBrowser.py b/lib/python/Screens/PluginBrowser.py index 0f6ee746..cd17e2e0 100644 --- a/lib/python/Screens/PluginBrowser.py +++ b/lib/python/Screens/PluginBrowser.py @@ -51,11 +51,9 @@ class PluginBrowser(Screen): plugin(session=self.session) def updateList(self): - self.list = [ ] self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU) - for plugin in self.pluginlist: - self.list.append(PluginEntryComponent(plugin)) - + self.list = [PluginEntryComponent(plugin) for plugin in self.pluginlist] + self["list"].l.setList(self.list) def delete(self): @@ -187,7 +185,7 @@ class PluginDownloadBrowser(Screen): self.pluginlist.append(plugin) def updateList(self): - self.list = [] + list = [] expandableIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/expandable-plugins.png")) expandedIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/expanded-plugins.png")) verticallineIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/verticalline-plugins.png")) @@ -204,10 +202,10 @@ class PluginDownloadBrowser(Screen): for x in self.plugins.keys(): if x in self.expanded: - self.list.append(PluginCategoryComponent(x, expandedIcon)) - for plugin in self.plugins[x]: - self.list.append(PluginDownloadComponent(plugin[0], plugin[1])) + list.append(PluginCategoryComponent(x, expandedIcon)) + list.extend([PluginDownloadComponent(plugin[0], plugin[1]) for plugin in self.plugins[x]]) else: - self.list.append(PluginCategoryComponent(x, expandableIcon)) - self["list"].l.setList(self.list) + list.append(PluginCategoryComponent(x, expandableIcon)) + self.list = list + self["list"].l.setList(list) diff --git a/lib/python/Screens/Rc.py b/lib/python/Screens/Rc.py index 3a7c78b3..27ba1abd 100644 --- a/lib/python/Screens/Rc.py +++ b/lib/python/Screens/Rc.py @@ -81,4 +81,3 @@ class Rc: for selectPic in self.selectpics: for pic in selectPic[1]: self[pic].hide() -
\ No newline at end of file diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index da6fcc12..8b5089a3 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -21,7 +21,7 @@ class NimSetup(Screen, ConfigListScreen): else: list.append(getConfigListEntry(_("Port A"), nim.diseqcA)) - if mode in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if mode in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): list.append(getConfigListEntry(_("Port B"), nim.diseqcB)) if mode == "diseqc_a_b_c_d": list.append(getConfigListEntry(_("Port C"), nim.diseqcC)) @@ -99,7 +99,7 @@ class NimSetup(Screen, ConfigListScreen): if self.nimConfig.configMode.value == "simple": #simple setup self.diseqcModeEntry = getConfigListEntry(_("Mode"), self.nimConfig.diseqcMode) self.list.append(self.diseqcModeEntry) - if self.nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if self.nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value) if self.nimConfig.diseqcMode.value == "positioner": self.createPositionerSetup(self.list) @@ -204,7 +204,7 @@ class NimSetup(Screen, ConfigListScreen): if self.have_advanced and self.nim.config_mode == "advanced": self.fillAdvancedList() for x in self.list: - if x in [self.turnFastEpochBegin, self.turnFastEpochEnd]: + if x in (self.turnFastEpochBegin, self.turnFastEpochEnd): # workaround for storing only hour*3600+min*60 value in configfile # not really needed.. just for cosmetics.. tm = localtime(x[1].value) @@ -453,7 +453,7 @@ class NimSelection(Screen): text = nimConfig.configMode.value if self.showNim(x): if x.isCompatible("DVB-S"): - if nimConfig.configMode.value in ["loopthrough", "equal", "satposdepends"]: + if nimConfig.configMode.value in ("loopthrough", "equal", "satposdepends"): text = { "loopthrough": _("loopthrough to"), "equal": _("equal to"), "satposdepends": _("second cable of motorized LNB") } [nimConfig.configMode.value] @@ -461,11 +461,11 @@ class NimSelection(Screen): elif nimConfig.configMode.value == "nothing": text = _("nothing connected") elif nimConfig.configMode.value == "simple": - if nimConfig.diseqcMode.value in ["single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): text = _("Sats") + ": " if nimConfig.diseqcA.orbital_position != 3601: text += nimmanager.getSatName(int(nimConfig.diseqcA.value)) - if nimConfig.diseqcMode.value in ["toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"]: + if nimConfig.diseqcMode.value in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"): if nimConfig.diseqcB.orbital_position != 3601: text += "," + nimmanager.getSatName(int(nimConfig.diseqcB.value)) if nimConfig.diseqcMode.value == "diseqc_a_b_c_d": @@ -491,4 +491,4 @@ class NimSelection(Screen): self.list.append((slotid, x.friendly_full_description, text, x)) self["nimlist"].setList(self.list) - self["nimlist"].updateList(self.list)
\ No newline at end of file + self["nimlist"].updateList(self.list) diff --git a/lib/python/Screens/ServiceInfo.py b/lib/python/Screens/ServiceInfo.py index df8af4b4..fa2f4474 100644 --- a/lib/python/Screens/ServiceInfo.py +++ b/lib/python/Screens/ServiceInfo.py @@ -19,11 +19,6 @@ def to_unsigned(x): return x & 0xFFFFFFFF def ServiceInfoListEntry(a, b, valueType=TYPE_TEXT, param=4): - res = [ ] - - #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags; - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 30, 0, RT_HALIGN_LEFT, "")) - res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 25, 0, RT_HALIGN_LEFT, a)) print "b:", b if not isinstance(b, str): if valueType == TYPE_VALUE_HEX: @@ -34,10 +29,13 @@ def ServiceInfoListEntry(a, b, valueType=TYPE_TEXT, param=4): b = ("0x%0" + str(param) + "x (%dd)") % (to_unsigned(b), b) else: b = str(b) - - res.append((eListboxPythonMultiContent.TYPE_TEXT, 220, 0, 350, 25, 0, RT_HALIGN_LEFT, b)) - return res + return [ + #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags; + (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 30, 0, RT_HALIGN_LEFT, ""), + (eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 25, 0, RT_HALIGN_LEFT, a), + (eListboxPythonMultiContent.TYPE_TEXT, 220, 0, 350, 25, 0, RT_HALIGN_LEFT, b) + ] class ServiceInfoList(HTMLComponent, GUIComponent): def __init__(self, source): @@ -151,9 +149,7 @@ class ServiceInfo(Screen): "transmission_mode": _("Transmission Mode"), "guard_interval" : _("Guard Interval"), "hierarchy_information": _("Hierarchy Information") } - Labels = [ ] - for i in tp_info.keys(): - Labels.append( (conv[i], tp_info[i], TYPE_VALUE_DEC) ) + Labels = [(conv[i], tp_info[i], TYPE_VALUE_DEC) for i in tp_info.keys()] self.fillList(Labels) def pids(self): @@ -186,7 +182,7 @@ class ServiceInfo(Screen): if frontendDataOrg and len(frontendDataOrg): frontendData = ConvertToHumanReadable(frontendDataOrg) if frontendDataOrg["tuner_type"] == "DVB-S": - return (("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT), + return (("NIM", ('A', 'B', 'C', 'D')[frontendData["tuner_number"]], TYPE_TEXT), ("Type", frontendData["system"], TYPE_TEXT), ("Modulation", frontendData["modulation"], TYPE_TEXT), ("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC), @@ -198,7 +194,7 @@ class ServiceInfo(Screen): ("Pilot", frontendData.get("pilot", None), TYPE_TEXT), ("Rolloff", frontendData.get("rolloff", None), TYPE_TEXT)) elif frontendDataOrg["tuner_type"] == "DVB-C": - return (("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT), + return (("NIM", ('A', 'B', 'C', 'D')[frontendData["tuner_number"]], TYPE_TEXT), ("Type", frontendData["tuner_type"], TYPE_TEXT), ("Frequency", frontendData["frequency"], TYPE_VALUE_DEC), ("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC), @@ -206,7 +202,7 @@ class ServiceInfo(Screen): ("Inversion", frontendData["inversion"], TYPE_TEXT), ("FEC inner", frontendData["fec_inner"], TYPE_TEXT)) elif frontendDataOrg["tuner_type"] == "DVB-T": - return (("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT), + return (("NIM", ('A', 'B', 'C', 'D')[frontendData["tuner_number"]], TYPE_TEXT), ("Type", frontendData["tuner_type"], TYPE_TEXT), ("Frequency", frontendData["frequency"], TYPE_VALUE_DEC), ("Inversion", frontendData["inversion"], TYPE_TEXT), diff --git a/lib/python/Screens/Setup.py b/lib/python/Screens/Setup.py index 1d035b8a..7226562f 100644 --- a/lib/python/Screens/Setup.py +++ b/lib/python/Screens/Setup.py @@ -21,10 +21,10 @@ setupfile.close() class SetupError(Exception): def __init__(self, message): - self.message = message + self.msg = message def __str__(self): - return self.message + return self.msg class SetupSummary(Screen): skin = """ @@ -35,11 +35,10 @@ class SetupSummary(Screen): </screen>""" def __init__(self, session, parent): - Screen.__init__(self, session) + Screen.__init__(self, session, parent = parent) self["SetupTitle"] = Label(_(parent.setup_title)) self["SetupEntry"] = Label("") self["SetupValue"] = Label("") - self.parent = parent self.onShow.append(self.addWatcher) self.onHide.append(self.removeWatcher) diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index d09f28af..afea94b9 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -87,9 +87,6 @@ class StandbySummary(Screen): </widget> </screen>""" - def __init__(self, session, parent): - Screen.__init__(self, session) - from enigma import quitMainloop, iRecordableService from Screens.MessageBox import MessageBox from time import time @@ -100,7 +97,7 @@ inTryQuitMainloop = False class TryQuitMainloop(MessageBox): def __init__(self, session, retvalue=1, timeout=-1, default_yes = True): self.retval=retvalue - recordings = len(session.nav.getRecordings()) + recordings = session.nav.getRecordings() jobs = len(job_manager.getPendingJobs()) self.connected = False reason = "" @@ -137,7 +134,7 @@ class TryQuitMainloop(MessageBox): def getRecordEvent(self, recservice, event): if event == iRecordableService.evEnd: recordings = self.session.nav.getRecordings() - if not len(recordings): # no more recordings exist + if not recordings: # no more recordings exist rec_time = self.session.nav.RecordTimer.getNextRecordingTime() if rec_time > 0 and (rec_time - time()) < 360: self.initTimeout(360) # wait for next starting timer diff --git a/lib/python/Screens/SubservicesQuickzap.py b/lib/python/Screens/SubservicesQuickzap.py index 24af517d..3bcc3c46 100644 --- a/lib/python/Screens/SubservicesQuickzap.py +++ b/lib/python/Screens/SubservicesQuickzap.py @@ -9,10 +9,17 @@ from Components.ServiceEventTracker import InfoBarBase from enigma import eTimer -class SubservicesQuickzap(InfoBarBase, InfoBarShowHide, InfoBarMenu, InfoBarInstantRecord, InfoBarSeek, InfoBarTimeshift, InfoBarTimeshiftState, InfoBarExtensions, InfoBarSubtitleSupport, InfoBarAudioSelection, Screen): +class SubservicesQuickzap(InfoBarBase, InfoBarShowHide, InfoBarMenu, \ + InfoBarInstantRecord, InfoBarSeek, InfoBarTimeshift, \ + InfoBarTimeshiftState, InfoBarExtensions, InfoBarSubtitleSupport, \ + InfoBarAudioSelection, Screen): + def __init__(self, session, subservices): Screen.__init__(self, session) - for x in [InfoBarBase, InfoBarShowHide, InfoBarMenu, InfoBarInstantRecord, InfoBarSeek, InfoBarTimeshift, InfoBarTimeshiftState, InfoBarSubtitleSupport, InfoBarExtensions, InfoBarAudioSelection]: + for x in InfoBarBase, InfoBarShowHide, InfoBarMenu, \ + InfoBarInstantRecord, InfoBarSeek, InfoBarTimeshift, \ + InfoBarTimeshiftState, InfoBarSubtitleSupport, \ + InfoBarExtensions, InfoBarAudioSelection: x.__init__(self) self.restoreService = self.session.nav.getCurrentlyPlayingServiceReference() @@ -97,12 +104,15 @@ class SubservicesQuickzap(InfoBarBase, InfoBarShowHide, InfoBarMenu, InfoBarInst def showSelection(self): self.updateSubservices() tlist = [] - if self.n is not None: - for x in range(self.n): - i = self.subservices.getSubservice(x) - tlist.append((i.getName(), x)) + n = self.n or 0 + if n: + idx = 0 + while idx < n: + i = self.subservices.getSubservice(idx) + tlist.append((i.getName(), idx)) + idx += 1 - keys = [ "", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * self.n + keys = [ "", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice..."), list = tlist, selection = self.currentlyPlayingSubservice, keys = keys) def subserviceSelected(self, service): diff --git a/lib/python/Screens/SubtitleDisplay.py b/lib/python/Screens/SubtitleDisplay.py index 80d3bd26..13ece59a 100644 --- a/lib/python/Screens/SubtitleDisplay.py +++ b/lib/python/Screens/SubtitleDisplay.py @@ -1,7 +1,6 @@ from Screens.Screen import Screen class SubtitleDisplay(Screen): - def __init__(self, session): - Screen.__init__(self, session) - + pass + # not really much to do... diff --git a/lib/python/Screens/Subtitles.py b/lib/python/Screens/Subtitles.py index e6378619..54bc7a5b 100644 --- a/lib/python/Screens/Subtitles.py +++ b/lib/python/Screens/Subtitles.py @@ -30,10 +30,11 @@ class Subtitles(Screen, ConfigListScreen): self.__selected_subtitle = None def fillList(self): - del self.list[:] - print "self.list", self.list + list = self.list + del list[:] + print "self.list", list if self.subtitlesEnabled(): - self.list.append(getConfigListEntry(_("Disable Subtitles"), ConfigNothing(), None)) + list.append(getConfigListEntry(_("Disable Subtitles"), ConfigNothing(), None)) sel = self.infobar.selected_subtitle else: sel = None @@ -44,29 +45,29 @@ class Subtitles(Screen, ConfigListScreen): text = _("Enable") if x[0] == 0: if LanguageCodes.has_key(x[4]): - self.list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x)) + list.append(getConfigListEntry(text+" DVB "+LanguageCodes[x[4]][0], ConfigNothing(), x)) else: - self.list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x)) + list.append(getConfigListEntry(text+" DVB "+x[4], ConfigNothing(), x)) elif x[0] == 1: if x[4] == 'und': #undefined - self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x)) + list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2]), ConfigNothing(), x)) else: if LanguageCodes.has_key(x[4]): - self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x)) + list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+LanguageCodes[x[4]][0], ConfigNothing(), x)) else: - self.list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x)) + list.append(getConfigListEntry(text+" TTX "+_("Page")+" %x%02x"%(x[3],x[2])+" "+x[4], ConfigNothing(), x)) elif x[0] == 2: - types = [" UTF-8 text "," SSA / AAS "," .SRT file "] + types = (" UTF-8 text "," SSA / AAS "," .SRT file ") if x[4] == 'und': #undefined - self.list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d" % x[1], ConfigNothing(), x)) + list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d" % x[1], ConfigNothing(), x)) else: if LanguageCodes.has_key(x[4]): - self.list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles") + ' ' + LanguageCodes[x[4]][0], ConfigNothing(), x)) + list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles") + ' ' + LanguageCodes[x[4]][0], ConfigNothing(), x)) else: - self.list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d " % x[1] +x[4], ConfigNothing(), x)) + list.append(getConfigListEntry(text+types[x[2]]+_("Subtitles")+" %d " % x[1] +x[4], ConfigNothing(), x)) # return _("Disable subtitles") - self["config"].list = self.list - self["config"].l.setList(self.list) + self["config"].list = list + self["config"].l.setList(list) def __updatedInfo(self): self.fillList() @@ -95,7 +96,7 @@ class Subtitles(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) def ok(self): - if len(self.list): + if self.list: cur = self["config"].getCurrent() self.enableSubtitle(cur[2]) self.close(1) diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 69604279..1453c05f 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -80,7 +80,7 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): else: self["job_task"].text = "" self["summary_job_task"].text = j.getStatustext() - if j.status in [j.FINISHED, j.FAILED]: + if j.status in (j.FINISHED, j.FAILED): self.performAfterEvent() self["backgroundable"].boolean = False if j.status == j.FINISHED: @@ -94,11 +94,11 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen): self.close(True) def ok(self): - if self.job.status in [self.job.FINISHED, self.job.FAILED]: + if self.job.status in (self.job.FINISHED, self.job.FAILED): self.close(False) def abort(self): - if self.job.status in [self.job.FINISHED, self.job.FAILED]: + if self.job.status in (self.job.FINISHED, self.job.FAILED): self.close(False) if self["cancelable"].boolean == True: self.job.cancel() diff --git a/lib/python/Screens/TimeDateInput.py b/lib/python/Screens/TimeDateInput.py index 7f940909..56ccae90 100644 --- a/lib/python/Screens/TimeDateInput.py +++ b/lib/python/Screens/TimeDateInput.py @@ -42,9 +42,10 @@ class TimeDateInput(Screen, ConfigListScreen): self.timeinput_time = conf_time def createSetup(self, configlist): - self.list = [] - self.list.append(getConfigListEntry(_("Date"), self.timeinput_date)) - self.list.append(getConfigListEntry(_("Time"), self.timeinput_time)) + self.list = [ + getConfigListEntry(_("Date"), self.timeinput_date), + getConfigListEntry(_("Time"), self.timeinput_time) + ] configlist.list = self.list configlist.l.setList(self.list) diff --git a/lib/python/Screens/TimerEdit.py b/lib/python/Screens/TimerEdit.py index 6499ef50..caaf8c95 100644 --- a/lib/python/Screens/TimerEdit.py +++ b/lib/python/Screens/TimerEdit.py @@ -171,14 +171,11 @@ class TimerEditList(Screen): self.key_blue_choice = self.EMPTY def fillTimerList(self): - del self.list[:] - - for timer in self.session.nav.RecordTimer.timer_list: - self.list.append((timer, False)) - - for timer in self.session.nav.RecordTimer.processed_timers: - self.list.append((timer, True)) - self.list.sort(cmp = lambda x, y: x[0].begin < y[0].begin) + list = self.list + del list[:] + list.extend([(timer, False) for timer in self.session.nav.RecordTimer.timer_list]) + list.extend([(timer, True) for timer in self.session.nav.RecordTimer.processed_timers]) + list.sort(cmp = lambda x, y: x[0].begin < y[0].begin) def showLog(self): cur=self["timerlist"].getCurrent() diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 92a16af8..edd19685 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -57,12 +57,12 @@ class TimerEntry(Screen, ConfigListScreen): AFTEREVENT.AUTO: "auto" }[self.timer.afterEvent] - weekday_table = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] + weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun") # calculate default values day = [] weekday = 0 - for x in range(0,7): + for x in (0, 1, 2, 3, 4, 5, 6): day.append(0) if self.timer.repeated: # repeated type = "repeated" @@ -74,7 +74,7 @@ class TimerEntry(Screen, ConfigListScreen): flags = self.timer.repeated repeated = "user" count = 0 - for x in range(0, 7): + for x in (0, 1, 2, 3, 4, 5, 6): if flags == 1: # weekly print "Set to weekday " + str(x) weekday = x @@ -98,7 +98,7 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False) self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False) self.timerentry_tags = self.timer.tags[:] - self.timerentry_tagsset = ConfigSelection(choices = [len(self.timerentry_tags) == 0 and "None" or " ".join(self.timerentry_tags)]) + self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)]) self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("daily", _("daily")), ("weekly", _("weekly")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))]) @@ -117,7 +117,7 @@ class TimerEntry(Screen, ConfigListScreen): self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))]) self.timerentry_day = ConfigSubList() - for x in range(0,7): + for x in (0, 1, 2, 3, 4, 5, 6): self.timerentry_day.append(ConfigYesNo(default = day[x])) # FIXME some service-chooser needed here @@ -197,14 +197,14 @@ class TimerEntry(Screen, ConfigListScreen): self.createSetup("config") def keyLeft(self): - if self["config"].getCurrent() in [self.channelEntry, self.tagsSet]: + if self["config"].getCurrent() in (self.channelEntry, self.tagsSet): self.keySelect() else: ConfigListScreen.keyLeft(self) self.newConfig() def keyRight(self): - if self["config"].getCurrent() in [self.channelEntry, self.tagsSet]: + if self["config"].getCurrent() in (self.channelEntry, self.tagsSet): self.keySelect() else: ConfigListScreen.keyRight(self) @@ -236,7 +236,7 @@ class TimerEntry(Screen, ConfigListScreen): self.keyGo() def finishedChannelSelection(self, *args): - if len(args): + if args: self.timerentry_service_ref = ServiceReference(args[0]) self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName()) self["config"].invalidate(self.channelEntry) @@ -281,18 +281,18 @@ class TimerEntry(Screen, ConfigListScreen): self.timer.begin, self.timer.end = self.getBeginEnd() if self.timerentry_type.value == "repeated": if self.timerentry_repeated.value == "daily": - for x in range(0,7): + for x in (0, 1, 2, 3, 4, 5, 6): self.timer.setRepeated(x) if self.timerentry_repeated.value == "weekly": self.timer.setRepeated(self.timerentry_weekday.index) if self.timerentry_repeated.value == "weekdays": - for x in range(0,5): + for x in (0, 1, 2, 3, 4): self.timer.setRepeated(x) if self.timerentry_repeated.value == "user": - for x in range(0,7): + for x in (0, 1, 2, 3, 4, 5, 6): if self.timerentry_day[x].value: self.timer.setRepeated(x) @@ -310,9 +310,9 @@ class TimerEntry(Screen, ConfigListScreen): if self.timer.eit is not None: event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit) - if event is not None: + if event: n = event.getNumOfLinkageServices() - if n > 0: + if n > 1: tlist = [] ref = self.session.nav.getCurrentlyPlayingServiceReference() parent = self.timer.service_ref.ref @@ -324,7 +324,9 @@ class TimerEntry(Screen, ConfigListScreen): tlist.append((i.getName(), i)) self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list = tlist, selection = selection) return - + elif n > 0: + parent = self.timer.service_ref.ref + self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0)) self.saveTimer() self.close((True, self.timer)) @@ -367,7 +369,7 @@ class TimerEntry(Screen, ConfigListScreen): def tagEditFinished(self, ret): if ret is not None: self.timerentry_tags = ret - self.timerentry_tagsset.setChoices([len(ret) == 0 and "None" or " ".join(ret)]) + self.timerentry_tagsset.setChoices([not ret and "None" or " ".join(ret)]) self["config"].invalidate(self.tagsSet) class TimerLog(Screen): @@ -410,9 +412,7 @@ class TimerLog(Screen): self.updateText() def fillLogList(self): - self.list = [ ] - for x in self.log_entries: - self.list.append((str(strftime("%Y-%m-%d %H-%M", localtime(x[0])) + " - " + x[2]), x)) + self.list = [(str(strftime("%Y-%m-%d %H-%M", localtime(x[0])) + " - " + x[2]), x) for x in self.log_entries] def clearLog(self): self.log_entries = [] @@ -444,7 +444,7 @@ class TimerLog(Screen): self.updateText() def updateText(self): - if len(self.list) > 0: + if self.list: self["logentry"].setText(str(self["loglist"].getCurrent()[1][2])) else: self["logentry"].setText("") diff --git a/lib/python/Screens/TimerSelection.py b/lib/python/Screens/TimerSelection.py index 7a1d9ecd..a97c7ba3 100644 --- a/lib/python/Screens/TimerSelection.py +++ b/lib/python/Screens/TimerSelection.py @@ -22,4 +22,3 @@ class TimerSelection(Screen): def selected(self): self.close(self["timerlist"].getCurrentIndex()) -
\ No newline at end of file diff --git a/lib/python/Screens/VirtualKeyBoard.py b/lib/python/Screens/VirtualKeyBoard.py index 5dc1a090..9b676a5f 100755 --- a/lib/python/Screens/VirtualKeyBoard.py +++ b/lib/python/Screens/VirtualKeyBoard.py @@ -1,289 +1,291 @@ -# -*- coding: iso-8859-1 -*-
-from Components.Language import language
-from Components.ActionMap import ActionMap
-from Components.Label import Label
-from Components.Pixmap import Pixmap
-from Components.MenuList import MenuList
-from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
-from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER
-from Screen import Screen
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
-from Tools.LoadPixmap import LoadPixmap
-
-class VirtualKeyBoardList(MenuList):
- def __init__(self, list, enableWrapAround=False):
- MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
- self.l.setFont(0, gFont("Regular", 22))
- self.l.setItemHeight(45)
-
-def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):
- key_backspace = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png"))
- key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png"))
- key_clr = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png"))
- key_esc = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png"))
- key_ok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png"))
- key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png"))
- key_shift = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png"))
- key_shift_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png"))
- key_space = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png"))
-
- res = [ (keys) ]
-
- x = 0
- count = 0
- if shiftMode:
- shiftkey_png = key_shift_sel
- else:
- shiftkey_png = key_shift
- for key in keys:
- if key == "EXIT":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc))
- elif key == "BACKSPACE":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace))
- elif key == "CLEAR":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr))
- elif key == "SHIFT":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png))
- elif key == "SPACE":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space))
- elif key == "OK":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok))
- #elif key == "<-":
- # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left))
- #elif key == "->":
- # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right))
-
- else:
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_bg))
- res.append(MultiContentEntryText(pos=(x, 0), size=(45, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER))
-
- if selectedKey == count:
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_sel))
-
- x += 45
- count += 1
-
- return res
-
-
-class VirtualKeyBoard(Screen):
-
- def __init__(self, session, title="", text=""):
- Screen.__init__(self, session)
- self.keys_list = []
- self.shiftkeys_list = []
- self.lang = language.getLanguage()
- if self.lang == 'de_DE':
- self.keys_list = [
- [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
- [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ü", u"+"],
- [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
- [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"@", u"ß", u"OK"]]
-
- self.shiftkeys_list = [
- [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
- [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ü", u"*"],
- [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
- [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]]
-
- elif self.lang == 'es_ES':
- #still missing keys (u"ùÙ")
- self.keys_list = [
- [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
- [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ú", u"+"],
- [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ó", u"á", u"#"],
- [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"@", u"£", u"à", u"é", u"è", u"í", u"ì", u"ñ", u"ò", u"OK"]]
-
- self.shiftkeys_list = [
- [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
- [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ú", u"*"],
- [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ó", u"Á", u"'"],
- [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"?", u"\\", u"À", u"É", u"È", u"Í", u"Ì", u"Ñ", u"Ò", u"OK"]]
-
- elif self.lang in ['sv_SE', 'fi_FI']:
- self.keys_list = [
- [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
- [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"é", u"+"],
- [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"],
- [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"@", u"ß", u"å", u"OK"]]
-
- self.shiftkeys_list = [
- [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
- [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],
- [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],
- [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
-
- [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]
- else:
- self.keys_list = [
- [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
- [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"],
- [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"],
- [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"OK"]]
-
- self.shiftkeys_list = [
- [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"],
- [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"],
- [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"],
- [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],
- [u"SHIFT", u"SPACE", u"OK"]]
-
- self.shiftMode = False
- self.text = text
- self.selectedKey = 0
-
- self["header"] = Label(title)
- self["text"] = Label(self.text)
- self["list"] = VirtualKeyBoardList([])
-
- self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"],
- {
- "ok": self.okClicked,
- "cancel": self.exit,
- "left": self.left,
- "right": self.right,
- "up": self.up,
- "down": self.down,
- "red": self.backClicked,
- "green": self.ok
- }, -2)
-
- self.onLayoutFinish.append(self.buildVirtualKeyBoard)
-
- def buildVirtualKeyBoard(self, selectedKey=0):
- list = []
-
- if self.shiftMode:
- self.k_list = self.shiftkeys_list
- for keys in self.k_list:
- if selectedKey < 12 and selectedKey > -1:
- list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True))
- else:
- list.append(VirtualKeyBoardEntryComponent(keys, -1,True))
- selectedKey -= 12
- else:
- self.k_list = self.keys_list
- for keys in self.k_list:
- if selectedKey < 12 and selectedKey > -1:
- list.append(VirtualKeyBoardEntryComponent(keys, selectedKey))
- else:
- list.append(VirtualKeyBoardEntryComponent(keys, -1))
- selectedKey -= 12
-
- self["list"].setList(list)
-
-
- def backClicked(self):
- self.text = self["text"].getText()[:-1]
- self["text"].setText(self.text)
-
- def okClicked(self):
- if self.shiftMode:
- list = self.shiftkeys_list
- else:
- list = self.keys_list
-
- selectedKey = self.selectedKey
-
- for x in list:
- if selectedKey < 12:
- text = x[selectedKey]
- break
- else:
- selectedKey -= 12
-
- text = text.encode("utf-8")
-
- if text == "EXIT":
- self.close(None)
-
- elif text == "BACKSPACE":
- self.text = self["text"].getText()[:-1]
- self["text"].setText(self.text)
-
- elif text == "CLEAR":
- self.text = ""
- self["text"].setText(self.text)
-
- elif text == "SHIFT":
- if self.shiftMode:
- self.shiftMode = False
- else:
- self.shiftMode = True
-
- self.buildVirtualKeyBoard(self.selectedKey)
-
- elif text == "SPACE":
- self.text += " "
- self["text"].setText(self.text)
-
- elif text == "OK":
- self.close(self["text"].getText())
-
- else:
- self.text = self["text"].getText()
- self.text += text
- self["text"].setText(self.text)
-
- def ok(self):
- self.close(self["text"].getText())
-
- def exit(self):
- self.close(None)
-
- def left(self):
- self.selectedKey -= 1
-
- if self.selectedKey == -1:
- self.selectedKey = 11
- elif self.selectedKey == 11:
- self.selectedKey = 23
- elif self.selectedKey == 23:
- self.selectedKey = 35
- elif self.selectedKey == 35:
- self.selectedKey = 47
- elif self.selectedKey == 47:
- self.selectedKey = 59
-
- self.showActiveKey()
-
- def right(self):
- self.selectedKey += 1
-
- if self.selectedKey == 12:
- self.selectedKey = 0
- elif self.selectedKey == 24:
- self.selectedKey = 12
- elif self.selectedKey == 36:
- self.selectedKey = 24
- elif self.selectedKey == 48:
- self.selectedKey = 36
- elif self.selectedKey == 60:
- self.selectedKey = 48
-
- self.showActiveKey()
-
- def up(self):
- self.selectedKey -= 12
-
- if self.selectedKey < 0:
- self.selectedKey += 60
-
- self.showActiveKey()
-
- def down(self):
- self.selectedKey += 12
-
- if self.selectedKey > 59:
- self.selectedKey -= 60
-
- self.showActiveKey()
-
- def showActiveKey(self):
- self.buildVirtualKeyBoard(self.selectedKey)
+# -*- coding: iso-8859-1 -*- +from Components.Language import language +from Components.ActionMap import ActionMap +from Components.Label import Label +from Components.Pixmap import Pixmap +from Components.MenuList import MenuList +from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest +from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER +from Screen import Screen +from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE +from Tools.LoadPixmap import LoadPixmap + +class VirtualKeyBoardList(MenuList): + def __init__(self, list, enableWrapAround=False): + MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent) + self.l.setFont(0, gFont("Regular", 22)) + self.l.setItemHeight(45) + +def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False): + key_backspace = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png")) + key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png")) + key_clr = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png")) + key_esc = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png")) + key_ok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png")) + key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png")) + key_shift = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png")) + key_shift_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png")) + key_space = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png")) + + res = [ (keys) ] + + x = 0 + count = 0 + if shiftMode: + shiftkey_png = key_shift_sel + else: + shiftkey_png = key_shift + for key in keys: + if key == "EXIT": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc)) + elif key == "BACKSPACE": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace)) + elif key == "CLEAR": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr)) + elif key == "SHIFT": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png)) + elif key == "SPACE": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space)) + elif key == "OK": + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok)) + #elif key == "<-": + # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_left)) + #elif key == "->": + # res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_right)) + + else: + res.extend(( + MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_bg), + MultiContentEntryText(pos=(x, 0), size=(45, 45), font=0, text=key.encode("utf-8"), flags=RT_HALIGN_CENTER | RT_VALIGN_CENTER) + )) + + if selectedKey == count: + res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_sel)) + + x += 45 + count += 1 + + return res + + +class VirtualKeyBoard(Screen): + + def __init__(self, session, title="", text=""): + Screen.__init__(self, session) + self.keys_list = [] + self.shiftkeys_list = [] + self.lang = language.getLanguage() + if self.lang == 'de_DE': + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ü", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"ß", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ü", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"?", u"\\", u"OK"]] + + elif self.lang == 'es_ES': + #still missing keys (u"ùÙ") + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"ú", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ó", u"á", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"£", u"à", u"é", u"è", u"í", u"ì", u"ñ", u"ò", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"Ú", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ó", u"Á", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"?", u"\\", u"À", u"É", u"È", u"Í", u"Ì", u"Ñ", u"Ò", u"OK"]] + + elif self.lang in ('sv_SE', 'fi_FI'): + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"é", u"+"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"ö", u"ä", u"#"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"@", u"ß", u"å", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + + [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]] + else: + self.keys_list = [ + [u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"], + [u"q", u"w", u"e", u"r", u"t", u"z", u"u", u"i", u"o", u"p", u"+", u"@"], + [u"a", u"s", u"d", u"f", u"g", u"h", u"j", u"k", u"l", u"#", u"\\"], + [u"<", u"y", u"x", u"c", u"v", u"b", u"n", u"m", u",", ".", u"-", u"CLEAR"], + [u"SHIFT", u"SPACE", u"OK"]] + + self.shiftkeys_list = [ + [u"EXIT", u"!", u'"', u"§", u"$", u"%", u"&", u"/", u"(", u")", u"=", u"BACKSPACE"], + [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"*"], + [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"'", u"?"], + [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"], + [u"SHIFT", u"SPACE", u"OK"]] + + self.shiftMode = False + self.text = text + self.selectedKey = 0 + + self["header"] = Label(title) + self["text"] = Label(self.text) + self["list"] = VirtualKeyBoardList([]) + + self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions"], + { + "ok": self.okClicked, + "cancel": self.exit, + "left": self.left, + "right": self.right, + "up": self.up, + "down": self.down, + "red": self.backClicked, + "green": self.ok + }, -2) + + self.onLayoutFinish.append(self.buildVirtualKeyBoard) + + def buildVirtualKeyBoard(self, selectedKey=0): + list = [] + + if self.shiftMode: + self.k_list = self.shiftkeys_list + for keys in self.k_list: + if selectedKey < 12 and selectedKey > -1: + list.append(VirtualKeyBoardEntryComponent(keys, selectedKey,True)) + else: + list.append(VirtualKeyBoardEntryComponent(keys, -1,True)) + selectedKey -= 12 + else: + self.k_list = self.keys_list + for keys in self.k_list: + if selectedKey < 12 and selectedKey > -1: + list.append(VirtualKeyBoardEntryComponent(keys, selectedKey)) + else: + list.append(VirtualKeyBoardEntryComponent(keys, -1)) + selectedKey -= 12 + + self["list"].setList(list) + + + def backClicked(self): + self.text = self["text"].getText()[:-1] + self["text"].setText(self.text) + + def okClicked(self): + if self.shiftMode: + list = self.shiftkeys_list + else: + list = self.keys_list + + selectedKey = self.selectedKey + + for x in list: + if selectedKey < 12: + text = x[selectedKey] + break + else: + selectedKey -= 12 + + text = text.encode("utf-8") + + if text == "EXIT": + self.close(None) + + elif text == "BACKSPACE": + self.text = self["text"].getText()[:-1] + self["text"].setText(self.text) + + elif text == "CLEAR": + self.text = "" + self["text"].setText(self.text) + + elif text == "SHIFT": + if self.shiftMode: + self.shiftMode = False + else: + self.shiftMode = True + + self.buildVirtualKeyBoard(self.selectedKey) + + elif text == "SPACE": + self.text += " " + self["text"].setText(self.text) + + elif text == "OK": + self.close(self["text"].getText()) + + else: + self.text = self["text"].getText() + self.text += text + self["text"].setText(self.text) + + def ok(self): + self.close(self["text"].getText()) + + def exit(self): + self.close(None) + + def left(self): + self.selectedKey -= 1 + + if self.selectedKey == -1: + self.selectedKey = 11 + elif self.selectedKey == 11: + self.selectedKey = 23 + elif self.selectedKey == 23: + self.selectedKey = 35 + elif self.selectedKey == 35: + self.selectedKey = 47 + elif self.selectedKey == 47: + self.selectedKey = 59 + + self.showActiveKey() + + def right(self): + self.selectedKey += 1 + + if self.selectedKey == 12: + self.selectedKey = 0 + elif self.selectedKey == 24: + self.selectedKey = 12 + elif self.selectedKey == 36: + self.selectedKey = 24 + elif self.selectedKey == 48: + self.selectedKey = 36 + elif self.selectedKey == 60: + self.selectedKey = 48 + + self.showActiveKey() + + def up(self): + self.selectedKey -= 12 + + if self.selectedKey < 0: + self.selectedKey += 60 + + self.showActiveKey() + + def down(self): + self.selectedKey += 12 + + if self.selectedKey > 59: + self.selectedKey -= 60 + + self.showActiveKey() + + def showActiveKey(self): + self.buildVirtualKeyBoard(self.selectedKey) diff --git a/lib/python/Screens/Wizard.py b/lib/python/Screens/Wizard.py index 2326b915..555110a4 100755 --- a/lib/python/Screens/Wizard.py +++ b/lib/python/Screens/Wizard.py @@ -475,6 +475,11 @@ class Wizard(Screen): self.currStep += 1 self.updateValues() else: + if self.wizard[self.currStep].has_key("displaytext"): + displaytext = self.wizard[self.currStep]["displaytext"] + print "set LCD text" + for x in self.lcdCallbacks: + x(displaytext) if len(self.stepHistory) == 0 or self.stepHistory[-1] != self.currStep: self.stepHistory.append(self.currStep) print "wizard step:", self.wizard[self.currStep] @@ -599,10 +604,7 @@ class WizardManager: self.wizards.append((wizard, precondition, priority)) def getWizards(self): - list = [] - for x in self.wizards: - if x[1] == 1: # precondition - list.append((x[2], x[0])) - return list + # x[1] is precondition + return [(x[2], x[0]) for x in self.wizards if x[1] == 1] wizardManager = WizardManager() diff --git a/lib/python/Screens/WizardLanguage.py b/lib/python/Screens/WizardLanguage.py index ec9758d2..91fc80db 100644 --- a/lib/python/Screens/WizardLanguage.py +++ b/lib/python/Screens/WizardLanguage.py @@ -31,7 +31,3 @@ class WizardLanguage(Wizard): self.updateText(firstset = True) self.updateValues() self.updateLanguageDescription() - - - -
\ No newline at end of file diff --git a/lib/python/Tools/DreamboxHardware.py b/lib/python/Tools/DreamboxHardware.py index 5461f7b0..9e81bb47 100644 --- a/lib/python/Tools/DreamboxHardware.py +++ b/lib/python/Tools/DreamboxHardware.py @@ -23,6 +23,16 @@ def setFPWakeuptime(wutime): except IOError: print "setFPWakeupTime failed!" +def setRTCtime(wutime): + try: + open("/proc/stb/fp/rtc", "w").write(str(wutime)) + except IOError: + try: + fp = open("/dev/dbox/fp0") + ioctl(fp.fileno(), 0x101, pack('L', wutime)) # set wake up + except IOError: + print "setRTCtime failed!" + def getFPWakeuptime(): ret = 0 try: diff --git a/lib/python/Tools/NumericalTextInput.py b/lib/python/Tools/NumericalTextInput.py index c5576405..df6a5ea8 100644 --- a/lib/python/Tools/NumericalTextInput.py +++ b/lib/python/Tools/NumericalTextInput.py @@ -52,7 +52,7 @@ class NumericalTextInput: self.mapping.append (u"pqrs7PQRS") # 7 self.mapping.append (u"tuvúù8TUVÚÙ") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 - if self.lang in ['sv_SE', 'fi_FI']: + if self.lang in ('sv_SE', 'fi_FI'): self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 self.mapping.append (u" 1") # 1 self.mapping.append (u"abcåä2ABCÅÄ") # 2 diff --git a/lib/service/event.cpp b/lib/service/event.cpp index e78ddc4e..e15eebfc 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -88,7 +88,7 @@ bool eServiceEvent::loadLanguage(Event *evt, std::string lang, int tsidonid) lang = cc; // use first found language if (cc == lang) { - m_event_name = convertDVBUTF8(sed->getEventName(), table, tsidonid); + m_event_name = convertDVBUTF8(replace_all(replace_all(sed->getEventName(), "\n", " "), "\t", " "), table, tsidonid); m_short_description = convertDVBUTF8(sed->getText(), table, tsidonid); retval=1; } diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 14c849db..7292e6df 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -2291,8 +2291,18 @@ void eDVBServicePlay::updateDecoder() } } } - m_decoder->setAC3Delay(ac3_delay == -1 ? 0 : ac3_delay); - m_decoder->setPCMDelay(pcm_delay == -1 ? 0 : pcm_delay); + + std::string config_delay; + int config_delay_int = 0; + if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + m_decoder->setAC3Delay(ac3_delay == -1 ? config_delay_int : ac3_delay + config_delay_int); + + if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0) + config_delay_int = atoi(config_delay.c_str()); + else + config_delay_int = 0; + m_decoder->setPCMDelay(pcm_delay == -1 ? config_delay_int : pcm_delay + config_delay_int); m_decoder->setVideoPID(vpid, vpidtype); selectAudioStream(); diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index bbcb3b5c..569272b0 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -321,11 +321,11 @@ eServiceMP3::eServiceMP3(const char *filename): m_filename(filename), m_pump(eAp switch (sourceinfo.containertype) { case ctMPEGTS: - demux_type = "flutsdemux"; + demux_type = "mpegtsdemux"; break; case ctMPEGPS: case ctVCD: - demux_type = "flupsdemux"; + demux_type = "mpegpsdemux"; break; case ctMKV: demux_type = "matroskademux"; @@ -838,6 +838,7 @@ int eServiceMP3::getInfo(int w) case sGenre: case sVideoType: case sTimeCreate: + case sUser+10: case sUser+12: return resIsString; case sCurrentTitle: @@ -886,6 +887,9 @@ std::string eServiceMP3::getInfoString(int w) case sGenre: tag = GST_TAG_GENRE; break; + case sUser+10: + tag = GST_TAG_AUDIO_CODEC; + break; case sVideoType: tag = GST_TAG_VIDEO_CODEC; break; @@ -1025,7 +1029,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) source = GST_MESSAGE_SRC(msg); sourceName = gst_object_get_name(source); -#if 0 +#if 1 if (gst_message_get_structure(msg)) { gchar *string = gst_structure_to_string(gst_message_get_structure(msg)); @@ -1050,8 +1054,13 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg) eWarning("Gstreamer error: %s (%i) from %s", err->message, err->code, sourceName ); if ( err->domain == GST_STREAM_ERROR ) { - if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND && g_strrstr(sourceName, "videosink") ) - m_event((iPlayableService*)this, evUser+11); + if ( err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND ) + { + if ( g_strrstr(sourceName, "videosink") ) + m_event((iPlayableService*)this, evUser+11); + else if ( g_strrstr(sourceName, "audiosink") ) + m_event((iPlayableService*)this, evUser+10); + } else if ( err->code == GST_STREAM_ERROR_FAILED && g_strrstr(sourceName, "file-source") ) { eWarning("error in tag parsing, linking mp3parse directly to file-sink, bypassing id3demux..."); |
