2SUB & 2LANG
============

This archive contains two plugins/addons for Dreambox 7025 written by Gruffy.
2LANG is maintained and tweaked by WeeGull.

2SUB Contact: gruffypuffy1234 AT hotmail DOT com
2LANG Contact: weegull-2lang AT hotmail DOT com

Automatic Install - well...almost auto:
=======================================
 1. Copy 2sub.2lang_2.07.02_mipsel.ipk to /tmp with FTP.
 2. Enter the following commands in a Telnet session:
	cd /
	ipkg install /tmp/2sub.2lang_2.07.02_mipsel.ipk
 4. Reboot
 5. Enjoy

Manual Install:
===============
Just copy all files to their place according to the archive file 2SUB_files.tar.gz:

Make sure you do a "killall 2SUB" if you have an old version running!

The binary file:
/usr/bin/2SUB

The Python autostart plugin:
/usr/lib/enigma2/python/Plugins/Extensions/2SUB/__init__.py
/usr/lib/enigma2/python/Plugins/Extensions/2SUB/plugin.pyc

The Python GUI plugin:
/usr/lib/enigma2/python/Plugins/Extensions/2SUBConf/__init__.py
/usr/lib/enigma2/python/Plugins/Extensions/2SUBConf/plugin.pyc
/usr/lib/enigma2/python/Plugins/Extensions/2SUBConf/2SUB.png
/usr/lib/enigma2/python/Plugins/Extensions/2SUBConf/subtitleSettings.py

The Python 2LANG plugin:
/usr/lib/enigma2/python/Plugins/Extensions/2LANG/__init__.py
/usr/lib/enigma2/python/Plugins/Extensions/2LANG/plugin.pyc
/usr/lib/enigma2/python/Plugins/Extensions/2LANG/2LANG.audio

The config files:
/usr/var/2SUB/2SUB.audio
/usr/var/2SUB/2SUB.channels
/usr/var/2SUB/2SUB.conf
/usr/var/2SUB/2SUB.translation

Then you RESTART Enigma2 or REBOOT the box!

2007-08-27 - 2.07.12
--------------------

 - First release where 2SUB2LANG is splitted into two packages.

2LANG
 - Rewrote all code for detecting channel change in 2LANG so this hopefully works better.
   One of the things is to only try to change language if more than one audiotrack is found.
 - After many wishes from Scandinavian people there is a AC3 override function.
   Read 2LANG.audio for how to activate it. Note, this function will be changed in future!
 - Increased 2LANG to support three different languages instead of two.

2SUB
 - Update 2SUB.channels since there has been some changes in the real world.
 - The restart could run out of memory and give a BSOD.

2007-06-06 - 2.07.10
--------------------
 - Fixed crash bug. 
 - Rework for PPC version.

2007-06-19 - 2.07.09
-------
 - Added a feature to the 2SUB python plugin. It will restart 2SUB if it is not running, not 
   only at startup, but on all channel changes etc.

2007-06-03 - 2.07.08
--------------------
 - Reworked the 2SUB python plugin and changed the 2SUB binary accordingly.
   Now should handle the missing dutch cable channels...hopefully.

2007-05-26 - 2.07.07
--------------------
 - Updated 2LANG to not react on spamming events from E2. This
   should remove the "audio hickup" when using 2LANG. By WeeGull

2007-05-13 - 2.07.06
--------------------
 - FINALLY! The "overhearing" bug is killed...now texts from false channels
   should not be seen on wrong channels.

2007-05-02 - 2.07.05
--------------------
 - The RecDelay was broken. Should now be restored.
 - Various small fixes after code review.

2007-05-01 - 2.07.04
--------------------
 - Changed python plugin to listen to more events for detecting wide screen 
   better.
 - Small fixes/cleanups in binary file.

2007-02-17 - 2.07.03
--------------------
 - Synced with code from gSUB 2.07.03
 - Changed behaviour of 8-bit clearing (nothing for 2SUB version only gSUB)
 - Finally fixed the "too long line crash" of 2SUB! Sorry it took so long...

2007-01-27 - 2.06.08
--------------------
 - Added the missing code so that Disable/Enable now works again.
 - Minor update of 2LANG to speed up detection of audiotrack. (WeeGull)

2007-01-23 - 2.06.07
--------------------
 - New translation file, small fix for French.
 - Added shortcut to handle 858, 859 teletext pages from france...

2007-01-21 - 2.06.06
--------------------
 - Fixed reading of 2SUB.translation to support the "#" char now...
 - Improved clearing of "staying subs".

