@@ -154,7 +154,7 @@ def menu():
154154 print (' 2. Download by image_id' )
155155 print (' 3. Download by tags' )
156156 print (' 4. Download from list' )
157- print (' 5. Download from bookmarked artists (/bookmark.php?type=user)' )
157+ print (' 5. Download from followed artists (/bookmark.php?type=user)' )
158158 print (' 6. Download from bookmarked images (/bookmark.php)' )
159159 print (' 7. Download from tags list' )
160160 print (' 8. Download new illust from bookmarked members (/bookmark_new_illust.php)' )
@@ -184,6 +184,7 @@ def menu():
184184 print (' d. Manage database' )
185185 print (' e. Export online followed artist.' )
186186 print (' m. Export online other\' s followed artist.' )
187+ print (' p. Export online image bookmarks.' )
187188 print (' i. Import list file' )
188189 print (' r. Reload config.ini' )
189190 print (' p. Print config.ini' )
@@ -735,8 +736,8 @@ def menu_export_online_bookmark(opisvalid, args, options):
735736 filename = "export.txt"
736737
737738 if opisvalid :
738- if len ( args ) > 0 :
739- filename = args [ 0 ]
739+ if options . export_filename is not None :
740+ filename = options . export_filename
740741 if options .bookmark_flag is not None :
741742 hide = options .bookmark_flag .lower ()
742743 if hide not in ('y' , 'n' , 'o' ):
@@ -759,9 +760,9 @@ def menu_export_online_user_bookmark(opisvalid, args, options):
759760 filename = "export-user.txt"
760761
761762 if opisvalid and len (args ) > 0 :
762- arg = args [0 ]
763- if len ( args ) > 1 :
764- filename = args [ 1 ]
763+ arg = args [0 ] # member id
764+ if options . export_filename is not None :
765+ filename = options . export_filename
765766 else :
766767 filename = f"export-user-{ arg } .txt"
767768 else :
@@ -778,6 +779,52 @@ def menu_export_online_user_bookmark(opisvalid, args, options):
778779 PixivBookmarkHandler .export_bookmark (sys .modules [__name__ ], __config__ , filename , 'n' , 1 , 0 , member_id )
779780
780781
782+ def menu_export_from_online_image_bookmark (opisvalid , args , options ):
783+ __log__ .info ("Export User's Image Bookmark mode (p)." )
784+ start_page = 1
785+ end_page = 0
786+ hide = 'n'
787+ tag = ''
788+ use_image_tag = False
789+ filename = "Exported_images.txt"
790+
791+ if opisvalid :
792+ if len (args ) > 0 :
793+ tag = args [0 ]
794+
795+ (start_page , end_page ) = get_start_and_end_page_from_options (options )
796+ if options .bookmark_flag is not None :
797+ hide = options .bookmark_flag .lower ()
798+ if hide not in ('y' , 'n' , 'o' ):
799+ PixivHelper .print_and_log ("error" , f"Invalid args for bookmark_flag: { options .bookmark_flag } , valid values are [y/n/o]." )
800+ return
801+ use_image_tag = options .use_image_tag
802+ if options .export_filename is not None :
803+ filename = options .export_filename
804+ else :
805+ hide = input ("Include Private bookmarks [y/n/o, default is no]: " ).rstrip ("\r " ) or 'n'
806+ hide = hide .lower ()
807+ if hide not in ('y' , 'n' , 'o' ):
808+ print ("Invalid args: " , hide )
809+ return
810+ tag = input ("Tag (press enter for all images): " ).rstrip ("\r " ) or ''
811+ (start_page , end_page ) = PixivHelper .get_start_and_end_number (total_number_of_page = options .number_of_pages )
812+ if tag != '' :
813+ use_image_tag = input ("Use Image Tags as the filter [y/n, default is no]? " ).rstrip ("\r " ) or 'n'
814+ use_image_tag = use_image_tag .lower ()
815+ use_image_tag = True if use_image_tag == 'y' else False
816+ filename = input (f"Filename (default is '{ filename } '): " ).rstrip ("\r " ) or filename
817+
818+ PixivBookmarkHandler .export_image_bookmark (sys .modules [__name__ ],
819+ __config__ ,
820+ hide = hide ,
821+ start_page = start_page ,
822+ end_page = end_page ,
823+ tag = tag ,
824+ use_image_tag = use_image_tag ,
825+ filename = filename )
826+
827+
781828def menu_fanbox_download_from_list (op_is_valid , via , args , options ):
782829 via_type = ""
783830 if via == PixivModelFanbox .FanboxArtist .SUPPORTING :
@@ -935,12 +982,13 @@ def menu_sketch_download_by_artist_id(opisvalid, args, options):
935982 if opisvalid and len (args ) > 0 :
936983 for member_id in args :
937984 try :
938- prefix = f"[{ current_member } of { len (args )} ] "
985+ prefix = f"Pixiv Sketch [{ current_member } of { len (args )} ] "
939986 PixivSketchHandler .process_sketch_artists (sys .modules [__name__ ],
940987 __config__ ,
941988 member_id ,
942989 page ,
943- end_page )
990+ end_page ,
991+ title_prefix = prefix )
944992 current_member = current_member + 1
945993 except PixivException as ex :
946994 PixivHelper .print_and_log ("error" , f"Error when processing Pixiv Sketch:{ member_id } " , ex )
@@ -953,12 +1001,13 @@ def menu_sketch_download_by_artist_id(opisvalid, args, options):
9531001 PixivHelper .print_and_log ('info' , f"Artist IDs: { member_ids } " )
9541002 for member_id in member_ids :
9551003 try :
956- prefix = f"[{ current_member } of { len (member_ids )} ] "
1004+ prefix = f"Pixiv Sketch [{ current_member } of { len (member_ids )} ] "
9571005 PixivSketchHandler .process_sketch_artists (sys .modules [__name__ ],
9581006 __config__ ,
9591007 member_id ,
9601008 page ,
961- end_page )
1009+ end_page ,
1010+ title_prefix = prefix )
9621011 current_member = current_member + 1
9631012 except PixivException as ex :
9641013 PixivHelper .print_and_log ("error" , f"Error when processing Pixiv Sketch:{ member_id } " , ex )
@@ -1087,7 +1136,7 @@ def setup_option_parser():
10871136 __valid_options = ('1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' , '11' , '12' , '13' , '14' , '15' , '16' , '17' , '18' ,
10881137 'f1' , 'f2' , 'f3' , 'f4' , 'f5' ,
10891138 's1' , 's2' ,
1090- 'd' , 'e' , 'm' , 'b' )
1139+ 'd' , 'e' , 'm' , 'b' , 'p' )
10911140 parser = OptionParser ()
10921141
10931142 # need to keep the whitespace to adjust the output for --help
@@ -1115,6 +1164,7 @@ def setup_option_parser():
11151164b - Batch Download from batch_job.json \n
11161165e - Export online bookmark \n
11171166m - Export online user bookmark \n
1167+ p - Export online image bookmark \n
11181168d - Manage database''' )
11191169 parser .add_option ('-x' , '--exit_when_done' ,
11201170 dest = 'exit_when_done' ,
@@ -1210,7 +1260,7 @@ def setup_option_parser():
12101260 parser .add_option ('--bcl' , '--bookmark_count_limit' ,
12111261 dest = 'bookmark_count_limit' ,
12121262 default = - 1 ,
1213- help = '''Bookmark count limit in integer. \n
1263+ help = '''Bookmark count limit in integer. \n
12141264Used in option 3, 5, 7, and 8.''' )
12151265 parser .add_option ('--rm' , '--rank_mode' ,
12161266 dest = 'rank_mode' ,
@@ -1220,6 +1270,11 @@ def setup_option_parser():
12201270 dest = 'rank_content' ,
12211271 default = "all" ,
12221272 help = '''Ranking Content Type.''' )
1273+ parser .add_option ('--ef' , '--export_filename' ,
1274+ dest = 'export_filename' ,
1275+ default = "export.txt" ,
1276+ help = '''Filename for exporting members/images. \n
1277+ Used in option e, m, p''' )
12231278 return parser
12241279
12251280
@@ -1285,6 +1340,8 @@ def main_loop(ewd, op_is_valid, selection, np_is_valid_local, args, options):
12851340 menu_export_online_bookmark (op_is_valid , args , options )
12861341 elif selection == 'm' :
12871342 menu_export_online_user_bookmark (op_is_valid , args , options )
1343+ elif selection == 'p' :
1344+ menu_export_from_online_image_bookmark (op_is_valid , args , options )
12881345 elif selection == 'd' :
12891346 __dbManager__ .main ()
12901347 elif selection == 'r' :
0 commit comments