From patchwork Mon Jul 30 13:02:38 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luca Olivetti X-Patchwork-Id: 12496 Received: from 61.pool85-52-226.static.orange.es ([85.52.226.61] helo=ventoso.org) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1IFUuB-0006uQ-IT for vdr@linuxtv.org; Mon, 30 Jul 2007 15:03:23 +0200 Received: from [192.168.10.30] (unknown [192.168.10.30]) by ventoso.org (Postfix) with ESMTP id 966E8C44C0A for ; Mon, 30 Jul 2007 15:02:52 +0200 (CEST) Message-ID: <46ADE16E.5030807@ventoso.org> Date: Mon, 30 Jul 2007 15:02:38 +0200 From: Luca Olivetti User-Agent: Thunderbird 2.0.0.4 (X11/20070620) MIME-Version: 1.0 To: VDR Mailing List References: <435905.57638.qm@web34812.mail.mud.yahoo.com> <46ADD5D2.9060300@ventoso.org> In-Reply-To: <46ADD5D2.9060300@ventoso.org> Subject: Re: [vdr] Announce LoadEPG 0.1.11 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2007 13:03:24 -0000 Status: O X-Status: X-Keywords: X-UID: 13620 En/na Luca Olivetti ha escrit: > En/na lukkinosat ha escrit: >> --- Luca Olivetti ha scritto: >>> I made a crude hack: I assume that the epg is in >>> ISO-8859-15, so if >>> SystemCharacterTable is different than iso-8859-15, >>> I call iconv to >>> convert the file in cLoadepgOsd::SaveEpg, just >>> before the LoadFile label: >> [CUT] >> >> Hi >> >> The epg is ISO-8859-15. I must still try with vdr >> version 1.5.x. > > Well, with the previous patch, the iconv hack and using > cDevice::PrimaryDevice() to tune to the epg channel, everything is > working fine here. > For a more general solution I suppose I'll have to do the same I did in > my actuator plugin (use cDevice::PrimaryDevice() only if the selected > device is ActualDevice and provides the needed channel). > I'll look into it and post a revised patch. Here it is. It should work for 1.4.x as well as for 1.5.x (but I only tested it with 1.5.6 and a single dvb card, so YMMV). Bye Només a loadepg-0.1.11: .dependencies diff --unified --recursive --exclude '*.o' --exclude '*.so' loadepg-0.1.11.orig/loadepg.c loadepg-0.1.11/loadepg.c --- loadepg-0.1.11.orig/loadepg.c 2007-07-26 18:32:05.000000000 +0200 +++ loadepg-0.1.11/loadepg.c 2007-07-30 14:54:09.468527000 +0200 @@ -936,6 +936,10 @@ Timeout = 0; LoadepgConfig.OldUpdateChannels = Setup.UpdateChannels; Setup.UpdateChannels = 0; + EpgDevice=NULL; + for (int i=0; iCardIndex()==LoadepgConfig.DeviceNumber -1) + EpgDevice=cDevice::GetDevice(i); } cLoadepgOsd::~cLoadepgOsd( void ) @@ -947,7 +951,7 @@ Setup.UpdateChannels = LoadepgConfig.OldUpdateChannels; if( Filter ) { - cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->Detach( Filter ); + EpgDevice->Detach( Filter ); delete Filter; } if( Osd ) @@ -967,7 +971,7 @@ if( SwitchToEpgChannel() ) { Filter = new cLoadepgFilter(); - cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->AttachFilter( Filter ); + EpgDevice->AttachFilter( Filter ); } else { @@ -1009,6 +1013,7 @@ void cLoadepgOsd::Show( void ) { + if ( EpgDevice == NULL) return; Osd = cOsdProvider::NewOsd( 160, 88 ); if( Osd ) { @@ -1026,7 +1031,8 @@ bool cLoadepgOsd::SaveOldChannel( void ) { - OldChannel = Channels.GetByNumber( cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->CurrentChannel() ); + if (EpgDevice == NULL) return false; + OldChannel = Channels.GetByNumber( EpgDevice->CurrentChannel() ); if( OldChannel ) { return true; @@ -1038,7 +1044,8 @@ { if( OldChannel ) { - cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->SwitchChannel( OldChannel, true ); + if (UsingPrimaryDevice) cDevice::PrimaryDevice()->SwitchChannel( OldChannel, true); + else EpgDevice->SwitchChannel( OldChannel, false ); } } @@ -1055,9 +1062,19 @@ *EpgChannel = *OldChannel; sscanf( EpgProviderValue1[MenuItem], "%[^:]:%[^:]:%[^:]:%[^:]:%[^:]", ProviderName, Frequency, Polarization, SourceName, SymbolRate ); EpgChannel->cChannel::SetSatTransponderData( cSource::FromString( SourceName ), atoi( Frequency ), Polarization[0], atoi( SymbolRate ), FEC_AUTO ); - cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->SwitchChannel( EpgChannel, true ); + if (EpgDevice==cDevice::ActualDevice() && cDevice::GetDevice(EpgChannel,0 + #if APIVERSNUM >= 10500 + ,true + #endif + ) == EpgDevice) { + cDevice::PrimaryDevice()->SwitchChannel( EpgChannel, true ); + UsingPrimaryDevice = true; + } else { + EpgDevice->SwitchChannel( EpgChannel, false ); + UsingPrimaryDevice = false; + } usleep( 2000000 ); - if( cDevice::GetDevice( LoadepgConfig.DeviceNumber - 1 )->HasLock() ) + if( EpgDevice->HasLock() ) { return true; } @@ -1071,6 +1088,10 @@ eOSState cLoadepgOsd::ProcessKey( eKeys Key ) { + if (EpgDevice == NULL ) { + Skins.Message(mtError,tr("Card not available")); + return osEnd; + } eOSState state = cOsdObject::ProcessKey( Key ); StatusKey = 0; if( state == osUnknown ) @@ -1259,6 +1280,18 @@ BeginProgramId = BeginProgramId + ListEpgPrograms[ChannelId+1]; } fclose( File ); +#if APIVERSNUM >= 10500 + const char *syschar=cCharSetConv::SystemCharacterTable(); + if (syschar==NULL || !strcasestr(syschar, "ISO-8859-15")) { + char *cmd; + asprintf(&cmd, "iconv -f ISO-8859-15 -t %s -o \"%s.converted\" \"%s\"", syschar ? syschar : "UTF-8",FileName,FileName); + SystemExec(cmd); + free(cmd); + asprintf(&cmd, "mv \"%s.converted\" \"%s\"", FileName,FileName); + SystemExec(cmd); + free(cmd); + } +#endif } LoadFile:; if( ( File = fopen( FileName, "r" ) ) != NULL ) @@ -1357,7 +1390,7 @@ } if( Status.Plugin == STATUS_INIT ) { - if( LoadepgConfig.DeviceNumber == 1 ) + if( UsingPrimaryDevice ) { LineHeight = Font->Height() + ( Padding * 2 ); LineWidth = 399; diff --unified --recursive --exclude '*.o' --exclude '*.so' loadepg-0.1.11.orig/loadepg.h loadepg-0.1.11/loadepg.h --- loadepg-0.1.11.orig/loadepg.h 2007-07-26 18:32:23.000000000 +0200 +++ loadepg-0.1.11/loadepg.h 2007-07-30 14:49:15.478527000 +0200 @@ -380,6 +380,8 @@ cLoadepgFilter *Filter; cChannel *OldChannel; cChannel *EpgChannel; + cDevice *EpgDevice; + bool UsingPrimaryDevice; int Margin; int StatusKey; int Padding;