2007-01-19 - 2.06.05
-----------------
 - Synced code versions with gSUB
 - Changed how clearing/drawing is done, should be better and not clear all screen,

2007-01-14 - 2.06
-----------------
 - Decreased CPU load by removing a stupid thing...
 - Added back the OutlineSize that has been missing.
 - Implemented a workaround for Premiere and their "Dolby Digital 5.1" languagecode.
   This only works if your gui is set to German language.
 - Implemented a fix for Premiere since they do not use correct languagecode to
   identify their transmitted language. This fix also works on Premiere which
   uses Tonoption 1 = German and Tonoption 2 = English

2006-12-19 - 2.05
-----------------
 - Reworked how DVB Subtitles are decoded. Now works much better...but still some
   issues that I currently think is a driver issue...time will tell!

2006-12-19 - 2.04
-----------------
 - Fixed bug where text could be drawn outside the screen.
 - Fixed bug with SecondaryLanguage, the GUI generated wrong
   stuff into the config file and this most likely ended up
   in 2SUB to select English as SecondaryLanguage.
 - Improved DVB Subtitles, changed the MAX-STAY handling.
 - Added OSD Messages feature, select in GUI to show some
   info in the top when 2SUB finds some subtitles. This is
   mostly for debugging.
 - Added Framebuffer mutex lock to prevent crash in 
   multithreading environments.
 - Corrected bugs in 2LANG with newer CVS-images (thanks
   WeeGull).
 - Now generated with newer version of BOUML...great tool!

2006-10-17 - 2.03
-----------------
 - Reworked some of the TXT subs to handle Sky channels better. It is not 100%
   flicker free yet, but it will at least show the subs in a better and complete
   way. SkyTV seems to send out TXT subs rather different compared to other
   channels (they do not transmit the CLEAR PAGE all the time) so 2SUB has to try
   and detect when this is needed by itself. It works OK for now anyhow...


2006-10-12 - 2.02
-----------------
 - Added negative numbers for ExtraSpace setting in GUI, now [-9...+9].
 - Fixed the ExtraSpace parameter so that it is done both up and down, i.e. centered addition.

2006-10-08 - 2.01
-----------------
 - Fixed bug where 2LANG BlueScreened...
 - Altered 2LANG algorithm...AC3 should work now.
 - Added ExtraYSpace and WideExtraYSpace to GUI
 - Changed default config files a bit to have better settings.

2006-10-07 - 2.00
-----------------
 - ALL CODE IS REWRITTEN FROM SCRATCH!
   This means that a lot has become better and some new/old bugs probably exists in the code.
   So, please have some patience with this new generation of 2SUB. All will be cool in time. 
   I do think that this release is good enough for going out in beta...
 - Added a new configuration file 2SUB.translation
   This file contains all character conversions in 2SUB. So if you like to add your own language
   it is possible to edit in this file! Also, if some characters are wrong, just dig into this
   file and update it and test. MAKE SURE TO SEND ME ALL PATCHES SO THAT I CAN ADD IT TO NEXT
   RELEASE OF 2SUB. Thanks!
 - If you add a new language, make sure to add it into the GUI menu file: subtitleSettings.py
   located in the 2SUBConf file.
 - First attempt to have 2LANG to support AC3 and MPEG audio. Difficult for me to test...need
   your feedback on this one.

2006-08-23 - 0.78
-----------------
 - Added new setting for DVB Subs. If the transmissions does not have any "timeout" value, the subs
   will stay on the screen until next subtitle is displayed...irritating. Now a "timeout" value in the
   settings has been added. This is used if and ONLY IF the transmission does not include any value
   on this.

2006-07-31 - 0.73
-----------------
 - Fixed bug where timeout on DVB Subtitles were not working perfectly.
 - Fixed some polish characters.

2006-07-31 - 0.72
-----------------
 - Fixed bugs in DVB Subtitle that was found on gSUB.
 - Added "Use 2SUB.channels" option to GUI...this was totally forgotten...hehe.


2006-07-20
----------
 - Fixed bug where 2SUB did not find subtitles in recorded movies. Also removed speed for detection of subs
   for movies. 


2006-07-18
----------
 - Added DVB Subtitle support for the first time!!! This is still a very early release and have patience with me...
 - New setting in GUI added to select if 2SUB should prefer DVB susb or Teletext subs.
 - Also writing the PMT pid to the /tmp/2SUB.tmp file so external tools can use this file... VLC PID Loader for example.

