Changeset 1372

Show
Ignore:
Timestamp:
03/03/07 20:28:47 (2 years ago)
Author:
jm3
Message:

adjustments to support adjusted delicious export format

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/bin/import-bookmarks.pl

    r857 r1372  
    11#!/usr/bin/perl 
     2use FeedMeLinks::Environment; 
     3use File::Temp qw/ :mktemp  /; 
     4 
     5 
    26$glc = 0; 
    37 
    4 #p( "convert line-endings to unix" ); 
    5 #p( "determine browser" ); 
    6  
    7 my ($link, $tag, @tags, @links, @folks, $hideGarbage, $dd, $glc, $mandatory_tag, $path); 
     8my ($link, $tag, @tags, @links, @folks, $hideGarbage, $dd, $glc, $mandatory_tag, $path, $bin, $format); 
    89 
    910$link = $tag = undef; 
     
    1819# extract the user name from the file path (this practice oculd be considered a bit shady...) 
    1920$path = $filename = $ARGV[0]; 
    20 $parser = $ARGV[1]; 
    21 $link_xslt = $ARGV[2]; 
    22 $tag_xslt = $ARGV[3]; 
     21$parser     = $ARGV[1]; 
     22$link_xslt = $ARGV[2]; 
     23$tag_xslt   = $ARGV[3]; 
    2324$path =~ s:\/([^/]+)$::; #strip filename 
    24 #$path =~ s:.*\/([^/]+)$:$1:; #strip all but parent dir 
     25$bin = FeedMeLinks::Environment::get_webserver_root() . "/bin"; 
     26 
     27($fh, $converted) = mkstemp( "bookmark_conversion_XXXX" ); 
     28# one of: delicious-hybrid, netscape, delicious-API 
     29$format = detect_bookmarks_format( $bin, $filename ); 
     30print "format: $format\n"; 
     31if( $format == "delicious-hybrid" ) { 
     32        $cmd = "$bin/hybrid-to-xml.pl $filename > $converted"; 
     33        print "cmd: $cmd\n"; 
     34        $out =`$cmd`; 
     35        print "converted is $converted\n out is : $out\n"; 
     36        $filename = $converted; 
     37
     38 
     39exit; 
    2540 
    2641while( <> ) { 
     
    112127add_pending_link_or_tag(); 
    113128write_raw_files(); 
     129unlink( $converted ); 
     130 
    114131exit( 0 ); 
    115132 
    116133## END ## 
    117134 
     135sub detect_bookmarks_format { 
     136        my( $bin, $filename) = @_; 
     137        my $cmd = "$bin/detect-bookmarks-file-format.sh $filename"; 
     138        my $out = `$cmd`; 
     139        return $out; 
     140} 
    118141 
    119142sub write_raw_files() { 
     
    172195        #print "DEBUG> " . $_[0] . "\n"; 
    173196} 
     197 
  • feedmelinks/import/index.php

    r1365 r1372  
    2727                $path       = $b["path"]; 
    2828 
    29                 echo "dir $dir, path $path"; 
    30  
    3129                $show_form = true; 
    3230 
  • feedmelinks/import/ready-to-import.php

    r1328 r1372  
    1 <% include_once( "../modules/utils.inc.php" ); 
     1<?php 
     2        include_once( "../modules/utils.inc.php" ); 
    23 
    34        $u   = $sessionUserId = $_COOKIE["c_uid"]; 
     
    78                include_once( "$modules/header.inc.php" ); 
    89 
    9 %
     10?
    1011<br /> 
    11 <% 
     12<?php 
    1213 
    1314                $b =  get_bookmarks_info( $u ); 
     
    5960 
    6061                        } else { 
    61                                 fatal( "Wow! You have a very nice collection of links. Because you have approximately " . $ls . " links and " . $ts . " tags, your import has bene 'flagged for review' by our team to make sure everything is imported correctly. A notice has been sent to the team and they will be in contact with you shortly to finish the import process. <p />Thanks very much,<p /> -- <a href='http://jm3.net/'><b>John Manoogian III</b></a><br /> &nbsp; &nbsp;<a href='http://codeswami.com'>Code Swami</a>: Feed Me Links" ); 
     62                                fatal( "Hello, new users' link uploads are autmatically capped to protect against spamming. You import has been 'flagged for review'. An admin will contact you shortly to finish the import process. <p />Sorry for the inconvenience,<p /> -- <a href='http://jm3.net/'><b>John Manoogian III</b></a><br /> &nbsp; &nbsp;<a href='http://codeswami.com'>Code Swami</a>: Feed Me Links" ); 
    6263 
    6364                                $headers = ""; 
     
    8384                echo bounceTo( $site . "/login?bounceToPage=import/" ); 
    8485        } 
    85 %
     86?
  • feedmelinks/modules/utils.inc.php

    r1360 r1372  
    24232423  } else if( $argWhichQuery  == "tag" ) { 
    24242424    return " 
    2425     SELECT * FROM links, tags AS t, links_tags_xref AS x WHERE x.tagID = " . urlencode( $args[1] ) . " AND x.linkID = links.ID AND t.ID = x.tagID AND userid = '" 
     2425    SELECT * FROM links, tags AS t, links_tags_xref AS x WHERE x.tagID = " . urlencode( $args[1] ) . " AND x.linkID = links.ID AND t.ID = x.tagID AND links.userid = '" 
    24262426    . urlencode( $args[2] ) ."';"; 
    24272427