eServiceReference, iRecordableService, quitMainloop
from Components.config import config
+from Components.UsageConfig import defaultMoviePath
from Components.TimerSanityCheck import TimerSanityCheck
from Screens.MessageBox import MessageBox
if config.recording.ascii_filenames.value:
filename = ASCIItranslit.legacyEncode(filename)
- if self.dirname and not Directories.fileExists(self.dirname, 'w'):
- self.dirnameHadToFallback = True
- self.Filename = Directories.getRecordingFilename(filename, None)
+ if not self.dirname or not Directories.fileExists(self.dirname, 'w'):
+ if self.dirname:
+ self.dirnameHadToFallback = True
+ dirname = defaultMoviePath()
else:
- self.Filename = Directories.getRecordingFilename(filename, self.dirname)
+ dirname = self.dirname
+ self.Filename = Directories.getRecordingFilename(filename, dirname)
self.log(0, "Filename calculated as: '%s'" % self.Filename)
#begin_date + " - " + service_name + description)
lib/python/Plugins/SystemPlugins/Hotplug/Makefile
lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile
lib/python/Plugins/SystemPlugins/Makefile
+lib/python/Plugins/SystemPlugins/NetworkWizard/Makefile
+lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile
lib/python/Plugins/SystemPlugins/NFIFlash/Makefile
lib/python/Plugins/SystemPlugins/NFIFlash/meta/Makefile
lib/python/Plugins/SystemPlugins/PositionerSetup/Makefile
lib/python/Plugins/SystemPlugins/VideoTune/meta/Makefile
lib/python/Plugins/SystemPlugins/Videomode/Makefile
lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile
+lib/python/Plugins/SystemPlugins/WirelessLan/Makefile
+lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile
lib/python/Tools/Makefile
lib/service/Makefile
lib/components/Makefile
<item level="1" text="Device Setup..." entryID="device_setup"><screen module="NetworkSetup" screen="NetworkAdapterSelection"/></item>
<item level="1" text="Nameserver Setup..." entryID="dns_setup"><screen module="NetworkSetup" screen="NameserverSetup"/></item>
</menu>-->
- <item level="2" text="Timeshift path..." entryId="timeshift_path"><screen module="LocationBox" screen="TimeshiftLocationBox" /></item>
+ <item level="2" text="Recording paths..." entryId="RecordPaths"><screen module="RecordPaths" screen="RecordPathsSettings" /></item>
</menu>
<item weight="10" level="1" text="Common Interface" entryID="ci_setup" requires="CommonInterface"><screen module="Ci" screen="CiSelection" /></item>
<item weight="15" level="0" text="Parental control" entryID="parental_setup"><screen module="ParentalControlSetup" screen="ParentalControlSetup" /></item>
<item text="Standby" entryID="standby"><screen module="Standby" screen="Standby"/></item>
<item text="Restart" entryID="restart"><screen module="Standby" screen="TryQuitMainloop">2</screen></item>
<item level="2" text="Restart GUI" entryID="restart_enigma"><screen module="Standby" screen="TryQuitMainloop">3</screen></item>
- <item text="Deep Standby" entryID="deep_standby"><screen module="Standby" screen="TryQuitMainloop">1</screen></item>
+ <item text="Deep Standby" requires="DeepstandbySupport" entryID="deep_standby"><screen module="Standby" screen="TryQuitMainloop">1</screen></item>
+ <item text="Shutdown" requires="!DeepstandbySupport" entryID="deep_standby"><screen module="Standby" screen="TryQuitMainloop">1</screen></item>
</menu>
</menu>
<item level="0" text="TV System">config.av.tvsystem</item>
<item level="1" text="WSS on 4:3">config.av.wss</item>
<item level="1" text="AC3 default">config.av.defaultac3</item>
- <item level="1" text="General AC3 delay">config.av.generalAC3delay</item>
- <item level="1" text="General PCM delay">config.av.generalPCMdelay</item>
+ <item level="1" text="General AC3 delay (ms)">config.av.generalAC3delay</item>
+ <item level="1" text="General PCM delay (ms)">config.av.generalPCMdelay</item>
<item level="1" text="AC3 downmix" requires="CanDownmixAC3">config.av.downmix_ac3</item>
<item level="1" text="Auto scart switching" requires="ScartSwitch">config.av.vcrswitch</item>
</setup>
<widget source="Adaptertext" render="Label" position="10,355" size="120,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
<widget source="Adapter" render="Label" position="120,355" size="400,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
<widget source="introduction2" render="Label" position="10,380" size="540,21" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1"/>
- <widget name="VKeyIcon" pixmap="skin_default/buttons/key_text.png" position="10,380" zPosition="10" size="35,25" transparent="1" alphatest="on" />
+ <widget source="VKeyIcon" render="Pixmap" pixmap="skin_default/buttons/key_text.png" position="10,380" zPosition="10" size="35,25" transparent="1" alphatest="on" >
+ <convert type="ConditionalShowHide" />
+ </widget>
<widget name="HelpWindow" pixmap="skin_default/vkey_icon.png" position="160,315" zPosition="1" size="1,1" transparent="1" alphatest="on" />
</screen>
<widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
</screen>
<!-- Dish -->
- <screen name="Dish" flags="wfNoBorder" position="300,100" size="130,160" title="Dish" zPosition="-1" backgroundColor="transparent">
+ <screen name="Dish" flags="wfNoBorder" position="300,100" size="130,160" title="Dish" zPosition="100" backgroundColor="transparent">
<widget name="Dishpixmap" pixmap="skin_default/icons/dish.png" position="0,0" size="130,160" alphatest="off" />
</screen>
<!-- EPG Selection - Single -->
- "image default"
An image default is stored in /usr/share/enigma2/defaults. You can have several defaults at the same time, but you should keep
in mind, that these defaults are all installed without user interaction. So defaults with contrary contents should be avoided
- (e.g. setting a default parameter in one settings file an setting another setting for the same parameter in another could lead
+ (e.g. setting a default parameter in one settings file and setting another setting for the same parameter in another could lead
to unexpected behaviour, since the installation order is undetermined and completely random. so use prerequisites insted)
The "image default" is also used to set box specific config elements (for example show the new RC on a dm8000) and install the
default bouquets.
size_t written_since_last_sync = 0;
- int already_empty = 0;
eDebug("FILEPUSH THREAD START");
/* we set the signal to not restart syscalls, so we can detect our signal. */
if (m_buf_end == 0)
{
/* on EOF, try COMMITting once. */
- if (m_send_pvr_commit && !already_empty)
+ if (m_send_pvr_commit)
{
- eDebug("sending PVR commit");
-
struct pollfd pfd;
pfd.fd = m_fd_dest;
pfd.events = POLLIN;
- 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;
- eDebug("commit done");
- /* well check again */
- continue;
+ switch (poll(&pfd, 1, 250)) // wait for 250ms
+ {
+ case 0:
+ eDebug("wait for driver eof timeout");
+ continue;
+ case 1:
+ eDebug("wait for driver eof ok");
+ break;
+ default:
+ eDebug("wait for driver eof aborted by signal");
+ continue;
+ }
}
/* in stream_mode, we are sending EOF events
bytes_read += m_buf_end;
if (m_sg)
current_span_remaining -= m_buf_end;
- already_empty = 0;
}
// printf("FILEPUSH: read %d bytes\n", m_buf_end);
}
int eTSMPEGDecoder::m_pcm_delay=-1,
eTSMPEGDecoder::m_ac3_delay=-1;
-RESULT eTSMPEGDecoder::setPCMDelay(int delay)
+RESULT eTSMPEGDecoder::setHwPCMDelay(int delay)
{
- if (m_decoder == 0 && delay != m_pcm_delay )
+ if (delay != m_pcm_delay )
{
FILE *fp = fopen("/proc/stb/audio/audio_delay_pcm", "w");
if (fp)
return -1;
}
-RESULT eTSMPEGDecoder::setAC3Delay(int delay)
+RESULT eTSMPEGDecoder::setHwAC3Delay(int delay)
{
- if ( m_decoder == 0 && delay != m_ac3_delay )
+ if ( delay != m_ac3_delay )
{
FILE *fp = fopen("/proc/stb/audio/audio_delay_bitstream", "w");
if (fp)
return -1;
}
+
+RESULT eTSMPEGDecoder::setPCMDelay(int delay)
+{
+ return m_decoder == 0 ? setHwPCMDelay(delay) : -1;
+}
+
+RESULT eTSMPEGDecoder::setAC3Delay(int delay)
+{
+ return m_decoder == 0 ? setHwAC3Delay(delay) : -1;
+}
+
eTSMPEGDecoder::eTSMPEGDecoder(eDVBDemux *demux, int decoder)
: m_demux(demux),
m_vpid(-1), m_vtype(-1), m_apid(-1), m_atype(-1), m_pcrpid(-1), m_textpid(-1),
int getVideoProgressive();
int getVideoFrameRate();
int getVideoAspect();
+ static RESULT setHwPCMDelay(int delay);
+ static RESULT setHwAC3Delay(int delay);
};
#endif
continue;
}
- size_t iframe_len;
- /* try to align to iframe */
- int direction = pts < 0 ? -1 : 1;
- m_tstools.findFrame(offset, iframe_len, direction);
-
- eDebug("ok, resolved skip (rel: %d, diff %lld), now at %08llx (skipped additional %d frames due to iframe re-align)", relative, pts, offset, direction);
+ eDebug("ok, resolved skip (rel: %d, diff %lld), now at %08llx", relative, pts, offset);
current_offset = align(offset, blocksize); /* in case tstools return non-aligned offset */
}
#ifdef ENABLE_PRIVATE_EPG
data->m_PrivatePid = -1;
#endif
+#ifdef ENABLE_MHW_EPG
+ data->m_mhw2_channel_pid = 0x231; // defaults for astra 19.2 D+
+ data->m_mhw2_title_pid = 0x234; // defaults for astra 19.2 D+
+ data->m_mhw2_summary_pid = 0x236; // defaults for astra 19.2 D+
+#endif
singleLock s(channel_map_lock);
m_knownChannels.insert( std::pair<iDVBChannel*, channel_data* >(chan, data) );
chan->connectStateChange(slot(*this, &eEPGCache::DVBChannelStateChanged), data->m_stateChangedConn);
break;
}
#endif
+#ifdef ENABLE_MHW_EPG
+ case Message::got_mhw2_channel_pid:
+ {
+ singleLock s(channel_map_lock);
+ for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it)
+ {
+ eDVBChannel *channel = (eDVBChannel*) it->first;
+ channel_data *data = it->second;
+ eDVBChannelID chid = channel->getChannelID();
+ if ( chid.transport_stream_id.get() == msg.service.tsid &&
+ chid.original_network_id.get() == msg.service.onid )
+ {
+ data->m_mhw2_channel_pid = msg.pid;
+ eDebug("[EPGC] got mhw2 channel pid %04x", msg.pid);
+ break;
+ }
+ }
+ break;
+ }
+ case Message::got_mhw2_title_pid:
+ {
+ singleLock s(channel_map_lock);
+ for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it)
+ {
+ eDVBChannel *channel = (eDVBChannel*) it->first;
+ channel_data *data = it->second;
+ eDVBChannelID chid = channel->getChannelID();
+ if ( chid.transport_stream_id.get() == msg.service.tsid &&
+ chid.original_network_id.get() == msg.service.onid )
+ {
+ data->m_mhw2_title_pid = msg.pid;
+ eDebug("[EPGC] got mhw2 title pid %04x", msg.pid);
+ break;
+ }
+ }
+ break;
+ }
+ case Message::got_mhw2_summary_pid:
+ {
+ singleLock s(channel_map_lock);
+ for (channelMapIterator it(m_knownChannels.begin()); it != m_knownChannels.end(); ++it)
+ {
+ eDVBChannel *channel = (eDVBChannel*) it->first;
+ channel_data *data = it->second;
+ eDVBChannelID chid = channel->getChannelID();
+ if ( chid.transport_stream_id.get() == msg.service.tsid &&
+ chid.original_network_id.get() == msg.service.onid )
+ {
+ data->m_mhw2_summary_pid = msg.pid;
+ eDebug("[EPGC] got mhw2 summary pid %04x", msg.pid);
+ break;
+ }
+ }
+ break;
+ }
+#endif
case Message::timeChanged:
cleanLoop();
break;
isRunning |= MHW;
memcpy(&m_MHWFilterMask, &mask, sizeof(eDVBSectionFilterMask));
- mask.pid = 0x231;
+ mask.pid = m_mhw2_channel_pid;
mask.data[0] = 0xC8;
mask.mask[0] = 0xFF;
mask.data[1] = 0;
memcpy(&m_MHWFilterMask2, &mask, sizeof(eDVBSectionFilterMask));
mask.data[1] = 0;
mask.mask[1] = 0;
+ m_MHWTimeoutet=false;
#endif
mask.pid = 0x12;
int tmp=0;
switch ((*es)->getType())
{
+ case 0xC1: // user private
+ for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin();
+ desc != (*es)->getDescriptors()->end(); ++desc)
+ {
+ switch ((*desc)->getTag())
+ {
+ case 0xC2: // user defined
+ if ((*desc)->getLength() == 8)
+ {
+ __u8 buffer[10];
+ (*desc)->writeToBuffer(buffer);
+ if (!strncmp((unsigned char*)buffer+2, "EPGDATA", 7))
+ {
+ eServiceReferenceDVB ref;
+ if (!pmthandler->getServiceReference(ref))
+ {
+ int pid = (*es)->getPid();
+ messages.send(Message(Message::got_mhw2_channel_pid, ref, pid));
+ }
+ }
+ else if(!strncmp((unsigned char*)buffer+2, "FICHAS", 6))
+ {
+ eServiceReferenceDVB ref;
+ if (!pmthandler->getServiceReference(ref))
+ {
+ int pid = (*es)->getPid();
+ messages.send(Message(Message::got_mhw2_summary_pid, ref, pid));
+ }
+ }
+ else if(!strncmp((unsigned char*)buffer+2, "GENEROS", 7))
+ {
+ eServiceReferenceDVB ref;
+ if (!pmthandler->getServiceReference(ref))
+ {
+ int pid = (*es)->getPid();
+ messages.send(Message(Message::got_mhw2_title_pid, ref, pid));
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
case 0x05: // private
for (DescriptorConstIterator desc = (*es)->getDescriptors()->begin();
desc != (*es)->getDescriptors()->end(); ++desc)
packet->segment_last_table_id = 0x50;
__u8 *title = isMHW2 ? ((__u8*)(itTitle->second.title))-4 : (__u8*)itTitle->second.title;
- std::string prog_title = (char *) delimitName( title, name, isMHW2 ? 33 : 23 );
+ std::string prog_title = (char *) delimitName( title, name, isMHW2 ? 35 : 23 );
int prog_title_length = prog_title.length();
int packet_length = EIT_SIZE + EIT_LOOP_SIZE + EIT_SHORT_EVENT_DESCRIPTOR_SIZE +
{
eDebug("[EPGC] mhw2 aborted %d", state);
}
- else if (m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0)
+ else if (m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0)
// Channels table
{
- int num_channels = data[119];
+ int num_channels = data[120];
m_channels.resize(num_channels);
- if(dataLen > 119)
+ if(dataLen > 120)
{
- int ptr = 120 + 8 * num_channels;
+ int ptr = 121 + 8 * num_channels;
if( dataLen > ptr )
{
for( int chid = 0; chid < num_channels; ++chid )
else
goto abort;
// data seems consistent...
- const __u8 *tmp = data+120;
+ const __u8 *tmp = data+121;
for (int i=0; i < num_channels; ++i)
{
mhw_channel_name_t channel;
channel.channel_id_hi = *(tmp++);
channel.channel_id_lo = *(tmp++);
m_channels[i]=channel;
+// eDebug("%d(%02x) %04x: %02x %02x", i, i, (channel.channel_id_hi << 8) | channel.channel_id_lo, *tmp, *(tmp+1));
tmp+=2;
}
for (int i=0; i < num_channels; ++i)
for (; x < channel_name_len; ++x)
channel.name[x]=*(tmp++);
channel.name[x+1]=0;
+// eDebug("%d(%02x) %s", i, i, channel.name);
}
haveData |= MHW;
eDebug("[EPGC] mhw2 %d channels found", m_channels.size());
}
- else if (m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1)
+ else if (m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1)
{
// Themes table
eDebug("[EPGC] mhw2 themes nyi");
}
- else if (m_MHWFilterMask2.pid == 0x234 && m_MHWFilterMask2.data[0] == 0xe6)
+ else if (m_MHWFilterMask2.pid == m_mhw2_title_pid && m_MHWFilterMask2.data[0] == 0xe6)
// Titles table
{
int pos=18;
- bool valid=true;
- int len = ((data[1]&0xf)<<8) + data[2] - 16;
+ bool valid=false;
bool finish=false;
- if(data[dataLen-1] != 0xff)
- return;
- while( pos < dataLen )
+
+// eDebug("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
+// data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10],
+// data[11], data[12], data[13], data[14], data[15], data[16], data[17] );
+
+ while( pos < dataLen && !valid)
{
- valid = false;
- pos += 7;
- if( pos < dataLen )
- {
- pos += 3;
- if( pos < dataLen )
- {
- if( data[pos] > 0xc0 )
- {
- pos += ( data[pos] - 0xc0 );
- pos += 4;
- if( pos < dataLen )
- {
- if( data[pos] == 0xff )
- {
- ++pos;
- valid = true;
- }
- }
- }
- }
- }
- if( !valid )
- {
- if (checkTimeout())
- goto start_summary;
- return;
- }
+ pos += 18;
+ pos += (data[pos] & 0x3F) + 4;
+ if( pos == dataLen )
+ valid = true;
}
+
+ if (!valid)
+ {
+ if (dataLen > 18)
+ eDebug("mhw2 title table invalid!!");
+ if (checkTimeout())
+ goto abort;
+ if (!m_MHWTimeoutTimer->isActive())
+ startTimeout(5000);
+ return; // continue reading
+ }
+
// data seems consistent...
mhw_title_t title;
pos = 18;
- while (pos < len)
+ while (pos < dataLen)
{
+// eDebugNoNewLine(" [%02x] %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x [%02x %02x %02x %02x %02x %02x %02x] LL - DESCR - ",
+// data[pos], data[pos+1], data[pos+2], data[pos+3], data[pos+4], data[pos+5], data[pos+6], data[pos+7],
+// data[pos+8], data[pos+9], data[pos+10], data[pos+11], data[pos+12], data[pos+13], data[pos+14], data[pos+15], data[pos+16], data[pos+17]);
title.channel_id = data[pos]+1;
- title.program_id_ml = data[pos+1];
- title.program_id_lo = data[pos+2];
- title.mhw2_mjd_hi = data[pos+3];
- title.mhw2_mjd_lo = data[pos+4];
- title.mhw2_hours = data[pos+5];
- title.mhw2_minutes = data[pos+6];
- title.mhw2_seconds = data[pos+7];
- int duration = ((data[pos+8] << 8)|data[pos+9]) >> 4;
+ title.mhw2_mjd_hi = data[pos+11];
+ title.mhw2_mjd_lo = data[pos+12];
+ title.mhw2_hours = data[pos+13];
+ title.mhw2_minutes = data[pos+14];
+ title.mhw2_seconds = data[pos+15];
+ int duration = ((data[pos+16] << 8)|data[pos+17]) >> 4;
title.mhw2_duration_hi = (duration&0xFF00) >> 8;
title.mhw2_duration_lo = duration&0xFF;
- __u8 slen = data[pos+10] & 0x3f;
+
+ // Create unique key per title
+ __u32 title_id = (data[pos+7] << 24) | (data[pos+8] << 16) | (data[pos+9] << 8) | data[pos+10];
+
+ __u8 slen = data[pos+18] & 0x3f;
__u8 *dest = ((__u8*)title.title)-4;
- memcpy(dest, &data[pos+11], slen>33 ? 33 : slen);
- memset(dest+slen, 0, 33-slen);
- pos += 11 + slen;
+ memcpy(dest, &data[pos+19], slen>35 ? 35 : slen);
+ memset(dest+slen, 0, 35-slen);
+ pos += 19 + slen;
+// eDebug("%02x [%02x %02x]: %s", data[pos], data[pos+1], data[pos+2], dest);
+
// not used theme id (data[7] & 0x3f) + (data[pos] & 0x3f);
__u32 summary_id = (data[pos+1] << 8) | data[pos+2];
- // Create unique key per title
- __u32 title_id = (title.channel_id<<16) | (title.program_id_ml<<8) | title.program_id_lo;
+// if (title.channel_id > m_channels.size())
+// eDebug("channel_id(%d %02x) to big!!", title.channel_id);
+
+// eDebug("pos %d prog_id %02x %02x chid %02x summary_id %04x dest %p len %d\n",
+// pos, title.program_id_ml, title.program_id_lo, title.channel_id, summary_id, dest, slen);
- pos += 4;
+// eDebug("title_id %08x -> summary_id %04x\n", title_id, summary_id);
+
+ pos += 3;
std::map<__u32, mhw_title_t>::iterator it = m_titles.find( title_id );
if ( it == m_titles.end() )
{
// Titles table has been read, there are summaries to read.
// Start reading summaries, store corresponding titles on the fly.
- startMHWReader2(0x236, 0x96);
+ startMHWReader2(m_mhw2_summary_pid, 0x96);
startTimeout(15000);
return;
}
else
return;
}
- else if (m_MHWFilterMask2.pid == 0x236 && m_MHWFilterMask2.data[0] == 0x96)
+ else if (m_MHWFilterMask2.pid == m_mhw2_summary_pid && m_MHWFilterMask2.data[0] == 0x96)
// Summaries table
{
if (!checkTimeout())
}
else
return; // continue reading
+
if (valid)
{
// data seems consistent...
__u32 summary_id = (data[3]<<8)|data[4];
+// eDebug ("summary id %04x\n", summary_id);
+// eDebug("[%02x %02x] %02x %02x %02x %02x %02x %02x %02x %02x XX\n", data[3], data[4], data[5], data[6], data[7], data[8], data[9], data[10], data[11], data[12], data[13] );
// ugly workaround to convert const __u8* to char*
char *tmp=0;
len += lenline + 1;
}
if( len > 0 )
- tmp[pos+len] = 0;
+ tmp[pos+len] = 0;
else
tmp[pos+1] = 0;
startTimeout(15000);
std::string the_text = (char *) (data + pos + 1);
+// eDebug ("summary id %04x : %s\n", summary_id, data+pos+1);
+
while( itProgId != m_program_ids.end() && itProgId->first == summary_id )
{
+// eDebug(".");
// Find corresponding title, store title and summary in epgcache.
std::map<__u32, mhw_title_t>::iterator itTitle( m_titles.find( itProgId->second ) );
if ( itTitle != m_titles.end() )
}
if (isRunning & eEPGCache::MHW)
{
- if ( m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0)
+ if ( m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 0)
{
// Channels table has been read, start reading the themes table.
- startMHWReader2(0x231, 0xC8, 1);
+ startMHWReader2(m_mhw2_channel_pid, 0xC8, 1);
return;
}
- else if ( m_MHWFilterMask2.pid == 0x231 && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1)
+ else if ( m_MHWFilterMask2.pid == m_mhw2_channel_pid && m_MHWFilterMask2.data[0] == 0xC8 && m_MHWFilterMask2.data[1] == 1)
{
// Themes table has been read, start reading the titles table.
- startMHWReader2(0x234, 0xe6);
+ startMHWReader2(m_mhw2_title_pid, 0xe6);
return;
}
else
ePtr<iDVBSectionReader> m_MHWReader, m_MHWReader2;
eDVBSectionFilterMask m_MHWFilterMask, m_MHWFilterMask2;
ePtr<eTimer> m_MHWTimeoutTimer;
+ __u16 m_mhw2_channel_pid, m_mhw2_title_pid, m_mhw2_summary_pid;
bool m_MHWTimeoutet;
void MHWTimeout() { m_MHWTimeoutet=true; }
void readMHWData(const __u8 *data);
leaveChannel,
quit,
got_private_pid,
+ got_mhw2_channel_pid,
+ got_mhw2_title_pid,
+ got_mhw2_summary_pid,
timeChanged
};
int type;
u_char ppv_id_ml :8;
u_char ppv_id_lo :8;
u_char program_id_hi :8;
- u_char program_id_mh :8; // mhw2_title end (33chars max)
+ u_char program_id_mh :8;
u_char program_id_ml :8;
- u_char program_id_lo :8;
+ u_char program_id_lo :8; // mhw2_title end (35chars max)
u_char mhw2_mjd_hi :8;
u_char mhw2_mjd_lo :8;
u_char mhw2_duration_hi :8;
off_t last = 0;
off_t last2 = 0;
pts_t lastc = 0;
+ ts += 1; // Add rounding error margin
for (std::map<off_t, pts_t>::const_iterator i(m_access_points.begin()); i != m_access_points.end(); ++i)
{
pts_t delta = getDelta(i->first);
pts |= ((unsigned long long)(packet[ 9]&0xFF)) << 1;
pts |= ((unsigned long long)(packet[10]&0x80)) >> 7;
offset -= 188;
- eDebug("PCR found at %llx: %16llx", offset, pts);
+ eDebug("PCR %16llx found at %lld pid %02x (%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x)", pts, offset, pid, packet[0], packet[1], packet[2], packet[3], packet[4], packet[5], packet[6], packet[7], packet[8], packet[9], packet[10]);
if (fixed && fixupPTS(offset, pts))
return -1;
return 0;
pts |= ((unsigned long long)(payload[13]&0xFE)) >> 1;
offset -= 188;
-// eDebug("found pts %08llx at %08llx pid %02x stream: %02x", pts, offset, pid, payload[3]);
-
+ eDebug("PTS %16llx found at %lld pid %02x stream: %02x", pts, offset, pid, payload[3]);
+
/* convert to zero-based */
if (fixed && fixupPTS(offset, pts))
- return -1;
+ return -1;
return 0;
}
}
now -= pos;
return 0;
}
+ eDebug("eDVBTSTools::fixupPTS failed!");
+ return -1;
}
int eDVBTSTools::getOffset(off_t &offset, pts_t &pts, int marg)
{
+ eDebug("getOffset for pts 0x%llx", pts);
if (m_use_streaminfo)
{
if (pts >= m_pts_end && marg > 0 && m_end_valid)
m_samples_taken = 1;
m_samples.clear();
pts_t dummy;
+ int retries=2;
+
if (calcLen(dummy) == -1)
return;
bytes_per_sample = 40*1024*1024;
bytes_per_sample -= bytes_per_sample % 188;
-
- for (off_t offset = m_offset_begin; offset < m_offset_end; offset += bytes_per_sample)
+
+ eDebug("samples step %lld, pts begin %llx, pts end %llx, offs begin %lld, offs end %lld:",
+ bytes_per_sample, m_pts_begin, m_pts_end, m_offset_begin, m_offset_end);
+
+ for (off_t offset = m_offset_begin; offset < m_offset_end;)
{
pts_t p;
- takeSample(offset, p);
+ if (takeSample(offset, p) && retries--)
+ continue;
+ retries = 2;
+ offset += bytes_per_sample;
}
m_samples[0] = m_offset_begin;
m_samples[m_pts_end - m_pts_begin] = m_offset_end;
-
-// eDebug("begin, end: %llx %llx", m_offset_begin, m_offset_end);
}
/* returns 0 when a sample was taken. */
int eDVBTSTools::takeSample(off_t off, pts_t &p)
{
+ off_t offset_org = off;
+
if (!eDVBTSTools::getPTS(off, p, 1))
{
/* as we are happily mixing PTS and PCR values (no comment, please), we might
{
if ((l->second > off) || (u->second < off))
{
- eDebug("ignoring sample %llx %llx %llx (%lld %lld %lld)",
+ eDebug("ignoring sample %lld %lld %lld (%llx %llx %llx)",
l->second, off, u->second, l->first, p, u->first);
return 1;
}
}
}
-
+ eDebug("adding sample %lld: pts 0x%llx -> pos %lld (diff %lld bytes)", offset_org, p, off, off-offset_org);
m_samples[p] = off;
return 0;
}
- return 1;
+ return -1;
}
int eDVBTSTools::findPMT(int &pmt_pid, int &service_id)
int eDVBTSTools::findNextPicture(off_t &offset, size_t &len, int &distance, int frame_types)
{
- int nr_frames = 0;
+ int nr_frames, direction;
// eDebug("trying to move %d frames at %llx", distance, offset);
frame_types = frametypeI; /* TODO: intelligent "allow IP frames when not crossing an I-Frame */
- int direction = distance > 0 ? 0 : -1;
- distance = abs(distance);
-
off_t new_offset = offset;
size_t new_len = len;
int first = 1;
+ if (distance > 0) {
+ direction = 0;
+ nr_frames = 0;
+ } else {
+ direction = -1;
+ nr_frames = -1;
+ distance = -distance+1;
+ }
while (distance > 0)
{
int dir = direction;
// eDebug("we moved %d, %d to go frames (now at %llx)", dir, distance, new_offset);
- if (distance >= 0 || first)
+ if (distance >= 0 || direction == 0)
{
first = 0;
offset = new_offset;
len = new_len;
nr_frames += abs(dir);
+ }
+ else if (first) {
+ first = 0;
+ offset = new_offset;
+ len = new_len;
+ nr_frames += abs(dir) + distance; // never jump forward during rewind
}
}
from config import config, ConfigSlider, ConfigSelection, ConfigYesNo, \
- ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigNumber, ConfigNothing, NoSave
+ ConfigEnableDisable, ConfigSubsection, ConfigBoolean, ConfigSelectionNumber, ConfigNothing, NoSave
from enigma import eAVSwitch, getDesktop
from SystemInfo import SystemInfo
from os import path as os_path
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.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 25, default = 0)
+ config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 25, default = 0)
config.av.vcrswitch = ConfigEnableDisable(default = False)
iAVSwitch = AVSwitch()
year = version[4:8]
month = version[8:10]
day = version[10:12]
+ date = '-'.join((year, month, day))
if image_type == '0':
image_type = "Release"
+ version = '.'.join((major, minor, revision))
+ return ' '.join((image_type, version, date))
else:
image_type = "Experimental"
- date = '-'.join((year, month, day))
- version = '.'.join((major, minor, revision))
- return ' '.join((image_type, version, date))
+ return ' '.join((image_type, date))
file.close()
except IOError:
pass
from MenuList import MenuList
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
from Tools.LoadPixmap import LoadPixmap
else:
res.append((eListboxPythonMultiContent.TYPE_TEXT, 45, 00, 800, 25, 0, RT_HALIGN_LEFT, text[0]))
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/key_" + key + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/key_" + key + ".png"))
if png is not None:
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 5, 0, 35, 25, png))
from HTMLComponent import HTMLComponent
from GUIComponent import GUIComponent
-from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement
-from Components.ActionMap import NumberActionMap
+from config import KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS, ConfigElement, ConfigText, ConfigPassword
+from Components.ActionMap import NumberActionMap, ActionMap
from enigma import eListbox, eListboxPythonConfigContent, eRCInput, eTimer
from Screens.MessageBox import MessageBox
self.current = self.getCurrent()
if self.current:
self.current[1].onSelect(self.session)
+
for x in self.onSelectionChanged:
x()
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1) # to prevent left/right overriding the listbox
+
+ self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"],
+ {
+ "showVirtualKeyboard": self.KeyText,
+ }, -2)
+ self["VirtualKB"].setEnabled(False)
self["config"] = ConfigList(list, session = session)
+
if on_change is not None:
self.__changed = on_change
else:
self.__changed = lambda: None
-
+
+ if not self.handleInputHelpers in self["config"].onSelectionChanged:
+ self["config"].onSelectionChanged.append(self.handleInputHelpers)
+
+ def handleInputHelpers(self):
+ if self["config"].getCurrent() is not None:
+ if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword):
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(True)
+ self["VKeyIcon"].boolean = True
+ if self.has_key("HelpWindow"):
+ if self["config"].getCurrent()[1].help_window.instance is not None:
+ helpwindowpos = self["HelpWindow"].getPosition()
+ from enigma import ePoint
+ self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+
+ def KeyText(self):
+ from Screens.VirtualKeyBoard import VirtualKeyBoard
+ self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title = self["config"].getCurrent()[0], text = self["config"].getCurrent()[1].getValue())
+
+ def VirtualKeyBoardCallback(self, callback = None):
+ if callback is not None and len(callback):
+ self["config"].getCurrent()[1].setValue(callback)
+ self["config"].invalidate(self["config"].getCurrent())
+
def keyOK(self):
self["config"].handleKey(KEY_OK)
from time import localtime, time
from ServiceReference import ServiceReference
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
EPG_TYPE_SINGLE = 0
EPG_TYPE_MULTI = 1
assert(type == EPG_TYPE_SIMILAR)
self.l.setBuildFunc(self.buildSimilarEntry)
self.epgcache = eEPGCache.getInstance()
- self.clock_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock.png'))
- self.clock_add_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_add.png'))
- self.clock_pre_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_pre.png'))
- self.clock_post_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_post.png'))
- self.clock_prepost_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_prepost.png'))
+ self.clock_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock.png'))
+ self.clock_add_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_add.png'))
+ self.clock_pre_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_pre.png'))
+ self.clock_post_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_post.png'))
+ self.clock_prepost_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_prepost.png'))
def getEventFromId(self, service, eventid):
event = None
from MenuList import MenuList
from Components.Harddisk import harddiskmanager
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists
from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \
eServiceReference, eServiceCenter, gFont
res = [ (absolute, isDir) ]
res.append((eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
if isDir:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
else:
extension = name.split('.')
extension = extension[-1].lower()
if EXTENSIONS.has_key(extension):
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
else:
png = None
if png is not None:
directories.sort()
files.sort()
else:
- if os_path.exists(directory):
- files = listdir(directory)
+ if fileExists(directory):
+ try:
+ files = listdir(directory)
+ except:
+ files = []
files.sort()
tmpfiles = files[:]
for x in tmpfiles:
res = [ (absolute, isDir, selected, name) ]
res.append((eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
if isDir:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
else:
extension = name.split('.')
extension = extension[-1].lower()
if EXTENSIONS.has_key(extension):
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
else:
png = None
if png is not None:
if not name.startswith('<'):
if selected is False:
- icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_off.png"))
+ icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
else:
- icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png"))
+ icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
return res
directories.sort()
files.sort()
else:
- if os_path.exists(directory):
- files = listdir(directory)
+ if fileExists(directory):
+ try:
+ files = listdir(directory)
+ except:
+ files = []
files.sort()
tmpfiles = files[:]
for x in tmpfiles:
# any access has been made to the disc. If there has been no access over a specifed time,
# we set the hdd into standby.
def readStats(self):
- l = readFile("/sys/block/%s/stat" % self.device)
+ try:
+ l = open("/sys/block/%s/stat" % self.device).read()
+ except IOError:
+ return -1,-1
(nr_read, _, _, _, nr_write) = l.split()[:5]
return int(nr_read), int(nr_write)
l = sum(stats)
print "sum", l, "prev_sum", self.last_stat
- if l != self.last_stat: # access
+ if l != self.last_stat and l >= 0: # access
print "hdd was accessed since previous check!"
self.last_stat = l
self.last_access = t
from MenuList import MenuList
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename
from os import path
from enigma import eListboxPythonMultiContent, RT_VALIGN_CENTER, gFont, eServiceCenter
STATE_FORWARD = 4
STATE_NONE = 5
-PlayIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_play.png"))
-PauseIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_pause.png"))
-StopIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_stop.png"))
-RewindIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_rewind.png"))
-ForwardIcon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/ico_mp_forward.png"))
+PlayIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_play.png"))
+PauseIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_pause.png"))
+StopIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_stop.png"))
+RewindIcon = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_rewind.png"))
+ForwardIcon = LoadPixmap(path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/ico_mp_forward.png"))
def PlaylistEntryComponent(serviceref, state):
res = [ serviceref ]
self.activateConsole = Console()
self.resetNetworkConsole = Console()
self.DnsConsole = Console()
+ self.PingConsole = Console()
self.config_ready = None
self.getInterfaces()
def getLinkStateFinished(self, result, retval,extra_args):
(callback) = extra_args
+
if self.LinkConsole is not None:
if len(self.LinkConsole.appContainers) == 0:
callback(result)
+ def stopPingConsole(self):
+ if self.PingConsole is not None:
+ if len(self.PingConsole.appContainers):
+ for name in self.PingConsole.appContainers.keys():
+ self.PingConsole.kill(name)
+
def stopLinkStateConsole(self):
if self.LinkConsole is not None:
if len(self.LinkConsole.appContainers):
def getSatDescription(self, pos):
return self.satellites[pos]
+ def sortFunc(self, x):
+ orbpos = x[0]
+ if orbpos > 1800:
+ return orbpos - 3600
+ else:
+ return orbpos + 1800
+
def readTransponders(self):
# read initial networks from file. we only read files which we are interested in,
# which means only these where a compatible tuner exists.
if self.hasNimType("DVB-S"):
print "Reading satellites.xml"
db.readSatellites(self.satList, self.satellites, self.transponders)
-# print "SATLIST", self.satList
-# print "SATS", self.satellites
-# print "TRANSPONDERS", self.transponders
+ self.satList.sort(key = self.sortFunc) # sort by orbpos
+ #print "SATLIST", self.satList
+ #print "SATS", self.satellites
+ #print "TRANSPONDERS", self.transponders
if self.hasNimType("DVB-C"):
print "Reading cables.xml"
x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER, configElement.value))
config.sec.delay_after_voltage_change_before_measure_idle_inputpower = x
- x = ConfigInteger(default=750, limits = (0, 9999))
+ x = ConfigInteger(default=900, limits = (0, 9999))
x.addNotifier(lambda configElement: secClass.setParam(secClass.DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD, configElement.value))
config.sec.delay_after_enable_voltage_before_motor_command = x
from MenuList import MenuList
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT
from Tools.LoadPixmap import LoadPixmap
-selectionpng = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/selectioncross.png"))
+selectionpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/selectioncross.png"))
def SelectionEntryComponent(description, value, index, selected):
res = [
from enigma import eListboxServiceContent, eListbox, eServiceCenter, eServiceReference, gFont, eRect
from Tools.LoadPixmap import LoadPixmap
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
class ServiceList(HTMLComponent, GUIComponent):
MODE_NORMAL = 0
GUIComponent.__init__(self)
self.l = eListboxServiceContent()
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/folder.png"))
+ pic = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/folder.png"))
if pic:
self.l.setPixmap(self.l.picFolder, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/marker.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/marker.png"))
if pic:
self.l.setPixmap(self.l.picMarker, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_s-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_s-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_S, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_c-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_c-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_C, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_dvb_t-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_dvb_t-fs8.png"))
if pic:
self.l.setPixmap(self.l.picDVB_T, pic)
- pic = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "ico_service_group-fs8.png"))
+ pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "ico_service_group-fs8.png"))
if pic:
self.l.setPixmap(self.l.picServiceGroup, pic)
from enigma import eDVBResourceManager
from Tools.Directories import fileExists
+from Tools.HardwareInfo import HardwareInfo
SystemInfo = { }
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
+SystemInfo["DeepstandbySupport"] = HardwareInfo().get_device_name() != "dm800"
RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_VALIGN_CENTER
from Tools.LoadPixmap import LoadPixmap
from timer import TimerEntry
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
class TimerList(HTMLComponent, GUIComponent, object):
#
res.append((eListboxPythonMultiContent.TYPE_TEXT, width-150, 50, 150, 20, 1, RT_HALIGN_RIGHT|RT_VALIGN_CENTER, state))
if timer.disabled:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/redx.png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/redx.png"))
res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 490, 5, 40, 40, png))
return res
from Components.Harddisk import harddiskmanager
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
+from Tools.Directories import resolveFilename, SCOPE_HDD
from enigma import Misc_Options, setTunerTypePriorityOrder;
from SystemInfo import SystemInfo
import os
def InitUsageConfig():
config.usage = ConfigSubsection();
- config.usage.showdish = ConfigYesNo(default = False)
+ config.usage.showdish = ConfigYesNo(default = True)
config.usage.multibouquet = ConfigYesNo(default = False)
config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
config.usage.e1like_radio_mode = ConfigYesNo(default = False)
("standard", _("standard")), ("swap", _("swap PiP and main picture")),
("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ])
+ config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
+ config.usage.timer_path = ConfigText(default = "<default>")
+ config.usage.instantrec_path = ConfigText(default = "<default>")
+ config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])
- config.usage.timeshift_path = ConfigText(default = "/media/hdd")
config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [
("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ])
def TunerTypePriorityOrderChanged(configElement):
setTunerTypePriorityOrder(int(configElement.value))
- config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
+ config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)
def setHDDStandby(configElement):
for hdd in harddiskmanager.HDDList():
hdd[1].setIdleTime(int(configElement.value))
- config.usage.hdd_standby.addNotifier(setHDDStandby)
+ config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)
def set12VOutput(configElement):
if configElement.value == "on":
Misc_Options.getInstance().set_12V_output(1)
elif configElement.value == "off":
Misc_Options.getInstance().set_12V_output(0)
- config.usage.output_12V.addNotifier(set12VOutput)
+ config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
defval = str(x)
break
sel.setChoices(map(str, choices), defval)
+
+def preferredPath(path):
+ if config.usage.setup_level.index < 2 or path == "<default>":
+ return None # config.usage.default_path.value, but delay lookup until usage
+ elif path == "<current>":
+ return config.movielist.last_videodir.value
+ elif path == "<timer>":
+ return config.movielist.last_timer_videodir.value
+ else:
+ return path
+
+def preferredTimerPath():
+ return preferredPath(config.usage.timer_path.value)
+
+def preferredInstantRecordPath():
+ return preferredPath(config.usage.instantrec_path.value)
+
+def defaultMoviePath():
+ return config.usage.default_path.value
+
from enigma import getPrevAsciiCode
from Tools.NumericalTextInput import NumericalTextInput
-from Tools.Directories import resolveFilename, SCOPE_CONFIG
+from Tools.Directories import resolveFilename, SCOPE_CONFIG, fileExists
from Components.Harddisk import harddiskmanager
from copy import copy as copy_copy
from os import path as os_path
ConfigText.onDeselect(self, session)
self.hidden = True
+# lets the user select between [min, min+stepwidth, min+(stepwidth*2)..., maxval] with maxval <= max depending
+# on the stepwidth
+# min, max, stepwidth, default are int values
+# wraparound: pressing RIGHT key at max value brings you to min value and vice versa if set to True
+class ConfigSelectionNumber(ConfigSelection):
+ def __init__(self, min, max, stepwidth, default = None, wraparound = False):
+ self.wraparound = wraparound
+ if default is None:
+ default = min
+ default = str(default)
+ choices = []
+ step = min
+ while step <= max:
+ choices.append(str(step))
+ step += stepwidth
+
+ ConfigSelection.__init__(self, choices, default)
+
+ def getValue(self):
+ return int(ConfigSelection.getValue(self))
+
+ def setValue(self, val):
+ ConfigSelection.setValue(self, str(val))
+
+ def handleKey(self, key):
+ if not self.wraparound:
+ if key == KEY_RIGHT:
+ if len(self.choices) == (self.choices.index(self.value) + 1):
+ return
+ if key == KEY_LEFT:
+ if self.choices.index(self.value) == 0:
+ return
+ ConfigSelection.handleKey(self, key)
+
class ConfigNumber(ConfigText):
def __init__(self, default = 0):
ConfigText.__init__(self, str(default), fixed_size = False)
self.default = default
self.locations = []
self.mountpoints = []
- harddiskmanager.on_partition_list_change.append(self.mountpointsChanged)
self.value = default[:]
def setValue(self, value):
locations = [[x, None, False, False] for x in tmp]
self.refreshMountpoints()
for x in locations:
- if os_path.exists(x[0]):
+ if fileExists(x[0]):
x[1] = self.getMountpoint(x[0])
x[2] = True
self.locations = locations
return False
return self.tostring([x[0] for x in locations]) != sv
- def mountpointsChanged(self, action, dev):
- print "Mounts changed: ", action, dev
- mp = dev.mountpoint+"/"
- if action == "add":
- self.addedMount(mp)
- elif action == "remove":
- self.removedMount(mp)
- self.refreshMountpoints()
-
def addedMount(self, mp):
for x in self.locations:
if x[1] == mp:
x[2] = True
- elif x[1] == None and os_path.exists(x[0]):
+ elif x[1] == None and fileExists(x[0]):
x[1] = self.getMountpoint(x[0])
x[2] = True
x[2] = False
def refreshMountpoints(self):
- self.mountpoints = [p.mountpoint + "/" for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"]
+ self.mountpoints = [p.mountpoint for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"]
self.mountpoints.sort(key = lambda x: -len(x))
def checkChangedMountpoints(self):
<packagename>enigma2-plugin-extensions-cutlisteditor</packagename>
<shortdescription>CutListEditor allows you to edit your movies.</shortdescription>
<description>CutListEditor allows you to edit your movies.\nSeek to the start of the stuff you want to cut away. Press OK, select 'start cut'.\nThen seek to the end, press OK, select 'end cut'. That's it.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/cutlisteditor.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cutlisteditor.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.</shortdescription>
<description>Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.\nSpulen Sie zum Anfang des zu schneidenden Teils der Aufnahme. Drücken Sie dann OK und wählen Sie: 'start cut'.\nDann spulen Sie zum Ende, drücken OK und wählen 'end cut'. Das ist alles.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/cutlisteditor.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cutlisteditor.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-cutlisteditor" />
from Components.MultiContent import MultiContentEntryText
from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
from Components.VideoWindow import VideoWindow
+from Components.Label import Label
from Screens.InfoBarGenerics import InfoBarSeek, InfoBarCueSheetSupport
from Components.GUIComponent import GUIComponent
from enigma import eListboxPythonMultiContent, eListbox, gFont, iPlayableService, RT_HALIGN_RIGHT
<widget source="session.CurrentService" render="Label" position="135,405" size="450,50" font="Regular;22" halign="center" valign="center">
<convert type="ServiceName">Name</convert>
</widget>
- <widget source="session.CurrentService" render="Label" position="50,450" zPosition="1" size="620,25" font="Regular;20" halign="center" valign="center">
+ <widget source="session.CurrentService" render="Label" position="320,450" zPosition="1" size="420,25" font="Regular;20" halign="left" valign="center">
<convert type="ServicePosition">Position,Detailed</convert>
</widget>
- <eLabel position="62,98" size="179,274" backgroundColor="#505555" />
- <eLabel position="64,100" size="175,270" backgroundColor="#000000" />
- <widget source="cutlist" position="64,100" zPosition="1" size="175,270" scrollbarMode="showOnDemand" transparent="1" render="Listbox" >
+ <widget name="SeekState" position="210,450" zPosition="1" size="100,25" halign="right" font="Regular;20" valign="center" />
+ <eLabel position="48,98" size="204,274" backgroundColor="#505555" />
+ <eLabel position="50,100" size="200,270" backgroundColor="#000000" />
+ <widget source="cutlist" position="50,100" zPosition="1" size="200,270" scrollbarMode="showOnDemand" transparent="1" render="Listbox" >
<convert type="TemplatedMultiContent">
{"template": [
MultiContentEntryText(size=(125, 20), text = 1, backcolor = MultiContentTemplateColor(3)),
self["Timeline"] = ServicePositionGauge(self.session.nav)
self["cutlist"] = List(self.getCutlist())
self["cutlist"].onSelectionChanged.append(self.selectionChanged)
+ self["SeekState"] = Label()
+ self.onPlayStateChanged.append(self.updateStateLabel)
+ self.updateStateLabel(self.seekstate)
self["Video"] = VideoWindow(decoder = 0)
})
# to track new entries we save the last version of the cutlist
- self.last_cuts = [ ]
+ self.last_cuts = self.getCutlist()
self.cut_start = None
+ self.inhibit_seek = False
self.onClose.append(self.__onClose)
def __onClose(self):
self.session.nav.playService(self.old_service, forceRestart=True)
+ def updateStateLabel(self, state):
+ self["SeekState"].setText(state[3].strip())
+
def showTutorial(self):
if not self.tutorial_seen:
self.tutorial_seen = True
return r
def selectionChanged(self):
- where = self["cutlist"].getCurrent()
- if where is None:
- print "no selection"
- return
- pts = where[0][0]
- seek = self.getSeek()
- if seek is None:
- print "no seek"
- return
- seek.seekTo(pts)
+ if not self.inhibit_seek:
+ where = self["cutlist"].getCurrent()
+ if where is None:
+ print "no selection"
+ return
+ pts = where[0][0]
+ seek = self.getSeek()
+ if seek is None:
+ print "no seek"
+ return
+ seek.seekTo(pts)
def refillList(self):
print "cue sheet changed, refilling"
self.downloadCuesheet()
- # get the first changed entry, and select it
+ # get the first changed entry, counted from the end, and select it
new_list = self.getCutlist()
self["cutlist"].list = new_list
- for i in range(min(len(new_list), len(self.last_cuts))):
- if new_list[i] != self.last_cuts[i]:
- self["cutlist"].setIndex(i)
+ l1 = len(new_list)
+ l2 = len(self.last_cuts)
+ for i in range(min(l1, l2)):
+ if new_list[l1-i-1] != self.last_cuts[l2-i-1]:
+ self["cutlist"].setIndex(l1-i-1)
break
self.last_cuts = new_list
def getStateForPosition(self, pos):
- state = 0 # in
-
- # when first point is "in", the beginning is "out"
- if len(self.cut_list) and self.cut_list[0][1] == 0:
- state = 1
-
+ state = -1
for (where, what) in self.cut_list:
- if where < pos:
- if what == 0: # in
- state = 0
- elif what == 1: # out
+ if what in [0, 1]:
+ if where < pos:
+ state = what
+ elif where == pos:
state = 1
+ elif state == -1:
+ state = 1 - what
+ if state == -1:
+ state = 0
return state
def showMenu(self):
in_after = None
for (where, what) in self.cut_list:
- if what == 1 and where < self.context_position: # out
+ if what == 1 and where <= self.context_position: # out
out_before = (where, what)
elif what == 0 and where < self.context_position: # in, before out
out_before = None
- elif what == 0 and where > self.context_position and in_after is None:
+ elif what == 0 and where >= self.context_position and in_after is None:
in_after = (where, what)
if out_before is not None:
if in_after is not None:
self.cut_list.remove(in_after)
+ self.inhibit_seek = True
self.uploadCuesheet()
+ self.inhibit_seek = False
elif result == CutListContextMenu.RET_MARK:
self.__addMark()
elif result == CutListContextMenu.RET_DELETEMARK:
self.cut_list.remove(self.context_nearest_mark)
+ self.inhibit_seek = True
self.uploadCuesheet()
+ self.inhibit_seek = False
elif result == CutListContextMenu.RET_REMOVEBEFORE:
# remove in/out marks before current position
for (where, what) in self.cut_list[:]:
self.cut_list.remove((where, what))
# add 'in' point
bisect.insort(self.cut_list, (self.context_position, 0))
+ self.inhibit_seek = True
self.uploadCuesheet()
+ self.inhibit_seek = False
elif result == CutListContextMenu.RET_REMOVEAFTER:
# remove in/out marks after current position
for (where, what) in self.cut_list[:]:
self.cut_list.remove((where, what))
# add 'out' point
bisect.insort(self.cut_list, (self.context_position, 1))
+ self.inhibit_seek = True
self.uploadCuesheet()
+ self.inhibit_seek = False
elif result == CutListContextMenu.RET_GRABFRAME:
self.grabFrame()
self.update()
def mediainfoCB(self, mediuminfo, retval, extra_args):
- capacity = 1
+ formatted_capacity = 0
+ read_capacity = 0
+ capacity = 0
used = 0
infotext = ""
mediatype = ""
self.formattable = True
else:
self.formattable = False
- if line.find("Legacy lead-out at:") > -1:
+ elif line.find("Legacy lead-out at:") > -1:
used = int(line.rsplit('=',1)[1]) / 1048576.0
- print "[lead out] used =", used
+ print "[dvd+rw-mediainfo] lead out used =", used
elif line.find("formatted:") > -1:
- capacity = int(line.rsplit('=',1)[1]) / 1048576.0
- print "[formatted] capacity =", capacity
- elif capacity == 1 and line.find("READ CAPACITY:") > -1:
- capacity = int(line.rsplit('=',1)[1]) / 1048576.0
- print "[READ CAP] capacity =", capacity
- elif line.find("Disc status:") > -1:
- if line.find("blank") > -1:
- print "[Disc status] capacity=%d, used=0" % (capacity)
- capacity = used
- used = 0
- elif line.find("Free Blocks:") > -1:
+ formatted_capacity = int(line.rsplit('=',1)[1]) / 1048576.0
+ print "[dvd+rw-mediainfo] formatted capacity =", formatted_capacity
+ elif formatted_capacity == 0 and line.find("READ CAPACITY:") > -1:
+ read_capacity = int(line.rsplit('=',1)[1]) / 1048576.0
+ print "[dvd+rw-mediainfo] READ CAPACITY =", read_capacity
+ for line in mediuminfo.splitlines():
+ if line.find("Free Blocks:") > -1:
try:
size = eval(line[14:].replace("KB","*1024"))
except:
capacity = size / 1048576
if used:
used = capacity-used
- print "[free blocks] capacity=%d, used=%d" % (capacity, used)
+ print "[dvd+rw-mediainfo] free blocks capacity=%d, used=%d" % (capacity, used)
+ elif line.find("Disc status:") > -1:
+ if line.find("blank") > -1:
+ print "[dvd+rw-mediainfo] Disc status blank capacity=%d, used=0" % (capacity)
+ capacity = used
+ used = 0
+ elif line.find("complete") > -1 and formatted_capacity == 0:
+ print "[dvd+rw-mediainfo] Disc status complete capacity=0, used=%d" % (capacity)
+ used = read_capacity
+ capacity = 1
+ else:
+ capacity = formatted_capacity
infotext += line+'\n'
+ if capacity and used > capacity:
+ used = read_capacity or capacity
+ capacity = formatted_capacity or capacity
self["details"].setText(infotext)
if self.formattable:
self["key_yellow"].text = _("Format")
installdir = $(datadir)/meta/
dist_install_DATA = plugin_dvdburn.xml
+
+EXTRA_DIST = dvdburn_de.jpg dvdburn_en.jpg
<packagename>enigma2-plugin-extensions-dvdburn</packagename>
<shortdescription>With DVDBurn you can burn your recordings to a dvd.</shortdescription>
<description>With DVDBurn you can burn your recordings to a dvd.\nArchive all your favorite movies to recordable dvds with menus if wanted.</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdburn_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<packagename>enigma2-plugin-extensions-dvdburn</packagename>
<shortdescription>Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.</shortdescription>
<description>Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.\nArchivieren Sie Ihre Liblingsfilme auf DVD mit Menus wenn Sie es wünschen.</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdburn_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-dvdburn" />
<packagename>enigma2-plugin-extensions-dvdplayer</packagename>
<shortdescription>DVDPlayer plays your DVDs on your Dreambox.</shortdescription>
<description>DVDPlayer plays your DVDs on your Dreambox.\nWith the DVDPlayer you can play your DVDs on your Dreambox from a DVD or even from an iso file or video_ts folder on your harddisc or network.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/dvdplayer.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdplayer.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.</shortdescription>
<description>Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.\nMit dem DVDPlayer können Sie Ihre DVDs auf Ihrer Dreambox abspielen. Dabei ist es egal ob Sie von DVD, iso-Datei oder sogar direkt von einer video_ts Ordnerstruktur von Ihrer Festplatte oder dem Netzwerk abspielen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/dvdplayer.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdplayer.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-dvdplayer" />
from Screens.EpgSelection import EPGSelection
from Screens.TimerEdit import TimerSanityConflict
from Screens.MessageBox import MessageBox
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
from ServiceReference import ServiceReference
from Tools.LoadPixmap import LoadPixmap
if overjump_empty:
self.l.setSelectableFunc(self.isSelectable)
self.epgcache = eEPGCache.getInstance()
- self.clock_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock.png'))
- self.clock_add_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_add.png'))
- self.clock_pre_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_pre.png'))
- self.clock_post_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_post.png'))
- self.clock_prepost_pixmap = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, 'skin_default/icons/epgclock_prepost.png'))
+ self.clock_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock.png'))
+ self.clock_add_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_add.png'))
+ self.clock_pre_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_pre.png'))
+ self.clock_post_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_post.png'))
+ self.clock_prepost_pixmap = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, 'skin_default/icons/epgclock_prepost.png'))
self.time_base = None
self.time_epoch = time_epoch
self.list = None
<packagename>eenigma2-plugin-extensions-graphmultiepg</packagename>
<shortdescription>GraphMultiEPG shows a graphical timeline EPG.</shortdescription>
<description>GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/graphmultiepg_en.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_graphmultiepg_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Zeigt ein grafisches Zeitlinien-EPG.</shortdescription>
<description>Zeigt ein grafisches Zeitlinien-EPG.\nZeigt eine grafische Ãœbersicht aller laufenden und kommenden Sendungen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/graphmultiepg_de.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_graphmultiepg_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-graphmultiepg" />
<packagename>enigma2-plugin-extensions-mediaplayer</packagename>
<shortdescription>Mediaplayer plays your favorite music and videos.</shortdescription>
<description>Mediaplayer plays your favorite music and videos.\nPlay all your favorite music and video files, organize them in playlists, view cover and album information.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/mediaplayer_en.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediaplayer_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Mediaplayer spielt Ihre Musik und Videos.</shortdescription>
<description>Mediaplayer spielt Ihre Musik und Videos.\nSie können all Ihre Musik- und Videodateien abspielen, in Playlisten organisieren, Cover und Albuminformationen abrufen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/mediaplayer_de.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediaplayer_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-mediaplayer" />
from Components.AVSwitch import AVSwitch
from Components.Harddisk import harddiskmanager
from Components.config import config
-from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_SKIN_IMAGE
+from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_CURRENT_SKIN
from settings import MediaPlayerSettings
import random
noCoverFile = value
break
if noCoverFile is None:
- noCoverFile = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png")
+ noCoverFile = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/no_coverArt.png")
self.noCoverPixmap = LoadPixmap(noCoverFile)
return Pixmap.applySkin(self, desktop, screen)
# 'None' is magic to start at the list of mountpoints
defaultDir = config.mediaplayer.defaultDir.getValue()
- self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+ self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
self["filelist"] = self.filelist
self.playlist = MyPlayList()
installdir = $(datadir)/meta/
dist_install_DATA = plugin_mediascanner.xml
+
+EXTRA_DIST = mediascanner_de.jpg mediascanner_en.jpg
<packagename>enigma2-plugin-extensions-mediascanner</packagename>
<shortdescription>MediaScanner scans devices for playable media files.</shortdescription>
<description>MediaScanner scans devices for playable media files and displays a menu with possible actions like viewing pictures or playing movies.</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediascanner_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>MediaScanner durchsucht Geräte nach Mediendateien.</shortdescription>
<description>MediaScanner durchsucht Geräte nach Mediendateien und bietet Ihnen die dazu passenden Aktionen an wie z.B. Bilder betrachten oder Videos abspielen.
</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediascanner_en.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-mediascanner" />
<packagename>enigma2-plugin-extensions-pictureplayer</packagename>
<shortdescription>PicturePlayer displays your photos on the TV.</shortdescription>
<description>The PicturePlayer displays your photos on the TV.\nYou can view them as thumbnails or slideshow.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/pictureplayer.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_pictureplayer.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.</shortdescription>
<description>Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.\nSie können sich Ihre Bilder als Thumbnails, einzeln oder als Slideshow anzeigen lassen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/pictureplayer.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_pictureplayer.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-pictureplayer" />
# reason (True: Networkconfig read finished, False: Networkconfig reload initiated )
WHERE_NETWORKCONFIG_READ = 12
+ WHERE_AUDIOMENU = 13
+
+ # fnc 'SoftwareSupported' or 'AdvancedSoftwareSupported' must take a parameter and return None
+ # if the plugin should not be displayed inside Softwaremanger or return a function which is called with session
+ # and 'None' as parameter to call the plugin from the Softwaremanager menus. "menuEntryName" and "menuEntryDescription"
+ # should be provided to name and describe the new menu entry.
+ WHERE_SOFTWAREMANAGER = 14
+
+
def __init__(self, name = "Plugin", where = [ ], description = "", icon = None, fnc = None, wakeupfnc = None, internal = False):
self.name = name
self.internal = internal
installdir = $(datadir)/meta/
dist_install_DATA = plugin_cleanupwizard.xml
+
+EXTRA_DIST = cleanupwizard_de.jpg cleanupwizard_en.jpg
<description>The CleanupWizard informs you when your internal free memory of your dreambox has droppen under 2MB.
You can use this wizard to remove some extensions.
</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cleanupwizard_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<description>Der CleanupWizard informiert Sie, wenn der interne freie Speicher Ihrer Dreambox unter 2MB fällt.
Sie können dann einige Erweiterungen deinstallieren um wieder Platz zu schaffen.
</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cleanupwizard_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-cleanupwizard" />
in your Dreambox and assign to each of them dedicated providers/services or caids.\n
So it is then possible to watch a scrambled service while recording another one.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/ciassignment.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_ciassignment.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
So ist es möglich mit einem CI einen Sender aufzunehmen\n
und mit einem anderen einen Sender zu schauen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/ciassignment.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_ciassignment.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-commoninterfaceassignment" />
installdir = $(datadir)/meta/
dist_install_DATA = plugin_crashlogautosubmit.xml
+
+EXTRA_DIST = crashlogautosubmit_de.jpg crashlogautosubmit_en.jpg
<description>With the CrashlogAutoSubmit extension it is possible to automatically send crashlogs
found on your Harddrive to Dream Multimedia
</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_crashlogautosubmit_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<packagename>enigma2-plugin-systemplugins-crashlogautosubmit</packagename>
<shortdescription>Automatisches versenden von Crashlogs an Dream Multimedia</shortdescription>
<description>Mit dem CrashlogAutoSubmit Plugin ist es möglich auf Ihrer Festplatte
- gefundene Crashlogs automatisch an Dream Multimedia zu versenden.
+ gefundene Crashlogs automatisch an Dream Multimedia zu versenden.
</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_crashlogautosubmit_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-crashlogautosubmit" />
<shortdescription>Scans default lamedbs sorted by satellite with a connected dish positioner.</shortdescription>
<description>With the DefaultServicesScanner extension you can scan default lamedbs sorted by satellite with a connected dish positioner.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/defaultservicescanner.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_defaultservicescanner.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Standard Sendersuche nach Satellit mit einem Rotor.</shortdescription>
<description>Mit der DefaultServicesScanner Erweiterung können Sie eine standard Sendersuche nach Satellit mit einem angeschlossenen Rotor durchführen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/defaultservicescanner.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_defaultservicescanner.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-defaultservicesscanner" />
dist_install_DATA = plugin_diseqctester.xml
-EXTRA_DIST = diseqctester.jpg
+EXTRA_DIST = diseqctester_de.jpg diseqctester_en.jpg
<shortdescription>Test your Diseqc equipment.</shortdescription>
<description>With the DiseqcTester extension you can test your satellite equipment for Diseqc compatibility and errors.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/diseqctester.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_diseqctester_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Testet Ihr Diseqc Equipment.</shortdescription>
<description>Mit der DiseqcTester Erweiterung können Sie Ihr Satelliten-Equipment nach Diseqc-Kompatibilität und Fehlern überprüfen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/diseqctester.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_diseqctester_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-diseqctester" />
SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \
SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \
DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment \
- CrashlogAutoSubmit CleanupWizard VideoEnhancement
+ CrashlogAutoSubmit CleanupWizard VideoEnhancement WirelessLan NetworkWizard
install_PYTHON = \
__init__.py
dist_install_DATA = plugin_nfiflash.xml
-EXTRA_DIST = nfiflash.jpg
+EXTRA_DIST = nfiflash_de.jpg nfiflash_en.jpg
<description>With the NFIFlash extension it is possible to prepare a USB stick with an Dreambox image.\n
It is then possible to flash your Dreambox with the image on that stick.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/nfiflash.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_nfiflash_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<description>Mit der NFIFlash Erweiterung können Sie ein Dreambox Image auf einen USB-Stick laden.\
Mit diesem USB-Stick ist es dann möglich Ihre Dreambox zu flashen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/nfiflash.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_nfiflash_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-nfiflash" />
+from Plugins.Plugin import PluginDescriptor
+from Tools.HardwareInfo import HardwareInfo
+from Tools.Directories import fileExists
+from downloader import NFIDownload, filescan
+
+def NFIFlasherMain(session, tmp = None, **kwargs):
+ session.open(NFIDownload, "/home/root" )
+
+def NFICallFnc(tmp = None):
+ return NFIFlasherMain
+
def Plugins(**kwargs):
- from Plugins.Plugin import PluginDescriptor
- from Tools.HardwareInfo import HardwareInfo
# currently only available for DM8000
if HardwareInfo().get_device_name() != "dm8000":
return [PluginDescriptor()]
- from Tools.Directories import fileExists
if fileExists("/usr/share/bootlogo-flasher.mvi"):
import flasher
# started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it
return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))]
else:
# started on real enigma2
- import downloader
- return [PluginDescriptor(name="NFI Image Flashing",
- description = _("Download .NFI-Files for USB-Flasher"),
+ return [PluginDescriptor(name=_("NFI Image Flashing"),
+ description=_("Download .NFI-Files for USB-Flasher"),
icon = "flash.png",
- where = [PluginDescriptor.WHERE_PLUGINMENU],
- fnc = downloader.main), PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = downloader.filescan)
- ]
+ where = PluginDescriptor.WHERE_SOFTWAREMANAGER,
+ fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"),
+ "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}),
+ PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]
--- /dev/null
+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.
--- /dev/null
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/NetworkWizard\r
+\r
+SUBDIRS = meta\r
+\r
+install_PYTHON = \\r
+ __init__.py \\r
+ NetworkWizard.py \\r
+ plugin.py\r
+\r
+dist_install_DATA = \\r
+ LICENSE \\r
+ networkwizard.xml
\ No newline at end of file
--- /dev/null
+from Screens.Wizard import wizardManager, WizardSummary
+from Screens.WizardLanguage import WizardLanguage
+from Screens.Rc import Rc
+from Screens.MessageBox import MessageBox
+from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
+from Components.Sources.Boolean import Boolean
+from Components.config import config, ConfigBoolean, configfile, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, getConfigListEntry, ConfigSelection, ConfigPassword
+from Components.Network import iNetwork
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from enigma import eTimer
+
+
+config.misc.firstrun = ConfigBoolean(default = True)
+list = []
+list.append("WEP")
+list.append("WPA")
+list.append("WPA2")
+list.append("WPA/WPA2")
+
+weplist = []
+weplist.append("ASCII")
+weplist.append("HEX")
+
+config.plugins.wlan = ConfigSubsection()
+config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+
+config.plugins.wlan.encryption = ConfigSubsection()
+config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False))
+config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" ))
+config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
+
+class NetworkWizard(WizardLanguage, Rc):
+ skin = """
+ <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
+ <widget name="text" position="153,40" size="340,300" font="Regular;22" />
+ <widget source="list" render="Listbox" position="53,340" size="440,180" scrollbarMode="showOnDemand" >
+ <convert type="StringList" />
+ </widget>
+ <widget name="config" position="53,340" zPosition="1" size="440,180" transparent="1" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
+ <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
+ <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" alphatest="on" />
+ <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" alphatest="on" />
+ <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget source="VKeyIcon" render="Pixmap" pixmap="skin_default/buttons/key_text.png" position="40,260" zPosition="0" size="35,25" transparent="1" alphatest="on" >
+ <convert type="ConditionalShowHide" />
+ </widget>
+ <widget name="HelpWindow" pixmap="skin_default/buttons/key_text.png" position="125,170" zPosition="1" size="1,1" transparent="1" alphatest="on" />
+ </screen>"""
+ def __init__(self, session):
+ self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")
+ WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
+ Rc.__init__(self)
+ self.session = session
+ self["wizard"] = Pixmap()
+ self["HelpWindow"] = Pixmap()
+ self["HelpWindow"].hide()
+ self["VKeyIcon"] = Boolean(False)
+
+ self.InstalledInterfaceCount = None
+ self.Adapterlist = None
+ self.InterfaceState = None
+ self.isInterfaceUp = None
+ self.WlanPluginInstalled = None
+ self.ap = None
+ self.selectedInterface = None
+ self.NextStep = None
+ self.resetRef = None
+ self.checkRef = None
+ self.AdapterRef = None
+ self.APList = None
+ self.newAPlist = None
+ self.WlanList = None
+ self.oldlist = None
+ self.originalAth0State = None
+ self.originalEth0State = None
+ self.originalWlan0State = None
+ self.originalInterfaceStateChanged = False
+ self.Text = None
+ self.rescanTimer = eTimer()
+ self.rescanTimer.callback.append(self.rescanTimerFired)
+ self.getInstalledInterfaceCount()
+ self.isWlanPluginInstalled()
+
+ def exitWizardQuestion(self, ret = False):
+ if (ret):
+ self.markDone()
+ self.close()
+
+ def markDone(self):
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ pass
+
+ def getInstalledInterfaceCount(self):
+ self.rescanTimer.stop()
+ self.Adapterlist = iNetwork.getAdapterList()
+ self.InstalledInterfaceCount = len(self.Adapterlist)
+ self.originalAth0State = iNetwork.getAdapterAttribute('ath0', 'up')
+ self.originalEth0State = iNetwork.getAdapterAttribute('eth0', 'up')
+ self.originalWlan0State = iNetwork.getAdapterAttribute('wlan0', 'up')
+
+ def checkOldInterfaceState(self):
+ # disable up interface if it was originally down and config is unchanged.
+ if self.originalAth0State is False and self.originalInterfaceStateChanged is False:
+ if iNetwork.checkforInterface('ath0') is True:
+ iNetwork.deactivateInterface('ath0')
+ if self.originalEth0State is False and self.originalInterfaceStateChanged is False:
+ if iNetwork.checkforInterface('eth0') is True:
+ iNetwork.deactivateInterface('eth0')
+ if self.originalWlan0State is False and self.originalInterfaceStateChanged is False:
+ if iNetwork.checkforInterface('wlan0') is True:
+ iNetwork.deactivateInterface('wlan0')
+
+ def listInterfaces(self):
+ self.rescanTimer.stop()
+ self.checkOldInterfaceState()
+ list = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()]
+ list.append((_("Exit network wizard"), "end"))
+ return list
+
+ def InterfaceSelectionMade(self, index):
+ self.selectedInterface = index
+ self.InterfaceSelect(index)
+
+ def InterfaceSelect(self, index):
+ if index == 'end':
+ self.NextStep = 'end'
+ elif index == 'eth0':
+ self.NextStep = 'nwconfig'
+ else:
+ self.NextStep = 'scanwlan'
+
+ def InterfaceSelectionMoved(self):
+ self.InterfaceSelect(self.selection)
+
+ def checkInterface(self,iface):
+ self.rescanTimer.stop()
+ if self.Adapterlist is None:
+ self.Adapterlist = iNetwork.getAdapterList()
+ if self.NextStep is not 'end':
+ if len(self.Adapterlist) == 0:
+ #Reset Network to defaults if network broken
+ iNetwork.resetNetworkConfig('lan', self.resetNetworkConfigCB)
+ self.resetRef = self.session.openWithCallback(self.resetNetworkConfigFinished, MessageBox, _("Please wait while we prepare your network interfaces..."), type = MessageBox.TYPE_INFO, enable_input = False)
+ if iface in ('eth0', 'wlan0', 'ath0'):
+ if iface in iNetwork.configuredNetworkAdapters and len(iNetwork.configuredNetworkAdapters) == 1:
+ if iNetwork.getAdapterAttribute(iface, 'up') is True:
+ self.isInterfaceUp = True
+ else:
+ self.isInterfaceUp = False
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+ else:
+ self.isInterfaceUp = iNetwork.checkforInterface(iface)
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+ else:
+ self.resetNetworkConfigFinished(False)
+
+ def resetNetworkConfigFinished(self,data):
+ if data is True:
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+ else:
+ self.currStep = self.getStepWithID(self.NextStep)
+ self.afterAsyncCode()
+
+ def resetNetworkConfigCB(self,callback,iface):
+ if callback is not None:
+ if callback is True:
+ iNetwork.getInterfaces(self.getInterfacesFinished)
+
+ def getInterfacesFinished(self, data):
+ if data is True:
+ if iNetwork.getAdapterAttribute(self.selectedInterface, 'up') is True:
+ self.isInterfaceUp = True
+ else:
+ self.isInterfaceUp = False
+ self.resetRef.close(True)
+ else:
+ print "we should never come here!"
+
+ def AdapterSetupEnd(self, iface):
+ self.originalInterfaceStateChanged = True
+ if iNetwork.getAdapterAttribute(iface, "dhcp") is True:
+ iNetwork.checkNetworkState(self.AdapterSetupEndFinished)
+ self.AdapterRef = self.session.openWithCallback(self.AdapterSetupEndCB, MessageBox, _("Please wait while we test your network..."), type = MessageBox.TYPE_INFO, enable_input = False)
+ else:
+ self.currStep = self.getStepWithID("confdns")
+ self.afterAsyncCode()
+
+ def AdapterSetupEndCB(self,data):
+ if data is True:
+ if self.selectedInterface in ('wlan0', 'ath0'):
+ if self.WlanPluginInstalled == True:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
+ iStatus.getDataForInterface(self.selectedInterface,self.checkWlanStateCB)
+ else:
+ self.currStep = self.getStepWithID("checklanstatusend")
+ self.afterAsyncCode()
+ else:
+ self.currStep = self.getStepWithID("checklanstatusend")
+ self.afterAsyncCode()
+
+ def AdapterSetupEndFinished(self,data):
+ if data <= 2:
+ self.InterfaceState = True
+ else:
+ self.InterfaceState = False
+ self.AdapterRef.close(True)
+
+ def checkWlanStateCB(self,data,status):
+ if data is not None:
+ if data is True:
+ if status is not None:
+ text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n")
+ text2 = _('Accesspoint:') + "\t" + status[self.selectedInterface]["acesspoint"] + "\n"
+ text3 = _('SSID:') + "\t" + status[self.selectedInterface]["essid"] + "\n"
+ text4 = _('Link Quality:') + "\t" + status[self.selectedInterface]["quality"]+"%" + "\n"
+ text5 = _('Signal Strength:') + "\t" + status[self.selectedInterface]["signal"] + "\n"
+ text6 = _('Bitrate:') + "\t" + status[self.selectedInterface]["bitrate"] + "\n"
+ text7 = _('Encryption:') + " " + status[self.selectedInterface]["encryption"] + "\n"
+ text8 = _("Please press OK to continue.")
+ infotext = text1 + text2 + text3 + text4 + text5 + text7 +"\n" + text8
+ self.currStep = self.getStepWithID("checkWlanstatusend")
+ self.Text = infotext
+ self.afterAsyncCode()
+
+ def checkNetwork(self):
+ iNetwork.checkNetworkState(self.checkNetworkStateCB)
+ self.checkRef = self.session.openWithCallback(self.checkNetworkCB, MessageBox, _("Please wait while we test your network..."), type = MessageBox.TYPE_INFO, enable_input = False)
+
+ def checkNetworkCB(self,data):
+ if data is True:
+ if self.selectedInterface in ('wlan0', 'ath0'):
+ if self.WlanPluginInstalled == True:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
+ iStatus.getDataForInterface(self.selectedInterface,self.checkWlanStateCB)
+ else:
+ self.currStep = self.getStepWithID("checklanstatusend")
+ self.afterAsyncCode()
+ else:
+ self.currStep = self.getStepWithID("checklanstatusend")
+ self.afterAsyncCode()
+
+ def checkNetworkStateCB(self,data):
+ if data <= 2:
+ self.InterfaceState = True
+ else:
+ self.InterfaceState = False
+ self.checkRef.close(True)
+
+ def rescanTimerFired(self):
+ self.rescanTimer.stop()
+ self.updateAPList()
+
+ def updateAPList(self):
+ self.oldlist = self.APList
+ self.newAPlist = []
+ newList = []
+ newListIndex = None
+ currentListEntry = None
+ newList = self.listAccessPoints()
+
+ for oldentry in self.oldlist:
+ if oldentry not in newList:
+ newList.append(oldentry)
+
+ for newentry in newList:
+ if newentry[1] == "hidden...":
+ continue
+ self.newAPlist.append(newentry)
+
+ if len(self.newAPlist):
+ if "hidden..." not in self.newAPlist:
+ self.newAPlist.append(( _("enter hidden network SSID"), "hidden..." ))
+
+ if (self.wizard[self.currStep].has_key("dynamiclist")):
+ currentListEntry = self["list"].getCurrent()
+ idx = 0
+ for entry in self.newAPlist:
+ if entry == currentListEntry:
+ newListIndex = idx
+ idx +=1
+ self.wizard[self.currStep]["evaluatedlist"] = self.newAPlist
+ self['list'].setList(self.newAPlist)
+ self["list"].setIndex(newListIndex)
+ self["list"].updateList(self.newAPlist)
+
+ def listAccessPoints(self):
+ self.APList = []
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
+ except ImportError:
+ self.APList.append( ( _("No networks found"),_("unavailable") ) )
+ return self.APList
+ else:
+ self.w = Wlan(self.selectedInterface)
+ aps = self.w.getNetworkList()
+ if aps is not None:
+ print "[NetworkWizard.py] got Accespoints!"
+ tmplist = []
+ complist = []
+ for ap in aps:
+ a = aps[ap]
+ if a['active']:
+ tmplist.append( (a['bssid'], a['essid']) )
+ complist.append( (a['bssid'], a['essid']) )
+
+ for entry in tmplist:
+ if entry[1] == "":
+ for compentry in complist:
+ if compentry[0] == entry[0]:
+ complist.remove(compentry)
+ for entry in complist:
+ self.APList.append( (entry[1], entry[1]) )
+
+ if "hidden..." not in self.APList:
+ self.APList.append(( _("enter hidden network SSID"), "hidden..." ))
+
+ self.rescanTimer.start(3000)
+ return self.APList
+
+ def AccessPointsSelectionMade(self, index):
+ self.ap = index
+ self.WlanList = []
+ currList = []
+ if (self.wizard[self.currStep].has_key("dynamiclist")):
+ currList = self['list'].list
+ for entry in currList:
+ self.WlanList.append( (entry[1], entry[0]) )
+ self.AccessPointsSelect(index)
+
+ def AccessPointsSelect(self, index):
+ self.NextStep = 'wlanconfig'
+
+ def AccessPointsSelectionMoved(self):
+ self.AccessPointsSelect(self.selection)
+
+ def checkWlanSelection(self):
+ self.rescanTimer.stop()
+ self.currStep = self.getStepWithID(self.NextStep)
+
+ def isWlanPluginInstalled(self):
+ try:
+ from Plugins.SystemPlugins.WirelessLan.Wlan import Wlan
+ except ImportError:
+ self.WlanPluginInstalled = False
+ else:
+ self.WlanPluginInstalled = True
+
+
+
--- /dev/null
+installdir = $(datadir)/meta/
+
+dist_install_DATA = plugin_networkwizard.xml
+
+EXTRA_DIST = networkwizard_en.jpg networkwizard_de.jpg
--- /dev/null
+<default>
+ <prerequisites>
+ <tag type="System" />
+ </prerequisites>
+ <info language="en">
+ <author>Dream Multimedia</author>
+ <name>NetworkWizard</name>
+ <packagename>enigma2-plugin-systemplugins-networkwizard</packagename>
+ <shortdescription>Step by step network configuration</shortdescription>
+ <description>With the NetworkWizard you can easy configure your network step by step.
+ </description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_networkwizard_en.jpg" />
+ </info>
+ <info language="de">
+ <author>Dream Multimedia</author>
+ <name>NetzwerkWizard</name>
+ <packagename>enigma2-plugin-systemplugins-networkwizard</packagename>
+ <shortdescription>Schritt für Schritt Netzwerk konfiguration</shortdescription>
+ <description>Mit dem NetzwerkWizard können Sie Ihr Netzwerk konfigurieren. Sie werden Schritt
+ für Schritt durch die Konfiguration geleitet.
+ </description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_networkwizard_de.jpg" />
+ </info>
+ <files type="package"> <!-- without version, without .ipk -->
+ <file type="package" name="enigma2-plugin-systemplugins-networkwizard" />
+ </files>
+</default>
--- /dev/null
+<wizard>
+ <step id="welcome" nextstep="selectinterface">
+ <text value="Welcome.\n\nIf you want to connect your Dreambox to the Internet, this wizard will guide you through the basic network setup of your Dreambox.\n\nPress OK to start configuring your network" />
+ <displaytext value="Network Wizard" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+ </code>
+ </step>
+
+ <step id="selectinterface">
+ <text value="Please select the network interface that you want to use for your internet connection.\n\nPlease press OK to continue." />
+ <displaytext value="Select interface" />
+ <list type="dynamic" source="listInterfaces" evaluation="InterfaceSelectionMade" onselect="InterfaceSelectionMoved" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+ </code>
+ <code pos="after" async="yes">
+self.checkInterface(self.selectedInterface)
+ </code>
+ </step>
+ <step id="nwconfig">
+ <text value="Please configure your internet connection by filling out the required values.\nWhen you are ready press OK to continue." />
+ <displaytext value="Configure interface" />
+ <config screen="AdapterSetup" module="NetworkSetup" args="self.selectedInterface" type="ConfigList" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
+ </code>
+ <code pos="after" async="yes">
+self.AdapterSetupEnd(self.selectedInterface)
+ </code>
+ </step>
+ <step id="confdns" nextstep="checklanstatusend">
+ <text value="Please configure or verify your Nameservers by filling out the required values.\nWhen you are ready press OK to continue." />
+ <displaytext value="Configure nameservers" />
+ <config screen="NameserverSetup" module="NetworkSetup" type="ConfigList" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+ </code>
+ <code pos="after" async="yes">
+self.checkNetwork()
+ </code>
+ </step>
+ <step id="checklanstatusend" nextstep="end">
+ <condition>
+self.condition = (self.InterfaceState == True )
+ </condition>
+ <text value="Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\nPlease press OK to continue." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+ </code>
+ <code pos="after">
+currStep = self.numSteps
+self.wizard[currStep]["nextstep"] = None
+self.markDone()
+self.close()
+ </code>
+ </step>
+ <step id="checklanstatusend">
+ <condition>
+self.condition = (self.InterfaceState == False )
+ </condition>
+ <text value="Your internet connection is not working!\nPlease choose what you want to do next." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+ </code>
+ <list>
+ <listentry caption="Configure your network again" step="selectinterface" />
+ <listentry caption="Exit network wizard" step="end" />
+ </list>
+ </step>
+ <step id="scanwlan">
+ <condition>
+self.condition = (self.isInterfaceUp == True and self.WlanPluginInstalled == True)
+ </condition>
+ <text value="Please select the wireless network that you want to connect to.\n\nPlease press OK to continue." />
+ <displaytext value="Select wireless network" />
+ <list type="dynamic" source="listAccessPoints" evaluation="AccessPointsSelectionMade" onselect="AccessPointsSelectionMoved" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
+ </code>
+ <code pos="after">
+self.checkWlanSelection()
+ </code>
+ </step>
+ <step id="scanwlan">
+ <condition>
+self.condition = (self.isInterfaceUp == False and self.WlanPluginInstalled == True)
+ </condition>
+ <text value="Your wireless LAN internet connection could not be started!\nHave you attached your USB WLAN Stick?\n\nPlease choose what you want to do next." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <list>
+ <listentry caption="Configure your wireless LAN again" step="scanwlan" />
+ <listentry caption="Configure your internal LAN" step="selectinterface" />
+ <listentry caption="Exit network wizard" step="end" />
+ </list>
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+ </code>
+ </step>
+ <step id="scanwlan">
+ <condition>
+self.condition = (self.isInterfaceUp == True and self.WlanPluginInstalled == False)
+ </condition>
+ <text value="The wireless LAN plugin is not installed!\nPlease install it and choose what you want to do next." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <list>
+ <listentry caption="Configure your internal LAN" step="selectinterface" />
+ <listentry caption="Exit network wizard" step="end" />
+ </list>
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+ </code>
+ </step>
+ <step id="wlanconfig">
+ <text value="Please configure your internet connection by filling out the required values.\nWhen you are ready press OK to continue." />
+ <displaytext value="Configure interface" />
+ <config screen="AdapterSetup" module="NetworkSetup" args="(self.selectedInterface,self.ap,self.WlanList)" type="ConfigList" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+self.selectKey("LEFT")
+self.selectKey("RIGHT")
+ </code>
+ <code pos="after" async="yes">
+self.AdapterSetupEnd(self.selectedInterface)
+ </code>
+ </step>
+ <step id="checkWlanstatusend" nextstep="end">
+ <condition>
+self.condition = (self.InterfaceState == True )
+ </condition>
+ <text value="Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\nPlease press OK to continue." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self["text"].setText(self.Text)
+ </code>
+ <code pos="after">
+currStep = self.numSteps
+self.wizard[currStep]["nextstep"] = None
+self.markDone()
+self.close()
+ </code>
+ </step>
+ <step id="checkWlanstatusend">
+ <condition>
+self.condition = (self.InterfaceState == False )
+ </condition>
+ <text value="Your internet connection is not working!\nPlease choose what you want to do next." />
+ <displaytext value="Please follow the instructions on the TV" />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+self.selectKey("UP")
+self.selectKey("DOWN")
+ </code>
+ <list>
+ <listentry caption="Configure your network again" step="selectinterface" />
+ <listentry caption="Exit network wizard" step="end" />
+ </list>
+ </step>
+
+ <step id="end">
+ <text value="Thank you for using the wizard.\nPlease press OK to continue." />
+ <code>
+self.clearSelectedKeys()
+self.selectKey("OK")
+ </code>
+ </step>
+</wizard>
+
+
--- /dev/null
+from Screens.Screen import Screen
+from Plugins.Plugin import PluginDescriptor
+from Components.config import getConfigListEntry, config
+
+def NetworkWizardMain(session, **kwargs):
+ session.open(NetworkWizard)
+
+def startSetup(menuid):
+ if menuid != "system":
+ return [ ]
+
+ return [(_("Network Wizard") + "...", NetworkWizardMain, "nw_wizard", 40)]
+
+def NetworkWizard(*args, **kwargs):
+ from NetworkWizard import NetworkWizard
+ return NetworkWizard(*args, **kwargs)
+
+def Plugins(**kwargs):
+ list = []
+ if config.misc.firstrun.value:
+ list.append(PluginDescriptor(name=_("Network Wizard"), where = PluginDescriptor.WHERE_WIZARD, fnc=(25, NetworkWizard)))
+ return list
<shortdescription>PositionerSetup helps you installing a motorized dish.</shortdescription>
<description>With the PositionerSetup extension it is easy to install and configure a motorized dish.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/positionersetup.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_positionersetup.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<description>Die PositionerSetup Erweiterung unterstützt Sie beim einrichten
und konfigurieren einer motorgesteuerten Satellitenantenne.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/positionersetup.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_positionersetup.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-positionersetup" />
<shortdescription>SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings.</shortdescription>
<description>With the SatelliteEquipmentControl extension it is possible to fine-tune DiSEqC-settings.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/satcontrol.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satcontrol.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<shortdescription>Fein-Einstellungen für DiSEqC</shortdescription>
<description>Die SatelliteEquipmentControl-Erweiterung unterstützt Sie beim Feintuning der DiSEqC Einstellungen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/satcontrol.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satcontrol.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-satelliteequipmentcontrol" />
<name>Satfinder</name>
<packagename>enigma2-plugin-systemplugins-satfinder</packagename>
<shortdescription>Satfinder helps you to align your dish.</shortdescription>
- <description>The Satfinder extension helps you to align your dish.\
+ <description>The Satfinder extension helps you to align your dish.\n
It shows you informations about signal rate and errors.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/satfinder.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satfinder.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<description>Die Satfinder-Erweiterung unterstützt Sie beim Ausrichten ihrer Satellitenanlage.\n
Es zeigt Ihnen Daten wie Signalstärke und Fehlerrate an.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/satfinder.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satfinder.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-satfinder" />
dist_install_DATA = plugin_skinselector.xml
-EXTRA_DIST = skinselector.jpg
+EXTRA_DIST = skinselector_de.jpg skinselector_en.jpg
<description>The SkinSelector shows a menu with selectable skins.\n
It's now easy to change the look and feel of your Dreambox.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/skinselector.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_skinselector_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<description>Die SkinSelector Erweiterung zeigt Ihnen ein Menu mit auswählbaren Skins.\n
Sie können nun einfach das Aussehen der grafischen Oberfläche Ihrer Dreambox verändern.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/skinselector.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_skinselector_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-skinselector" />
self.setTitle(_("Backup is running..."))
def doBackup(self):
+ configfile.save()
try:
if (path.exists(self.backuppath) == False):
makedirs(self.backuppath)
dist_install_DATA = plugin_softwaremanager.xml
-EXTRA_DIST = softmanager.jpg
+EXTRA_DIST = softwaremanager_en.jpg softwaremanager_de.jpg
<description>The SoftwareManager manages your Dreambox software.\n
It's easy to update your receiver's software, install or remove extensions or even backup and restore your system settings.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/softmanager.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_softwaremanager_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
Sie können nun einfach Ihre Dreambox-Software aktualisieren, neue Erweiterungen installieren oder entfernen,
oder ihre Einstellungen sichern und wiederherstellen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/softmanager.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_softwaremanager_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-softwaremanager" />
from Components.DreamInfoHandler import DreamInfoHandler
from Components.Language import language
from Components.AVSwitch import AVSwitch
-from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE, SCOPE_METADIR
+from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR
from Tools.LoadPixmap import LoadPixmap
from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad
from cPickle import dump, load
self.oktext = _("\nPress OK on your remote control to continue.")
self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
if self.menu == 0:
- self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext) )
- #self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext) )
- self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext))
- self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext))
- self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext))
- self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext))
+ self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None))
+ #self.list.append(("install-plugins", _("Install extensions"), _("\nInstall new Extensions or Plugins to your dreambox" ) + self.oktext, None))
+ self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None))
+ self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None))
+ self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None))
+ self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local packages and install them." ) + self.oktext, None))
+ for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER):
+ if p.__call__.has_key("SoftwareSupported"):
+ callFnc = p.__call__["SoftwareSupported"](None)
+ if callFnc is not None:
+ if p.__call__.has_key("menuEntryName"):
+ menuEntryName = p.__call__["menuEntryName"](None)
+ else:
+ menuEntryName = _('Extended Software')
+ if p.__call__.has_key("menuEntryDescription"):
+ menuEntryDescription = p.__call__["menuEntryDescription"](None)
+ else:
+ menuEntryDescription = _('Extended Software Plugin')
+ self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc))
if config.usage.setup_level.index >= 2: # expert+
- self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext))
+ self.list.append(("advanced", _("Advanced Options"), _("\nAdvanced options and settings." ) + self.oktext, None))
elif self.menu == 1:
- self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext))
- self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext ))
- self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext))
+ self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None))
+ self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None))
+ self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None))
if config.usage.setup_level.index >= 2: # expert+
- self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext))
- self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext))
+ self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None))
+ self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None))
+ for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER):
+ if p.__call__.has_key("AdvancedSoftwareSupported"):
+ callFnc = p.__call__["AdvancedSoftwareSupported"](None)
+ if callFnc is not None:
+ if p.__call__.has_key("menuEntryName"):
+ menuEntryName = p.__call__["menuEntryName"](None)
+ else:
+ menuEntryName = _('Advanced Software')
+ if p.__call__.has_key("menuEntryDescription"):
+ menuEntryDescription = p.__call__["menuEntryDescription"](None)
+ else:
+ menuEntryDescription = _('Advanced Software Plugin')
+ self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc))
self["menu"] = List(self.list)
self["key_red"] = StaticText(_("Close"))
def go(self):
current = self["menu"].getCurrent()
if current:
- current = current[0]
+ currentEntry = current[0]
if self.menu == 0:
- if (current == "software-update"):
+ if (currentEntry == "software-update"):
self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to update your Dreambox?")+"\n"+_("\nAfter pressing OK, please wait!"))
- elif (current == "software-restore"):
+ elif (currentEntry == "software-restore"):
self.session.open(ImageWizard)
- elif (current == "install-plugins"):
+ elif (currentEntry == "install-plugins"):
self.session.open(PluginManager, self.skin_path)
- elif (current == "system-backup"):
+ elif (currentEntry == "system-backup"):
self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True)
- elif (current == "system-restore"):
+ elif (currentEntry == "system-restore"):
if os_path.exists(self.fullbackupfilename):
self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your Enigma2 backup?\nEnigma2 will restart after the restore"))
else:
self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10)
- elif (current == "ipkg-install"):
+ elif (currentEntry == "ipkg-install"):
try:
from Plugins.Extensions.MediaScanner.plugin import main
main(self.session)
except:
self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10)
- elif (current == "advanced"):
+ elif (currentEntry == "default-plugin"):
+ self.extended = current[3]
+ self.extended(self.session, None)
+ elif (currentEntry == "advanced"):
self.session.open(UpdatePluginMenu, 1)
elif self.menu == 1:
- if (current == "ipkg-manager"):
+ if (currentEntry == "ipkg-manager"):
self.session.open(PacketManager, self.skin_path)
- elif (current == "backuplocation"):
+ elif (currentEntry == "backuplocation"):
parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
for x in parts:
if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/':
parts.remove(x)
if len(parts):
self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts)
- elif (current == "backupfiles"):
+ elif (currentEntry == "backupfiles"):
self.session.openWithCallback(self.backupfiles_choosen,BackupSelection)
- elif (current == "advancedrestore"):
+ elif (currentEntry == "advancedrestore"):
self.session.open(RestoreMenu, self.skin_path)
- elif (current == "ipkg-source"):
+ elif (currentEntry == "ipkg-source"):
self.session.open(IPKGMenu, self.skin_path)
+ elif (currentEntry == "advanced-plugin"):
+ self.extended = current[3]
+ self.extended(self.session, None)
def backupfiles_choosen(self, ret):
self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
def setStatus(self,status = None):
if status:
self.statuslist = []
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if status == 'update':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'',statuspng, divpng ))
self['list'].setList(self.statuslist)
elif status == 'error':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'',statuspng, divpng ))
self['list'].setList(self.statuslist)
self.buildPacketList()
def buildEntryComponent(self, name, version, description, state):
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if state == 'installed':
- installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
return((name, version, description, state, installedpng, divpng))
elif state == 'upgradeable':
- upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgradeable.png"))
+ upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png"))
return((name, version, description, state, upgradeablepng, divpng))
else:
- installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png"))
return((name, version, description, state, installablepng, divpng))
def buildPacketList(self):
self["key_green"].setText("")
self["key_blue"].setText("")
self["key_yellow"].setText("")
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if status == 'update':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' ))
self["list"].style = "default"
self['list'].setList(self.statuslist)
elif status == 'sync':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' ))
self["list"].style = "default"
self['list'].setList(self.statuslist)
elif status == 'error':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' ))
self["list"].style = "default"
self['list'].setList(self.statuslist)
self.Console.ePopen(cmd, self.InstallMetaPackage_Finished)
def buildEntryComponent(self, name, details, description, packagename, state, selected = False):
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if state == 'installed':
- installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
return((name, details, description, packagename, state, installedpng, divpng, selected))
elif state == 'installable':
- installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png"))
return((name, details, description, packagename, state, installablepng, divpng, selected))
elif state == 'remove':
- removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
return((name, details, description, packagename, state, removepng, divpng, selected))
elif state == 'install':
- installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/install.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png"))
return((name, details, description, packagename, state, installpng, divpng, selected))
def buildPacketList(self, categorytag = None):
self.selectionChanged()
def buildCategoryComponent(self, tag = None):
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if tag is not None:
if tag == 'System':
return(( _("System"), _("View list of available system extensions" ), tag, divpng ))
self['list'].updateList(self.list)
def buildEntryComponent(self, action,info):
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
- upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
- installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/install.png"))
- removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
+ upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
if action == 'install':
return(( _('Installing'), info, installpng, divpng))
elif action == 'remove':
self['list'].updateList(self.list)
def buildEntryComponent(self, state):
- divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
- installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
- installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
- removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
- installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/install.png"))
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png"))
if state == 'installed':
return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng))
if not noScreenshot:
filename = self.thumbnail
else:
- filename = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/noprev.png")
+ filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png")
sc = AVSwitch().getFramebufferScale()
self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000"))
dist_install_DATA = plugin_videoenhancement.xml
-EXTRA_DIST = videoenhancement.jpg
+EXTRA_DIST = videoenhancement_en.jpg videoenhancement_de.jpg
<default>
<prerequisites>
+ <hardware type="dm8000" />
+ <hardware type="dm800" />
+ <hardware type="dm500hd" />
<tag type="Display" />
<tag type="System" />
</prerequisites>
<packagename>enigma2-plugin-systemplugins-videoenhancement</packagename>
<shortdescription>VideoEnhancement provides advanced video enhancement settings.</shortdescription>
<description>The VideoEnhancement extension provides advanced video enhancement settings.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videoenhancement.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videoenhancement_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
- <name>VideoEnhancement</name>
+ <name>Erweiterte A/V Einstellungen</name>
<packagename>enigma2-plugin-systemplugins-videoenhancement</packagename>
- <shortdescription>Videomode bietet erweiterte Video Konfigurationsoptionen.</shortdescription>
- <description>Die Videomode-Erweiterung bietet erweiterte Video Konfigurationsoptionen.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videoenhancement.jpg" />
+ <shortdescription>Erweiterte A/V Einstellungen für Ihre Dreambox.</shortdescription>
+ <description>Erweiterte A/V Einstellungen für Ihre Dreambox.</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videoenhancement_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
<packagename>enigma2-plugin-systemplugins-videotune</packagename>
<shortdescription>VideoTune helps fine-tuning your tv display.</shortdescription>
<description>The VideoTune helps fine-tuning your tv display.\nYou can control brightness and contrast of your tv.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videotune.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videotune.jpg" />
</info>
<info language="de">
<author>Dream Multimedia - DE</author>
<shortdescription>VideoTune hilft beim fein-einstellen des Fernsehers.</shortdescription>
<description>VideoTune hilf beim fein-einstellen des Fernsehers.\nSie können Kontrast und Helligkeit fein-einstellen.
</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videotune.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videotune.jpg" />
</info>
<files type="package"> <!-- ohne versionsnummer, ohne .ipkg -->
<file type="package" name="enigma2-plugin-systemplugins-videotune" />
dist_install_DATA = plugin_videomode.xml
-EXTRA_DIST = videomode.jpg
+EXTRA_DIST = videomode_en.jpg videomode_de.jpg
<packagename>enigma2-plugin-systemplugins-videomode</packagename>
<shortdescription>Videomode provides advanced video modes.</shortdescription>
<description>The Videomode extension provides advanced video modes.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videomode.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videomode_en.jpg" />
</info>
<info language="de">
<author>Dream Multimedia</author>
<packagename>enigma2-plugin-systemplugins-videomode</packagename>
<shortdescription>Videomode bietet erweiterte Video Einstellungen.</shortdescription>
<description>Die Videomode-Erweiterung bietet erweiterte Video-Einstellungen.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/videomode.jpg" />
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videomode_de.jpg" />
</info>
<files type="package"> <!-- without version, without .ipk -->
--- /dev/null
+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.
--- /dev/null
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/WirelessLan
+
+SUBDIRS = meta
+
+install_PYTHON = \
+ __init__.py \
+ flags.py \
+ iwlibs.py \
+ plugin.py \
+ Wlan.py
+
+dist_install_DATA = \
+ LICENSE
--- /dev/null
+#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
+#from Components.MultiContent import MultiContentEntryText
+#from Components.GUIComponent import GUIComponent
+#from Components.HTMLComponent import HTMLComponent
+from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
+from Components.Console import Console
+
+from os import system
+from string import maketrans, strip
+import sys
+import types
+from re import compile as re_compile, search as re_search
+from iwlibs import getNICnames, Wireless, Iwfreq
+
+list = []
+list.append("WEP")
+list.append("WPA")
+list.append("WPA2")
+list.append("WPA/WPA2")
+
+weplist = []
+weplist.append("ASCII")
+weplist.append("HEX")
+
+config.plugins.wlan = ConfigSubsection()
+config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+
+config.plugins.wlan.encryption = ConfigSubsection()
+config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = True))
+config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2"))
+config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
+
+class Wlan:
+ def __init__(self, iface):
+ a = ''; b = ''
+ for i in range(0, 255):
+ a = a + chr(i)
+ if i < 32 or i > 127:
+ b = b + ' '
+ else:
+ b = b + chr(i)
+
+ self.iface = iface
+ self.wlaniface = {}
+ self.WlanConsole = Console()
+ self.asciitrans = maketrans(a, b)
+
+ def stopWlanConsole(self):
+ if self.WlanConsole is not None:
+ print "killing self.WlanConsole"
+ self.WlanConsole = None
+ del self.WlanConsole
+
+ def getDataForInterface(self, callback = None):
+ #get ip out of ip addr, as avahi sometimes overrides it in ifconfig.
+ print "self.iface im getDataForInterface",self.iface
+ if len(self.WlanConsole.appContainers) == 0:
+ self.WlanConsole = Console()
+ cmd = "iwconfig " + self.iface
+ self.WlanConsole.ePopen(cmd, self.iwconfigFinished, callback)
+
+ def iwconfigFinished(self, result, retval, extra_args):
+ print "self.iface im iwconfigFinished",self.iface
+ callback = extra_args
+ data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
+ #print "result im iwconfigFinished",result
+
+ for line in result.splitlines():
+ #print "line",line
+ line = line.strip()
+ if "ESSID" in line:
+ if "off/any" in line:
+ ssid = _("No Connection")
+ else:
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
+ #print "SSID->",ssid
+ if ssid is not None:
+ data['essid'] = ssid
+ if 'Frequency' in line:
+ frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
+ #print "Frequency",frequency
+ if frequency is not None:
+ data['frequency'] = frequency
+ if "Access Point" in line:
+ ap=line[line.index('Access Point')+14:len(line)-1]
+ #print "AP",ap
+ if ap is not None:
+ data['acesspoint'] = ap
+ if "Bit Rate" in line:
+ br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
+ #print "Bitrate",br
+ if br is not None:
+ data['bitrate'] = br
+ if 'Encryption key' in line:
+ if ":off" in line:
+ enc = _("Disabled")
+ else:
+ enc = line[line.index('Encryption key')+15 :line.index(' Security')]
+ #print "Encryption key",enc
+ if enc is not None:
+ data['encryption'] = _("Enabled")
+ if 'Quality' in line:
+ if "/100" in line:
+ qual = line[line.index('Quality')+8:line.index('/100')]
+ else:
+ qual = line[line.index('Quality')+8:line.index('Sig')]
+ #print "Quality",qual
+ if qual is not None:
+ data['quality'] = qual
+ if 'Signal level' in line:
+ signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+ #print "Signal level",signal
+ if signal is not None:
+ data['signal'] = signal
+
+ self.wlaniface[self.iface] = data
+
+ if len(self.WlanConsole.appContainers) == 0:
+ print "self.wlaniface after loading:", self.wlaniface
+ self.WlanConsole = None
+ if callback is not None:
+ callback(True,self.wlaniface)
+
+ def getAdapterAttribute(self, attribute):
+ print "im getAdapterAttribute"
+ if self.wlaniface.has_key(self.iface):
+ print "self.wlaniface.has_key",self.iface
+ if self.wlaniface[self.iface].has_key(attribute):
+ return self.wlaniface[self.iface][attribute]
+ return None
+
+ def asciify(self, str):
+ return str.translate(self.asciitrans)
+
+
+ def getWirelessInterfaces(self):
+ iwifaces = None
+ try:
+ iwifaces = getNICnames()
+ except:
+ print "[Wlan.py] No Wireless Networkcards could be found"
+
+ return iwifaces
+
+
+ def getNetworkList(self):
+ system("ifconfig "+self.iface+" up")
+ ifobj = Wireless(self.iface) # a Wireless NIC Object
+
+ #Association mappings
+ stats, quality, discard, missed_beacon = ifobj.getStatistics()
+ snr = quality.signallevel - quality.noiselevel
+
+ try:
+ scanresults = ifobj.scan()
+ except:
+ scanresults = None
+ print "[Wlan.py] No Wireless Networks could be found"
+
+ if scanresults is not None:
+ aps = {}
+ for result in scanresults:
+
+ bssid = result.bssid
+
+ encryption = map(lambda x: hex(ord(x)), result.encode)
+
+ if encryption[-1] == "0x8":
+ encryption = True
+ else:
+ encryption = False
+
+ extra = []
+ for element in result.custom:
+ element = element.encode()
+ extra.append( strip(self.asciify(element)) )
+
+ if result.quality.sl is 0 and len(extra) > 0:
+ begin = extra[0].find('SignalStrength=')+15
+
+ done = False
+ end = begin+1
+
+ while not done:
+ if extra[0][begin:end].isdigit():
+ end += 1
+ else:
+ done = True
+ end -= 1
+
+ signal = extra[0][begin:end]
+ #print "[Wlan.py] signal is:" + str(signal)
+
+ else:
+ signal = str(result.quality.sl)
+
+ aps[bssid] = {
+ 'active' : True,
+ 'bssid': result.bssid,
+ 'channel': result.frequency.getChannel(result.frequency.getFrequency()),
+ 'encrypted': encryption,
+ 'essid': strip(self.asciify(result.essid)),
+ 'iface': self.iface,
+ 'maxrate' : result.rate[-1],
+ 'noise' : result.quality.getNoiselevel(),
+ 'quality' : str(result.quality.quality),
+ 'signal' : signal,
+ 'custom' : extra,
+ }
+ print aps[bssid]
+ return aps
+
+
+ def getStatus(self):
+ ifobj = Wireless(self.iface)
+ fq = Iwfreq()
+ try:
+ self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
+ except:
+ self.channel = 0
+ #print ifobj.getStatistics()
+ status = {
+ 'BSSID': str(ifobj.getAPaddr()),
+ 'ESSID': str(ifobj.getEssid()),
+ 'quality': str(ifobj.getStatistics()[1].quality),
+ 'signal': str(ifobj.getStatistics()[1].sl),
+ 'bitrate': str(ifobj.getBitrate()),
+ 'channel': str(self.channel),
+ #'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
+ }
+
+ for (key, item) in status.items():
+ if item is "None" or item is "":
+ status[key] = _("N/A")
+
+ return status
+
+
+class wpaSupplicant:
+ def __init__(self):
+ pass
+
+
+ def writeConfig(self):
+
+ essid = config.plugins.wlan.essid.value
+ hiddenessid = config.plugins.wlan.hiddenessid.value
+ encrypted = config.plugins.wlan.encryption.enabled.value
+ encryption = config.plugins.wlan.encryption.type.value
+ wepkeytype = config.plugins.wlan.encryption.wepkeytype.value
+ psk = config.plugins.wlan.encryption.psk.value
+ fp = file('/etc/wpa_supplicant.conf', 'w')
+ fp.write('#WPA Supplicant Configuration by enigma2\n')
+ fp.write('ctrl_interface=/var/run/wpa_supplicant\n')
+ fp.write('eapol_version=1\n')
+ fp.write('fast_reauth=1\n')
+ if essid == 'hidden...':
+ fp.write('ap_scan=2\n')
+ else:
+ fp.write('ap_scan=1\n')
+ fp.write('network={\n')
+ if essid == 'hidden...':
+ fp.write('\tssid="'+hiddenessid+'"\n')
+ else:
+ fp.write('\tssid="'+essid+'"\n')
+ fp.write('\tscan_ssid=0\n')
+ if encrypted:
+ if encryption == 'WPA' or encryption == 'WPA2' or encryption == 'WPA/WPA2' :
+ fp.write('\tkey_mgmt=WPA-PSK\n')
+
+ if encryption == 'WPA':
+ fp.write('\tproto=WPA\n')
+ fp.write('\tpairwise=TKIP\n')
+ fp.write('\tgroup=TKIP\n')
+ elif encryption == 'WPA2':
+ fp.write('\tproto=WPA RSN\n')
+ fp.write('\tpairwise=CCMP TKIP\n')
+ fp.write('\tgroup=CCMP TKIP\n')
+ else:
+ fp.write('\tproto=WPA WPA2\n')
+ fp.write('\tpairwise=CCMP\n')
+ fp.write('\tgroup=TKIP\n')
+ fp.write('\tpsk="'+psk+'"\n')
+
+ elif encryption == 'WEP':
+ fp.write('\tkey_mgmt=NONE\n')
+ if wepkeytype == 'ASCII':
+ fp.write('\twep_key0="'+psk+'"\n')
+ else:
+ fp.write('\twep_key0='+psk+'\n')
+ else:
+ fp.write('\tkey_mgmt=NONE\n')
+ fp.write('}')
+ fp.write('\n')
+ fp.close()
+ system("cat /etc/wpa_supplicant.conf")
+
+ def loadConfig(self):
+ try:
+ #parse the wpasupplicant configfile
+ fp = file('/etc/wpa_supplicant.conf', 'r')
+ supplicant = fp.readlines()
+ fp.close()
+ ap_scan = False
+ essid = None
+
+ for s in supplicant:
+ split = s.strip().split('=',1)
+ if split[0] == 'ap_scan':
+ print "[Wlan.py] Got Hidden SSID Scan Value "+split[1]
+ if split[1] == '2':
+ ap_scan = True
+ else:
+ ap_scan = False
+
+ elif split[0] == 'ssid':
+ print "[Wlan.py] Got SSID "+split[1][1:-1]
+ essid = split[1][1:-1]
+
+ elif split[0] == 'proto':
+ print "split[1]",split[1]
+ config.plugins.wlan.encryption.enabled.value = True
+ if split[1] == "WPA" :
+ mode = 'WPA'
+ if split[1] == "WPA WPA2" :
+ mode = 'WPA/WPA2'
+ if split[1] == "WPA RSN" :
+ mode = 'WPA2'
+ config.plugins.wlan.encryption.type.value = mode
+ print "[Wlan.py] Got Encryption: "+mode
+
+ #currently unused !
+ #elif split[0] == 'key_mgmt':
+ # print "split[1]",split[1]
+ # if split[1] == "WPA-PSK" :
+ # config.plugins.wlan.encryption.enabled.value = True
+ # config.plugins.wlan.encryption.type.value = "WPA/WPA2"
+ # print "[Wlan.py] Got Encryption: "+ config.plugins.wlan.encryption.type.value
+
+ elif split[0] == 'wep_key0':
+ config.plugins.wlan.encryption.enabled.value = True
+ config.plugins.wlan.encryption.type.value = 'WEP'
+ if split[1].startswith('"') and split[1].endswith('"'):
+ config.plugins.wlan.encryption.wepkeytype.value = 'ASCII'
+ config.plugins.wlan.encryption.psk.value = split[1][1:-1]
+ else:
+ config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
+ config.plugins.wlan.encryption.psk.value = split[1]
+ print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
+ print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
+
+ elif split[0] == 'psk':
+ config.plugins.wlan.encryption.psk.value = split[1][1:-1]
+ print "[Wlan.py] Got PSK: "+split[1][1:-1]
+ else:
+ pass
+
+ if ap_scan is True:
+ config.plugins.wlan.hiddenessid.value = essid
+ config.plugins.wlan.essid.value = 'hidden...'
+ else:
+ config.plugins.wlan.hiddenessid.value = essid
+ config.plugins.wlan.essid.value = essid
+ wsconfig = {
+ 'hiddenessid': config.plugins.wlan.hiddenessid.value,
+ 'ssid': config.plugins.wlan.essid.value,
+ 'encryption': config.plugins.wlan.encryption.enabled.value,
+ 'encryption_type': config.plugins.wlan.encryption.type.value,
+ 'encryption_wepkeytype': config.plugins.wlan.encryption.wepkeytype.value,
+ 'key': config.plugins.wlan.encryption.psk.value,
+ }
+
+ for (key, item) in wsconfig.items():
+ if item is "None" or item is "":
+ if key == 'hiddenessid':
+ wsconfig['hiddenessid'] = "home"
+ if key == 'ssid':
+ wsconfig['ssid'] = "home"
+ if key == 'encryption':
+ wsconfig['encryption'] = True
+ if key == 'encryption':
+ wsconfig['encryption_type'] = "WPA/WPA2"
+ if key == 'encryption':
+ wsconfig['encryption_wepkeytype'] = "ASCII"
+ if key == 'encryption':
+ wsconfig['key'] = "mysecurewlan"
+
+ except:
+ print "[Wlan.py] Error parsing /etc/wpa_supplicant.conf"
+ wsconfig = {
+ 'hiddenessid': "home",
+ 'ssid': "home",
+ 'encryption': True,
+ 'encryption_type': "WPA/WPA2",
+ 'encryption_wepkeytype': "ASCII",
+ 'key': "mysecurewlan",
+ }
+ print "[Wlan.py] WS-CONFIG-->",wsconfig
+ return wsconfig
+
+
+ def restart(self, iface):
+ system("start-stop-daemon -K -x /usr/sbin/wpa_supplicant")
+ system("start-stop-daemon -S -x /usr/sbin/wpa_supplicant -- -B -i"+iface+" -c/etc/wpa_supplicant.conf")
+
+class Status:
+ def __init__(self):
+ self.wlaniface = {}
+ self.backupwlaniface = {}
+ self.WlanConsole = Console()
+
+ def stopWlanConsole(self):
+ if self.WlanConsole is not None:
+ print "killing self.WlanConsole"
+ self.WlanConsole = None
+
+ def getDataForInterface(self, iface, callback = None):
+ self.WlanConsole = Console()
+ cmd = "iwconfig " + iface
+ self.WlanConsole.ePopen(cmd, self.iwconfigFinished, [iface, callback])
+
+ def iwconfigFinished(self, result, retval, extra_args):
+ (iface, callback) = extra_args
+ data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
+ for line in result.splitlines():
+ line = line.strip()
+ if "ESSID" in line:
+ if "off/any" in line:
+ ssid = _("No Connection")
+ else:
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
+ #print "SSID->",ssid
+ if ssid is not None:
+ data['essid'] = ssid
+ if 'Frequency' in line:
+ frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
+ #print "Frequency",frequency
+ if frequency is not None:
+ data['frequency'] = frequency
+ if "Access Point" in line:
+ ap=line[line.index('Access Point')+14:len(line)]
+ #print "AP",ap
+ if ap is not None:
+ data['acesspoint'] = ap
+ if ap == "Not-Associated":
+ data['essid'] = _("No Connection")
+ if "Bit Rate" in line:
+ if "kb" in line:
+ br = line[line.index('Bit Rate')+9 :line.index(' kb/s')]
+ if br == '0':
+ br = _("Unsupported")
+ else:
+ br += " Mb/s"
+ else:
+ br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
+ #print "Bitrate",br
+ if br is not None:
+ data['bitrate'] = br
+ if 'Encryption key' in line:
+ if ":off" in line:
+ if data['acesspoint'] is not "Not-Associated":
+ enc = _("Unsupported")
+ else:
+ enc = _("Disabled")
+ else:
+ enc = line[line.index('Encryption key')+15 :line.index(' Security')]
+ if enc is not None:
+ enc = _("Enabled")
+ #print "Encryption key",enc
+ if enc is not None:
+ data['encryption'] = enc
+ if 'Quality' in line:
+ if "/100" in line:
+ qual = line[line.index('Quality')+8:line.index('/100')]
+ else:
+ qual = line[line.index('Quality')+8:line.index('Sig')]
+ #print "Quality",qual
+ if qual is not None:
+ data['quality'] = qual
+ if 'Signal level' in line:
+ if "dBm" in line:
+ signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+ signal += " dBm"
+ elif "/100" in line:
+ signal = line[line.index('Signal level')+13:line.index('/100 Noise')]
+ signal += "%"
+ else:
+ signal = line[line.index('Signal level')+13:line.index(' Noise')]
+ signal += "%"
+ #print "Signal level",signal
+ if signal is not None:
+ data['signal'] = signal
+
+ self.wlaniface[iface] = data
+ self.backupwlaniface = self.wlaniface
+
+ if self.WlanConsole is not None:
+ if len(self.WlanConsole.appContainers) == 0:
+ print "self.wlaniface after loading:", self.wlaniface
+ if callback is not None:
+ callback(True,self.wlaniface)
+
+ def getAdapterAttribute(self, iface, attribute):
+ print "im getAdapterAttribute"
+ self.iface = iface
+ if self.wlaniface.has_key(self.iface):
+ print "self.wlaniface.has_key",self.iface
+ if self.wlaniface[self.iface].has_key(attribute):
+ return self.wlaniface[self.iface][attribute]
+ return None
+
+iStatus = Status()
\ No newline at end of file
--- /dev/null
+# -*- coding: ISO-8859-1 -*-
+# python-wifi -- a wireless library to access wireless cards via python
+# Copyright (C) 2004, 2005, 2006 Róman Joost
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+modes = ['Auto',
+ 'Ad-Hoc',
+ 'Managed',
+ 'Master',
+ 'Repeat',
+ 'Second',
+ 'Monitor']
+
+IFNAMSIZE = 16
+IW_ESSID_MAX_SIZE = 16
+
+KILO = 10**3
+MEGA = 10**6
+GIGA = 10**9
+
+# ioctl calls for the Linux/i386 kernel
+SIOCIWFIRST = 0x8B00 # FIRST ioctl identifier
+SIOCGIFCONF = 0x8912 # ifconf struct
+SIOCGIWNAME = 0x8B01 # get name == wireless protocol
+SIOCGIWFREQ = 0x8B05 # get channel/frequency
+SIOCSIWMODE = 0x8B06 # set the operation mode
+SIOCGIWMODE = 0x8B07 # get operation mode
+SIOCGIWSENS = 0x8B09 # get sensitivity
+SIOCGIWAP = 0x8B15 # get AP MAC address
+SIOCSIWSCAN = 0x8B18 # set scanning off
+SIOCGIWSCAN = 0x8B19 # get scanning results
+SIOCGIWRATE = 0x8B21 # get default bit rate
+SIOCGIWRTS = 0x8B23 # get rts/cts threshold
+SIOCGIWFRAG = 0x8B25 # get fragmention thrh
+SIOCGIWTXPOW = 0x8B27 # get transmit power (dBm)
+SIOCGIWRETRY = 0x8B29 # get retry limit
+SIOCGIWRANGE = 0x8B0B # range
+SIOCGIWSTATS = 0x8B0F # get wireless statistics
+SIOCSIWESSID = 0x8B1A # set essid
+SIOCGIWESSID = 0x8B1B # get essid
+SIOCGIWPOWER = 0x8B2D # get power managment settings
+SIOCGIWENCODE = 0x8B2B # get encryption information
+SIOCIWLAST = 0x8BFF # LAST ioctl identifier
+
+# Power management flags
+IW_POWER_ON = 0x0000 # No details ...
+IW_POWER_TYPE = 0xF000 # Type of parameter
+IW_POWER_PERIOD = 0x1000 # Value is a period/duration of
+IW_POWER_TIMEOUT = 0x2000 # Value is a timeout
+IW_POWER_MODE = 0x0F00 # Power management mode
+IW_POWER_MIN = 0x0001 # Value is a minimum
+IW_POWER_MAX = 0x0002 # Value is a maximum
+IW_POWER_RELATIVE = 0x0004 # Value is not in seconds/ms/us
+
+# Retry limits
+IW_RETRY_TYPE = 0xF000 # Type of parameter
+
+# encoding stuff
+IW_ENCODE_DISABLED = 0x8000 # encoding is disabled
+IW_ENCODE_NOKEY = 0x0800 # key is write only, not present
+
+# constants responsible for scanning
+IW_SCAN_MAX_DATA = 4096
+
+IW_EV_LCP_LEN = 4
+IW_EV_CHAR_LEN = IW_EV_LCP_LEN + IFNAMSIZE
+IW_EV_UINT_LEN = IW_EV_LCP_LEN + 4
+IW_EV_FREQ_LEN = IW_EV_LCP_LEN + 8
+IW_EV_ADDR_LEN = IW_EV_LCP_LEN + 16
+IW_EV_POINT_LEN = IW_EV_LCP_LEN + 4
+IW_EV_PARAM_LEN = IW_EV_LCP_LEN + 8
+IW_EV_QUAL_LEN = IW_EV_LCP_LEN + 4
+
+EPERM = 1
+E2BIG = 7
+EAGAIN = 11
+
+IWHT_NULL = 0
+IWHT_CHAR = 2
+IWHT_UINT = 4
+IWHT_FREQ = 5
+IWHT_ADDR = 6
+IWHT_POINT = 8
+IWHT_PARAM = 9
+IWHT_QUAL = 10
+
+IWEVFIRST = 0x8C00 # FIRST event identifier
+IWEVQUAL = 0x8C01 # Quality statistics from scan
+IWEVCUSTOM = 0x8C02 # Custom Ascii string from Driver
+IWEVLAST = 0x8C0A # LAST event identifier
--- /dev/null
+# -*- coding: ISO-8859-1 -*-
+# python-wifi -- a wireless library to access wireless cards via python
+# Copyright (C) 2004, 2005, 2006 Róman Joost
+#
+# Contributions from:
+# Mike Auty <m.auty@softhome.net> (Iwscanresult, Iwscan)
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+from struct import pack as struct_pack, \
+ unpack as struct_unpack, \
+ calcsize as struct_calcsize
+
+from array import array
+from math import ceil, log10
+from fcntl import ioctl
+from socket import AF_INET, SOCK_DGRAM, socket
+from time import sleep
+from re import compile
+
+from flags import *
+
+def getNICnames():
+ """ extract wireless device names of /proc/net/wireless
+
+ returns empty list if no devices are present
+
+ >>> getNICnames()
+ ['eth1', 'wifi0']
+ """
+ device = compile('[a-z]+[0-9]+')
+ ifnames = []
+
+ f = open('/proc/net/wireless', 'r')
+ data = f.readlines()
+ for line in data:
+ try:
+ ifnames.append(device.search(line).group())
+ except AttributeError:
+ pass
+ # if we couldn't lookup the devices, try to ask the kernel
+ if ifnames == []:
+ ifnames = getConfiguredNICnames()
+
+ return ifnames
+
+def getConfiguredNICnames():
+ """get the *configured* ifnames by a systemcall
+
+ >>> getConfiguredNICnames()
+ []
+ """
+ iwstruct = Iwstruct()
+ ifnames = []
+ buff = array('c', '\0'*1024)
+ caddr_t, length = buff.buffer_info()
+ s = iwstruct.pack('iP', length, caddr_t)
+ try:
+ result = iwstruct._fcntl(SIOCGIFCONF, s)
+ except IOError, (i, e):
+ return i, e
+
+ # get the interface names out of the buffer
+ for i in range(0, 1024, 32):
+ ifname = buff.tostring()[i:i+32]
+ ifname = struct_unpack('32s', ifname)[0]
+ ifname = ifname.split('\0', 1)[0]
+ if ifname:
+ # verify if ifnames are really wifi devices
+ wifi = Wireless(ifname)
+ result = wifi.getAPaddr()
+ if result[0] == 0:
+ ifnames.append(ifname)
+
+ return ifnames
+
+def makedict(**kwargs):
+ return kwargs
+
+
+class Wireless(object):
+ """Access to wireless interfaces"""
+
+ def __init__(self, ifname):
+ self.sockfd = socket(AF_INET, SOCK_DGRAM)
+ self.ifname = ifname
+ self.iwstruct = Iwstruct()
+
+ def getAPaddr(self):
+ """ returns accesspoint mac address
+
+ >>> from iwlibs import Wireless, getNICnames
+ >>> ifnames = getNICnames()
+ >>> ifnames
+ ['eth1', 'wifi0']
+ >>> wifi = Wireless(ifnames[0])
+ >>> wifi.getAPaddr()
+ '00:0D:88:8E:4E:93'
+
+ Test with non-wifi card:
+ >>> wifi = Wireless('eth0')
+ >>> wifi.getAPaddr()
+ (95, 'Operation not supported')
+
+ Test with non-existant card:
+ >>> wifi = Wireless('eth2')
+ >>> wifi.getAPaddr()
+ (19, 'No such device')
+ """
+ buff, s = self.iwstruct.pack_wrq(32)
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWAP,
+ data=s)
+ if i > 0:
+ return result
+
+ return self.iwstruct.getMAC(result)
+
+ def getBitrate(self):
+ """returns device currently set bit rate
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getBitrate()
+ '11 Mb/s'
+ """
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWRATE)
+ if i > 0:
+ return result
+ iwfreq = Iwfreq(result)
+ return iwfreq.getBitrate()
+
+ def getBitrates(self):
+ """returns the number of available bitrates for the device
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> num, rates = wifi.getBitrates()
+ >>> num == len(rates)
+ True
+ """
+ range = Iwrange(self.ifname)
+ if range.errorflag:
+ return (range.errorflag, range.error)
+ return (range.num_bitrates, range.bitrates)
+
+ def getChannelInfo(self):
+ """returns the number of channels and available frequency for
+ the device
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> num, rates = wifi.getChannelInfo()
+ >>> num == len(rates)
+ True
+ """
+ range = Iwrange(self.ifname)
+ if range.errorflag:
+ return (range.errorflag, range.error)
+ return (range.num_channels, range.frequencies)
+
+ def getEssid(self):
+ """get essid information
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getEssid()
+ 'romanofski'
+ """
+ essid = ""
+ buff, s = self.iwstruct.pack_wrq(32)
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWESSID,
+ data=s)
+ if i > 0:
+ return result
+ str = buff.tostring()
+ return str.strip('\x00')
+
+ def setEssid(self, essid):
+ """set essid """
+ raise NotImplementedError
+ if len(essid) > IW_ESSID_MAX_SIZE:
+ return "essid to big"
+ buff, s = self.iwstruct.pack_test(essid, 32)
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCSIWESSID,
+ data=s)
+ if i > 0:
+ return result
+
+ def getEncryption(self):
+ """get encryption information which is probably a string of '*',
+ 'open', 'private'
+
+ as a normal user, you will get a 'Operation not permitted'
+ error:
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getEncryption()
+ (1, 'Operation not permitted')
+ """
+ iwpoint = Iwpoint(self.ifname)
+ if iwpoint.errorflag:
+ return (iwpoint.errorflag, iwpoint.error)
+ return iwpoint.getEncryptionKey()
+
+ def getFragmentation(self):
+ """returns fragmentation threshold
+
+ It depends on what the driver says. If you have fragmentation
+ threshold turned on, you'll get an int. If it's turned of
+ you'll get a string: 'off'.
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getFragmentation()
+ 'off'
+ """
+ iwparam = Iwparam(self.ifname, SIOCGIWFRAG)
+ if iwparam.errorflag:
+ return (iwparam.errorflag, iwparam.error)
+ return iwparam.getValue()
+
+ def getFrequency(self):
+ """returns currently set frequency of the card
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getFrequency()
+ '2.417GHz'
+ """
+ i, r = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWFREQ)
+ if i > 0:
+ return (i, r)
+ iwfreq = Iwfreq(r)
+ return iwfreq.getFrequency()
+
+
+ def getMode(self):
+ """returns currently set operation mode
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getMode()
+ 'Managed'
+ """
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWMODE)
+ if i > 0:
+ return result
+ mode = self.iwstruct.unpack('i', result[:4])[0]
+ return modes[mode]
+
+ def setMode(self, mode):
+ """sets the operation mode """
+ try:
+ this_modes = [x.lower() for x in modes]
+ mode = mode.lower()
+ wifimode = this_modes.index(mode)
+ except ValueError:
+ return "Invalid operation mode!"
+
+ s = self.iwstruct.pack('I', wifimode)
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCSIWMODE,
+ data=s)
+ if i > 0:
+ return result
+
+ def getWirelessName(self):
+ """ returns wireless name
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getWirelessName()
+ 'IEEE 802.11-DS'
+ """
+ i, result = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWNAME)
+ if i > 0:
+ return result
+ return result.split('\0')[0]
+
+ def getPowermanagement(self):
+ """returns power management settings
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getPowermanagement()
+ 'off'
+ """
+ iwparam = Iwparam(self.ifname, SIOCGIWPOWER)
+ if iwparam.errorflag:
+ return (iwparam.errorflag, iwparam.error)
+ return iwparam.getValue()
+
+
+ def getRetrylimit(self):
+ """returns limit retry/lifetime
+
+ man iwconfig:
+ Most cards have MAC retransmissions, and some allow to set
+ the behaviour of the retry mechanism.
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getRetrylimit()
+ 16
+ """
+ iwparam = Iwparam(self.ifname, SIOCGIWRETRY)
+ if iwparam.errorflag:
+ return (iwparam.errorflag, iwparam.error)
+ return iwparam.getValue()
+
+ def getRTS(self):
+ """returns rts threshold
+
+ returns int, 'auto', 'fixed', 'off'
+
+ man iwconfig:
+ RTS/CTS adds a handshake before each packet transmission to
+ make sure that the channel is clear. This adds overhead, but
+ increases performance in case of hidden nodes or a large
+ number of active nodes. This parameter sets the size of the
+ smallest packet for which the node sends RTS; a value equal
+ to the maximum packet size disable the mechanism.
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getRTS()
+ 'off'
+ """
+ iwparam = Iwparam(self.ifname, SIOCGIWRTS)
+ if iwparam.errorflag:
+ return (iwparam.errorflag, iwparam.error)
+ return iwparam.getValue()
+
+ def getSensitivity(self):
+ """returns sensitivity information
+
+ man iwconfig:
+ This is the lowest signal level for which the hardware
+ attempt packet reception, signals weaker than this are
+ ignored. This is used to avoid receiving background noise,
+ so you should set it according to the average noise
+ level. Positive values are assumed to be the raw value used
+ by the hardware or a percentage, negative values are
+ assumed to be dBm.
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getSensitivity()
+ 'off'
+
+ """
+ iwparam = Iwparam(self.ifname, SIOCGIWSENS)
+ if iwparam.errorflag:
+ return (iwparam.errorflag, iwparam.error)
+ return iwparam.getValue()
+
+ def getTXPower(self):
+ """returns transmit power in dBm
+
+ >>> from iwlibs import Wireless
+ >>> wifi = Wireless('eth1')
+ >>> wifi.getTXPower()
+ '17 dBm'
+ """
+ i, r = self.iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWTXPOW)
+ if i > 0:
+ return (i, r)
+ iwfreq = Iwfreq(r)
+ return iwfreq.getTransmitPower()
+
+ def getStatistics(self):
+ """returns statistics information which can also be found in
+ /proc/net/wireless
+ """
+ iwstats = Iwstats(self.ifname)
+ if iwstats.errorflag > 0:
+ return (iwstats.errorflag, iwstats.error)
+ return [iwstats.status, iwstats.qual, iwstats.discard,
+ iwstats.missed_beacon]
+
+ def scan(self):
+ """returns Iwscanresult objects, after a successful scan"""
+ iwscan = Iwscan(self.ifname)
+ return iwscan.scan()
+
+
+class Iwstruct(object):
+ """basic class to handle iwstruct data """
+
+ def __init__(self):
+ self.idx = 0
+ self.sockfd = socket(AF_INET, SOCK_DGRAM)
+
+ def parse_data(self, fmt, data):
+ """ unpacks raw C data """
+ size = struct_calcsize(fmt)
+ idx = self.idx
+
+ str = data[idx:idx + size]
+ self.idx = idx+size
+ value = struct_unpack(fmt, str)
+
+ # take care of a tuple like (int, )
+ if len(value) == 1:
+ return value[0]
+ else:
+ return value
+
+ def pack(self, fmt, *args):
+ """ calls struct_pack and returns the result """
+ return struct_pack(fmt, *args)
+
+ def pack_wrq(self, buffsize):
+ """ packs wireless request data for sending it to the kernel """
+ # Prepare a buffer
+ # We need the address of our buffer and the size for it. The
+ # ioctl itself looks for the pointer to the address in our
+ # memory and the size of it.
+ # Dont change the order how the structure is packed!!!
+ buff = array('c', '\0'*buffsize)
+ caddr_t, length = buff.buffer_info()
+ s = struct_pack('Pi', caddr_t, length)
+ return buff, s
+
+ def pack_test(self, string, buffsize):
+ """ packs wireless request data for sending it to the kernel """
+ buffsize = buffsize - len(string)
+ buff = array('c', string+'\0'*buffsize)
+ caddr_t, length = buff.buffer_info()
+ s = struct_pack('Pii', caddr_t, length, 1)
+ return buff, s
+
+ def unpack(self, fmt, packed_data):
+ """ unpacks data with given format """
+ return struct_unpack(fmt, packed_data)
+
+ def _fcntl(self, request, args):
+ return ioctl(self.sockfd.fileno(), request, args)
+
+ def iw_get_ext(self, ifname, request, data=None):
+ """ read information from ifname """
+ # put some additional data behind the interface name
+ if data is not None:
+ buff = IFNAMSIZE-len(ifname)
+ ifreq = ifname + '\0'*buff
+ ifreq = ifreq + data
+ else:
+ ifreq = (ifname + '\0'*32)
+
+ try:
+ result = self._fcntl(request, ifreq)
+ except IOError, (i, e):
+ return i, e
+
+ return (0, result[16:])
+
+ def getMAC(self, packed_data):
+ """ extracts mac addr from packed data and returns it as str """
+ mac_addr = struct_unpack('xxBBBBBB', packed_data[:8])
+ return "%02X:%02X:%02X:%02X:%02X:%02X" % mac_addr
+
+class Iwparam(object):
+ """class to hold iwparam data """
+
+ def __init__(self, ifname, ioctl):
+ # (i) value, (b) fixed, (b) disabled, (b) flags
+ self.fmt = "ibbH"
+ self.value = 0
+ self.fixed = 0
+ self.disabled = 0
+ self.flags = 0
+ self.errorflag = 0
+ self.error = ""
+ self.ioctl = ioctl
+ self.ifname = ifname
+ self.update()
+
+ def getValue(self):
+ """returns the value if not disabled """
+
+ if self.disabled:
+ return 'off'
+ if self.flags & IW_RETRY_TYPE == 0:
+ return self.getRLAttributes()
+ else:
+ return self.getPMAttributes()
+
+ def getRLAttributes(self):
+ """returns a string with attributes determined by self.flags
+ """
+ return self.value
+
+ def getPMAttributes(self):
+ """returns a string with attributes determined by self.flags
+ and IW_POWER*
+ """
+ result = ""
+
+ # Modifiers
+ if self.flags & IW_POWER_MIN == 0:
+ result = " min"
+ if self.flags & IW_POWER_MAX == 0:
+ result = " max"
+
+ # Type
+ if self.flags & IW_POWER_TIMEOUT == 0:
+ result = " period:"
+ else:
+ result = " timeout:"
+ # Value with or without units
+ # IW_POWER_RELATIVE - value is *not* in s/ms/us
+ if self.flags & IW_POWER_RELATIVE:
+ result += "%f" %(float(self.value)/MEGA)
+ else:
+ if self.value >= MEGA:
+ result += "%fs" %(float(self.value)/MEGA)
+ elif self.value >= KILO:
+ result += "%fms" %(float(self.value)/KILO)
+ else:
+ result += "%dus" % self.value
+
+ return result
+
+ def update(self):
+ iwstruct = Iwstruct()
+ i, r = iwstruct.iw_get_ext(self.ifname,
+ self.ioctl)
+ if i > 0:
+ self.errorflag = i
+ self.error = r
+ self._parse(r)
+
+ def _parse(self, data):
+ """ unpacks iwparam data """
+ iwstruct = Iwstruct()
+ self.value, self.fixed, self.disabled, self.flags =\
+ iwstruct.parse_data(self.fmt, data)
+
+class Iwfreq(object):
+ """ class to hold iwfreq data
+ delegates to Iwstruct class
+ """
+
+ def __init__(self, data=None):
+ self.fmt = "ihbb"
+ if data is not None:
+ self.frequency = self.parse(data)
+ else:
+ self.frequency = 0
+ self.iwstruct = Iwstruct()
+
+ def __getattr__(self, attr):
+ return getattr(self.iwstruct, attr)
+
+ def parse(self, data):
+ """ unpacks iwparam"""
+
+ size = struct_calcsize(self.fmt)
+ m, e, i, pad = struct_unpack(self.fmt, data[:size])
+ # XXX well, its not *the* frequency - we need a better name
+ if e == 0:
+ return m
+ else:
+ return float(m)*10**e
+
+ def getFrequency(self):
+ """returns Frequency (str)
+
+ data - binary data returned by systemcall (iw_get_ext())
+ """
+ freq = self.frequency
+
+ if freq >= GIGA:
+ return "%0.3fGHz" %(freq/GIGA)
+
+ if freq >= MEGA:
+ return "%0.3fMHZ" %(freq/MEGA)
+
+ if freq >= KILO:
+ return "%0.3fKHz" %(freq/KILO)
+
+ def getBitrate(self):
+ """ returns Bitrate in Mbit
+
+ data - binary data returned by systemcall (iw_get_ext())
+ """
+ bitrate = self.frequency
+
+ if bitrate >= GIGA:
+ return "%i Gb/s" %(bitrate/GIGA)
+
+ if bitrate >= MEGA:
+ return "%i Mb/s" %(bitrate/MEGA)
+
+ if bitrate >= KILO:
+ return "%i Kb/s" %(bitrate/KILO)
+
+ def getTransmitPower(self):
+ """ returns transmit power in dbm """
+ # XXX something flaky is going on with m and e
+ # eg. m = 50 and e should than be 0, because the number is stored in
+ # m and don't needs to be recalculated
+ return "%i dBm" %self.mw2dbm(self.frequency/10)
+
+ def getChannel(self, freq):
+ """returns channel information given by frequency
+
+ returns None if frequency can't be converted
+ freq = frequency to convert (int)
+ iwrange = Iwrange object
+ """
+
+ try:
+ freq = float(freq)
+ except:
+ return None
+
+ lut = {}
+ #13 Channels beginning at 2.412GHz and inreasing by 0,005 GHz steps
+ for i in range(0,12):
+ cur = float( 2.412 + ( i * 0.005 ) )
+ lut[str(cur)] = i+1
+ # Channel 14 need special actions ;)
+ lut['2.484'] = 14
+
+
+ if str(freq) in lut.keys():
+ return lut[str(freq)]
+
+ return None
+
+
+ def mw2dbm(self, mwatt):
+ """ converts mw to dbm(float) """
+ return ceil(10.0 * log10(mwatt))
+
+ def _setFrequency(self, list):
+ """sets self.frequency by given list
+
+ currently only used by Iwrange
+ """
+ assert len(list) == 4
+ m, e, i, pad = list
+ if e == 0:
+ self.frequency = m
+ else:
+ self.frequency = m #float(m)*10**e
+
+class Iwstats(object):
+ """ class to hold iwstat data """
+
+ def __init__(self, ifname):
+ # (2B) status, 4B iw_quality, 6i iw_discarded
+ self.fmt = "2B4B6i"
+ self.status = 0
+ self.qual = Iwquality()
+ self.discard = {}
+ self.missed_beacon = 0
+ self.ifname = ifname
+ self.errorflag = 0
+ self.error = ""
+ self.update()
+
+ def update(self):
+ iwstruct = Iwstruct()
+ buff, s = iwstruct.pack_wrq(32)
+ i, result = iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWSTATS,
+ data=s)
+ if i > 0:
+ self.error = result
+ self.errorflag = i
+ self._parse(buff.tostring())
+
+ def _parse(self, data):
+ """ unpacks iwstruct data """
+ struct = Iwstruct()
+ iwqual = Iwquality()
+ iwstats_data = struct.parse_data(self.fmt, data)
+
+ self.status = iwstats_data[0:2]
+ self.qual.quality, self.qual.sl, self.qual.nl,\
+ self.qual.flags = iwstats_data[2:6]
+ nwid, code, frag, retries, flags = iwstats_data[6:11]
+ self.missed_beacon = iwstats_data[11:12][0]
+ self.discard = makedict(nwid=nwid, code=code,
+ fragment=frag, retries=retries, misc=flags)
+
+class Iwquality(object):
+ """ class to hold iwquality data """
+
+ def __init__(self):
+ self.quality = 0
+ self.sl = 0
+ self.nl = 0
+ self.updated = 0
+ self.fmt = "4B"
+
+ def parse(self, data):
+ """ unpacks iwquality data """
+ struct = Iwstruct()
+ qual, sl, nl, flags = struct.parse_data(self.fmt, data)
+
+ # compute signal and noise level
+ self.signal_level = sl
+ self.noise_level = nl
+
+ # asign the other values
+ self.quality = qual
+ self.updated = flags
+
+ def setValues(self, list):
+ """ assigns values given by a list to our attributes """
+ attributes = ["quality", "signallevel", "noise_level",
+ "updated"]
+ assert len(list) == 4
+
+ for i in range(len(list)):
+ setattr(self, attributes[i], list[i])
+
+ def getSignallevel(self):
+ """ returns signal level """
+ return self.sl-0x100
+
+ def setSignallevel(self, sl):
+ """ sets signal level """
+ self.sl = sl
+ signallevel = property(getSignallevel, setSignallevel)
+
+ def getNoiselevel(self):
+ """ returns noise level """
+ return self.nl - 0x100
+
+ def setNoiselevel(self):
+ raise NotImplementedError
+ self.nl = nl
+ noiselevel = property(getNoiselevel, setNoiselevel)
+
+class Iwpoint(object):
+ """ class to hold iwpoint data """
+
+ def __init__(self, ifname):
+ self.key = [0,0,0,0]
+ self.fields = 0
+ self.flags = 0
+ # (4B) pointer to data, H length, H flags
+ self.fmt = "4BHH"
+ self.errorflag = 0
+ self.error = ""
+ self.ifname = ifname
+ self.update()
+
+ def __getattr__(self, attr):
+ return getattr(self.iwstruct, attr)
+
+ def update(self):
+ iwstruct = Iwstruct()
+ buff, s = iwstruct.pack_wrq(32)
+ i, result = iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWENCODE,
+ data=s)
+ if i > 0:
+ self.errorflag = i
+ self.error = result
+ self._parse(result)
+
+ def getEncryptionKey(self):
+ """ returns encryption key as '**' or 'off' as str """
+ if self.flags & IW_ENCODE_DISABLED != 0:
+ return 'off'
+ elif self.flags & IW_ENCODE_NOKEY != 0:
+ # a key is set, so print it
+ return '**' * self.fields
+
+ def _parse(self, data):
+ """ unpacks iwpoint data
+ """
+ iwstruct = Iwstruct()
+ ptr, ptr, ptr, ptr, self.fields, self.flags =\
+ iwstruct.parse_data(self.fmt, data)
+ self.key = [ptr, ptr, ptr, ptr]
+
+class Iwrange(object):
+ """holds iwrange struct """
+ IW_MAX_FREQUENCIES = 32
+
+ def __init__(self, ifname):
+ self.fmt = "iiihb6ii4B4Bi32i2i2i2i2i3h8h2b2bhi8i2b3h2i2ihB17x"\
+ + self.IW_MAX_FREQUENCIES*"ihbb"
+
+ self.ifname = ifname
+ self.errorflag = 0
+ self.error = ""
+
+ # informative stuff
+ self.throughput = 0
+
+ # nwid (or domain id)
+ self.min_nwid = self.max_nwid = 0
+
+ # frequency for backward compatibility
+ self.old_num_channels = self.old_num_frequency = self.old_freq = 0
+
+ # signal level threshold
+ self.sensitivity = 0
+
+ # link quality
+ self.max_qual = Iwquality()
+ self.avg_qual = Iwquality()
+
+ # rates
+ self.num_bitrates = 0
+ self.bitrates = []
+
+ # rts threshold
+ self.min_rts = self.max_rts = 0
+
+ # fragmention threshold
+ self.min_frag = self.max_frag = 0
+
+ # power managment
+ self.min_pmp = self.max_pmp = 0
+ self.min_pmt = self.max_pmt = 0
+ self.pmp_flags = self.pmt_flags = self.pm_capa = 0
+
+ # encoder stuff
+ self.encoding_size = 0
+ self.num_encoding_sizes = self.max_encoding_tokens = 0
+ self.encoding_login_index = 0
+
+ # transmit power
+ self.txpower_capa = self.num_txpower = self.txpower = 0
+
+ # wireless extension version info
+ self.we_vers_compiled = self.we_vers_src = 0
+
+ # retry limits and lifetime
+ self.retry_capa = self.retry_flags = self.r_time_flags = 0
+ self.min_retry = self.max_retry = 0
+ self.min_r_time = self.max_r_time = 0
+
+ # frequency
+ self.num_channels = self.num_frequency = 0
+ self.frequencies = []
+ self.update()
+
+ def update(self):
+ """updates Iwrange object by a system call to the kernel
+ and updates internal attributes
+ """
+ iwstruct = Iwstruct()
+ buff, s = iwstruct.pack_wrq(640)
+ i, result = iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWRANGE,
+ data=s)
+ if i > 0:
+ self.errorflag = i
+ self.error = result
+ data = buff.tostring()
+ self._parse(data)
+
+ def _parse(self, data):
+ struct = Iwstruct()
+ result = struct.parse_data(self.fmt, data)
+
+ # XXX there is maybe a much more elegant way to do this
+ self.throughput, self.min_nwid, self.max_nwid = result[0:3]
+ self.old_num_channels, self.old_num_frequency = result[3:5]
+ self.old_freq = result[5:11]
+ self.sensitivity = result[11]
+ self.max_qual.setValues(result[12:16])
+ self.avg_qual.setValues(result[16:20])
+ self.num_bitrates = result[20] # <- XXX
+ raw_bitrates = result[21:53]
+ for rate in raw_bitrates:
+ iwfreq = Iwfreq()
+ iwfreq.frequency = rate
+ br = iwfreq.getBitrate()
+ if br is not None:
+ self.bitrates.append(br)
+
+ self.min_rts, self.max_rts = result[53:55]
+ self.min_frag, self.max_frag = result[55:57]
+ self.min_pmp, self.max_pmp = result[57:59]
+ self.min_pmt, self.max_pmt = result[59:61]
+ self.pmp_flags, self.pmt_flags, self.pm_capa = result[61:64]
+ self.encoding_size = result[64:72]
+ self.num_encoding_sizes, self.max_encoding_tokens = result[72:74]
+ self.encoding_login_index = result[74:76]
+ self.txpower_capa, self.num_txpower = result[76:78]
+ self.txpower = result[78:86]
+ self.we_vers_compiled, self.we_vers_src = result[86:88]
+ self.retry_capa, self.retry_flags, self.r_time_flags = result[88:91]
+ self.min_retry, self.max_retry = result[91:93]
+ self.min_r_time, self.max_r_time = result[93:95]
+ self.num_channels = result[95]
+ self.num_frequency = result[96]
+ freq = result[97:]
+
+ i = self.num_frequency
+ for x in range(0, len(freq), 4):
+ iwfreq = Iwfreq()
+ iwfreq._setFrequency(freq[x:x+4])
+ fq = iwfreq.getFrequency()
+ if fq is not None:
+ self.frequencies.append(fq)
+ i -= 1
+ if i <= 0:
+ break
+
+class Iwscan(object):
+ """class to handle AP scanning"""
+
+ def __init__(self, ifname):
+ self.ifname = ifname
+ self.range = Iwrange(ifname)
+ self.errorflag = 0
+ self.error = ""
+ self.stream = None
+ self.aplist = None
+
+ def scan(self, fullscan=True):
+ """Completes a scan for available access points,
+ and returns them in Iwscanresult format
+
+ fullscan: If False, data is read from a cache of the last scan
+ If True, a scan is conducted, and then the data is read
+ """
+ # By default everything is fine, do not wait
+ result = 1
+ if fullscan:
+ self.setScan()
+ if self.errorflag > EPERM:
+ raise RuntimeError, 'setScan failure ' + str(self.errorflag) + " " + str(self.error)
+ return None
+ elif self.errorflag < EPERM:
+ # Permission was NOT denied, therefore we must WAIT to get results
+ result = 250
+
+ while (result > 0):
+ sleep(result/1000)
+ result = self.getScan()
+
+ if result < 0 or self.errorflag != 0:
+ raise RuntimeError, 'getScan failure ' + str(self.errorflag) + " " + str(self.error)
+
+ return self.aplist
+
+
+ def setScan(self):
+ """Triggers the scan, if we have permission
+ """
+ iwstruct = Iwstruct()
+ s = iwstruct.pack('Pii', 0, 0, 0)
+ i, result = iwstruct.iw_get_ext(self.ifname,
+ SIOCSIWSCAN,s)
+ if i > 0:
+ self.errorflag = i
+ self.error = result
+ return result
+
+ def getScan(self):
+ """Retreives results, stored from the most recent scan
+ Returns 0 if successful, a delay if the data isn't ready yet
+ or -1 if something really nasty happened
+ """
+ iwstruct = Iwstruct()
+ i = E2BIG
+ bufflen = IW_SCAN_MAX_DATA
+
+ # Keep resizing the buffer until it's large enough to hold the scan
+ while (i == E2BIG):
+ buff, s = iwstruct.pack_wrq(bufflen)
+ i, result = iwstruct.iw_get_ext(self.ifname,
+ SIOCGIWSCAN,
+ data=s)
+ if i == E2BIG:
+ pbuff, newlen = iwstruct.unpack('Pi', s)
+ if bufflen < newlen:
+ bufflen = newlen
+ else:
+ bufflen = bufflen * 2
+
+ if i == EAGAIN:
+ return 100
+ if i > 0:
+ self.errorflag = i
+ self.error = result
+ return -1
+
+ pbuff, reslen = iwstruct.unpack('Pi', s)
+ if reslen > 0:
+ # Initialize the stream, and turn it into an enumerator
+ self.aplist = self._parse(buff.tostring())
+ return 0
+
+ def _parse(self, data):
+ """Parse the event stream, and return a list of Iwscanresult objects
+ """
+ iwstruct = Iwstruct()
+ scanresult = None
+ aplist = []
+
+ # Run through the stream, until broken
+ while 1:
+ # If we're the stream doesn't have enough space left for a header, break
+ if len(data) < IW_EV_LCP_LEN:
+ break;
+
+ # Unpack the header
+ length, cmd = iwstruct.unpack('HH', data[:4])
+ # If the header says the following data is shorter than the header, then break
+ if length < IW_EV_LCP_LEN:
+ break;
+
+ # Put the events into their respective result data
+ if cmd == SIOCGIWAP:
+ if scanresult is not None:
+ aplist.append(scanresult)
+ scanresult = Iwscanresult(data[IW_EV_LCP_LEN:length], self.range)
+ elif scanresult is None:
+ raise RuntimeError, 'Attempting to add an event without AP data'
+ else:
+ scanresult.addEvent(cmd, data[IW_EV_LCP_LEN:length])
+
+ # We're finished with the preveious event
+ data = data[length:]
+
+ # Don't forgset the final result
+ if scanresult.bssid != "00:00:00:00:00:00":
+ aplist.append(scanresult)
+ else:
+ raise RuntimeError, 'Attempting to add an AP without a bssid'
+ return aplist
+
+class Iwscanresult(object):
+ """An object to contain all the events associated with a single scanned AP
+ """
+
+ def __init__(self, data, range):
+ """Initialize the scan result with the access point data"""
+ self.iwstruct = Iwstruct()
+ self.range = range
+ self.bssid = "%02X:%02X:%02X:%02X:%02X:%02X" % struct_unpack('BBBBBB', data[2:8])
+ self.essid = None
+ self.mode = None
+ self.rate = []
+ self.quality = Iwquality()
+ self.frequency = None
+ self.encode = None
+ self.custom = []
+ self.protocol = None
+
+ def addEvent(self, cmd, data):
+ """Attempts to add the data from an event to a scanresult
+ Only certain data is accept, in which case the result is True
+ If the event data is invalid, None is returned
+ If the data is valid but unused, False is returned
+ """
+ if cmd <= SIOCIWLAST:
+ if cmd < SIOCIWFIRST:
+ return None
+ elif cmd >= IWEVFIRST:
+ if cmd > IWEVLAST:
+ return None
+ else:
+ return None
+
+ if cmd == SIOCGIWESSID:
+ self.essid = data[4:]
+ elif cmd == SIOCGIWMODE:
+ self.mode = modes[self.iwstruct.unpack('i', data[:4])[0]]
+ elif cmd == SIOCGIWRATE:
+ # TODO, deal with multiple rates, or at least the highest rate
+ freqsize = struct_calcsize("ihbb")
+ while len(data) >= freqsize:
+ iwfreq = Iwfreq(data)
+ self.rate.append(iwfreq.getBitrate())
+ data = data[freqsize:]
+ elif cmd == IWEVQUAL:
+ self.quality.parse(data)
+ elif cmd == SIOCGIWFREQ:
+ self.frequency = Iwfreq(data)
+ elif cmd == SIOCGIWENCODE:
+ self.encode = data
+ elif cmd == IWEVCUSTOM:
+ self.custom.append(data[1:])
+ elif cmd == SIOCGIWNAME:
+ self.protocol = data[:len(data)-2]
+ else:
+ #print "Cmd:", cmd
+ return False
+ return True
\ No newline at end of file
--- /dev/null
+installdir = $(datadir)/meta/
+
+dist_install_DATA = plugin_wirelesslan.xml
+
+EXTRA_DIST = wirelesslan_de.jpg wirelesslan_en.jpg
--- /dev/null
+<default>
+ <prerequisites>
+ <tag type="Network" />
+ <tag type="System" />
+ </prerequisites>
+ <info language="en">
+ <author>Dream Multimedia</author>
+ <name>WirelessLan</name>
+ <packagename>enigma2-plugin-systemplugins-wirelesslan</packagename>
+ <shortdescription>Configure your WLAN network interface</shortdescription>
+ <description>The WirelessLan extensions helps you configuring your WLAN network interface.</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_wirelesslan_en.jpg" />
+ </info>
+ <info language="de">
+ <author>Dream Multimedia</author>
+ <name>WirelessLan</name>
+ <packagename>enigma2-plugin-systemplugins-wirelesslan</packagename>
+ <shortdescription>Konfigurieren Sie Ihr WLAN Netzwerk.</shortdescription>
+ <description>Die WirelessLan Erweiterung hilft Ihnen beim konfigurieren Ihres WLAN Netzwerkes..</description>
+ <screenshot src="http://www.dreamboxupdate.com/preview/plugin_wirelesslan_de.jpg" />
+ </info>
+
+ <files type="package"> <!-- without version, without .ipk -->
+ <file type="package" name="enigma2-plugin-systemplugins-wirelesslan" />
+ </files>
+
+</default>
--- /dev/null
+from enigma import eTimer
+from Screens.Screen import Screen
+from Components.ActionMap import ActionMap, NumberActionMap
+from Components.Pixmap import Pixmap,MultiPixmap
+from Components.Label import Label
+from Components.Sources.StaticText import StaticText
+from Components.Sources.List import List
+from Components.MenuList import MenuList
+from Components.config import config, getConfigListEntry, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
+from Components.ConfigList import ConfigListScreen
+from Components.Network import Network, iNetwork
+from Components.Console import Console
+from Plugins.Plugin import PluginDescriptor
+from os import system, path as os_path, listdir
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.LoadPixmap import LoadPixmap
+from Wlan import Wlan, wpaSupplicant, iStatus
+
+plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan"
+
+list = []
+list.append("WEP")
+list.append("WPA")
+list.append("WPA2")
+list.append("WPA/WPA2")
+
+weplist = []
+weplist.append("ASCII")
+weplist.append("HEX")
+
+config.plugins.wlan = ConfigSubsection()
+config.plugins.wlan.essid = NoSave(ConfigText(default = "home", fixed_size = False))
+config.plugins.wlan.hiddenessid = NoSave(ConfigText(default = "home", fixed_size = False))
+
+config.plugins.wlan.encryption = ConfigSubsection()
+config.plugins.wlan.encryption.enabled = NoSave(ConfigYesNo(default = False))
+config.plugins.wlan.encryption.type = NoSave(ConfigSelection(list, default = "WPA/WPA2" ))
+config.plugins.wlan.encryption.wepkeytype = NoSave(ConfigSelection(weplist, default = "ASCII"))
+config.plugins.wlan.encryption.psk = NoSave(ConfigPassword(default = "mysecurewlan", fixed_size = False))
+
+
+class WlanStatus(Screen):
+ skin = """
+ <screen name="WlanStatus" position="center,center" size="560,400" title="Wireless Network State" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+
+ <widget source="LabelBSSID" render="Label" position="10,60" size="250,25" valign="left" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="LabelESSID" render="Label" position="10,100" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="LabelQuality" render="Label" position="10,140" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="LabelSignal" render="Label" position="10,180" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="LabelBitrate" render="Label" position="10,220" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="LabelEnc" render="Label" position="10,260" size="250,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+
+ <widget source="BSSID" render="Label" position="320,60" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="ESSID" render="Label" position="320,100" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="quality" render="Label" position="320,140" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="signal" render="Label" position="320,180" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="bitrate" render="Label" position="320,220" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+ <widget source="enc" render="Label" position="320,260" size="180,25" valign="center" font="Regular;20" transparent="1" foregroundColor="#FFFFFF" />
+
+ <ePixmap pixmap="skin_default/div-h.png" position="0,350" zPosition="1" size="560,2" />
+ <widget source="IFtext" render="Label" position="10,355" size="120,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
+ <widget source="IF" render="Label" position="120,355" size="400,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1" />
+ <widget source="Statustext" render="Label" position="10,375" size="115,21" zPosition="10" font="Regular;20" halign="left" backgroundColor="#25062748" transparent="1"/>
+ <widget name="statuspic" pixmaps="skin_default/buttons/button_green.png,skin_default/buttons/button_green_off.png" position="130,380" zPosition="10" size="15,16" transparent="1" alphatest="on"/>
+ </screen>"""
+
+ def __init__(self, session, iface):
+ Screen.__init__(self, session)
+ self.session = session
+ self.iface = iface
+
+ self["LabelBSSID"] = StaticText(_('Accesspoint:'))
+ self["LabelESSID"] = StaticText(_('SSID:'))
+ self["LabelQuality"] = StaticText(_('Link Quality:'))
+ self["LabelSignal"] = StaticText(_('Signal Strength:'))
+ self["LabelBitrate"] = StaticText(_('Bitrate:'))
+ self["LabelEnc"] = StaticText(_('Encryption:'))
+
+ self["BSSID"] = StaticText()
+ self["ESSID"] = StaticText()
+ self["quality"] = StaticText()
+ self["signal"] = StaticText()
+ self["bitrate"] = StaticText()
+ self["enc"] = StaticText()
+
+ self["IFtext"] = StaticText()
+ self["IF"] = StaticText()
+ self["Statustext"] = StaticText()
+ self["statuspic"] = MultiPixmap()
+ self["statuspic"].hide()
+ self["key_red"] = StaticText(_("Close"))
+
+ self.resetList()
+ self.updateStatusbar()
+
+ self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions", "ShortcutActions"],
+ {
+ "ok": self.exit,
+ "back": self.exit,
+ "red": self.exit,
+ }, -1)
+ self.timer = eTimer()
+ self.timer.timeout.get().append(self.resetList)
+ self.onShown.append(lambda: self.timer.start(5000))
+ self.onLayoutFinish.append(self.layoutFinished)
+ self.onClose.append(self.cleanup)
+
+ def cleanup(self):
+ iStatus.stopWlanConsole()
+
+ def layoutFinished(self):
+ self.setTitle(_("Wireless Network State"))
+
+ def resetList(self):
+ iStatus.getDataForInterface(self.iface,self.getInfoCB)
+
+ def getInfoCB(self,data,status):
+ if data is not None:
+ if data is True:
+ if status is not None:
+ self["BSSID"].setText(status[self.iface]["acesspoint"])
+ self["ESSID"].setText(status[self.iface]["essid"])
+ self["quality"].setText(status[self.iface]["quality"]+"%")
+ self["signal"].setText(status[self.iface]["signal"])
+ self["bitrate"].setText(status[self.iface]["bitrate"])
+ self["enc"].setText(status[self.iface]["encryption"])
+ self.updateStatusLink(status)
+
+ def exit(self):
+ self.timer.stop()
+ self.close(True)
+
+ def updateStatusbar(self):
+ self["BSSID"].setText(_("Please wait..."))
+ self["ESSID"].setText(_("Please wait..."))
+ self["quality"].setText(_("Please wait..."))
+ self["signal"].setText(_("Please wait..."))
+ self["bitrate"].setText(_("Please wait..."))
+ self["enc"].setText(_("Please wait..."))
+ self["IFtext"].setText(_("Network:"))
+ self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
+ self["Statustext"].setText(_("Link:"))
+
+ def updateStatusLink(self,status):
+ if status is not None:
+ if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+ self["statuspic"].setPixmapNum(1)
+ else:
+ self["statuspic"].setPixmapNum(0)
+ self["statuspic"].show()
+
+class WlanScan(Screen):
+ skin = """
+ <screen name="WlanScan" position="center,center" size="560,400" title="Choose a Wireless Network" >
+ <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" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="list" render="Listbox" position="5,40" size="550,300" scrollbarMode="showOnDemand">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (0, 0), size = (550, 30), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the essid
+ MultiContentEntryText(pos = (0, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 5), # index 5 is the interface
+ MultiContentEntryText(pos = (175, 30), size = (175, 20), font=1, flags = RT_HALIGN_LEFT, text = 4), # index 0 is the encryption
+ MultiContentEntryText(pos = (350, 0), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 2), # index 0 is the signal
+ MultiContentEntryText(pos = (350, 30), size = (200, 20), font=1, flags = RT_HALIGN_LEFT, text = 3), # index 0 is the maxrate
+ MultiContentEntryPixmapAlphaTest(pos = (0, 52), size = (550, 2), png = 6), # index 6 is the div pixmap
+ ],
+ "fonts": [gFont("Regular", 28),gFont("Regular", 18)],
+ "itemHeight": 54
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,340" zPosition="1" size="560,2" />
+ <widget source="info" render="Label" position="0,350" size="560,50" font="Regular;24" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ </screen>"""
+
+ def __init__(self, session, iface):
+ Screen.__init__(self, session)
+ self.session = session
+ self.iface = iface
+ self.skin_path = plugin_path
+ self.oldInterfaceState = iNetwork.getAdapterAttribute(self.iface, "up")
+ self.APList = None
+ self.newAPList = None
+ self.WlanList = None
+ self.cleanList = None
+ self.oldlist = None
+ self.listLenght = None
+ self.rescanTimer = eTimer()
+ self.rescanTimer.callback.append(self.rescanTimerFired)
+
+ self["info"] = StaticText()
+
+ self.list = []
+ self["list"] = List(self.list)
+
+ self["key_red"] = StaticText(_("Close"))
+ self["key_green"] = StaticText(_("Connect"))
+ self["key_yellow"] = StaticText()
+
+ self["actions"] = NumberActionMap(["WizardActions", "InputActions", "EPGSelectActions"],
+ {
+ "ok": self.select,
+ "back": self.cancel,
+ }, -1)
+
+ self["shortcuts"] = ActionMap(["ShortcutActions"],
+ {
+ "red": self.cancel,
+ "green": self.select,
+ })
+ self.onLayoutFinish.append(self.layoutFinished)
+ self.getAccessPoints(refresh = False)
+
+ def layoutFinished(self):
+ self.setTitle(_("Choose a wireless network"))
+
+ def select(self):
+ cur = self["list"].getCurrent()
+ if cur is not None:
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ if cur[1] is not None:
+ essid = cur[1]
+ self.close(essid,self.getWlanList())
+ else:
+ self.close(None,None)
+ else:
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ self.close(None,None)
+
+ def WlanSetupClosed(self, *ret):
+ if ret[0] == 2:
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ self.close(None)
+
+ def cancel(self):
+ if self.oldInterfaceState is False:
+ iNetwork.setAdapterAttribute(self.iface, "up", False)
+ iNetwork.deactivateInterface(self.iface,self.deactivateInterfaceCB)
+ else:
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ self.close(None)
+
+ def deactivateInterfaceCB(self,data):
+ if data is not None:
+ if data is True:
+ self.rescanTimer.stop()
+ del self.rescanTimer
+ self.close(None)
+
+ def rescanTimerFired(self):
+ self.rescanTimer.stop()
+ self.updateAPList()
+
+ def buildEntryComponent(self, essid, bssid, encrypted, iface, maxrate, signal):
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/div-h.png"))
+ encryption = encrypted and _("Yes") or _("No")
+ if bssid == 'hidden...':
+ return((essid, bssid, None, None, None, None, divpng))
+ else:
+ return((essid, bssid, _("Signal: ") + str(signal), _("Max. Bitrate: ") + str(maxrate), _("Encrypted: ") + encryption, _("Interface: ") + str(iface), divpng))
+
+ def updateAPList(self):
+ self.oldlist = []
+ self.oldlist = self.cleanList
+ self.newAPList = []
+ newList = []
+ tmpList = []
+ newListIndex = None
+ currentListEntry = None
+ currentListIndex = None
+ newList = self.getAccessPoints(refresh = True)
+
+ for oldentry in self.oldlist:
+ if oldentry not in newList:
+ newList.append(oldentry)
+
+ for newentry in newList:
+ if newentry[1] == "hidden...":
+ continue
+ tmpList.append(newentry)
+
+ if len(tmpList):
+ if "hidden..." not in tmpList:
+ tmpList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+
+ for entry in tmpList:
+ self.newAPList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
+
+ currentListEntry = self["list"].getCurrent()
+ idx = 0
+ for entry in self.newAPList:
+ if entry == currentListEntry:
+ newListIndex = idx
+ idx +=1
+ self['list'].setList(self.newAPList)
+ self["list"].setIndex(newListIndex)
+ self["list"].updateList(self.newAPList)
+ self.listLenght = len(self.newAPList)
+ self.buildWlanList()
+ self.setInfo()
+
+ def getAccessPoints(self, refresh = False):
+ self.APList = []
+ self.cleanList = []
+ self.w = Wlan(self.iface)
+ aps = self.w.getNetworkList()
+ if aps is not None:
+ print "[NetworkWizard.py] got Accespoints!"
+ tmpList = []
+ compList = []
+ for ap in aps:
+ a = aps[ap]
+ if a['active']:
+ tmpList.append( (a['essid'], a['bssid']) )
+ compList.append( (a['essid'], a['bssid'], a['encrypted'], a['iface'], a['maxrate'], a['signal']) )
+
+ for entry in tmpList:
+ if entry[0] == "":
+ for compentry in compList:
+ if compentry[1] == entry[1]:
+ compList.remove(compentry)
+ for entry in compList:
+ self.cleanList.append( ( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ) )
+
+ if "hidden..." not in self.cleanList:
+ self.cleanList.append( ( _("enter hidden network SSID"), "hidden...", True, self.iface, _("unavailable"), "" ) )
+
+ for entry in self.cleanList:
+ self.APList.append(self.buildEntryComponent( entry[0], entry[1], entry[2], entry[3], entry[4], entry[5] ))
+
+ if refresh is False:
+ self['list'].setList(self.APList)
+ self.listLenght = len(self.APList)
+ self.setInfo()
+ self.rescanTimer.start(5000)
+ return self.cleanList
+
+ def setInfo(self):
+ length = self.getLength()
+ if length == 0:
+ self["info"].setText(_("No wireless networks found! Please refresh."))
+ elif length == 1:
+ self["info"].setText(_("1 wireless network found!"))
+ else:
+ self["info"].setText(str(length)+_(" wireless networks found!"))
+
+ def buildWlanList(self):
+ self.WlanList = []
+ currList = []
+ currList = self['list'].list
+ for entry in currList:
+ self.WlanList.append( (entry[1], entry[0]) )
+
+ def getLength(self):
+ return self.listLenght
+
+ def getWlanList(self):
+ return self.WlanList
+
+
+def WlanStatusScreenMain(session, iface):
+ session.open(WlanStatus, iface)
+
+
+def callFunction(iface):
+ w = Wlan(iface)
+ i = w.getWirelessInterfaces()
+ if i:
+ if iface in i:
+ return WlanStatusScreenMain
+ return None
+
+
+def configStrings(iface):
+ driver = iNetwork.detectWlanModule()
+ print "Found WLAN-Driver:",driver
+ if driver in ('ralink', 'zydas'):
+ return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate"
+ else:
+ if config.plugins.wlan.essid.value == "hidden...":
+ return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.hiddenessid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate'
+ else:
+ return ' pre-up iwconfig '+iface+' essid "'+config.plugins.wlan.essid.value+'"\n pre-up /usr/sbin/wpa_supplicant -i'+iface+' -c/etc/wpa_supplicant.conf -B -dd -D'+driver+'\n post-down wpa_cli terminate'
+
+def Plugins(**kwargs):
+ return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."})
+
\ No newline at end of file
importlist.append(where[0])
file.write("""from Screens.Screen import Screen
-from Plugins.Plugin import PluginDescriptor, %s
-""" % ', '.join(importlist))
+from Plugins.Plugin import PluginDescriptor
+""")
mainlist = []
for count in range(len(targetlist)):
from Components.EpgList import EPGList, EPG_TYPE_SINGLE, EPG_TYPE_SIMILAR, EPG_TYPE_MULTI
from Components.ActionMap import ActionMap
from Components.TimerSanityCheck import TimerSanityCheck
+from Components.UsageConfig import preferredTimerPath
from Components.Sources.ServiceEvent import ServiceEvent
from Components.Sources.Event import Event
from Screens.TimerEdit import TimerSanityConflict
self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
break
else:
- newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, *parseEvent(event))
+ newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(event))
self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
def finishedAdd(self, answer):
from Components.Label import Label
from Components.ScrollLabel import ScrollLabel
from Components.TimerList import TimerList
+from Components.UsageConfig import preferredTimerPath
from enigma import eEPGCache, eTimer, eServiceReference
from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
from TimerEntry import TimerEntry
self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName())
break
else:
- newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, *parseEvent(self.event))
+ newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(self.event))
self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry)
def finishedAdd(self, answer):
return
if answer in ("quit", "quitanddeleteconfirmed"):
- config.movielist.last_videodir.cancel()
self.close()
elif answer == "movielist":
ref = self.session.nav.getCurrentlyPlayingServiceReference()
from Components.Sources.Boolean import Boolean
from Components.config import config, ConfigBoolean, ConfigClock
from Components.SystemInfo import SystemInfo
+from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath
from EpgSelection import EPGSelection
from Plugins.Plugin import PluginDescriptor
from ServiceReference import ServiceReference
from Tools import Notifications
-from Tools.Directories import SCOPE_HDD, resolveFilename, fileExists
+from Tools.Directories import fileExists
from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
iPlayableService, eServiceReference, eEPGCache
iPlayableService.evSOF: self.__evSOF,
})
- self.minSpeedBackward = useSeekBackHack and 16 or 0
-
class InfoBarSeekActionMap(HelpableActionMap):
def __init__(self, screen, *args, **kwargs):
HelpableActionMap.__init__(self, screen, *args, **kwargs)
self.__seekableStatusChanged()
def makeStateForward(self, n):
- minspeed = config.seek.stepwise_minspeed.value
- repeat = int(config.seek.stepwise_repeat.value)
- if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
- return (0, n * repeat, repeat, ">> %dx" % n)
- else:
+# minspeed = config.seek.stepwise_minspeed.value
+# repeat = int(config.seek.stepwise_repeat.value)
+# if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
+# return (0, n * repeat, repeat, ">> %dx" % n)
+# else:
return (0, n, 0, ">> %dx" % n)
def makeStateBackward(self, n):
- minspeed = config.seek.stepwise_minspeed.value
- repeat = int(config.seek.stepwise_repeat.value)
- if self.minSpeedBackward and n < self.minSpeedBackward:
- r = (self.minSpeedBackward - 1)/ n + 1
- if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
- r = max(r, repeat)
- return (0, -n * r, r, "<< %dx" % n)
- elif minspeed != "Never" and n >= int(minspeed) and repeat > 1:
- return (0, -n * repeat, repeat, "<< %dx" % n)
- else:
+# minspeed = config.seek.stepwise_minspeed.value
+# repeat = int(config.seek.stepwise_repeat.value)
+# if minspeed != "Never" and n >= int(minspeed) and repeat > 1:
+# return (0, -n * repeat, repeat, "<< %dx" % n)
+# else:
return (0, -n, 0, "<< %dx" % n)
def makeStateSlowMotion(self, n):
if config.seek.on_pause.value == "play":
self.unPauseService()
elif config.seek.on_pause.value == "step":
- self.doSeekRelative(0)
+ self.doSeekRelative(1)
elif config.seek.on_pause.value == "last":
self.setSeekState(self.lastseekstate)
self.lastseekstate = self.SEEK_STATE_PLAY
self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))
self.doSeekRelative(-6)
elif seekstate == self.SEEK_STATE_PAUSE:
- self.doSeekRelative(-3)
+ self.doSeekRelative(-1)
elif self.isStateForward(seekstate):
speed = seekstate[1]
if seekstate[2]:
self.setSeekState(self.SEEK_STATE_PAUSE)
if back:
- self.doSeek(-5) # seek some gops before end
self.ts_rewind_timer.start(200, 1)
- else:
- self.doSeek(-1) # seek 1 gop before end
def rewindService(self):
self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value)))
if isinstance(serviceref, eServiceReference):
serviceref = ServiceReference(serviceref)
- recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = config.movielist.last_videodir.value)
+ recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = preferredInstantRecordPath())
recording.dontSave = True
if event is None or limitEvent == False:
self.session.nav.RecordTimer.timeChanged(entry)
def instantRecord(self):
- dir = config.movielist.last_videodir.value
- if not fileExists(dir, 'w'):
- dir = resolveFilename(SCOPE_HDD)
+ dir = preferredInstantRecordPath()
+ if not dir or not fileExists(dir, 'w'):
+ dir = defaultMoviePath()
try:
stat = os_stat(dir)
except:
else:
break
+ availableKeys = []
+ usedKeys = []
+
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
- 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
- keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n
+ flist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix),
+ ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")]
+ usedKeys.extend(["red", "green"])
+ availableKeys.extend(["yellow", "blue"])
selection += 2
- self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection")
+ else:
+ flist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")]
+ usedKeys.extend(["red"])
+ availableKeys.extend(["green", "yellow", "blue"])
+ selection += 1
+
+ if hasattr(self, "runPlugin"):
+ class PluginCaller:
+ def __init__(self, fnc, *args):
+ self.fnc = fnc
+ self.args = args
+ def __call__(self, *args, **kwargs):
+ self.fnc(*self.args)
+
+ Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ]
+
+ for p in Plugins:
+ selection += 1
+ flist.append((p[0], "CALLFUNC", p[1]))
+ if availableKeys:
+ usedKeys.append(availableKeys[0])
+ del availableKeys[0]
+ else:
+ usedKeys.append("")
+
+ flist.append(("--", ""))
+ usedKeys.append("")
+ selection += 1
+
+ keys = usedKeys + [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + [""] * n
+ self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = flist + tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection")
else:
del self.audioTracks
from Screens.Rc import Rc
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from Tools.LoadPixmap import LoadPixmap
def LanguageEntryComponent(file, name, index):
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "countries/" + file + ".png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "countries/" + file + ".png"))
if png == None:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
+ png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "countries/missing.png"))
res = (index, name, png)
return res
else:
self["filelist"].refresh()
self.removeBookmark(name, True)
+ val = self.realBookmarks and self.realBookmarks.value
+ if val and name in val:
+ val.remove(name)
+ self.realBookmarks.value = val
+ self.realBookmarks.save()
def up(self):
self[self.currList].up()
SubtitleDisplay.py SubservicesQuickzap.py ParentalControlSetup.py NumericalTextInputHelpDialog.py \
SleepTimerEdit.py Ipkg.py RdsDisplay.py Globals.py DefaultWizard.py \
SessionGlobals.py LocationBox.py WizardLanguage.py TaskView.py Rc.py VirtualKeyBoard.py \
- TextBox.py FactoryReset.py
+ TextBox.py FactoryReset.py RecordPaths.py
def addMenu(self, destList, node):
requires = node.get("requires")
- if requires and not SystemInfo.get(requires, False):
- return
+ if requires:
+ if requires[0] == '!':
+ if SystemInfo.get(requires[1:], False):
+ return
+ elif not SystemInfo.get(requires, False):
+ return
MenuTitle = _(node.get("text", "??").encode("UTF-8"))
entryID = node.get("entryID", "undefined")
weight = node.get("weight", 50)
def addItem(self, destList, node):
requires = node.get("requires")
- if requires and not SystemInfo.get(requires, False):
- return
+ if requires:
+ if requires[0] == '!':
+ if SystemInfo.get(requires[1:], False):
+ return
+ elif not SystemInfo.get(requires, False):
+ return
item_text = node.get("text", "").encode("UTF-8")
entryID = node.get("entryID", "undefined")
weight = node.get("weight", 50)
TYPE_WARNING = 2
TYPE_ERROR = 3
- def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True):
+ def __init__(self, session, text, type = TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True, msgBoxID = None):
self.type = type
Screen.__init__(self, session)
+
+ self.msgBoxID = msgBoxID
self["text"] = Label(text)
self["Text"] = StaticText(text)
from Components.Pixmap import Pixmap
from Components.Label import Label
from Components.PluginComponent import plugins
-from Components.config import config, ConfigSubsection, ConfigText, ConfigInteger, ConfigLocations
+from Components.config import config, ConfigSubsection, ConfigText, ConfigInteger, ConfigLocations, ConfigSet
from Components.Sources.ServiceEvent import ServiceEvent
+from Components.UsageConfig import defaultMoviePath
from Plugins.Plugin import PluginDescriptor
config.movielist.videodirs = ConfigLocations(default=[resolveFilename(SCOPE_HDD)])
config.movielist.first_tags = ConfigText(default="")
config.movielist.second_tags = ConfigText(default="")
+config.movielist.last_selected_tags = ConfigSet([], default=[])
def setPreferredTagEditor(te):
HelpableScreen.__init__(self)
self.tags = [ ]
- self.selected_tags = None
+ if selectedmovie:
+ self.selected_tags = config.movielist.last_selected_tags.value
+ else:
+ self.selected_tags = None
self.selected_tags_ele = None
self.movemode = False
self["DescriptionBorder"] = Pixmap()
self["DescriptionBorder"].hide()
- if not pathExists(config.movielist.last_videodir.value):
- config.movielist.last_videodir.value = resolveFilename(SCOPE_HDD)
+ if not fileExists(config.movielist.last_videodir.value):
+ config.movielist.last_videodir.value = defaultMoviePath()
config.movielist.last_videodir.save()
self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value)
self.close(None)
def saveconfig(self):
+ config.movielist.last_selected_tags.value = self.selected_tags
config.movielist.moviesort.save()
config.movielist.listtype.save()
config.movielist.description.save()
self["list"].setSortType(type)
def reloadList(self, sel = None, home = False):
- if not pathExists(config.movielist.last_videodir.value):
- path = resolveFilename(SCOPE_HDD)
+ if not fileExists(config.movielist.last_videodir.value):
+ path = defaultMoviePath()
config.movielist.last_videodir.value = path
config.movielist.last_videodir.save()
self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + path)
def gotFilename(self, res):
if res is not None and res is not config.movielist.last_videodir.value:
- if pathExists(res):
+ if fileExists(res):
config.movielist.last_videodir.value = res
config.movielist.last_videodir.save()
self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + res)
def showTagsN(self, tagele):
if not self.tags:
self.showTagWarning()
- elif not tagele or self.selected_tags_ele == tagele or not tagele.value in self.tags:
+ elif not tagele or (self.selected_tags and tagele.value in self.selected_tags) or not tagele.value in self.tags:
self.showTagsMenu(tagele)
else:
self.selected_tags_ele = tagele
from Screens.HelpMenu import HelpableScreen
from Components.Network import iNetwork
from Components.Sources.StaticText import StaticText
+from Components.Sources.Boolean import Boolean
from Components.Label import Label,MultiColorLabel
from Components.Pixmap import Pixmap,MultiPixmap
from Components.MenuList import MenuList
from Components.PluginComponent import plugins
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
from Components.ActionMap import ActionMap, NumberActionMap, HelpableActionMap
-from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_SKIN
from Tools.LoadPixmap import LoadPixmap
from Plugins.Plugin import PluginDescriptor
from enigma import eTimer, ePoint, eSize, RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont
num_configured_if = len(iNetwork.getConfiguredAdapters())
if num_configured_if >= 2:
if default is True:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue.png"))
if default is False:
- png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/buttons/button_blue_off.png"))
+ png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/buttons/button_blue_off.png"))
res.append(MultiContentEntryPixmapAlphaTest(pos=(10, 5), size=(25, 25), png = png))
if active is True:
- png2 = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png"))
+ png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png"))
if active is False:
- png2 = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_error.png"))
+ png2 = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_error.png"))
res.append(MultiContentEntryPixmapAlphaTest(pos=(40, 1), size=(25, 25), png = png2))
return res
def remove(self):
print "currentIndex:", self["config"].getCurrentIndex()
-
index = self["config"].getCurrentIndex()
if index < len(self.nameservers):
iNetwork.removeNameserver(self.nameservers[index])
self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
{
- "cancel": (self.cancel, _("exit network adapter setup menu")),
- "ok": (self.ok, _("select menu entry")),
+ "cancel": (self.keyCancel, _("exit network adapter configuration")),
+ "ok": (self.keySave, _("activate network adapter configuration")),
})
self["ColorActions"] = HelpableActionMap(self, "ColorActions",
{
- "red": (self.cancel, _("exit network adapter configuration")),
+ "red": (self.keyCancel, _("exit network adapter configuration")),
"blue": (self.KeyBlue, _("open nameserver configuration")),
})
- self["VirtualKB"] = HelpableActionMap(self, "VirtualKeyboardActions",
- {
- "showVirtualKeyboard": (self.KeyText, [_("open virtual keyboard input help"),_("* Only available when entering hidden SSID or network key")] ),
- })
-
self["actions"] = NumberActionMap(["SetupActions"],
{
- "ok": self.ok,
+ "ok": self.keySave,
}, -2)
self.list = []
self["key_red"] = StaticText(_("Cancel"))
self["key_blue"] = StaticText(_("Edit DNS"))
- self["VKeyIcon"] = Pixmap()
+ self["VKeyIcon"] = Boolean(False)
self["HelpWindow"] = Pixmap()
-
+ self["HelpWindow"].hide()
+
def layoutFinished(self):
self["DNS1"].setText(self.primaryDNS.getText())
self["DNS2"].setText(self.secondaryDNS.getText())
self["Gateway"].setText("")
self["Gatewaytext"].setText("")
self["Adapter"].setText(iNetwork.getFriendlyAdapterName(self.iface))
- self["VKeyIcon"].hide()
- self["VirtualKB"].setEnabled(False)
- self["HelpWindow"].hide()
def createConfig(self):
self.InterfaceEntry = None
try:
self.aps = self.w.getNetworkList()
if self.aps is not None:
- print "[NetworkSetup.py] got Accespoints!"
for ap in self.aps:
a = self.aps[ap]
if a['active']:
self.default = self.wsconfig['ssid']
if "hidden..." not in self.nwlist:
- self.nwlist.append(("hidden...",_("hidden network")))
+ self.nwlist.append(("hidden...",_("enter hidden network SSID")))
if self.default not in self.nwlist:
self.nwlist.append((self.default,self.default))
config.plugins.wlan.essid = NoSave(ConfigSelection(self.nwlist, default = self.default ))
self["config"].list = self.list
self["config"].l.setList(self.list)
- if not self.selectionChanged in self["config"].onSelectionChanged:
- self["config"].onSelectionChanged.append(self.selectionChanged)
def KeyBlue(self):
self.session.openWithCallback(self.NameserverSetupClosed, NameserverSetup)
- def KeyText(self):
- if self.iface == "wlan0" or self.iface == "ath0" :
- if self["config"].getCurrent() == self.hiddenSSID:
- if config.plugins.wlan.essid.value == 'hidden...':
- self.session.openWithCallback(self.VirtualKeyBoardSSIDCallback, VirtualKeyBoard, title = (_("Enter WLAN network name/SSID:")), text = config.plugins.wlan.essid.value)
- if self["config"].getCurrent() == self.encryptionKey:
- self.session.openWithCallback(self.VirtualKeyBoardKeyCallback, VirtualKeyBoard, title = (_("Enter WLAN passphrase/key:")), text = config.plugins.wlan.encryption.psk.value)
-
- def VirtualKeyBoardSSIDCallback(self, callback = None):
- if callback is not None and len(callback):
- config.plugins.wlan.hiddenessid.setValue(callback)
- self["config"].invalidate(self.hiddenSSID)
-
- def VirtualKeyBoardKeyCallback(self, callback = None):
- if callback is not None and len(callback):
- config.plugins.wlan.encryption.psk.setValue(callback)
- self["config"].invalidate(self.encryptionKey)
-
def newConfig(self):
if self["config"].getCurrent() == self.InterfaceEntry:
self.createSetup()
def keyRight(self):
ConfigListScreen.keyRight(self)
self.newConfig()
+
+ def keySave(self):
+ self.hideInputHelp()
+ if self["config"].isChanged():
+ self.session.openWithCallback(self.keySaveConfirm, MessageBox, (_("Are you sure you want to activate this network configuration?\n\n") + self.oktext ) )
+ else:
+ if self.finished_cb:
+ self.finished_cb()
+ else:
+ self.close('cancel')
- def selectionChanged(self):
- current = self["config"].getCurrent()
- if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
- helpwindowpos = self["HelpWindow"].getPosition()
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
- self["VKeyIcon"].show()
- self["VirtualKB"].setEnabled(True)
- elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
- helpwindowpos = self["HelpWindow"].getPosition()
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
- self["VKeyIcon"].show()
- self["VirtualKB"].setEnabled(True)
+ def keySaveConfirm(self, ret = False):
+ if (ret == True):
+ num_configured_if = len(iNetwork.getConfiguredAdapters())
+ if num_configured_if >= 1:
+ if num_configured_if == 1 and self.iface in iNetwork.getConfiguredAdapters():
+ self.applyConfig(True)
+ else:
+ self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("A second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
+ else:
+ self.applyConfig(True)
else:
- self["VKeyIcon"].hide()
- self["VirtualKB"].setEnabled(False)
+ self.keyCancel()
- def ok(self):
- current = self["config"].getCurrent()
- if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.hide()
- elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
- if current[1].help_window.instance is not None:
- current[1].help_window.instance.hide()
- self.session.openWithCallback(self.applyConfig, MessageBox, (_("Are you sure you want to activate this network configuration?\n\n") + self.oktext ) )
+ def secondIfaceFoundCB(self,data):
+ if data is False:
+ self.applyConfig(True)
+ else:
+ configuredInterfaces = iNetwork.getConfiguredAdapters()
+ for interface in configuredInterfaces:
+ if interface == self.iface:
+ continue
+ iNetwork.setAdapterAttribute(interface, "up", False)
+ iNetwork.deactivateInterface(interface)
+ self.applyConfig(True)
def applyConfig(self, ret = False):
if (ret == True):
iNetwork.restartNetwork(self.applyConfigDataAvail)
self.applyConfigRef = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait for activation of your network configuration..."), type = MessageBox.TYPE_INFO, enable_input = False)
else:
- self.cancel()
+ self.keyCancel()
def applyConfigDataAvail(self, data):
if data is True:
def applyConfigfinishedCB(self,data):
if data is True:
- num_configured_if = len(iNetwork.getConfiguredAdapters())
- if num_configured_if >= 2:
- self.session.openWithCallback(self.secondIfaceFoundCB, MessageBox, _("Your network configuration has been activated.\nA second configured interface has been found.\n\nDo you want to disable the second network interface?"), default = True)
+ if self.finished_cb:
+ self.session.openWithCallback(lambda x : self.finished_cb(), MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
else:
- if self.finished_cb:
- self.session.openWithCallback(lambda x : self.finished_cb(), MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
- else:
- self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
-
- def secondIfaceFoundCB(self,data):
- if data is False:
- self.close('ok')
- else:
- configuredInterfaces = iNetwork.getConfiguredAdapters()
- for interface in configuredInterfaces:
- if interface == self.iface:
- continue
- iNetwork.setAdapterAttribute(interface, "up", False)
- iNetwork.deactivateInterface(interface)
- self.applyConfig(True)
+ self.session.openWithCallback(self.ConfigfinishedCB, MessageBox, _("Your network configuration has been activated."), type = MessageBox.TYPE_INFO, timeout = 10)
def ConfigfinishedCB(self,data):
if data is not None:
if data is True:
self.close('ok')
- def cancel(self):
+ def keyCancelConfirm(self, result):
+ if not result:
+ return
if self.oldInterfaceState is False:
- iNetwork.deactivateInterface(self.iface,self.cancelCB)
+ iNetwork.deactivateInterface(self.iface,self.keyCancelCB)
else:
self.close('cancel')
- def cancelCB(self,data):
+ def keyCancel(self):
+ self.hideInputHelp()
+ if self["config"].isChanged():
+ self.session.openWithCallback(self.keyCancelConfirm, MessageBox, _("Really close without saving settings?"))
+ else:
+ self.close('cancel')
+
+ def keyCancelCB(self,data):
if data is not None:
if data is True:
self.close('cancel')
def runAsync(self, finished_cb):
self.finished_cb = finished_cb
- self.ok()
+ self.keySave()
def NameserverSetupClosed(self, *ret):
iNetwork.loadNameserverConfig()
def cleanup(self):
iNetwork.stopLinkStateConsole()
+
+ def hideInputHelp(self):
+ current = self["config"].getCurrent()
+ if current == self.hiddenSSID and config.plugins.wlan.essid.value == 'hidden...':
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.hide()
+ elif current == self.encryptionKey and config.plugins.wlan.encryption.enabled.value:
+ if current[1].help_window.instance is not None:
+ current[1].help_window.instance.hide()
class AdapterSetupConfiguration(Screen, HelpableScreen):
self.session = session
self.iface = iface
self.restartLanRef = None
+ self.LinkState = None
self.mainmenu = self.genMainMenu()
self["menulist"] = MenuList(self.mainmenu)
self["key_red"] = StaticText(_("Close"))
self.onClose.append(self.cleanup)
def ok(self):
+ self.cleanup()
if self["menulist"].getCurrent()[1] == 'edit':
if self.iface == 'wlan0' or self.iface == 'ath0':
try:
self.loadDescription()
def loadDescription(self):
- print self["menulist"].getCurrent()[1]
if self["menulist"].getCurrent()[1] == 'edit':
self["description"].setText(_("Edit the network configuration of your Dreambox.\n" ) + self.oktext )
if self["menulist"].getCurrent()[1] == 'test':
self["description"].setText(_(self["menulist"].getCurrent()[1][1]) + self.oktext )
def updateStatusbar(self, data = None):
+ self.mainmenu = self.genMainMenu()
+ self["menulist"].l.setList(self.mainmenu)
self["IFtext"].setText(_("Network:"))
self["IF"].setText(iNetwork.getFriendlyAdapterName(self.iface))
self["Statustext"].setText(_("Link:"))
if self.iface == 'wlan0' or self.iface == 'ath0':
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
except:
- self["statuspic"].setPixmapNum(1)
- self["statuspic"].show()
+ self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
else:
iStatus.getDataForInterface(self.iface,self.getInfoCB)
else:
callFnc = p.__call__["ifaceSupported"](self.iface)
if callFnc is not None:
self.extended = callFnc
- print p.__call__
if p.__call__.has_key("WlanPluginEntry"): # internally used only for WLAN Plugin
menu.append((_("Scan Wireless Networks"), "scanwlan"))
if iNetwork.getAdapterAttribute(self.iface, "up"):
# Display Wlan not available Message
self.showErrorMessage()
else:
- self.mainmenu = self.genMainMenu()
- self["menulist"].l.setList(self.mainmenu)
self.updateStatusbar()
else:
- self.mainmenu = self.genMainMenu()
- self["menulist"].l.setList(self.mainmenu)
self.updateStatusbar()
def WlanStatusClosed(self, *ret):
if ret is not None and len(ret):
from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
iStatus.stopWlanConsole()
- self.mainmenu = self.genMainMenu()
- self["menulist"].l.setList(self.mainmenu)
self.updateStatusbar()
def WlanScanClosed(self,*ret):
else:
from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
iStatus.stopWlanConsole()
- self.mainmenu = self.genMainMenu()
- self["menulist"].l.setList(self.mainmenu)
self.updateStatusbar()
def restartLan(self, ret = False):
self.session.open(MessageBox, _("Finished restarting your network"), type = MessageBox.TYPE_INFO, timeout = 10, default = False)
def dataAvail(self,data):
- self.output = data.strip()
- result = self.output.split('\n')
- pattern = re_compile("Link detected: yes")
- for item in result:
- if re_search(pattern, item):
- self["statuspic"].setPixmapNum(0)
- else:
- self["statuspic"].setPixmapNum(1)
- self["statuspic"].show()
+ self.LinkState = None
+ for line in data.splitlines():
+ line = line.strip()
+ if 'Link detected:' in line:
+ if "yes" in line:
+ self.LinkState = True
+ else:
+ self.LinkState = False
+ if self.LinkState == True:
+ iNetwork.checkNetworkState(self.checkNetworkCB)
+ else:
+ self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
def showErrorMessage(self):
self.session.open(MessageBox, self.errortext, type = MessageBox.TYPE_INFO,timeout = 10 )
def cleanup(self):
iNetwork.stopLinkStateConsole()
iNetwork.stopDeactivateInterfaceConsole()
+ iNetwork.stopPingConsole()
try:
- from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus,Status
+ from Plugins.SystemPlugins.WirelessLan.Wlan import iStatus
except ImportError:
pass
else:
iStatus.stopWlanConsole()
def getInfoCB(self,data,status):
+ self.LinkState = None
if data is not None:
if data is True:
if status is not None:
if status[self.iface]["acesspoint"] == "No Connection" or status[self.iface]["acesspoint"] == "Not-Associated" or status[self.iface]["acesspoint"] == False:
+ self.LinkState = False
self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
else:
- self["statuspic"].setPixmapNum(0)
- self["statuspic"].show()
+ self.LinkState = True
+ iNetwork.checkNetworkState(self.checkNetworkCB)
+
+ def checkNetworkCB(self,data):
+ if iNetwork.getAdapterAttribute(self.iface, "up") is True:
+ if self.LinkState is True:
+ if data <= 2:
+ self["statuspic"].setPixmapNum(0)
+ else:
+ self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
+ else:
+ self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
+ else:
+ self["statuspic"].setPixmapNum(1)
+ self["statuspic"].show()
+
class NetworkAdapterTest(Screen):
def __init__(self, session,iface):
pass
else:
iStatus.stopWlanConsole()
-
+
from Screen import Screen
-
+from Components.Language import language
from enigma import eConsoleAppContainer
from Components.ActionMap import ActionMap
from time import time
+def languageChanged():
+ plugins.clearPluginList()
+ plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+
class PluginBrowser(Screen):
def __init__(self, session):
Screen.__init__(self, session)
self.list = list
self["list"].l.setList(list)
+language.addCallback(languageChanged)
\ No newline at end of file
from Components.ServiceEventTracker import ServiceEventTracker
from Components.Pixmap import Pixmap
from Components.Label import Label
-from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE
+from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from Tools.LoadPixmap import LoadPixmap
class RdsInfoDisplay(Screen):
9 : self["subpages_9"] }
self.subpage_png = {
- 1 : LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/rass_page1.png")),
- 2 : LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/rass_page2.png")),
- 3 : LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/rass_page3.png")),
- 4 : LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/rass_page4.png")) }
+ 1 : LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/rass_page1.png")),
+ 2 : LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/rass_page2.png")),
+ 3 : LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/rass_page3.png")),
+ 4 : LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/rass_page4.png")) }
self.current_page=0;
self.current_subpage=0;
--- /dev/null
+from Screens.Screen import Screen
+from Screens.LocationBox import MovieLocationBox, TimeshiftLocationBox
+from Screens.MessageBox import MessageBox
+from Components.Label import Label
+from Components.config import config, ConfigSelection, getConfigListEntry, configfile
+from Components.ConfigList import ConfigListScreen
+from Components.ActionMap import ActionMap
+from Tools.Directories import fileExists
+
+
+class RecordPathsSettings(Screen,ConfigListScreen):
+ skin = """
+ <screen name="RecordPathsSettings" position="160,150" size="450,200" title="Recording paths">
+ <ePixmap pixmap="skin_default/buttons/red.png" position="10,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="300,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="10,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="300,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget name="config" position="10,44" size="430,146" />
+ </screen>"""
+
+ def __init__(self, session):
+ from Components.Sources.StaticText import StaticText
+ Screen.__init__(self, session)
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("Save"))
+
+ ConfigListScreen.__init__(self, [])
+ self.initConfigList()
+
+ self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
+ {
+ "green": self.save,
+ "red": self.cancel,
+ "cancel": self.cancel,
+ "ok": self.ok,
+ }, -2)
+
+ def checkReadWriteDir(self, configele):
+ print "checkReadWrite: ", configele.value
+ if configele.value in [x[0] for x in self.styles] or fileExists(configele.value, "w"):
+ configele.last_value = configele.value
+ return True
+ else:
+ dir = configele.value
+ configele.value = configele.last_value
+ self.session.open(
+ MessageBox,
+ _("The directory %s is not writable.\nMake sure you select a writable directory instead.")%dir,
+ type = MessageBox.TYPE_ERROR
+ )
+ return False
+
+ def initConfigList(self):
+ self.styles = [ ("<default>", _("<Default movie location>")), ("<current>", _("<Current movielist location>")), ("<timer>", _("<Last timer location>")) ]
+ styles_keys = [x[0] for x in self.styles]
+ tmp = config.movielist.videodirs.value
+ default = config.usage.default_path.value
+ if default not in tmp:
+ tmp = tmp[:]
+ tmp.append(default)
+ print "DefaultPath: ", default, tmp
+ self.default_dirname = ConfigSelection(default = default, choices = tmp)
+ tmp = config.movielist.videodirs.value
+ default = config.usage.timer_path.value
+ if default not in tmp and default not in styles_keys:
+ tmp = tmp[:]
+ tmp.append(default)
+ print "TimerPath: ", default, tmp
+ self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
+ tmp = config.movielist.videodirs.value
+ default = config.usage.instantrec_path.value
+ if default not in tmp and default not in styles_keys:
+ tmp = tmp[:]
+ tmp.append(default)
+ print "InstantrecPath: ", default, tmp
+ self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp)
+ default = config.usage.timeshift_path.value
+ tmp = config.usage.allowed_timeshift_paths.value
+ if default not in tmp:
+ tmp = tmp[:]
+ tmp.append(default)
+ print "TimeshiftPath: ", default, tmp
+ self.timeshift_dirname = ConfigSelection(default = default, choices = tmp)
+ self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
+ self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
+ self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
+ self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
+
+ self.list = []
+ if config.usage.setup_level.index >= 2:
+ self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname)
+ self.list.append(self.default_entry)
+ self.timer_entry = getConfigListEntry(_("Timer record location"), self.timer_dirname)
+ self.list.append(self.timer_entry)
+ self.instantrec_entry = getConfigListEntry(_("Instant record location"), self.instantrec_dirname)
+ self.list.append(self.instantrec_entry)
+ else:
+ self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname)
+ self.list.append(self.default_entry)
+ self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname)
+ self.list.append(self.timeshift_entry)
+ self["config"].setList(self.list)
+
+ def ok(self):
+ currentry = self["config"].getCurrent()
+ self.lastvideodirs = config.movielist.videodirs.value
+ self.lasttimeshiftdirs = config.usage.allowed_timeshift_paths.value
+ if config.usage.setup_level.index >= 2:
+ txt = _("Default movie location")
+ else:
+ txt = _("Movie location")
+ if currentry == self.default_entry:
+ self.entrydirname = self.default_dirname
+ self.session.openWithCallback(
+ self.dirnameSelected,
+ MovieLocationBox,
+ txt,
+ self.default_dirname.value
+ )
+ elif currentry == self.timer_entry:
+ self.entrydirname = self.timer_dirname
+ self.session.openWithCallback(
+ self.dirnameSelected,
+ MovieLocationBox,
+ _("Initial location in new timers"),
+ self.timer_dirname.value
+ )
+ elif currentry == self.instantrec_entry:
+ self.entrydirname = self.instantrec_dirname
+ self.session.openWithCallback(
+ self.dirnameSelected,
+ MovieLocationBox,
+ _("Location for instant recordings"),
+ self.instantrec_dirname.value
+ )
+ elif currentry == self.timeshift_entry:
+ self.entrydirname = self.timeshift_dirname
+ config.usage.timeshift_path.value = self.timeshift_dirname.value
+ self.session.openWithCallback(
+ self.dirnameSelected,
+ TimeshiftLocationBox
+ )
+
+ def dirnameSelected(self, res):
+ if res is not None:
+ self.entrydirname.value = res
+ if config.movielist.videodirs.value != self.lastvideodirs:
+ styles_keys = [x[0] for x in self.styles]
+ tmp = config.movielist.videodirs.value
+ default = self.default_dirname.value
+ if default not in tmp:
+ tmp = tmp[:]
+ tmp.append(default)
+ self.default_dirname.setChoices(tmp, default=default)
+ tmp = config.movielist.videodirs.value
+ default = self.timer_dirname.value
+ if default not in tmp and default not in styles_keys:
+ tmp = tmp[:]
+ tmp.append(default)
+ self.timer_dirname.setChoices(self.styles+tmp, default=default)
+ tmp = config.movielist.videodirs.value
+ default = self.instantrec_dirname.value
+ if default not in tmp and default not in styles_keys:
+ tmp = tmp[:]
+ tmp.append(default)
+ self.instantrec_dirname.setChoices(self.styles+tmp, default=default)
+ self.entrydirname.value = res
+ if config.usage.allowed_timeshift_paths.value != self.lasttimeshiftdirs:
+ tmp = config.usage.allowed_timeshift_paths.value
+ default = self.instantrec_dirname.value
+ if default not in tmp:
+ tmp = tmp[:]
+ tmp.append(default)
+ self.timeshift_dirname.setChoices(tmp, default=default)
+ self.entrydirname.value = res
+ if self.entrydirname.last_value != res:
+ self.checkReadWriteDir(self.entrydirname)
+
+ def save(self):
+ currentry = self["config"].getCurrent()
+ if self.checkReadWriteDir(currentry[1]):
+ config.usage.default_path.value = self.default_dirname.value
+ config.usage.timer_path.value = self.timer_dirname.value
+ config.usage.instantrec_path.value = self.instantrec_dirname.value
+ config.usage.timeshift_path.value = self.timeshift_dirname.value
+ config.usage.default_path.save()
+ config.usage.timer_path.save()
+ config.usage.instantrec_path.save()
+ config.usage.timeshift_path.save()
+ self.close()
+
+ def cancel(self):
+ self.close()
+
from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement
from Components.Sources.List import List
from Screens.MessageBox import MessageBox
+from Screens.ChoiceBox import ChoiceBox
from time import mktime, localtime
from datetime import datetime
new_configured_sats = nimmanager.getConfiguredSats()
self.unconfed_sats = old_configured_sats - new_configured_sats
self.satpos_to_remove = None
- self.deleteConfirmed(False)
+ self.deleteConfirmed((None, "no"))
def deleteConfirmed(self, confirmed):
- if confirmed:
+ if confirmed[1] == "yes" or confirmed[1] == "yestoall":
eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)
if self.satpos_to_remove is not None:
else:
h = _("E")
sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
- self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name))
+
+ if confirmed[1] == "yes" or confirmed[1] == "no":
+ self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("Delete no more configured satellite\n%s?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")])
+ if confirmed[1] == "yestoall" or confirmed[1] == "notoall":
+ self.deleteConfirmed(confirmed)
break
if not self.satpos_to_remove:
self.close()
-
+
def __init__(self, session, slotid):
Screen.__init__(self, session)
self.list = [ ]
for n in nimmanager.nim_slots:
if n.config_mode == "nothing":
continue
+ if n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
+ continue
if n.config_mode in ("loopthrough", "satposdepends"):
root_id = nimmanager.sec.getRoot(n.slot_id, int(n.config.connectedTo.value))
if n.type == nimmanager.nim_slots[root_id].type: # check if connected from a DVB-S to DVB-S2 Nim or vice versa
from Screen import Screen
from MessageBox import MessageBox
from Components.AVSwitch import AVSwitch
+from Tools import Notifications
class Scart(Screen):
def __init__(self, session, start_visible=True):
Screen.__init__(self, session)
+ self.msgBox = None
+ self.notificationVisible = None
self.avswitch = AVSwitch()
if not self.msgVisible:
self.msgVisible = True
self.avswitch.setInput("SCART")
- self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR)
+ if not self.session.in_exec:
+ self.notificationVisible = True
+ Notifications.AddNotificationWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR, msgBoxID = "scart_msgbox")
+ else:
+ self.msgBox = self.session.openWithCallback(self.MsgBoxClosed, MessageBox, _("If you see this, something is wrong with\nyour scart connection. Press OK to return."), MessageBox.TYPE_ERROR)
def MsgBoxClosed(self, *val):
self.msgBox = None
return
self.avswitch.setInput("ENCODER")
self.msgVisible = False
+ if self.notificationVisible:
+ self.avswitch.setInput("ENCODER")
+ self.notificationVisible = False
+ for notification in Notifications.current_notifications:
+ try:
+ if notification[1].msgBoxID == "scart_msgbox":
+ notification[1].close()
+ except:
+ print "other notification is open. try another one."
+
\ No newline at end of file
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.config import config, ConfigInteger
+from Components.SystemInfo import SystemInfo
from enigma import eEPGCache
from SleepTimer import SleepTimer
from time import time
self["red_text"].setText(_("Action:") + " " + _("Disable timer"))
if config.SleepTimer.action.value == "shutdown":
- self["green_text"].setText(_("Sleep timer action:") + " " + _("Deep Standby"))
+ if SystemInfo["DeepstandbySupport"]:
+ shutdownString = _("Deep Standby")
+ else:
+ shutdownString = _("Shutdown")
+ self["green_text"].setText(_("Sleep timer action:") + " " + shutdownString)
elif config.SleepTimer.action.value == "standby":
self["green_text"].setText(_("Sleep timer action:") + " " + _("Standby"))
from Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigSelection, getConfigListEntry
+from Components.SystemInfo import SystemInfo
from InfoBarGenerics import InfoBarNotifications
import Screens.Standby
from Tools import Notifications
self.afterevents = [ "nothing", "standby", "deepstandby", "close" ]
self.settings = ConfigSubsection()
- self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby"))], default = self.afterevents[afterEvent])
+ if SystemInfo["DeepstandbySupport"]:
+ shutdownString = _("go to deep standby")
+ else:
+ shutdownString = _("shut down")
+ self.settings.afterEvent = ConfigSelection(choices = [("nothing", _("do nothing")), ("close", _("Close")), ("standby", _("go to standby")), ("deepstandby", shutdownString)], default = self.afterevents[afterEvent])
self.setupList()
self.state_changed()
from Components.MenuList import MenuList
from Components.TimerList import TimerList
from Components.TimerSanityCheck import TimerSanityCheck
+from Components.UsageConfig import preferredTimerPath
from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT
from Screen import Screen
from Screens.ChoiceBox import ChoiceBox
else:
data = parseEvent(event, description = False)
- self.addTimer(RecordTimerEntry(serviceref, checkOldTimers = True, dirname = config.movielist.last_timer_videodir.value, *data))
+ self.addTimer(RecordTimerEntry(serviceref, checkOldTimers = True, dirname = preferredTimerPath(), *data))
def addTimer(self, timer):
self.session.openWithCallback(self.finishedAdd, TimerEntry, timer)
from Components.Button import Button
from Components.Label import Label
from Components.Pixmap import Pixmap
+from Components.SystemInfo import SystemInfo
+from Components.UsageConfig import defaultMoviePath
from Screens.MovieSelection import getPreferredTagEditor
from Screens.LocationBox import MovieLocationBox
from Screens.ChoiceBox import ChoiceBox
from RecordTimer import AFTEREVENT
-from Tools.Directories import resolveFilename, SCOPE_HDD
from enigma import eEPGCache
from time import localtime, mktime, time, strftime
from datetime import datetime
day[weekday] = 1
self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay])
- self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent)
+ if SystemInfo["DeepstandbySupport"]:
+ shutdownString = _("go to deep standby")
+ else:
+ shutdownString = _("shut down")
+ self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent)
self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
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_starttime = ConfigClock(default = self.timer.begin)
self.timerentry_endtime = ConfigClock(default = self.timer.end)
- default = self.timer.dirname or resolveFilename(SCOPE_HDD)
+ default = self.timer.dirname or defaultMoviePath()
tmp = config.movielist.videodirs.value
if default not in tmp:
tmp.append(default)
self.timer.service_ref = self.timerentry_service_ref
self.timer.tags = self.timerentry_tags
- self.timer.dirname = self.timerentry_dirname.value
- config.movielist.last_timer_videodir.value = self.timer.dirname
- config.movielist.last_timer_videodir.save()
+ if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath():
+ self.timer.dirname = self.timerentry_dirname.value
+ config.movielist.last_timer_videodir.value = self.timer.dirname
+ config.movielist.last_timer_videodir.save()
if self.timerentry_type.value == "once":
self.timer.begin, self.timer.end = self.getBeginEnd()
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.Directories import resolveFilename, SCOPE_CURRENT_SKIN
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.setFont(0, gFont("Regular", 28))
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"))
-
+ key_backspace = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_backspace.png"))
+ key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_bg.png"))
+ key_clr = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_clr.png"))
+ key_esc = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_esc.png"))
+ key_ok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_ok.png"))
+ key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_sel.png"))
+ key_shift = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift.png"))
+ key_shift_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_shift_sel.png"))
+ key_space = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/vkey_space.png"))
res = [ (keys) ]
x = 0
else:
shiftkey_png = key_shift
for key in keys:
+ width = None
if key == "EXIT":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_esc))
+ width = key_esc.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_esc))
elif key == "BACKSPACE":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_backspace))
+ width = key_backspace.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_backspace))
elif key == "CLEAR":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_clr))
+ width = key_clr.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_clr))
elif key == "SHIFT":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=shiftkey_png))
+ width = shiftkey_png.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=shiftkey_png))
elif key == "SPACE":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_space))
+ width = key_space.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_space))
elif key == "OK":
- res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(45, 45), png=key_ok))
+ width = key_ok.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 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:
+ width = key_bg.size().width()
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)
+ MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_bg),
+ MultiContentEntryText(pos=(x, 0), size=(width, 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
+ width = key_sel.size().width()
+ res.append(MultiContentEntryPixmapAlphaTest(pos=(x, 0), size=(width, 45), png=key_sel))
+
+ if width is not None:
+ x += width
+ else:
+ x += 45
count += 1
return res
from Screen import Screen
-
from Screens.HelpMenu import HelpableScreen
from Screens.MessageBox import MessageBox
-from Components.config import config, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS
+from Components.config import config, ConfigText, ConfigPassword, KEY_LEFT, KEY_RIGHT, KEY_HOME, KEY_END, KEY_0, KEY_DELETE, KEY_BACKSPACE, KEY_OK, KEY_TOGGLEOW, KEY_ASCII, KEY_TIMEOUT, KEY_NUMBERS
from Components.Label import Label
+from Components.Sources.StaticText import StaticText
from Components.Slider import Slider
from Components.ActionMap import NumberActionMap
from Components.MenuList import MenuList
from Components.ConfigList import ConfigList
from Components.Sources.List import List
-
from enigma import eTimer
from xml.sax import make_parser
class WizardSummary(Screen):
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 source="text" render="Label" position="6,0" size="120,16" font="Regular;16" transparent="1" />
+ <widget source="parent.list" render="Label" position="6,18" size="120,46" font="Regular;12">
<convert type="StringListSelection" />
</widget>
</screen>"""
#self.skinName.append("Wizard")
#print "*************+++++++++++++++++****************++++++++++******************* WizardSummary", self.skinName
#
- self["text"] = Label("")
+ self["text"] = StaticText("")
self.onShow.append(self.setCallback)
def setCallback(self):
self.onShown.append(self.updateValues)
self.configInstance = None
+ self.currentConfigIndex = None
self.lcdCallbacks = []
self.disableKeys = False
- self["actions"] = NumberActionMap(["WizardActions", "NumberActions", "ColorActions", "SetupActions", "InputAsciiActions"],
+ self["actions"] = NumberActionMap(["WizardActions", "NumberActions", "ColorActions", "SetupActions", "InputAsciiActions", "KeyboardInputActions"],
{
"gotAsciiCode": self.keyGotAscii,
"ok": self.ok,
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1)
+
+ self["VirtualKB"] = NumberActionMap(["VirtualKeyboardActions"],
+ {
+ "showVirtualKeyboard": self.KeyText,
+ }, -2)
+
+ self["VirtualKB"].setEnabled(False)
def red(self):
print "red"
self.resetCounter()
if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"):
self["config"].instance.moveSelection(self["config"].instance.moveUp)
+ self.handleInputHelpers()
elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
self["list"].selectPrevious()
if self.wizard[self.currStep].has_key("onselect"):
self.resetCounter()
if (self.showConfig and self.wizard[self.currStep]["config"]["screen"] != None or self.wizard[self.currStep]["config"]["type"] == "dynamic"):
self["config"].instance.moveSelection(self["config"].instance.moveDown)
+ self.handleInputHelpers()
elif (self.showList and len(self.wizard[self.currStep]["evaluatedlist"]) > 0):
#self["list"].instance.moveSelection(self["list"].instance.moveDown)
self["list"].selectNext()
print "clearConfigList", self.configInstance["config"], self["config"]
else:
self["config"].l.setList([])
+ self.handleInputHelpers()
+
+
else:
if self.has_key("config"):
self["config"].hide()
self.finished(gotoStep = self.wizard[self.currStep]["timeoutstep"])
self.updateText()
+ def handleInputHelpers(self):
+ if self["config"].getCurrent() is not None:
+ if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword):
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(True)
+ self["VKeyIcon"].boolean = True
+ if self.has_key("HelpWindow"):
+ if self["config"].getCurrent()[1].help_window.instance is not None:
+ helpwindowpos = self["HelpWindow"].getPosition()
+ from enigma import ePoint
+ self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+ else:
+ if self.has_key("VKeyIcon"):
+ self["VirtualKB"].setEnabled(False)
+ self["VKeyIcon"].boolean = False
+
+ def KeyText(self):
+ from Screens.VirtualKeyBoard import VirtualKeyBoard
+ self.currentConfigIndex = self["config"].getCurrentIndex()
+ self.session.openWithCallback(self.VirtualKeyBoardCallback, VirtualKeyBoard, title = self["config"].getCurrent()[0], text = self["config"].getCurrent()[1].getValue())
+
+ def VirtualKeyBoardCallback(self, callback = None):
+ if callback is not None and len(callback):
+ if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword):
+ if self.has_key("HelpWindow"):
+ if self["config"].getCurrent()[1].help_window.instance is not None:
+ helpwindowpos = self["HelpWindow"].getPosition()
+ from enigma import ePoint
+ self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
+ self["config"].instance.moveSelectionTo(self.currentConfigIndex)
+ self["config"].setCurrentIndex(self.currentConfigIndex)
+ self["config"].getCurrent()[1].setValue(callback)
+ self["config"].invalidate(self["config"].getCurrent())
+
+
class WizardManager:
def __init__(self):
self.wizards = []
SCOPE_DEFAULTPARTITION = 14
SCOPE_DEFAULTPARTITIONMOUNTDIR = 15
SCOPE_METADIR = 16
+SCOPE_CURRENT_PLUGIN = 17
PATH_CREATE = 0
PATH_DONTCREATE = 1
tmp = defaultPaths[SCOPE_SKIN]
pos = config.skin.primary_skin.value.rfind('/')
if pos != -1:
- path = tmp[0]+config.skin.primary_skin.value[:pos+1]
+ #if basefile is not available use default skin path as fallback
+ tmpfile = tmp[0]+config.skin.primary_skin.value[:pos+1] + base
+ if fileExists(tmpfile):
+ path = tmp[0]+config.skin.primary_skin.value[:pos+1]
+ else:
+ path = tmp[0]
+ else:
+ path = tmp[0]
+
+ elif scope == SCOPE_CURRENT_PLUGIN:
+ tmp = defaultPaths[SCOPE_PLUGINS]
+ from Components.config import config
+ skintmp = defaultPaths[SCOPE_SKIN]
+ pos = config.skin.primary_skin.value.rfind('/')
+ if pos != -1:
+ #if basefile is not available inside current skin path, use the original provided file as fallback
+ skintmpfile = skintmp[0]+config.skin.primary_skin.value[:pos+1] + base
+ if fileExists(skintmpfile):
+ path = skintmp[0]+config.skin.primary_skin.value[:pos+1]
+ else:
+ path = tmp[0]
else:
path = tmp[0]
else:
m_is_pvr = !m_reference.path.empty();
m_timeshift_enabled = m_timeshift_active = 0, m_timeshift_changed = 0;
- m_skipmode = 0;
+ m_skipmode = m_fastforward = m_slowmotion = 0;
CONNECT(m_service_handler.serviceEvent, eDVBServicePlay::serviceEvent);
CONNECT(m_service_handler_timeshift.serviceEvent, eDVBServicePlay::serviceEventTimeshift);
eDebug("eDVBServicePlay::setSlowMotion(%d)", ratio);
setFastForward_internal(0);
if (m_decoder)
+ {
+ m_slowmotion = ratio;
return m_decoder->setSlowMotion(ratio);
+ }
else
return -1;
}
return setFastForward_internal(ratio);
}
-RESULT eDVBServicePlay::setFastForward_internal(int ratio)
+RESULT eDVBServicePlay::setFastForward_internal(int ratio, bool final_seek)
{
- int skipmode, ffratio;
-
+ int skipmode, ffratio, ret = 0;
+ pts_t pos=0;
+
if (ratio > 8)
{
skipmode = ratio;
if (m_cue)
m_cue->setSkipmode(skipmode * 90000); /* convert to 90000 per second */
}
-
+
m_skipmode = skipmode;
-
+
+ if (final_seek)
+ eDebug("trickplay stopped .. ret %d, pos %lld", getPlayPosition(pos), pos);
+
+ m_fastforward = ffratio;
+
if (!m_decoder)
return -1;
-
+
if (ffratio == 0)
; /* return m_decoder->play(); is done in caller*/
else if (ffratio != 1)
- return m_decoder->setFastForward(ffratio);
+ ret = m_decoder->setFastForward(ffratio);
else
- return m_decoder->setTrickmode();
- return 0;
+ ret = m_decoder->setTrickmode();
+
+ if (pos)
+ eDebug("final seek after trickplay ret %d", seekTo(pos));
+
+ return ret;
}
RESULT eDVBServicePlay::seek(ePtr<iSeekableService> &ptr)
RESULT eDVBServicePlay::pause()
{
eDebug("eDVBServicePlay::pause");
- setFastForward_internal(0);
+ setFastForward_internal(0, m_slowmotion || m_fastforward > 1);
if (m_decoder)
{
+ m_slowmotion = 0;
m_is_paused = 1;
return m_decoder->pause();
} else
RESULT eDVBServicePlay::unpause()
{
eDebug("eDVBServicePlay::unpause");
- setFastForward_internal(0);
+ setFastForward_internal(0, m_slowmotion || m_fastforward > 1);
if (m_decoder)
{
+ m_slowmotion = 0;
m_is_paused = 0;
return m_decoder->play();
} else
{
eDVBServicePMTHandler::program program;
eDVBServicePMTHandler &h = m_timeshift_active ? m_service_handler_timeshift : m_service_handler;
+ pts_t position = -1;
if (h.getProgramInfo(program))
return -1;
apidtype = program.audioStreams[stream].type;
}
+ if (i != -1 && apid != m_current_audio_pid && (m_is_pvr || m_timeshift_active))
+ eDebug("getPlayPosition ret %d, pos %lld in selectAudioStream", getPlayPosition(position), position);
+
m_current_audio_pid = apid;
if (m_is_primary && m_decoder->setAudioPID(apid, apidtype))
return -4;
}
+ if (position != -1)
+ eDebug("seekTo ret %d", seekTo(position));
+
int rdsPid = apid;
/* if we are not in PVR mode, timeshift is not active and we are not in pip mode, check if we need to enable the rds reader */
m_new_subtitle_page_connection = 0;
m_rds_decoder_event_connection = 0;
m_video_event_connection = 0;
- m_is_paused = m_skipmode = 0; /* not supported in live mode */
+ m_is_paused = m_skipmode = m_fastforward = m_slowmotion = 0; /* not supported in live mode */
/* free the timeshift service handler, we need the resources */
m_service_handler_timeshift.free();
r.path = m_timeshift_file;
m_cue = new eCueSheet();
+ m_cue->seekTo(0, -1000);
m_service_handler_timeshift.tune(r, 1, m_cue, 0, m_dvb_service); /* use the decoder demux for everything */
eDebug("eDVBServicePlay::switchToTimeshift, in pause mode now.");
pause();
updateDecoder(); /* mainly to switch off PCR, and to set pause */
-
+
m_event((iPlayableService*)this, evSeekableStatusChanged);
}
}
}
- 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);
+ setAC3Delay(ac3_delay == -1 ? 0 : ac3_delay);
+ setPCMDelay(pcm_delay == -1 ? 0 : pcm_delay);
m_decoder->setVideoPID(vpid, vpidtype);
selectAudioStream();
{
if (m_dvb_service)
m_dvb_service->setCacheEntry(eDVBService::cAC3DELAY, delay ? delay : -1);
- if (m_decoder)
- m_decoder->setAC3Delay(delay);
+ if (m_decoder) {
+ 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(delay + config_delay_int);
+ }
}
void eDVBServicePlay::setPCMDelay(int delay)
{
if (m_dvb_service)
m_dvb_service->setCacheEntry(eDVBService::cPCMDELAY, delay ? delay : -1);
- if (m_decoder)
- m_decoder->setPCMDelay(delay);
+ if (m_decoder) {
+ std::string config_delay;
+ int config_delay_int = 0;
+ 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(delay + config_delay_int);
+ }
}
void eDVBServicePlay::video_event(struct iTSMPEGDecoder::videoEvent event)
int m_current_audio_stream;
int selectAudioStream(int n = -1);
- RESULT setFastForward_internal(int ratio);
+ RESULT setFastForward_internal(int ratio, bool final_seek=false);
/* timeshift */
ePtr<iDVBTSRecorder> m_record;
void updateDecoder();
int m_skipmode;
+ int m_fastforward;
+ int m_slowmotion;
/* cuesheet */
/* note: this requires gstreamer 0.10.x and a big list of plugins. */
/* it's currently hardcoded to use a big-endian alsasink as sink. */
+#include <lib/base/ebase.h>
#include <lib/base/eerror.h>
+#include <lib/base/init_num.h>
+#include <lib/base/init.h>
+#include <lib/base/nconfig.h>
#include <lib/base/object.h>
-#include <lib/base/ebase.h>
-#include <string>
+#include <lib/dvb/decoder.h>
+#include <lib/components/file_eraser.h>
+#include <lib/gui/esubtitle.h>
#include <lib/service/servicemp3.h>
#include <lib/service/service.h>
-#include <lib/components/file_eraser.h>
-#include <lib/base/init_num.h>
-#include <lib/base/init.h>
+
+#include <string>
+
#include <gst/gst.h>
#include <gst/pbutils/missing-plugins.h>
#include <sys/stat.h>
-/* for subtitles */
-#include <lib/gui/esubtitle.h>
// eServiceFactoryMP3
extensions.push_back("vob");
extensions.push_back("wav");
extensions.push_back("wave");
+ extensions.push_back("m4v");
extensions.push_back("mkv");
extensions.push_back("avi");
extensions.push_back("divx");
}
// eServiceMP3
+int eServiceMP3::ac3_delay,
+ eServiceMP3::pcm_delay;
eServiceMP3::eServiceMP3(eServiceReference ref)
:m_ref(ref), m_pump(eApp, 1)
sourceinfo.containertype = ctAVI;
sourceinfo.is_video = TRUE;
}
- else if ( strcasecmp(ext, ".mp4") == 0 || strcasecmp(ext, ".mov") == 0)
+ else if ( strcasecmp(ext, ".mp4") == 0 || strcasecmp(ext, ".mov") == 0 || strcasecmp(ext, ".m4v") == 0)
{
sourceinfo.containertype = ctMP4;
sourceinfo.is_video = TRUE;
return 0;
}
-
int eServiceMP3::getInfo(int w)
{
const gchar *tag = 0;
return 0;
}
+RESULT eServiceMP3::audioDelay(ePtr<iAudioDelay> &ptr)
+{
+ ptr = this;
+ return 0;
+}
+
int eServiceMP3::getNumberOfTracks()
{
return m_audioStreams.size();
g_object_set (G_OBJECT (sink), "emit-signals", TRUE, NULL);
gst_object_unref(sink);
}
+ setAC3Delay(ac3_delay);
+ setPCMDelay(pcm_delay);
} break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
{
return 0;
}
+int eServiceMP3::getAC3Delay()
+{
+ return ac3_delay;
+}
+
+int eServiceMP3::getPCMDelay()
+{
+ return pcm_delay;
+}
+
+void eServiceMP3::setAC3Delay(int delay)
+{
+ ac3_delay = delay;
+ if (!m_gst_playbin || m_state != stRunning)
+ return;
+ else
+ {
+ GstElement *sink;
+ int config_delay_int = delay;
+ g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL);
+
+ if (sink)
+ {
+ std::string config_delay;
+ if(ePythonConfigQuery::getConfigValue("config.av.generalAC3delay", config_delay) == 0)
+ config_delay_int += atoi(config_delay.c_str());
+ gst_object_unref(sink);
+ }
+ else
+ {
+ eDebug("dont apply ac3 delay when no video is running!");
+ config_delay_int = 0;
+ }
+
+ g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL);
+
+ if (sink)
+ {
+ gchar *name = gst_element_get_name(sink);
+ if (strstr(name, "dvbaudiosink"))
+ eTSMPEGDecoder::setHwAC3Delay(config_delay_int);
+ g_free(name);
+ gst_object_unref(sink);
+ }
+ }
+}
+
+void eServiceMP3::setPCMDelay(int delay)
+{
+ pcm_delay = delay;
+ if (!m_gst_playbin || m_state != stRunning)
+ return;
+ else
+ {
+ GstElement *sink;
+ int config_delay_int = delay;
+ g_object_get (G_OBJECT (m_gst_playbin), "video-sink", &sink, NULL);
+
+ if (sink)
+ {
+ std::string config_delay;
+ if(ePythonConfigQuery::getConfigValue("config.av.generalPCMdelay", config_delay) == 0)
+ config_delay_int += atoi(config_delay.c_str());
+ gst_object_unref(sink);
+ }
+ else
+ {
+ eDebug("dont apply pcm delay when no video is running!");
+ config_delay_int = 0;
+ }
+
+ g_object_get (G_OBJECT (m_gst_playbin), "audio-sink", &sink, NULL);
+
+ if (sink)
+ {
+ gchar *name = gst_element_get_name(sink);
+ if (strstr(name, "dvbaudiosink"))
+ eTSMPEGDecoder::setHwPCMDelay(config_delay_int);
+ else
+ {
+ // this is realy untested..and not used yet
+ gint64 offset = config_delay_int;
+ offset *= 1000000; // milli to nano
+ g_object_set (G_OBJECT (m_gst_playbin), "ts-offset", offset, NULL);
+ }
+ g_free(name);
+ gst_object_unref(sink);
+ }
+ }
+}
#else
#warning gstreamer not available, not building media player
typedef enum { stPlainText, stSSA, stSRT } subtype_t;
typedef enum { ctNone, ctMPEGTS, ctMPEGPS, ctMKV, ctAVI, ctMP4, ctVCD, ctCDA } containertype_t;
-class eServiceMP3: public iPlayableService, public iPauseableService,
- public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection, public iSubtitleOutput, public iStreamedService, public Object
+class eServiceMP3: public iPlayableService, public iPauseableService,
+ public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection,
+ public iSubtitleOutput, public iStreamedService, public iAudioDelay, public Object
{
DECLARE_REF(eServiceMP3);
public:
RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
+ RESULT audioDelay(ePtr<iAudioDelay> &ptr);
// not implemented (yet)
RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
RESULT cueSheet(ePtr<iCueSheet> &ptr) { ptr = 0; return -1; }
- RESULT audioDelay(ePtr<iAudioDelay> &ptr) { ptr = 0; return -1; }
+
RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
RESULT keys(ePtr<iServiceKeys> &ptr) { ptr = 0; return -1; }
RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
PyObject *getBufferCharge();
int setBufferSize(int size);
+ // iAudioDelay
+ int getAC3Delay();
+ int getPCMDelay();
+ void setAC3Delay(int);
+ void setPCMDelay(int);
+
struct audioStream
{
GstPad* pad;
}
};
private:
+ static int pcm_delay;
+ static int ac3_delay;
int m_currentAudioStream;
int m_currentSubtitleStream;
int selectAudioStream(int i);
from skin import readSkin
profile("LOAD:Tools")
-from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_SKIN
from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave
InitFallbackFiles()
profile("ReloadProfiles")
eDVBDB.getInstance().reloadBouquets()
-config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_SKIN_IMAGE)+"radio.mvi")
+config.misc.radiopic = ConfigText(default = resolveFilename(SCOPE_CURRENT_SKIN, "radio.mvi"))
config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False)
config.misc.useTransponderTime = ConfigYesNo(default=True)
config.misc.startCounter = ConfigInteger(default=0) # number of e2 starts...
./xml2po.py ../lib/python/Plugins/SystemPlugins/Videomode/ >> enigma2.pot
./xml2po.py ../lib/python/Plugins/SystemPlugins/SoftwareManager/ >> enigma2.pot
./xml2po.py ../lib/python/Plugins/SystemPlugins/CleanupWizard/ >> enigma2.pot
+ ./xml2po.py ../lib/python/Plugins/SystemPlugins/NetworkWizard/ >> enigma2.pot
cat enigma2_rel25.pot | tail -n +19 >> enigma2.pot
msguniq --no-location -o enigma2uniq.pot enigma2.pot
$(RM) enigma2.pot
guiObject.setFont(parseFont(value, scale))
elif attrib == 'zPosition':
guiObject.setZPosition(int(value))
+ elif attrib == 'itemHeight':
+ guiObject.setItemHeight(int(value))
elif attrib in ("pixmap", "backgroundPixmap", "selectionPixmap"):
ptr = loadPixmap(value, desktop) # this should already have been filename-resolved.
if attrib == "pixmap":