2006-06-13
----------
 - Updated langauge codes in 2SUB to handle localized characters better...unicode trouble before.
 - Added Enable/Disable bindings in the 2SUB GUI
 - New packing...all relnotes in main README from now on...also, only one package for 2SUB/2LANG.

2006-06-11
----------
 - Updated both 2LANG(two languages) and 2SUB(time sync). See their README files!

2006-06-07
----------
 - First public release. See README in each package for more details.

2SUB
----
This is a Teletext subtitle addon for the Dreambox 7025. It is based on the gSUB plugin for other Dreamboxes. The change in name states two things...it is NOT gSUB, as it is ported to new hardware, and the author has now joined the 2Gether Team and he wants to declare this by naming it 2SUB.

Features:
- True Type fonts, all freely selectable and scalable.
- RecDelay for recordings and Timeshift playback.
- Positioning on the screen, horizontal, vertical etc.
- Color selection.
- Render styles: Outline, Background and Outline+Background.
- Background transparency.
- GUI for settings.
- Autostarting on channel change.
- Select Primary and Secondary language.
- Hardcode/help 2SUB with the 2SUB.channels file (compare to gSUB.channels).
- ...

2LANG
-----
This plugin is a background/autostarting plugin that selects the audio track for the current channel. It is based on what OSD language you have set, so if you have "Swedish" as OSD language, 2LANG will try and select a "Swedish" audio track if possible. Not that it is possible to override the "current OSD language" by editing a file (see inside 2LANG.audio). It will also handle the "mono-channels" like Eurosport. These channels transmit each language as a mono channel, so if nothing is done when zaping to these channels you will hear two languages... This is handled by setting up the 2LANG.audio file accordinly. See inside that for more details.
In short...this is the code that was controlled by gSUB.audio in the old plugin!


Well...best of luck to you out there and I hope that you get them to work as expected. I have had much help from my betatesters!!! THANK YOU! 

Special thanks to (in random order): 2Gether (Nemesis, spacy & co. thanks for having me guys!), Gaj, Satandream and tmbinc!





ADD YOUR OWN NEW LANGUAGE TO 2SUB
=================================
Not all (actually quite few...) languages are supported by 2SUB when it comes to handle subtitles. But if you have 
a language that you would like to add there is now (since 2.00) a way to add this information into 2SUB on your
own. This text describes this process in short.

Edit the 2SUBConf to handle it in menus
---------------------------------------
1. Find the file subtitleSettings.py in the 2SUBConf plugin directory (see above for where it is installed).
   Edit this file with a Linux editor and look for the "## PRIMARY LANGUAGE" and the "## SECONDARY LANGUAGE" tags.
   These indicate the menu items needed for the 2SUBConf GUI python plugin. In this you can add your new 
   language by looking at how the default languages are added....but be careful, falut in this file will
   make you have a BlueScreen, so make a backup of the old one...
2. Delete the "compiled" version, "subtitleSettings.pyc".
3. Restart Enigma2 to make it load your new menu for 2SUBConf.
4. Test and make sure it works, change your language to your wanted one and hit SAVE.
5. Check that you actually have got the correct language saved in the "2SUB.conf" file.

Add new characters to your new Teletext subtitle language
---------------------------------------------------------
Some characters might be rendered as "{", "]", ... etc. This is how they are transmitted
into the TransportStream and now you have to lookup the new UNICODE values for these 
characters for your language. So, make notes of faulty characters and then use GOOGLE
to find your UNICODE values for these. (Look for some ISO table etc.)

HINT: You can do a "killall 2SUB", "/usr/bin/2SUB" from telnet to get the program to
log all of this for you in telnet. When done, go to "Restart Enigma" from menus to 
have 2SUB run as normal again. END-HINT

1. Find out what characters need to be translated and their UNICODE value in your language.
2. Edit the "2SUB.translation" file to add your new characters.
   Here is a sample table for Swedish and Finnish
	################################################
	##
	## SWEDISH/FINNISH
	##
	################################################
	BeginTable:swe;fin
	$:164
	@:201
	[:196
	\:214
	]:197
	^:220
	`:233
	{:228
	|:246
	}:229
	~:252
	EndTable
3. Restart 2SUB (by doing a restart of Enigma2 for example).


Now all is done and you are happy...the please mail me your new language (all edited files)
so that I can add them into the next 2SUB release. See top of mail for addy.

/Gruffy
