• Hi,

    I am trying to get to grips with the .csv import. Could you put some example albums with the corresponding .csv files onto https://wppa.nl/ ?

    I am trying to import 12000 Albums. I have the .jpgs in folders (one folder per album, max 11 photos per album). Each folder has a text file which has the following structure:

    Full User Name
    User@email
    Album Title eg: Album of trackday
    Date of Album eg: “Jul 25 2002 17:08:07”
    Name of this album upload folder eg: 1027616887
    Filename first photo eg: 1~1027616887.jpg
    Comment first photo eg: The racer at Watkins Glen last month with a ton of BMWs
    Filename second photo eg: 2~1027616887.jpg
    Comment first photo eg: Aluminum Ski Slope with all the buttons removed. I wanted a vintage race car look.

    and so on until the final photo
    eg:
    7~1027616887.jpg
    First point of impact. I\’ll try to save the 1/4 and just replace the lens and bumpers.

    Do I need to make one .csv for all the uploads, or can I autocreate the albums from individual .csv files within each upload folder?

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    The album db table only holds the album data, the photo db table holds a.o. the id of the album where the photo belongs to.

    The only items that are really important are: the id (must be a number and unique) and the name of the album. Make sure the name is exactly the same as the folder you have on your local pc.

    This is an example of file wp_wppa_albums.csv created by Table XII, first item. You can import this as described here: https://wppa.nl/nl/changelog/installation-notes/#moving

    
    id,name,description,a_order,main_photo,a_parent,p_order_by,cover_linktype,cover_linkpage,owner,timestamp,upload_limit,alt_thumbsize,default_tags,cover_type,suba_order_by,views,cats,scheduledtm,modified,crypt,custom,treecounts,wmfile,wmpos,indexdtm
    1,"Losse blog foto\'s",,0,0,0,0,content,0,opajaap,1412076225,0/0,0,,,,0,,,1412076225,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""0"";i:2;s:1:""0"";i:3;s:1:""0"";i:4;s:1:""0"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""0"";i:10;s:1:""0"";}",,,
    2,Leden,"Het moederalbum van de leden albums",0,0,-1,0,content,0,opajaap,1412076287,0/0,0,,,,0,,,1412076287,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""3"";i:2;s:1:""5"";i:3;s:1:""0"";i:4;s:2:""77"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""0"";i:10;s:2:""43"";}",,,
    3,"Tina Breetvelt","Standaard album voor Tina Breetvelt",0,0,2,0,content,0,omatina,1412076587,0/0,0,,,,0,,,1412076587,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""1"";i:2;s:1:""1"";i:3;s:1:""0"";i:4;s:2:""65"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""0"";i:10;s:1:""3"";}",,,
    4,"Jaap Breetvelt","Standaard album voor Jaap Breetvelt",0,0,2,0,content,0,opajaap,1412080695,0/0,0,,,,0,,,1412080695,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""1"";i:2;s:1:""1"";i:3;s:1:""0"";i:4;s:2:""12"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""0"";i:10;s:2:""40"";}",,,
    5,"Romy\'s houten huwelijk","Foto\'s door OpaJaap van het feest op 21 september 2014",0,0,4,0,content,0,opajaap,1412081981,0/0,0,,,,3,,,1412081981,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""0"";i:2;s:1:""0"";i:3;s:2:""12"";i:4;s:2:""12"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:2:""40"";i:10;s:2:""40"";}",,,
    6,"Piet Test","Default photo album for Piet Test",0,0,2,0,content,0,"Piet Test",1412172379,0/0,0,,,,0,,,1412172379,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""0"";i:2;s:1:""0"";i:3;s:1:""0"";i:4;s:1:""0"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""0"";i:10;s:1:""0"";}",,,
    7,"Verjaardag 2014","Alle foto\'s die zijn gemaakt rond mijn verjaardag in 2014",0,0,3,0,content,0,omatina,1412174642,0/0,0,,,,19,,,1412174642,,,"a:11:{i:0;s:1:""0"";i:1;s:1:""0"";i:2;s:1:""0"";i:3;s:2:""65"";i:4;s:2:""65"";i:5;s:1:""0"";i:6;s:1:""0"";i:7;s:1:""0"";i:8;s:1:""0"";i:9;s:1:""3"";i:10;s:1:""3"";}",,,
    

    An example of the photo db table: wp_wppa_photos.csv:

    
    id,album,ext,name,description,p_order,mean_rating,linkurl,linktitle,linktarget,owner,timestamp,status,rating_count,tags,alt,filename,modified,location,views,page_id,exifdtm,videox,videoy,scheduledtm,thumbx,thumby,photox,photoy,custom,stereo,crypt,clicks,scheduledel,magickstack,indexdtm
    1,5,jpg,HPIM3876.JPG,,0,,,,_self,opajaap,1412081531,publish,0,,,HPIM3876.JPG,1412081531,,4,0,"2014:09:14 14:01:47",0,0,,200,150,1022,768,,0,,0,,,1492680576
    2,5,jpg,HPIM3877.JPG,,0,,,,_self,opajaap,1412081533,publish,0,,,HPIM3877.JPG,1412081533,,4,0,"2014:09:14 14:02:18",0,0,,200,150,1022,768,,0,,0,,,1492680576
    3,5,jpg,HPIM3878.JPG,,0,,,,_self,opajaap,1412081534,publish,0,,,HPIM3878.JPG,1412081534,,4,0,"2014:09:14 14:02:58",0,0,,200,150,1022,768,,0,,0,,,1492680576
    4,5,jpg,HPIM3879.JPG,,0,,,,_self,opajaap,1412081536,publish,0,,,HPIM3879.JPG,1412081536,,4,0,"2014:09:14 14:03:11",0,0,,200,150,1022,768,,0,,0,,,1492680576
    5,5,jpg,HPIM3880.JPG,,0,,,,_self,opajaap,1412081802,publish,0,,,HPIM3880.JPG,1412081802,,4,0,"2014:09:14 14:14:17",0,0,,200,150,1022,768,,0,,0,,,1492680576
    6,5,jpg,HPIM3881.JPG,,0,,,,_self,opajaap,1412081804,publish,0,,,HPIM3881.JPG,1412081804,,3,0,"2014:09:14 14:14:35",0,0,,200,150,1022,768,,0,,0,,,1492680576
    7,5,jpg,HPIM3882.JPG,,0,,,,_self,opajaap,1412081866,publish,0,,,HPIM3882.JPG,1412081866,,3,0,"2014:09:14 14:16:22",0,0,,200,150,1022,768,,0,,0,,,1492680576
    8,5,jpg,HPIM3883.JPG,,0,,,,_self,opajaap,1412081867,publish,0,,,HPIM3883.JPG,1412081867,,5,0,"2014:09:14 14:17:21",0,0,,200,150,1022,768,,0,,0,,,1492680576
    9,5,jpg,HPIM3884.JPG,,0,,,,_self,opajaap,1412081922,publish,0,,,HPIM3884.JPG,1412081922,,3,0,"2014:09:14 14:17:35",0,0,,200,150,1022,768,,0,,0,,,1492680576
    10,5,jpg,HPIM3885.JPG,,0,,,,_self,opajaap,1412081923,publish,0,,,HPIM3885.JPG,1412081923,,2,0,"2014:09:14 14:24:50",0,0,,200,150,1022,768,,0,,0,,,1492680576
    11,5,jpg,HPIM3896.JPG,,0,,,,_self,opajaap,1412081979,publish,0,,,HPIM3896.JPG,1412081979,,2,0,"2014:09:27 11:18:39",0,0,,200,150,1022,768,,0,,0,,,1492680576
    12,5,jpg,HPIM3897.JPG,,0,,,,_self,opajaap,1412081981,publish,0,,,HPIM3897.JPG,1412081981,,2,0,"2014:09:27 11:19:03",0,0,,200,150,1022,768,,0,,0,,,1492680576
    13,7,jpg,HPIM3888.JPG,,0,,,,_self,omatina,1412173409,publish,0,,,HPIM3888.JPG,1412173409,,0,0,"2014:09:25 16:08:37",0,0,,200,150,1022,768,,0,,0,,,1492680576
    14,7,jpg,HPIM3889.JPG,,0,,,,_self,omatina,1412173411,publish,0,,,HPIM3889.JPG,1412173411,,0,0,"2014:09:25 16:08:45",0,0,,200,150,1022,768,,0,,0,,,1492680576
    15,7,jpg,HPIM3890.JPG,,0,,,,_self,omatina,1412173412,publish,0,,,HPIM3890.JPG,1492680721,,0,0,"2014:09:25 16:20:18",0,0,,200,150,1022,768,,0,,0,,,1492680754
    16,7,jpg,HPIM3891.JPG,,0,,,,_self,omatina,1412173413,publish,0,,,HPIM3891.JPG,1412173413,,0,0,"2014:09:25 16:22:16",0,0,,200,150,1022,768,,0,,0,,,1492680576
    17,7,jpg,HPIM3892.JPG,,0,,,,_self,omatina,1412173474,publish,0,,,HPIM3892.JPG,1412173474,,0,0,"2014:09:25 16:22:53",0,0,,200,150,1022,768,,0,,0,,,1492680576
    18,7,jpg,HPIM3893.JPG,,0,,,,_self,omatina,1412173475,publish,0,,,HPIM3893.JPG,1412173475,,0,0,"2014:09:25 16:28:28",0,0,,200,150,1022,768,,0,,0,,,1492680576
    19,7,jpg,HPIM3894.JPG,,0,,,,_self,omatina,1412173477,publish,0,,,HPIM3894.JPG,1412173477,,1,0,"2014:09:27 11:17:34",0,0,,200,150,1022,768,,0,,0,,,1492680576
    20,7,jpg,HPIM3895.JPG,,0,,,,_self,omatina,1412173478,publish,0,,,HPIM3895.JPG,1412173478,,1,0,"2014:09:27 11:17:46",0,0,,200,150,1022,768,,0,,0,,,1492680576
    21,7,jpg,HPIM3896.JPG,,0,,,,_self,omatina,1412173532,publish,0,,,HPIM3896.JPG,1412173532,,0,0,"2014:09:27 11:18:39",0,0,,200,150,1022,768,,0,,0,,,1492680576
    22,7,jpg,HPIM3897.JPG,,0,,,,_self,omatina,1412173533,publish,0,,,HPIM3897.JPG,1412173533,,0,0,"2014:09:27 11:19:03",0,0,,200,150,1022,768,,0,,0,,,1492680576
    23,7,jpg,HPIM3898.JPG,,0,,,,_self,omatina,1412173534,publish,0,,,HPIM3898.JPG,1412173534,,0,0,"2014:09:27 11:19:17",0,0,,200,150,1022,768,,0,,0,,,1492680576
    

    You can best first create the albums db table, the import the photos by importing the directory structure as described here: https://wppa.nl/nl/docs-by-subject/admin-pages/import-photos/

    Then export the photo db table as .csv file (Table XII), edit the csv and re-import.

    Thread Starter jagwaugh

    (@jagwaugh)

    Ok, thanks.

    (That’ll take me a while to digest)

    Thread Starter jagwaugh

    (@jagwaugh)

    Just as an aside for anyone else trying to import a heirarchy of albums.

    If you create a tree of folders:

    Level 0
        Level 1A
            Album 1a1
            Album 1a2
        Level 2A
            Album 2a1
            Album 2a1

    and put your photos inside 1a1, 1a2, 2a1, 2a2 but no photos in Level 0, Level 1A or Level 2A

    If you zip that structure into “Level 0.zip”, then upload and import the .zip, then wppa will create the parent albums Level 0, Level 1A and Level 2A and add the lowest levels with the parent albums accordingly.

    If you include a correctly formatted .csv either a single, one per parent, or a master, then when you import the .zip wppa will apply the values in the .csv to the photos automatically.

    Like magic.

    • This reply was modified 7 years, 6 months ago by jagwaugh.
    • This reply was modified 7 years, 6 months ago by jagwaugh. Reason: format
    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    It just does what i promised it would do…

    Thread Starter jagwaugh

    (@jagwaugh)

    Naja… it happens so rarely that one doesn’t expect it.

    Is there a way to (temporarily) suspend the wppa_remake_index_photos, and wppa_remake_index_albums during a mass import?

    From the look of the logfile each individual image triggers these two jobs. I’m working with a mass upload of about 5K albums with about 5 images per album and the machine is balls to the wall so that it times out a lot.

    I’d like to be able to suspend the individual remake_index jobs, then once the imports are done (i.e. moved out of the depot folder) I can trigger the clean, album, and photo index jobs with cron.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Do not bother about the indexes. They will be updated by cron jobs automayicly. The cron jobs do only the changed/added photos and should not bother your import activity.

    Thread Starter jagwaugh

    (@jagwaugh)

    I think I found why my machine was adding photos/albums so slowly.

    Yesterday morning when I first started this import I ran into a disk full condition during the import. It’s an AWS EC2 so I just bumped the disk size and did a reboot.

    For some reason wppa_cleanup_index was triggered (I can’t remember – I may have started it myself after expanding the disk), and it was apparently causing delays on the import.

    I did delete a lot of albums before I started the import, so it may still have been dealing with that before I started the import.

    I just left the machine overnight and started the import again now. performance is a LOT better. It is now adding about 40 photos/min, yesterday it was taking about 1min/photo.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    40 / min is GOOD!

    Thread Starter jagwaugh

    (@jagwaugh)

    I would be more inclined to say “breathtaking” as it’s only a free tier t2.micro (Single vCPU and 1 GiB RAM).

    But something has gone wrong again, the import has slowed down to a crawl again.
    VIII>A>8.3 shows:

    8.3 Clean Index Remove obsolete entries from index db table. Locked! Locked! Cron job 26329

    The bottom of wppa-log.txt shows:

    {b}Cron{/b}: on:May 7, 2017 6:51 am: cron-job: {b}wppa_remake_index_photos{/b} completed
    {b}Cron{/b}: on:May 7, 2017 6:51 am: cron-job: {b}wppa_cleanup_index{/b} continued. Allowed runtime: 894s. Cron id = 1494139903.7865159511566162109375
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Could not complete scan of index item # {b}403{/b}, slug = {b}am{/b}, count = {b}15189{/b}, photo id = {b}14460{/b}, next element # = {b}13197{/b},
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: {b}wppa_cleanup_index{/b} re-scheduled by {b}wppa_do_maintenance_proc( 'wppa_cleanup_index' ){/b} on line {b}1038{/b} of wppa-maintenance.php called by apply_filters
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: {b}wppa_remake_index_photos{/b} started. Allowed runtime: 894s. Cron id = 1494140076.2668220996856689453125
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Indexed photo {b}19713{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Adding index slug {b}12~1204097165{/b} for photo {b}19714{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Indexed photo {b}19714{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Adding index slug {b}1~1204097165{/b} for photo {b}19715{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Indexed photo {b}19715{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Adding index slug {b}2~1204097165{/b} for photo {b}19716{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: Indexed photo {b}19716{/b}
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: {b}wppa_remake_index_photos{/b} completed
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: {b}wppa_cleanup{/b} started.
    {b}Cron{/b}: on:May 7, 2017 6:54 am: cron-job: {b}wppa_cleanup{/b} completed.
    {b}Cron{/b}: on:May 7, 2017 6:55 am: cron-job: {b}wppa_cleanup_index{/b} continued. Allowed runtime: 895s. Cron id = 1494140105.1863238811492919921875
    {b}Cron{/b}: on:May 7, 2017 6:55 am: cron-job: Continuing cleanup index at slug = {b}am{/b}, element # = {b}13197{/b}
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: Could not complete scan of index item # {b}403{/b}, slug = {b}am{/b}, count = {b}15189{/b}, photo id = {b}8073{/b}, next element # = {b}6810{/b},
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_cleanup_index{/b} re-scheduled by {b}wppa_do_maintenance_proc( 'wppa_cleanup_index' ){/b} on line {b}1038{/b} of wppa-maintenance.php called by apply_filters
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_remake_index_photos{/b} started. Allowed runtime: 895s. Cron id = 1494140194.3013091087341308593750
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_remake_index_photos{/b} completed
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: Cron fixed treecounts for 505
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_cleanup{/b} started.
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_cleanup{/b} completed.
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_remake_index_albums{/b} started. Allowed runtime: 884s. Cron id = 1494140194.3013091087341308593750
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: Indexed album {b}4819{/b}
    {b}Cron{/b}: on:May 7, 2017 6:56 am: cron-job: {b}wppa_remake_index_albums{/b} completed
    {b}Cron{/b}: on:May 7, 2017 6:57 am: cron-job: {b}wppa_cleanup_index{/b} continued. Allowed runtime: 894s. Cron id = 1494140225.4872140884399414062500
    {b}Cron{/b}: on:May 7, 2017 6:57 am: cron-job: Continuing cleanup index at slug = {b}am{/b}, element # = {b}6810{/b}

    Am I just expecting too much from the machine?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    The log shows correct.
    However, try this:
    You can temporary skip the cron jobs as follows: (just try, and revert when done):
    Edit file wppa-cron.php:

    
    <?php
    /* wppa-cron.php
    * Package: wp-photo-album-plus
    *
    * Contains all cron functions
    * Version 6.6.24
    *
    *
    */
    
    // Are we in a cron job?
    function wppa_is_cron() {
    
    	if ( isset( $_GET['doing_wp_cron'] ) ) {
    		return $_GET['doing_wp_cron'];
    	}
    	if ( defined( 'DOING_CRON' ) ) {
    		return DOING_CRON;
    	}
    	return false;
    }
    
    // Activate our maintenance hook
    add_action( 'wppa_cron_event', 'wppa_do_maintenance_proc', 10, 1 );
    
    // Schedule maintenance proc
    function wppa_schedule_maintenance_proc( $slug, $from_settings_page = false ) {
    global $is_reschedule;
    

    Add right below global $is_reschedule;:
    return;

    This will prevent the majority of cron jobs. Afterwards, revert the edit, and just edit one photo desc and one album desc to trigger the index mechanism. Do not run it from Table VIII.

    Thread Starter jagwaugh

    (@jagwaugh)

    Just to be clear, Do I edit the file while the current import is running and the changes are effected on the fly, or do I need to restart the machine, edit the file, and re run the import?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Just edit on the fly.

    Just for your information:

    • 8.3 Clean Index Remove obsolete entries from index db table. Locked! Locked! Cron job 26329
      means Clean index runs as a cron job, do not manually interfere. You can overrule by clicking the first button, but you should not.
    • Remake index albums/photos works very fast as cron job. It only processes items where the datetame last indexed is prior to datetime last modified.
    • Do not run remake index interactively ( the Doit! button ) beause this will first clear the index completely (remake(!)), if needed, you can run it as cron job but this should not be needed.
    • I think the cleanup index job kills you, because it scans the entire index and you have a very large max_execution_time (900 s.), so the edit will most likely help you out.
    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Did you disable cron jobs and, if so, did it work? If usefull, I could make it a setting…

    Thread Starter jagwaugh

    (@jagwaugh)

    I did, and it made a big difference, roughly 3x faster.

    I also changed the AWS instance to a 2G one, which also helped.

    It was reading a LOT of EXIF data during the import, as far as I could tell by watching phpMyAdmin.

    I’m a edge case, but it would be nice to have a “Mass import” setting to hold off on any tasks other than just creating the Albums and copying the photos. Once the copy is complete then the rest could be pushed manually, or run as a cron (In my case the cron took about 10 hours once I’d finished the raw import.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I also changed the AWS instance to a 2G one, which also helped

    What is that?

    If you do not use exif, you can switch it off in Table IX-H8. This will still import the exif date and location (if present).

    Maybe there are more situations where it is handy to skip all background processes. Just a setting, and a reminder on every admin page that the setting is still on; when turned off, all cron jobs will be scheduled.

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘CSV import’ is closed to new replies.