@@ -796,36 +796,46 @@ function parse_SNGM(&$textall)
796
796
*/
797
797
798
798
//////////////////////////
799
- // $textall : contenu de "http ://www .camptocamp.org/outings/list/orderby/date/order/desc/page/$page "
799
+ // $textall : contenu de "https ://api .camptocamp.org/outings?pl=fr&act=skitouring "
800
800
// $last_id : ne garde que les sorties dont l'id > $last_id
801
801
// renvoie dans $textall un buffer pret a etre ecrit dans le fichier cache.
802
802
// et en return value : $new_id (l'id le plus recent).
803
- function parse_Skirando (&$ textall ,$ last_id )
803
+ function parse_Skirando (&$ textall , $ last_id )
804
804
{
805
- global $ dlim ;
805
+ global $ dlim ;
806
+
807
+ $ obj = json_decode ($ textall , true );
808
+ $ outings = $ obj ['documents ' ];
809
+ $ textall = '' ;
810
+ $ new_id = $ last_id ;
811
+
812
+ foreach ($ outings as $ outing ) {
813
+ $ id = $ outing ['document_id ' ];
814
+ $ date = $ outing ['date_start ' ];
815
+ $ name = $ outing ['locales ' ][0 ]['title ' ];
816
+ $ link = 'https://www.camptocamp.org/outings/ ' . $ id ;
817
+ $ area = c2c_area ($ outing );
818
+ $ cotation = "" ; // TODO get_cotation($outing);
819
+ $ author = $ outing ['author ' ]['name ' ];
820
+ if ($ date < $ dlim ) break ; // not older than one month
821
+ $ textall .= "c2c $ id \n$ date $ cotation \n$ name \n$ link \n$ area \n$ author \n" ;
822
+ if ($ id > $ new_id ) $ new_id = $ id ;
823
+ }
824
+
825
+ return $ new_id ;
826
+ }
806
827
807
- $ obj = json_decode ($ textall , true );
808
- $ outings = $ obj ['documents ' ];
809
- $ textall = '' ;
810
-
811
- $ new_id = $ last_id ;
812
-
813
- foreach ($ outings as $ outing ) {
814
- $ id = $ outing ['document_id ' ];
815
- $ date = $ outing ['date_start ' ];
816
- $ name = $ outing ['locales ' ][0 ]['title ' ];
817
- $ link = 'https://www.camptocamp.org/outings/ ' . $ id ;
818
- $ area = get_area ($ outing );
819
- $ cotation = "" ; // TODO get_cotation($outing);
820
- $ author = $ outing ['author ' ]['name ' ];
821
- if ($ date < $ dlim ) break ; // not older than one month
822
- $ textall .= "c2c $ id \n$ date $ cotation \n$ name \n$ link \n$ area \n$ author \n" ;
823
- if ($ id > $ new_id ) $ new_id = $ id ;
824
- }
825
-
826
- return $ new_id ;
828
+ function c2c_area ($ outing ) {
829
+ foreach ($ outing ["areas " ] as $ area ) {
830
+ $ name = $ area ["locales " ][0 ]["title " ];
831
+ if ($ area ["area_type " ] == "range " ) {
832
+ break ;
833
+ }
834
+ }
835
+ return $ name ;
827
836
}
828
837
838
+
829
839
// cherche la cot d'une volo-course si dispo (et ajoute les participants !)
830
840
function volo_cot ($ url ,&$ parts )
831
841
{
0 commit comments