configfile.version=4 // Version of this config file
mod_auth.authenticate=false // ask for username/password (http digit authentication)
mod_auth.no_auth_client= // IP Adress without http authentication
diff --git a/src/nhttpd/nhttpd.conf.in b/src/nhttpd/nhttpd.conf.in
index a4d74e924..4facd7a42 100644
--- a/src/nhttpd/nhttpd.conf.in
+++ b/src/nhttpd/nhttpd.conf.in
@@ -4,7 +4,7 @@ Tuxbox.LogosURL=@TARGET_ICONSDIR@/logo
WebsiteMain.directory=@TARGET_PRIVATE_HTTPDDIR@
WebsiteMain.override_directory=@TARGET_PUBLIC_HTTPDDIR@
WebsiteMain.port=80
-WebsiteMain.hosted_directory=/var/hosted
+WebsiteMain.hosted_directory=@TARGET_HOSTED_HTTPDDIR@
configfile.version=4
mod_auth.authenticate=false
mod_auth.no_auth_client=
diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp
index 9ea0ebaaf..a3489f34a 100644
--- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp
+++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp
@@ -345,7 +345,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
int i = 1;
char classname;
t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID();
- int prozent;
+ int prozent = 100;
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
std::string timestr;
bool have_logos = false;
@@ -373,20 +373,31 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
/* timer slider */
if(event && event->duration > 0)
+ {
prozent = 100 * (time(NULL) - event->startTime) / event->duration;
+ yresult += string_printf("\n"
+ "\t"
+ ""
+ " | "
+ " | "
+ " "
+ " \n | \n"
+ , classname
+ , (prozent / 10) * 3
+ , (10 - (prozent / 10))*3
+ );
+ }
else
- prozent = 100;
- yresult += string_printf("\n"
- "\t"
- ""
- " | "
- " | "
- " "
- " \n | \n"
- , classname
- , (prozent / 10) * 3
- , (10 - (prozent / 10))*3
- );
+ {
+ yresult += string_printf("\n"
+ "\t\n | \n"
+ , classname
+ );
+ }
/* channel name and buttons */
yresult += string_printf("\n%s
- |
{=L:set.nhttpd.port=} |
- {=L:active_after_boot=}
+ | {=L:set.nhttpd.active_after_boot=}
|
{=if-not-equal:{=global-var-get:boxtype=}~coolstream~
@@ -76,8 +76,15 @@ function do_submit()
=}
{=L:set.nhttpd.alternate_web_folder=} |
- {=L:active_after_boot=}
- |
+
+ {=L:set.nhttpd.active_after_boot=}
+ |
+
+
+ {=L:set.nhttpd.hosted_folder=} |
+
+ {=L:set.nhttpd.active_after_boot=}
+ |
{=L:set.nhttpd.allowed_file_extensions=} |
diff --git a/src/nhttpd/web/Y_Settings_yWeb.yhtm b/src/nhttpd/web/Y_Settings_yWeb.yhtm
index bc7e396d9..0be09d97a 100644
--- a/src/nhttpd/web/Y_Settings_yWeb.yhtm
+++ b/src/nhttpd/web/Y_Settings_yWeb.yhtm
@@ -9,12 +9,20 @@ function do_submit(){
document.f.submit();
}
function do_init(){
- val = "{=ini-get:/var/tuxbox/config/Y-Web.conf;fb;{=if-equal:{=global-var-get:boxtype=}~coolstream~Coolstream~default=}~open=}";
+ val = "{=ini-get:/var/tuxbox/config/Y-Web.conf;fb;0~open=}";
var sel=2;
switch(val){
- case "default": sel=0; break;
- case "Nokia": sel=1; break;
- case "CST": sel=3; break;
+ case "-2": // d-box philips
+ case "-1": // d-box nokia old
+ case "0": // auto
+ case "1": // cst hd1/bse
+ case "2": // cst neo
+ case "3": // cst zee/neo2
+ case "4": // cst neo twin (todo!)
+ sel=(sel*1+val*1);
+ break;
+ default:
+ break;
}
document.f.fb.selectedIndex = sel;
val = "{=ini-get:/var/tuxbox/config/Y-Web.conf;start_page;bouquets~cache=}";
@@ -78,12 +86,17 @@ function do_init(){
{=L:set.yweb.remote=} |
- |
+
+
+ |
{=L:set.yweb.start_page=} |
diff --git a/src/nhttpd/web/Y_Tools_Menue.yhtm b/src/nhttpd/web/Y_Tools_Menue.yhtm
index 6cf1ac3e5..aa4a47799 100644
--- a/src/nhttpd/web/Y_Tools_Menue.yhtm
+++ b/src/nhttpd/web/Y_Tools_Menue.yhtm
@@ -7,36 +7,9 @@ function cmd_popup(){
window.open('Y_Tools_Cmd.yhtm','cmd','width=720,height=470,resizable=yes');
}
function init(){
- var menu=ext.select_menu('tools');
- menu.each(function(e){
- var el=new Element('li').update(
- new Element('a', {'target':'work',
- 'title': e.get('desc'),
- 'href': e.get('file')
- }).update("-"+e.get('menuitem'))
- );
- $('secmenu_tools').insert({'bottom':el});
- });
- var menu=ext.select_menu('expert');
- menu.each(function(e){
- var el=new Element('li').update(
- new Element('a', {'target':'work',
- 'title': e.get('desc'),
- 'href': e.get('file')
- }).update("-"+e.get('menuitem'))
- );
- $('secmenu_expert').insert({'bottom':el});
- });
- var menu=ext.select_menu('yweb');
- menu.each(function(e){
- var el=new Element('li').update(
- new Element('a', {'target':'work',
- 'title': e.get('desc'),
- 'href': e.get('file')
- }).update("-"+e.get('menuitem'))
- );
- $('secmenu_yweb').insert({'bottom':el});
- });
+ add_yExtensions('tools', 'secmenu_tools');
+ add_yExtensions('expert', 'secmenu_expert');
+ add_yExtensions('yweb', 'secmenu_yweb');
}
diff --git a/src/nhttpd/web/Y_Tools_Screenshot.yhtm b/src/nhttpd/web/Y_Tools_Screenshot.yhtm
index 6adee9bc7..5051e5b27 100644
--- a/src/nhttpd/web/Y_Tools_Screenshot.yhtm
+++ b/src/nhttpd/web/Y_Tools_Screenshot.yhtm
@@ -65,17 +65,25 @@ function do_clearshot(){
loadSyncURL("/control/exec?Y_Tools&screenshot_clear");
}
-function do_zoomshot(){
- // not a really zoom-function
+function do_switchrc(){
if (id('remote').style.display == 'none')
$('remote').show();
else
$('remote').hide();
+
+ do_switchrc_txt();
+}
+
+function do_switchrc_txt(){
+ if (id('remote').style.display == 'none')
+ $('switchrc').update("{=L:bc.control.remote=} {=L:show=}");
+ else
+ $('switchrc').update("{=L:bc.control.remote=} {=L:hide=}");
}
//]]>
-
+
{=var-set:help_url==}{=var-set:menu={=L:bc.menue.screenshot=}=}{=include-block:Y_Blocks.txt;work_menu=}
@@ -85,7 +93,7 @@ function do_zoomshot(){
-
+
diff --git a/src/nhttpd/web/Y_Version.txt b/src/nhttpd/web/Y_Version.txt
index 92c58e2c6..31639c62c 100644
--- a/src/nhttpd/web/Y_Version.txt
+++ b/src/nhttpd/web/Y_Version.txt
@@ -1,4 +1,4 @@
-version=2.8.0.33
-date=06.02.2013
+version=2.8.0.39
+date=05.07.2013
type=Release
info=Port CST
diff --git a/src/nhttpd/web/Y_yweb.js b/src/nhttpd/web/Y_yweb.js
index a73bdd7a1..ecd729d2a 100644
--- a/src/nhttpd/web/Y_yweb.js
+++ b/src/nhttpd/web/Y_yweb.js
@@ -182,6 +182,22 @@ Object.extend(Y.extension.prototype, {
},this);
}
});
+
+function add_yExtensions(_ymenu, _id) {
+ var menu=ext.select_menu(_ymenu);
+ menu.each(function(e){
+ var el=new Element('li').update(
+ new Element('a', {
+ 'class': (_ymenu == 'main') ? 'y_menu_prim_ext' : 'y_menu_sec_ext',
+ 'target': (_ymenu == 'main') ? 'base' : 'work',
+ 'title': e.get('desc'),
+ 'href': e.get('file')
+ }).update(e.get('menuitem'))
+ );
+ $(_id).insert({'bottom':el});
+ });
+}
+
/* singleton pattern*/
if (window == top.top_main.prim_menu) {
var ext = new Y.extension();
diff --git a/src/nhttpd/web/images/LICENSE b/src/nhttpd/web/images/LICENSE
index c98e4bd19..71f5be81e 100644
--- a/src/nhttpd/web/images/LICENSE
+++ b/src/nhttpd/web/images/LICENSE
@@ -1,7 +1,7 @@
Same pictures used are form the Tuxbox Community:
Published under GPL v2
-- rc.jpg : Jonny Spitzner
-- rc_sagem.jpg Jonny Spitzner
+- rc_dbox_nokia_old.jpg : Jonny Spitzner
+- rc_dbox_philips.jpg : Jonny Spitzner
- tux.gif : from wiki.tuxbox.org
From Johannes Golombek yjogol@online.de:
diff --git a/src/nhttpd/web/images/Makefile.am b/src/nhttpd/web/images/Makefile.am
index 01bcdc88b..99ad6eaab 100644
--- a/src/nhttpd/web/images/Makefile.am
+++ b/src/nhttpd/web/images/Makefile.am
@@ -38,7 +38,6 @@ install_DATA = accept.png \
ftype_folder.gif \
ftype_link.gif \
fullscreen.png \
- hd1.jpg \
help.gif \
help_white.gif \
hidden.gif \
@@ -56,7 +55,6 @@ install_DATA = accept.png \
lock.gif \
lock.png \
modify.png \
- neo.jpg \
new.gif \
new.png \
ok.gif \
@@ -66,9 +64,12 @@ install_DATA = accept.png \
properties.gif \
properties.png \
radio.png \
- rc.gif \
- rc.jpg \
- rc_sagem.jpg \
+ rc_cst_v1.jpg \
+ rc_cst_v2.jpg \
+ rc_cst_v3.jpg \
+ rc_cst_v4.jpg \
+ rc_dbox_nokia_old.jpg \
+ rc_dbox_philips.jpg \
record.gif \
record.png \
reload.gif \
@@ -105,5 +106,4 @@ install_DATA = accept.png \
x_red.gif \
yjogol.gif \
y.png \
- zap.png \
- zee.jpg
+ zap.png
diff --git a/src/nhttpd/web/images/fb.png b/src/nhttpd/web/images/fb.png
index da7e7f031..e08d81e8b 100644
Binary files a/src/nhttpd/web/images/fb.png and b/src/nhttpd/web/images/fb.png differ
diff --git a/src/nhttpd/web/images/rc.gif b/src/nhttpd/web/images/rc.gif
deleted file mode 100644
index dfa2a1520..000000000
Binary files a/src/nhttpd/web/images/rc.gif and /dev/null differ
diff --git a/src/nhttpd/web/images/hd1.jpg b/src/nhttpd/web/images/rc_cst_v1.jpg
similarity index 100%
rename from src/nhttpd/web/images/hd1.jpg
rename to src/nhttpd/web/images/rc_cst_v1.jpg
diff --git a/src/nhttpd/web/images/neo.jpg b/src/nhttpd/web/images/rc_cst_v2.jpg
similarity index 100%
rename from src/nhttpd/web/images/neo.jpg
rename to src/nhttpd/web/images/rc_cst_v2.jpg
diff --git a/src/nhttpd/web/images/rc_cst_v3.jpg b/src/nhttpd/web/images/rc_cst_v3.jpg
new file mode 100644
index 000000000..33aba320e
Binary files /dev/null and b/src/nhttpd/web/images/rc_cst_v3.jpg differ
diff --git a/src/nhttpd/web/images/rc_cst_v4.jpg b/src/nhttpd/web/images/rc_cst_v4.jpg
new file mode 100644
index 000000000..b52e6f1e0
Binary files /dev/null and b/src/nhttpd/web/images/rc_cst_v4.jpg differ
diff --git a/src/nhttpd/web/images/rc.jpg b/src/nhttpd/web/images/rc_dbox_nokia_old.jpg
similarity index 100%
rename from src/nhttpd/web/images/rc.jpg
rename to src/nhttpd/web/images/rc_dbox_nokia_old.jpg
diff --git a/src/nhttpd/web/images/rc_sagem.jpg b/src/nhttpd/web/images/rc_dbox_philips.jpg
similarity index 100%
rename from src/nhttpd/web/images/rc_sagem.jpg
rename to src/nhttpd/web/images/rc_dbox_philips.jpg
diff --git a/src/nhttpd/web/images/rcd.jpg b/src/nhttpd/web/images/rcd.jpg
deleted file mode 100644
index 129742060..000000000
Binary files a/src/nhttpd/web/images/rcd.jpg and /dev/null differ
diff --git a/src/nhttpd/web/images/zee.jpg b/src/nhttpd/web/images/zee.jpg
deleted file mode 100644
index 7bbb8ae61..000000000
Binary files a/src/nhttpd/web/images/zee.jpg and /dev/null differ
diff --git a/src/nhttpd/web/languages/Deutsch b/src/nhttpd/web/languages/Deutsch
index c8ca664e0..f17d79614 100644
--- a/src/nhttpd/web/languages/Deutsch
+++ b/src/nhttpd/web/languages/Deutsch
@@ -53,6 +53,9 @@ attention=Achtung!
directory=Verzeichnis
filename=Dateiname
restriced_by_management_ip=Zugriff verwehrt wg. ManagementIP
+automatic=automatisch
+show=zeigen
+hide=verstecken
# ==========Main Menue
main.boxcontrol=Boxsteuerung
@@ -300,6 +303,7 @@ set.nhttpd.active_after_boot=Nach Neustart aktiv
set.nhttpd.port=Port
set.nhttpd.threading=Threading
set.nhttpd.alternate_web_folder=Alternativer Web-Ordner
+set.nhttpd.hosted_folder=Eingebundenes Verzeichnis
set.nhttpd.allowed_file_extensions=Erlaubte Dateiendungen / MIME
set.nhttpd.allow_all_file_extensions=Alle Dateiendungen erlauben
set.nhttpd.url_of_logos_desc=URL bzw. Verzeichnis der Logos eingeben
@@ -534,3 +538,54 @@ info.About=Über
info.check_for_updates=Auf Updates prüfen
info.your_version=Deine Version
info.actual_version=Aktuelle Version
+
+=========Remote control
+rc.key_power=Standby - Schaltet den Receiver ein bzw. aus
+rc.key_mute=Mute - Schaltet den Ton an bzw. aus
+rc.key_1=1
+rc.key_2=2
+rc.key_3=3
+rc.key_4=4
+rc.key_5=5
+rc.key_6=6
+rc.key_7=7
+rc.key_8=8
+rc.key_9=9
+rc.key_0=0
+rc.key_text=Text - Zeigt den Teletext an
+rc.key_favorites=Favoriten - Zeigt die Favoritenliste an
+rc.key_volumeup=Vol+ - Erhöht die Lautstärke
+rc.key_volumedown=Vol- - Verringert die Lautstärke
+rc.key_pageup=Page+ - Blättert im Menü eine Seite hoch
+rc.key_pagedown=Page- - Blättert im Menü eine Seiter runter
+rc.key_mode=TV/Radio - Wechselt zwischen TV- und Radio-Modus
+rc.key_next=Skip- - Ändert das 4:3 Anzeigeverhalten
+rc.key_previous=Skip+ - Ändert das Bildschirmformat
+rc.key_sleep=Sleep - Setzt einen Ausschalt-Timer
+rc.key_audio=Audio - Startet den Audioplayer bzw. Internetradio
+rc.key_help=Help - Startet je nach Modus verschiedene Funktionen
+rc.key_red=Rot - Öffnet das Menü 'EPG/Vorschau'
+rc.key_green=Grün - Offnet das Menü 'Ton-Optionen'
+rc.key_yellow=Gelb - Öffnet das Menü 'Bild-Optionen' (wenn verfügbar)
+rc.key_blue=Blau - Öffnet das Menü 'Erweiterungen'
+rc.key_epg=EPG - Zeigt EPG-Informationen an
+rc.key_info=Info - Zeigt die Infobar und EPG-Beschreibung an
+rc.key_ok=OK - Bestätigt Auswahl im Menüfenster
+rc.key_up=Hoch - Programmwechsel und Menünavigation
+rc.key_down=Runter - Programmwechsel und Menünavigation
+rc.key_left=Links - Programmwechsel und Menünavigation
+rc.key_right=Rechts - Programmwechsel und Menünavigation
+rc.key_setup=Menü - Öffnet bzw. schließt das Hauptmenü
+rc.key_home=Exit - Schließt das geöffnete Menüfenster
+rc.key_sat=Sat - Öffnet Satelliten- bzw. Anbieterübersicht
+rc.key_www=
+rc.key_rewind=Rewind - Zurückspulen
+rc.key_play=Play - Öffnet das Filmarchiv oder startet die Wiedergabe
+rc.key_forward=Forward - Vorspulen
+rc.key_stop=Stop - Beendet Aufnahme, Timeshift oder Wiedergabe
+rc.key_record=Record - Startet Aufnahme
+rc.key_pause=Pause - Aktiviert timeshift oder pausiert die Wiedergabe
+rc.key_games=
+rc.key_time=
+rc.key_picsize=Pic Size - Ändert das 4:3 Anzeigeverhalten
+rc.key_picmode=Pic Mode - Ändert das Bildschirmformat
diff --git a/src/nhttpd/web/languages/English b/src/nhttpd/web/languages/English
index d49bac530..d9ae7c8d2 100644
--- a/src/nhttpd/web/languages/English
+++ b/src/nhttpd/web/languages/English
@@ -53,6 +53,9 @@ attention=Attention!
directory=Directory
filename=Filename
restriced_by_management_ip=restricted by ManagementIP
+automatic=automatically
+show=show
+hide=hide
#========= MAIN Menue
main.live_tv_desc=LiveTV
@@ -303,6 +306,7 @@ set.nhttpd.active_after_boot=active after boot
set.nhttpd.port=Port
set.nhttpd.threading=Threading
set.nhttpd.alternate_web_folder=Alternate Web-Folder
+set.nhttpd.hosted_folder=Mounted directory
set.nhttpd.allowed_file_extensions=Allowed File Extensions / MIME
set.nhttpd.allow_all_file_extensions=Allow all File Extensions
set.nhttpd.url_of_logos_desc=Enter URL or directory of Logos
@@ -538,3 +542,53 @@ info.check_for_updates=Check for Updates
info.your_version=Your Version
info.actual_version=Actual Version
+=========Remote control
+rc.key_power=Standby
+rc.key_mute=Mute
+rc.key_1=1
+rc.key_2=2
+rc.key_3=3
+rc.key_4=4
+rc.key_5=5
+rc.key_6=6
+rc.key_7=7
+rc.key_8=8
+rc.key_9=9
+rc.key_0=0
+rc.key_text=Text
+rc.key_favorites=Favorites
+rc.key_volumeup=Vol+
+rc.key_volumedown=Vol-
+rc.key_pageup=Page+
+rc.key_pagedown=Page-
+rc.key_mode=TV/Radio
+rc.key_next=Skip-
+rc.key_previous=Skip+
+rc.key_sleep=Sleep
+rc.key_audio=Audio
+rc.key_help=Help
+rc.key_red=Red
+rc.key_green=Green
+rc.key_yellow=Yellow
+rc.key_blue=Blue
+rc.key_epg=EPG
+rc.key_info=Info
+rc.key_ok=OK
+rc.key_up=Up
+rc.key_down=Down
+rc.key_left=Left
+rc.key_right=Right
+rc.key_setup=Menu
+rc.key_home=Exit
+rc.key_sat=Sat
+rc.key_www=
+rc.key_rewind=Rewind
+rc.key_play=Play
+rc.key_forward=Forward
+rc.key_stop=Stop
+rc.key_record=Record
+rc.key_pause=Pause
+rc.key_games=
+rc.key_time=
+rc.key_picsize=Pic Size
+rc.key_picmode=Pic Mode
diff --git a/src/nhttpd/yconfig.h b/src/nhttpd/yconfig.h
index 675d6a04e..663e919b0 100644
--- a/src/nhttpd/yconfig.h
+++ b/src/nhttpd/yconfig.h
@@ -109,7 +109,8 @@
#define YWEB_CONFIGFILE HTTPD_CONFIGDIR"/Y-Web.conf"
#define PUBLICDOCUMENTROOT PUBLIC_HTTPDDIR
#define NEUTRINO_CONFIGFILE CONFIGDIR"/neutrino.conf"
-#define HOSTEDDOCUMENTROOT "/mnt/hosted"
+#define HOSTEDDOCUMENTROOT HOSTED_HTTPDDIR
+#define HOSTEDDOCUMENTURL "/hosted/"
#define EXTRASDOCUMENTROOT "/mnt/hosted/extras"
#define EXTRASDOCUMENTURL "/hosted/extras"
#define ZAPITXMLPATH CONFIGDIR"/zapit"
diff --git a/src/nhttpd/yhttpd.cpp b/src/nhttpd/yhttpd.cpp
index f3a2bf706..b4971328b 100644
--- a/src/nhttpd/yhttpd.cpp
+++ b/src/nhttpd/yhttpd.cpp
@@ -507,7 +507,7 @@ void Cyhttpd::ReadConfig(void) {
Config->setString("Language.selected", HTTPD_DEFAULT_LANGUAGE);
Config->setString("Language.directory", HTTPD_LANGUAGEDIR);
if (Config->getString("WebsiteMain.hosted_directory", "") == "")
- Config->setString("WebsiteMain.hosted_directory", "/var/hosted");
+ Config->setString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT);
Config->saveConfig(HTTPD_CONFIGFILE);
}
}
@@ -544,14 +544,20 @@ void Cyhttpd::ReadConfig(void) {
// Check location of logos
if (Config->getString("Tuxbox.LogosURL", "") == "") {
- if (access(std::string(ConfigList["WebsiteMain.directory"] + "/logos").c_str(), 4) == 0) {
- Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.directory"] + "/logos");
- have_config = false; //save config
- }
- else if (access(std::string(ConfigList["WebsiteMain.override_directory"] ).c_str(), 4) == 0){
+ if (access(std::string(ConfigList["WebsiteMain.override_directory"] + "/logos").c_str(), 4) == 0) {
Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.override_directory"] + "/logos");
have_config = false; //save config
}
+ else if (access(std::string(ConfigList["WebsiteMain.directory"] + "/logos").c_str(), 4) == 0){
+ Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.directory"] + "/logos");
+ have_config = false; //save config
+ }
+#ifdef Y_CONFIG_USE_HOSTEDWEB
+ else if (access(std::string(ConfigList["WebsiteMain.hosted_directory"] + "/logos").c_str(), 4) == 0){
+ Config->setString("Tuxbox.LogosURL", ConfigList["WebsiteMain.hosted_directory"] + "/logos");
+ have_config = false; //save config
+ }
+#endif //Y_CONFIG_USE_HOSTEDWEB
}
ConfigList["Tuxbox.LogosURL"] = Config->getString("Tuxbox.LogosURL", "");
diff --git a/src/nhttpd/yhttpd_core/yresponse.cpp b/src/nhttpd/yhttpd_core/yresponse.cpp
index 96ed8f510..74af5515a 100644
--- a/src/nhttpd/yhttpd_core/yresponse.cpp
+++ b/src/nhttpd/yhttpd_core/yresponse.cpp
@@ -64,14 +64,6 @@ bool CWebserverResponse::SendResponse() {
// Checking and Preperation: Auth, static, cache, ...
//--------------------------------------------------------------
- // move to mod_sendfile ???
-#ifdef Y_CONFIG_USE_HOSTEDWEB
- // for hosted webs: rewrite URL
- std::string _hosted="/hosted/";
- if((Connection->Request.UrlData["path"]).compare(0,_hosted.length(),"/hosted/") == 0) // hosted Web ?
- Connection->Request.UrlData["path"]=Cyhttpd::ConfigList["WebsiteMain.hosted_directory"]
- +(Connection->Request.UrlData["path"]).substr(_hosted.length()-1);
-#endif //Y_CONFIG_USE_HOSTEDWEB
do {
if (Connection->RequestCanceled)
return false;
diff --git a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp
index ce3a2551f..81f3cabb6 100644
--- a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp
+++ b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp
@@ -65,6 +65,14 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) {
hh->status = HANDLED_NONE;
log_level_printf(4, "mod_sendfile prepare hook start url:%s\n", hh->UrlData["fullurl"].c_str());
+
+#ifdef Y_CONFIG_USE_HOSTEDWEB
+ // for hosted webs: rewrite URL
+ std::string _hosted=HOSTEDDOCUMENTURL;
+ if((hh->UrlData["path"]).compare(0,_hosted.length(),HOSTEDDOCUMENTURL) == 0) // hosted Web ?
+ hh->UrlData["path"]=hh->WebserverConfigList["WebsiteMain.hosted_directory"]+(hh->UrlData["path"]).substr(_hosted.length()-1);
+#endif //Y_CONFIG_USE_HOSTEDWEB
+
std::string mime = sendfileTypes[hh->UrlData["fileext"]];
if (((mime != "") || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true"))
&& !(hh->UrlData["fileext"] == "yhtm" || hh->UrlData["fileext"] == "yjs" || hh->UrlData["fileext"] == "ysh")) {
diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp
index b7995dc23..e6859fb25 100644
--- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp
+++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp
@@ -271,10 +271,18 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh,
bool found = false;
std::string htmlfullfilename, yresult, html_template;
+ bool isHosted = false;
+#ifdef Y_CONFIG_USE_HOSTEDWEB
+ // for hosted webs: search in hosted_directory only
+ std::string _hosted=hh->WebserverConfigList["WebsiteMain.hosted_directory"];
+ if((hh->UrlData["path"]).compare(0,_hosted.length(),hh->WebserverConfigList["WebsiteMain.hosted_directory"]) == 0) // hosted Web ?
+ isHosted = true;
+#endif //Y_CONFIG_USE_HOSTEDWEB
+
char cwd[255];
getcwd(cwd, 254);
- for (unsigned int i = 0; i < HTML_DIR_COUNT && !found; i++) {
- htmlfullfilename = HTML_DIRS[i] + "/" + htmlfilename;
+ for (unsigned int i = 0; i < (isHosted ? 1 : HTML_DIR_COUNT) && !found; i++) {
+ htmlfullfilename = (isHosted ? "" : HTML_DIRS[i]) + "/" + htmlfilename;
std::fstream fin(htmlfullfilename.c_str(), std::fstream::in);
if (fin.good()) {
found = true;
@@ -292,11 +300,11 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh,
}
chdir(cwd);
if (!found) {
- printf("[CyParser] Y-cgi:template %s not found in\n",
- htmlfilename.c_str());
- for (unsigned int i = 0; i < HTML_DIR_COUNT; i++) {
- printf("%s\n", HTML_DIRS[i].c_str());
- }
+ printf("[CyParser] Y-cgi:template %s not found %s\n", htmlfilename.c_str(), isHosted ? "" : "in");
+ if (!isHosted)
+ for (unsigned int i = 0; i < HTML_DIR_COUNT; i++) {
+ printf("%s\n", HTML_DIRS[i].c_str());
+ }
}
return yresult;
}
diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp
index b6fb4bb40..f79227351 100644
--- a/src/system/flashtool.cpp
+++ b/src/system/flashtool.cpp
@@ -583,22 +583,30 @@ std::string CMTDInfo::getMTDName(const int pos)
{
// TODO: check /proc/mtd specification to determine mtdname encoding
- return FILESYSTEM_ENCODING_TO_UTF8_STRING(mtdData[pos]->name);
+ if (pos >= 0)
+ return FILESYSTEM_ENCODING_TO_UTF8_STRING(mtdData[pos]->name);
+ return "";
}
std::string CMTDInfo::getMTDFileName(const int pos)
{
- return mtdData[pos]->filename;
+ if (pos >= 0)
+ return mtdData[pos]->filename;
+ return "";
}
int CMTDInfo::getMTDSize(const int pos)
{
- return mtdData[pos]->size;
+ if (pos >= 0)
+ return mtdData[pos]->size;
+ return 0;
}
int CMTDInfo::getMTDEraseSize(const int pos)
{
- return mtdData[pos]->erasesize;
+ if (pos >= 0)
+ return mtdData[pos]->erasesize;
+ return 0;
}
int CMTDInfo::findMTDNumber(const std::string & filename)
@@ -630,7 +638,11 @@ int CMTDInfo::getMTDEraseSize( const std::string & filename )
std::string CMTDInfo::findMTDsystem()
{
+#ifdef BOXMODEL_APOLLO
+ std::string sysfs = "root0";
+#else
std::string sysfs = "systemFS";
+#endif
for(int i = 0; i < getMTDCount(); i++) {
if(getMTDName(i) == sysfs) {
diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp
index d7dc12781..741d9bfb3 100644
--- a/src/system/helpers.cpp
+++ b/src/system/helpers.cpp
@@ -284,6 +284,24 @@ bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree)
return true;
}
+std::string getPathName(std::string &path)
+{
+ size_t pos = path.find_last_of("/");
+ if (pos == std::string::npos)
+ return path;
+ return path.substr(0, pos);
+}
+
+std::string getBaseName(std::string &path)
+{
+ size_t pos = path.find_last_of("/");
+ if (pos == std::string::npos)
+ return path;
+ if (path.length() == pos +1)
+ return "";
+ return path.substr(pos+1);
+}
+
std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/)
{
std::string result = str.erase(str.find_last_not_of(trimChars) + 1);
diff --git a/src/system/helpers.h b/src/system/helpers.h
index a811edab8..70db9525b 100644
--- a/src/system/helpers.h
+++ b/src/system/helpers.h
@@ -22,6 +22,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include
+
int my_system(const char * cmd);
int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */
@@ -34,6 +36,8 @@ int check_dir(const char * dir);
bool get_fs_usage(const char * dir, long &total, long &used, long *bsize=NULL);
bool get_mem_usage(unsigned long &total, unsigned long &free);
+std::string getPathName(std::string &path);
+std::string getBaseName(std::string &path);
std::string trim(std::string &str, const std::string &trimChars = " \n\r\t");
class CFileHelpers
diff --git a/src/system/locals.h b/src/system/locals.h
index e9aff93c9..6137d73fd 100644
--- a/src/system/locals.h
+++ b/src/system/locals.h
@@ -1386,6 +1386,7 @@ typedef enum
LOCALE_MOVIEBROWSER_USE_DIR,
LOCALE_MOVIEBROWSER_USE_MOVIE_DIR,
LOCALE_MOVIEBROWSER_USE_REC_DIR,
+ LOCALE_MOVIEBROWSER_YT_CONCURRENT_CONNECTIONS,
LOCALE_MOVIEBROWSER_YT_ERROR,
LOCALE_MOVIEBROWSER_YT_MAX_RESULTS,
LOCALE_MOVIEBROWSER_YT_MOST_DISCUSSED,
@@ -1395,6 +1396,7 @@ typedef enum
LOCALE_MOVIEBROWSER_YT_MOST_SHARED,
LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS,
LOCALE_MOVIEBROWSER_YT_ON_THE_WEB,
+ LOCALE_MOVIEBROWSER_YT_PREF_QUALITY,
LOCALE_MOVIEBROWSER_YT_PREV_RESULTS,
LOCALE_MOVIEBROWSER_YT_RECENTLY_FEATURED,
LOCALE_MOVIEBROWSER_YT_REGION,
@@ -1603,6 +1605,9 @@ typedef enum
LOCALE_RECORDING_IS_RUNNING,
LOCALE_RECORDING_START,
LOCALE_RECORDING_STOP,
+ LOCALE_RECORDING_TIME_HOUR,
+ LOCALE_RECORDING_TIME_HOURS,
+ LOCALE_RECORDING_TIME_MIN,
LOCALE_RECORDINGMENU_APIDS,
LOCALE_RECORDINGMENU_APIDS_AC3,
LOCALE_RECORDINGMENU_APIDS_ALT,
@@ -1962,6 +1967,11 @@ typedef enum
LOCALE_VIDEOMENU_VIDEOMODE,
LOCALE_WIZARD_INITIAL_SETTINGS,
LOCALE_WIZARD_INSTALL_SETTINGS,
+ LOCALE_WIZARD_SETUP,
+ LOCALE_WIZARD_SETUP_ADVANCED,
+ LOCALE_WIZARD_SETUP_EASY,
+ LOCALE_WIZARD_SETUP_TYPE,
+ LOCALE_WIZARD_SETUP_TYPE_HINT,
LOCALE_WIZARD_WELCOME_HEAD,
LOCALE_WIZARD_WELCOME_TEXT,
LOCALE_WORD_FROM,
diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h
index 84e7587ee..3cfb6d9d4 100644
--- a/src/system/locals_intern.h
+++ b/src/system/locals_intern.h
@@ -1386,6 +1386,7 @@ const char * locale_real_names[] =
"moviebrowser.use_dir",
"moviebrowser.use_movie_dir",
"moviebrowser.use_rec_dir",
+ "moviebrowser.yt_concurrent_connections",
"moviebrowser.yt_error",
"moviebrowser.yt_max_results",
"moviebrowser.yt_most_discussed",
@@ -1395,6 +1396,7 @@ const char * locale_real_names[] =
"moviebrowser.yt_most_shared",
"moviebrowser.yt_next_results",
"moviebrowser.yt_on_the_web",
+ "moviebrowser.yt_pref_quality",
"moviebrowser.yt_prev_results",
"moviebrowser.yt_recently_featured",
"moviebrowser.yt_region",
@@ -1603,6 +1605,9 @@ const char * locale_real_names[] =
"recording.is_running",
"recording.start",
"recording.stop",
+ "recording.time_hour",
+ "recording.time_hours",
+ "recording.time_min",
"recordingmenu.apids",
"recordingmenu.apids_ac3",
"recordingmenu.apids_alt",
@@ -1962,6 +1967,11 @@ const char * locale_real_names[] =
"videomenu.videomode",
"wizard.initial_settings",
"wizard.install_settings",
+ "wizard.setup",
+ "wizard.setup_advanced",
+ "wizard.setup_easy",
+ "wizard.setup_type",
+ "wizard.setup_type_hint",
"wizard.welcome_head",
"wizard.welcome_text",
"word.from",
diff --git a/src/system/set_threadname.h b/src/system/set_threadname.h
new file mode 100644
index 000000000..587b8c4f9
--- /dev/null
+++ b/src/system/set_threadname.h
@@ -0,0 +1,14 @@
+#ifndef __set_threadname_h__
+#define __set_threadname_h__
+#include
+#include
+#include
+
+inline void set_threadname(const char *name)
+{
+ char threadname[17];
+ strncpy(threadname, name, sizeof(threadname));
+ threadname[16] = 0;
+ prctl (PR_SET_NAME, (unsigned long)&threadname);
+}
+#endif
diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp
index 012684e77..3e9eb1d46 100644
--- a/src/system/ytparser.cpp
+++ b/src/system/ytparser.cpp
@@ -22,6 +22,7 @@
#include
#include
#include
+#include
#include
#include
@@ -29,6 +30,9 @@
#include
#include
+#include
+#include "set_threadname.h"
+
#include "ytparser.h"
#if LIBCURL_VERSION_NUM < 0x071507
@@ -59,19 +63,26 @@ void cYTVideoInfo::Dump()
printf("===================================================================\n");
}
-std::string cYTVideoInfo::GetUrl(int fmt)
+std::string cYTVideoInfo::GetUrl(int fmt, bool mandatory)
{
yt_urlmap_iterator_t it;
if (fmt) {
if ((it = formats.find(fmt)) != formats.end())
return it->second.GetUrl();
- return "";
+ if (mandatory)
+ return "";
}
- if ((it = formats.find(37)) != formats.end())
+ if ((it = formats.find(37)) != formats.end()) // 1080p MP4
return it->second.GetUrl();
- if ((it = formats.find(22)) != formats.end())
+ if ((it = formats.find(22)) != formats.end()) // 720p MP4
return it->second.GetUrl();
- if ((it = formats.find(18)) != formats.end())
+#if 0
+ if ((it = formats.find(35)) != formats.end()) // 480p FLV
+ return it->second.GetUrl();
+ if ((it = formats.find(34)) != formats.end()) // 360p FLV
+ return it->second.GetUrl();
+#endif
+ if ((it = formats.find(18)) != formats.end()) // 270p/360p MP4
return it->second.GetUrl();
return "";
}
@@ -83,36 +94,41 @@ cYTFeedParser::cYTFeedParser()
feedmode = -1;
tquality = "mqdefault";
max_results = 25;
+ concurrent_downloads = 2;
+ curl_handle = curl_easy_init();
}
cYTFeedParser::~cYTFeedParser()
{
+ curl_easy_cleanup(curl_handle);
}
size_t cYTFeedParser::CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data)
{
- std::string* pStr = (std::string*) data;
- pStr->append((char*) ptr, nmemb);
+ if (size * nmemb > 0) {
+ std::string* pStr = (std::string*) data;
+ pStr->append((char*) ptr, nmemb);
+ }
return size*nmemb;
}
-bool cYTFeedParser::getUrl(std::string &url, std::string &answer)
+bool cYTFeedParser::getUrl(std::string &url, std::string &answer, CURL *_curl_handle)
{
- CURL * curl_handle = curl_easy_init();
- curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
- curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, &cYTFeedParser::CurlWriteToString);
- curl_easy_setopt(curl_handle, CURLOPT_FILE, (void *)&answer);
- curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, 1);
- curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT);
- curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, (long)1);
+ if (!_curl_handle)
+ _curl_handle = curl_handle;
+
+ curl_easy_setopt(_curl_handle, CURLOPT_URL, url.c_str());
+ curl_easy_setopt(_curl_handle, CURLOPT_WRITEFUNCTION, &cYTFeedParser::CurlWriteToString);
+ curl_easy_setopt(_curl_handle, CURLOPT_FILE, (void *)&answer);
+ curl_easy_setopt(_curl_handle, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(_curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT);
+ curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1);
char cerror[CURL_ERROR_SIZE];
- curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, cerror);
+ curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);
printf("try to get [%s] ...\n", url.c_str());
- CURLcode httpres = curl_easy_perform(curl_handle);
-
- curl_easy_cleanup(curl_handle);
+ CURLcode httpres = curl_easy_perform(_curl_handle);
printf("http: res %d size %d\n", httpres, answer.size());
@@ -123,32 +139,34 @@ bool cYTFeedParser::getUrl(std::string &url, std::string &answer)
return true;
}
-bool cYTFeedParser::DownloadUrl(std::string &url, std::string &file)
+bool cYTFeedParser::DownloadUrl(std::string &url, std::string &file, CURL *_curl_handle)
{
+ if (!_curl_handle)
+ _curl_handle = curl_handle;
+
FILE * fp = fopen(file.c_str(), "wb");
if (fp == NULL) {
perror(file.c_str());
return false;
}
- CURL * curl_handle = curl_easy_init();
- curl_easy_setopt(curl_handle, CURLOPT_URL, url.c_str());
- curl_easy_setopt(curl_handle, CURLOPT_FILE, fp);
- curl_easy_setopt(curl_handle, CURLOPT_FAILONERROR, 1);
- curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT);
- curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, (long)1);
+ curl_easy_setopt(_curl_handle, CURLOPT_URL, url.c_str());
+ curl_easy_setopt(_curl_handle, CURLOPT_WRITEFUNCTION, NULL);
+ curl_easy_setopt(_curl_handle, CURLOPT_FILE, fp);
+ curl_easy_setopt(_curl_handle, CURLOPT_FAILONERROR, 1);
+ curl_easy_setopt(_curl_handle, CURLOPT_TIMEOUT, URL_TIMEOUT);
+ curl_easy_setopt(_curl_handle, CURLOPT_NOSIGNAL, (long)1);
char cerror[CURL_ERROR_SIZE];
- curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, cerror);
+ curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror);
printf("try to get [%s] ...\n", url.c_str());
- CURLcode httpres = curl_easy_perform(curl_handle);
+ CURLcode httpres = curl_easy_perform(_curl_handle);
double dsize;
- curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD, &dsize);
- curl_easy_cleanup(curl_handle);
+ curl_easy_getinfo(_curl_handle, CURLINFO_SIZE_DOWNLOAD, &dsize);
fclose(fp);
- printf("http: res %d size %f.\n", httpres, dsize);
+ printf("http: res %d size %g.\n", httpres, dsize);
if (httpres != 0) {
printf("curl error: %s\n", cerror);
@@ -160,9 +178,7 @@ bool cYTFeedParser::DownloadUrl(std::string &url, std::string &file)
void cYTFeedParser::decodeUrl(std::string &url)
{
- CURL * curl_handle = curl_easy_init();
char * str = curl_easy_unescape(curl_handle, url.c_str(), 0, NULL);
- curl_easy_cleanup(curl_handle);
if(str)
url = str;
curl_free(str);
@@ -170,9 +186,7 @@ void cYTFeedParser::decodeUrl(std::string &url)
void cYTFeedParser::encodeUrl(std::string &txt)
{
- CURL * curl_handle = curl_easy_init();
char * str = curl_easy_escape(curl_handle, txt.c_str(), txt.length());
- curl_easy_cleanup(curl_handle);
if(str)
txt = str;
curl_free(str);
@@ -357,12 +371,22 @@ bool cYTFeedParser::parseFeedXml(std::string &answer)
/* save first one, if wanted not found */
if (vinfo.thumbnail.empty())
vinfo.thumbnail = thumbnail;
- if (ParseVideoInfo(vinfo))
- videos.push_back(vinfo);
+ vinfo.ret = false;
+ videos.push_back(vinfo);
}
entry = entry->xmlNextNode;
}
xmlFreeDoc(answer_parser);
+
+ GetVideoUrls();
+
+ std::vector::iterator pos = videos.begin();
+ while (pos != videos.end())
+ if ((*pos).ret)
+ ++pos;
+ else
+ pos = videos.erase(pos);
+
parsed = !videos.empty();
return parsed;
}
@@ -529,7 +553,7 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri
return ParseFeed(url);
}
-bool cYTFeedParser::ParseVideoInfo(cYTVideoInfo &vinfo)
+bool cYTFeedParser::ParseVideoInfo(cYTVideoInfo &vinfo, CURL *_curl_handle)
{
bool ret = false;
std::vector estr;
@@ -544,44 +568,98 @@ bool cYTFeedParser::ParseVideoInfo(cYTVideoInfo &vinfo)
vurl += "&ps=default&eurl=&gl=US&hl=en";
printf("cYTFeedParser::ParseVideoInfo: get [%s]\n", vurl.c_str());
std::string answer;
- if (!getUrl(vurl, answer))
+ if (!getUrl(vurl, answer, _curl_handle))
continue;
ret = decodeVideoInfo(answer, vinfo);
if (ret)
break;
}
+ vinfo.ret = ret;
return ret;
}
+void *cYTFeedParser::DownloadThumbnailsThread(void *arg)
+{
+ set_threadname("YT::DownloadThumbnails");
+ bool ret = true;
+ cYTFeedParser *caller = (cYTFeedParser *)arg;
+ CURL *c = curl_easy_init();
+ unsigned int i;
+ do {
+ OpenThreads::ScopedLock m_lock(caller->mutex);
+ i = caller->worker_index++;
+ } while (i < caller->videos.size() && ((ret &= caller->DownloadThumbnail(caller->videos[i], c)) || true));
+ curl_easy_cleanup(c);
+ pthread_exit(&ret);
+}
+
+bool cYTFeedParser::DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle)
+{
+ if (!_curl_handle)
+ _curl_handle = curl_handle;
+ bool found = false;
+ if (!vinfo.thumbnail.empty()) {
+ std::string fname = thumbnail_dir + "/" + vinfo.id + ".jpg";
+ found = !access(fname.c_str(), F_OK);
+ if (!found)
+ found = DownloadUrl(vinfo.thumbnail, fname, _curl_handle);
+ if (found)
+ vinfo.tfile = fname;
+ }
+ return found;
+}
+
bool cYTFeedParser::DownloadThumbnails()
{
- bool ret = false;
- if (mkdir(thumbnail_dir.c_str(), 0755)) {
+ bool ret = true;
+ if (mkdir(thumbnail_dir.c_str(), 0755) && errno != EEXIST) {
perror(thumbnail_dir.c_str());
- //return ret;
+ return false;
}
- for (unsigned i = 0; i < videos.size(); i++) {
- if (!videos[i].thumbnail.empty()) {
- std::string fname = thumbnail_dir;
- fname += "/";
- fname += videos[i].id;
- fname += ".jpg";
- bool found = !access(fname.c_str(), F_OK);
- if (!found)
- found = DownloadUrl(videos[i].thumbnail, fname);
- if (found)
- videos[i].tfile = fname;
- ret |= found;
- }
+ unsigned int max_threads = concurrent_downloads;
+ if (videos.size() < max_threads)
+ max_threads = videos.size();
+ pthread_t ta[max_threads];
+ worker_index = 0;
+ for (unsigned i = 0; i < max_threads; i++)
+ pthread_create(&ta[i], NULL, cYTFeedParser::DownloadThumbnailsThread, this);
+ for (unsigned i = 0; i < max_threads; i++) {
+ void *r;
+ pthread_join(ta[i], &r);
+ ret &= *((bool *)r);
}
return ret;
}
+void *cYTFeedParser::GetVideoUrlsThread(void *arg)
+{
+ set_threadname("YT::GetVideoUrls");
+ int ret = 0;
+ cYTFeedParser *caller = (cYTFeedParser *)arg;
+ CURL *c = curl_easy_init();
+ unsigned int i;
+ do {
+ OpenThreads::ScopedLock m_lock(caller->mutex);
+ i = caller->worker_index++;
+ } while (i < caller->videos.size() && ((ret |= caller->ParseVideoInfo(caller->videos[i], c)) || true));
+ curl_easy_cleanup(c);
+ pthread_exit(&ret);
+}
+
bool cYTFeedParser::GetVideoUrls()
{
- bool ret = false;
- for (unsigned i = 0; i < videos.size(); i++) {
- ret |= ParseVideoInfo(videos[i]);
+ int ret = 0;
+ unsigned int max_threads = concurrent_downloads;
+ if (videos.size() < max_threads)
+ max_threads = videos.size();
+ pthread_t ta[max_threads];
+ worker_index = 0;
+ for (unsigned i = 0; i < max_threads; i++)
+ pthread_create(&ta[i], NULL, cYTFeedParser::GetVideoUrlsThread, this);
+ for (unsigned i = 0; i < max_threads; i++) {
+ void *r;
+ pthread_join(ta[i], &r);
+ ret |= *((int *)r);
}
return ret;
}
diff --git a/src/system/ytparser.h b/src/system/ytparser.h
index 8978f7ef0..fb97d65d1 100644
--- a/src/system/ytparser.h
+++ b/src/system/ytparser.h
@@ -28,6 +28,9 @@
#include
#include
+#include
+#include
+
class cYTVideoUrl
{
public:
@@ -56,9 +59,10 @@ class cYTVideoInfo
std::string published;
int duration;
yt_urlmap_t formats;
+ bool ret;
void Dump();
- std::string GetUrl(int fmt = 0);
+ std::string GetUrl(int fmt = 0, bool mandatory = true);
};
@@ -80,6 +84,7 @@ class cYTFeedParser
int feedmode;
int max_results;
+ int concurrent_downloads;
bool parsed;
yt_video_list_t videos;
@@ -87,14 +92,20 @@ class cYTFeedParser
std::string getXmlAttr(xmlNodePtr node, const char * attr);
std::string getXmlData(xmlNodePtr node);
+ CURL *curl_handle;
+ OpenThreads::Mutex mutex;
+ int worker_index;
+ static void* GetVideoUrlsThread(void*);
+ static void* DownloadThumbnailsThread(void*);
+
static size_t CurlWriteToString(void *ptr, size_t size, size_t nmemb, void *data);
- static void encodeUrl(std::string &txt);
- static void decodeUrl(std::string &url);
+ void encodeUrl(std::string &txt);
+ void decodeUrl(std::string &url);
static void splitString(std::string &str, std::string delim, std::vector &strlist, int start = 0);
static void splitString(std::string &str, std::string delim, std::map &strmap, int start = 0);
static bool saveToFile(const char * name, std::string str);
- bool getUrl(std::string &url, std::string &answer);
- bool DownloadUrl(std::string &url, std::string &file);
+ bool getUrl(std::string &url, std::string &answer, CURL *_curl_handle = NULL);
+ bool DownloadUrl(std::string &url, std::string &file, CURL *_curl_handle = NULL);
bool parseFeedXml(std::string &answer);
bool decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo);
bool supportedFormat(int fmt);
@@ -122,7 +133,8 @@ class cYTFeedParser
~cYTFeedParser();
bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = "");
- bool ParseVideoInfo(cYTVideoInfo &vinfo);
+ bool ParseVideoInfo(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL);
+ bool DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL);
bool GetVideoUrls();
bool DownloadThumbnails();
void Dump();
@@ -138,6 +150,7 @@ class cYTFeedParser
void SetRegion(std::string reg) { region = reg; }
void SetMaxResults(int count) { max_results = count; }
+ void SetConcurrentDownloads(int count) { concurrent_downloads = count; }
};
#endif
diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp
index d160e2fd6..86f95f27e 100644
--- a/src/zapit/src/getservices.cpp
+++ b/src/zapit/src/getservices.cpp
@@ -474,19 +474,26 @@ void CServiceManager::FindTransponder(xmlNodePtr search)
while (search) {
fe_type_t delsys = FE_QPSK;
- if (!(strcmp(xmlGetName(search), "cable")))
+ t_satellite_position satellitePosition = xmlGetSignedNumericAttribute(search, "position", 10);
+ if (!(strcmp(xmlGetName(search), "cable"))) {
delsys = FE_QAM;
- else if (!strcmp(xmlGetName(search), "terrestrial"))
+ char * name = xmlGetAttribute(search, "name");
+ satellitePosition = GetSatellitePosition(name);
+ }
+ else if (!strcmp(xmlGetName(search), "terrestrial")) {
delsys = FE_OFDM;
+ char * name = xmlGetAttribute(search, "name");
+ satellitePosition = GetSatellitePosition(name);
+ }
else if ((strcmp(xmlGetName(search), "sat"))) {
search = search->xmlNextNode;
continue;
}
-
+#if 0
//t_satellite_position satellitePosition = xmlGetSignedNumericAttribute(search, "position", 10);
char * name = xmlGetAttribute(search, "name");
t_satellite_position satellitePosition = GetSatellitePosition(name);
-
+#endif
DBG("going to parse dvb-%c provider %s\n", xmlGetName(search)[0], xmlGetAttribute(search, "name"));
ParseTransponders(search->xmlChildrenNode, satellitePosition, delsys);
newfound++;
|
|
|