From e883a64bd78fd996ba48358c16ed97716f3b3a50 Mon Sep 17 00:00:00 2001 From: agibert Date: Tue, 27 Aug 2013 16:36:46 +0000 Subject: [PATCH] - Add Sitemap support, - Add Sitemap button. --- html/lmbrowse.php | 331 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 249 insertions(+), 82 deletions(-) diff --git a/html/lmbrowse.php b/html/lmbrowse.php index 373acfc..43303ef 100644 --- a/html/lmbrowse.php +++ b/html/lmbrowse.php @@ -1,13 +1,13 @@         + +    
@@ -990,67 +992,6 @@ function lmb_news_tab_get( ) -/*--------------------------------------------------------------------------------------------------------------------*/ -/* News Tab */ -/*--------------------------------------------------------------------------------------------------------------------*/ - -function lmb_news_tab_old( ) -{ - global $lmb_url; - - - $news_file = "news.txt"; - - $line = array(); - $cmd = "sed -e 's/\t*\t/\t/g' ${news_file}"; - - exec( $cmd, $line); - - - ob_start(); - - for( $i = 0; $i < count($line); $i++) - { - $tab = explode( "\t", $line[$i]); - $css_row = ( $i + 1) % 2 + 1; - - if( count($tab) > 2) - { - $play_name = $tab[2]; - $play_type = $tab[3]; - $play_id = $tab[4]; - $play_priority = $tab[5]; - - $link_tag = ""; - $img_tag = "\"\"/"; - $height = 110; - $play_tag=" {$link_tag}{$play_name} - {$link_tag}{$img_tag}"; - $colspan_tag = ""; - } - else - { - $play_tag = ""; - $cover_tag = ""; - $colspan_tag = "colspan=\"3\""; - } - - echo " - - {$tab[0]} - ".lmb_html_text_format( "{$tab[1]}")." -{$play_tag} - -"; - } - - $data = ob_get_contents(); - ob_end_clean(); - - lmb_make_tab( "news", "news", "r", "/images/lm-logo5-n-220.png", $data); -} - - /*--------------------------------------------------------------------------------------------------------------------*/ /* News Tab */ /*--------------------------------------------------------------------------------------------------------------------*/ @@ -1141,15 +1082,223 @@ function lmb_main_page() +/*--------------------------------------------------------------------------------------------------------------------*/ +/* SiteMap Item */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_sitemap_item( $item_type, $page_url, $img_tab) +{ + global $lmb_url; + + + echo " +"; + + echo " http://www.langueur-monotone.com{$lmb_url}${page_url} + 2013-08-20 + weekly + 0.5 +"; + + if( isset( $img_tab)) + { + foreach( $img_tab as $img) + { + echo " + http://www.langueur-monotone.com/{$img["url"]} + {$img["title"]} + +"; + } + } + + echo " +"; +} + + + +/*--------------------------------------------------------------------------------------------------------------------*/ +/* SiteMap Track */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_sitemap_track( $play_type, $play_id, $play_priority, $track_id) +{ + $play_path = "discography/{$play_type}/{$play_priority}-{$play_id}"; + $url = "?page=track&type={$play_type}&id={$play_id}&priority={$play_priority}&tid={$track_id}"; + $img_tab = array(); + $size = 1024; + + lmb_sitemap_item( "track", "{$url}", $img_tab); +} + + + +/*--------------------------------------------------------------------------------------------------------------------*/ +/* SiteMap Play */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_sitemap_play( $play_type, $play_id, $play_priority) +{ + $play_path = "discography/{$play_type}/{$play_priority}-{$play_id}"; + $cover_path = "{$play_path}/covers"; + $extra_path = "{$play_path}/extras"; + $play_info = lmb_play_info_get( $play_type, $play_id, $play_priority); + $url = "?page=play&type={$play_type}&id={$play_id}&priority={$play_priority}"; + $img_tab = array(); + $img_idx = 0; + + $play_title = lmb_play_title_get( $play_type, $play_id, $play_priority); + + $img_tab[$img_idx ]["url"] = "{$play_path}/logos/{$play_id}-logo-1-128.png"; + $img_tab[$img_idx++]["title"] = "Langueur Monotone - {$play_title} - Logo 1"; + $img_tab[$img_idx ]["url"] = "{$play_path}/logos/{$play_id}-logo-2-128.png"; + $img_tab[$img_idx++]["title"] = "Langueur Monotone - {$play_title} - Logo 2"; + + /* Cover Dump */ + + $cmd = "ls {$cover_path}/{$play_id}-cover-*.png | sed -e 's/.*{$play_id}-//' | grep -v icon.png | sort "; + exec( $cmd, $cover_tab); + + for( $i = 0, $j = 1; $i < count($cover_tab); $i++, $j++) + { + $cover_info_tab = explode( "-", $cover_tab[$i]); + $nb = $cover_info_tab[1]; + $size = str_replace( ".png", "", $cover_info_tab[2]); + + $img_tab[$img_idx ]["url"] = "{$cover_path}/{$play_id}-cover-{$cover_tab[$i]}"; + $img_tab[$img_idx++]["title"] = "Langueur Monotone - {$play_title} - Cover {$nb} ({$size})"; + } + + + /* Extra Dump */ + + if( ! file_exists( "{$extra_path}/.hide" )) + { + $cmd = "ls {$extra_path}/{$play_id}-*.png | sed -e 's/.*{$play_id}-//' | grep -v icon.png | sort "; + exec($cmd, $extra_tab); + + for( $i = 0, $j = 1; $i < count($extra_tab); $i++, $j++) + { + $extra_info_tab = explode( "-", $extra_tab[$i]); + $type = ucfirst( $extra_info_tab[0]); + $nb = $extra_info_tab[1]; + $format = str_replace( "_", "/", $extra_info_tab[2]); + $size = str_replace( ".png", "", $extra_info_tab[3]); + + $img_tab[$img_idx ]["url"] = "{$extra_path}/{$play_id}-{$extra_tab[$i]}"; + $img_tab[$img_idx++]["title"] = "Langueur Monotone - {$play_title} - Extra - {$type} {$nb} ({$format}-{$size})"; + } + } + + + + lmb_sitemap_item( "play", "{$url}", $img_tab); + + $track_list_info = lmb_tracklist_info_get( $play_type, $play_id, $play_priority); + + foreach( $track_list_info as $track_info) + { + lmb_sitemap_track( $play_type, $play_id, $play_priority, str_pad( "{$track_info["id"]}", 2, '0', STR_PAD_LEFT)); + } +} + + + +/*--------------------------------------------------------------------------------------------------------------------*/ +/* SiteMap Play Type */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_sitemap_play_type( $play_type) +{ + $path = "discography/{$play_type}"; + $line = array(); + $cmd = "ls -d {$path}/??-* | sed -e 's/.*\///'"; + + exec($cmd, $line); + + for( $i = 0; $i < count($line); $i++) + { + $play_tab = explode( "-", $line[$i]); + $play_priority = $play_tab[0]; + $play_id = $play_tab[1]; + + if( ! file_exists( "{$path}/{$play_priority}-{$play_id}/.hide" )) + { + lmb_sitemap_play( $play_type, $play_id, $play_priority); + } + } +} + + + +/*--------------------------------------------------------------------------------------------------------------------*/ +/* SiteMap Page */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_sitemap_page() +{ + global $lmb_myname; + global $lmb_myver; + global $time_start; + + + header( 'Content-Type: application/xml'); + + echo " + + + +"; + + $img_tab = array(); + $size = 220; + $img_tab[0]["url"] = "{$play_path}/images/lm-logo5-n-{$size}.png"; + $img_tab[0]["title"] = "Langueur Monotone - Logo 5 ({$size})"; + + lmb_sitemap_item( "top", "", $img_tab); + +// $img_tab = array(); +// lmb_sitemap_item( "page", "?page=rss", $img_tab); + + $img_tab = array(); + $size = 220; + $img_tab[0]["url"] = "{$play_path}/images/lm-logo6-n-{$size}.png"; + $img_tab[0]["title"] = "Langueur Monotone - Logo 6 ({$size})"; + + lmb_sitemap_item( "page", "?page=about", $img_tab); + + $img_tab = array(); + lmb_sitemap_item( "page", "?page=discography", $img_tab); + + lmb_sitemap_play_type( "ep", $img_tab); + lmb_sitemap_play_type( "lp", $img_tab); + lmb_sitemap_play_type( "oldies", $img_tab); + + $time_stop = microtime_float(); + $time_elaps = intval( ( $time_stop - $time_start) * 1000) / 1000; + + echo " + +"; +} + + + /*--------------------------------------------------------------------------------------------------------------------*/ /* RSS Page */ /*--------------------------------------------------------------------------------------------------------------------*/ function lmb_rss_page() { - header( 'Content-Type: application/rss+xml'); + global $lmb_myname; + global $lmb_myver; + global $time_start; - echo " + + header( 'Content-Type: application/rss+xml'); + + echo " +"; + + $time_stop = microtime_float(); + $time_elaps = intval( ( $time_stop - $time_start) * 1000) / 1000; + + echo " "; } @@ -1661,6 +1816,7 @@ function lmb_track_info_get( $play_type, $play_id, $play_priority, $track_id) /*--------------------------------------------------------------------------------------------------------------------*/ /* Track File Tag Get */ /*--------------------------------------------------------------------------------------------------------------------*/ + function lmb_track_file_tag_get( $play_type, $play_id, $play_priority, $track_id) { global $lmb_url; @@ -2495,25 +2651,23 @@ function lmb_play_type_name_get( $play_type_id) function lmb_play_name_get( $play_type, $play_id, $play_priority) { - $file = "discography/{$play_type}/{$play_priotiry}-{}-*"; + $play_info = lmb_play_info_get( $play_type, $play_id, $play_priority); - switch( "{$play_type_id}") - { - case "ep": - { - return( "EP"); - } + return( "{$play_info["name"]}"); +} - case "lp": - { - return( "LP"); - } - case "oldies": - { - return( "Oldies"); - } - } + +/*--------------------------------------------------------------------------------------------------------------------*/ +/* Play Title Get */ +/*--------------------------------------------------------------------------------------------------------------------*/ + +function lmb_play_title_get( $play_type, $play_id, $play_priority) +{ + $play_name = lmb_play_name_get( $play_type, $play_id, $play_priority); + $play_type_name = lmb_play_type_name_get( $play_type); + + return( "{$play_name} - {$play_type_name}"); } @@ -2528,10 +2682,17 @@ function lmb_play_page( $play_type, $play_id, $play_priority) $play_info = lmb_play_info_get( $play_type, $play_id, $play_priority); +/* $play_name = lmb_play_type_name_get( $play_type); $play_title = "{$play_info["name"]} - {$play_name}"; +*/ + + + $play_title = lmb_play_title_get( $play_type, $play_id, $play_priority); $play_image = "{$play_type}"; + + // lmb_header( 3, "Langueur Monotone - {$play_title} Page", "/images/title-{$play_image}.png", "{$play_name}", "Langueur Monotone play page, giving all the information about {$play_info["name"]} {$play_name}", "{$play_type},{$play_info["name"]}", 0); lmb_header( 3, "Langueur Monotone - {$play_title} Page", "/images/title-{$play_image}.png", "{$play_title}", "Langueur Monotone play page, giving all the information about {$play_info["name"]} {$play_name}", "{$play_type},{$play_info["name"]}", 0); lmb_play_body( $play_type, $play_id, $play_priority); @@ -3525,6 +3686,12 @@ function lmb_get_proceed( $get_array) switch ($page_id) { + case "sitemap": + { + lmb_sitemap_page( ); + break; + } + case "rss": { lmb_rss_page( );