@@ -154,7 +154,7 @@ def menu():
154
154
print (' 2. Download by image_id' )
155
155
print (' 3. Download by tags' )
156
156
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)' )
158
158
print (' 6. Download from bookmarked images (/bookmark.php)' )
159
159
print (' 7. Download from tags list' )
160
160
print (' 8. Download new illust from bookmarked members (/bookmark_new_illust.php)' )
@@ -184,6 +184,7 @@ def menu():
184
184
print (' d. Manage database' )
185
185
print (' e. Export online followed artist.' )
186
186
print (' m. Export online other\' s followed artist.' )
187
+ print (' p. Export online image bookmarks.' )
187
188
print (' i. Import list file' )
188
189
print (' r. Reload config.ini' )
189
190
print (' p. Print config.ini' )
@@ -735,8 +736,8 @@ def menu_export_online_bookmark(opisvalid, args, options):
735
736
filename = "export.txt"
736
737
737
738
if opisvalid :
738
- if len ( args ) > 0 :
739
- filename = args [ 0 ]
739
+ if options . export_filename is not None :
740
+ filename = options . export_filename
740
741
if options .bookmark_flag is not None :
741
742
hide = options .bookmark_flag .lower ()
742
743
if hide not in ('y' , 'n' , 'o' ):
@@ -759,9 +760,9 @@ def menu_export_online_user_bookmark(opisvalid, args, options):
759
760
filename = "export-user.txt"
760
761
761
762
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
765
766
else :
766
767
filename = f"export-user-{ arg } .txt"
767
768
else :
@@ -778,6 +779,52 @@ def menu_export_online_user_bookmark(opisvalid, args, options):
778
779
PixivBookmarkHandler .export_bookmark (sys .modules [__name__ ], __config__ , filename , 'n' , 1 , 0 , member_id )
779
780
780
781
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
+
781
828
def menu_fanbox_download_from_list (op_is_valid , via , args , options ):
782
829
via_type = ""
783
830
if via == PixivModelFanbox .FanboxArtist .SUPPORTING :
@@ -935,12 +982,13 @@ def menu_sketch_download_by_artist_id(opisvalid, args, options):
935
982
if opisvalid and len (args ) > 0 :
936
983
for member_id in args :
937
984
try :
938
- prefix = f"[{ current_member } of { len (args )} ] "
985
+ prefix = f"Pixiv Sketch [{ current_member } of { len (args )} ] "
939
986
PixivSketchHandler .process_sketch_artists (sys .modules [__name__ ],
940
987
__config__ ,
941
988
member_id ,
942
989
page ,
943
- end_page )
990
+ end_page ,
991
+ title_prefix = prefix )
944
992
current_member = current_member + 1
945
993
except PixivException as ex :
946
994
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):
953
1001
PixivHelper .print_and_log ('info' , f"Artist IDs: { member_ids } " )
954
1002
for member_id in member_ids :
955
1003
try :
956
- prefix = f"[{ current_member } of { len (member_ids )} ] "
1004
+ prefix = f"Pixiv Sketch [{ current_member } of { len (member_ids )} ] "
957
1005
PixivSketchHandler .process_sketch_artists (sys .modules [__name__ ],
958
1006
__config__ ,
959
1007
member_id ,
960
1008
page ,
961
- end_page )
1009
+ end_page ,
1010
+ title_prefix = prefix )
962
1011
current_member = current_member + 1
963
1012
except PixivException as ex :
964
1013
PixivHelper .print_and_log ("error" , f"Error when processing Pixiv Sketch:{ member_id } " , ex )
@@ -1087,7 +1136,7 @@ def setup_option_parser():
1087
1136
__valid_options = ('1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '10' , '11' , '12' , '13' , '14' , '15' , '16' , '17' , '18' ,
1088
1137
'f1' , 'f2' , 'f3' , 'f4' , 'f5' ,
1089
1138
's1' , 's2' ,
1090
- 'd' , 'e' , 'm' , 'b' )
1139
+ 'd' , 'e' , 'm' , 'b' , 'p' )
1091
1140
parser = OptionParser ()
1092
1141
1093
1142
# need to keep the whitespace to adjust the output for --help
@@ -1115,6 +1164,7 @@ def setup_option_parser():
1115
1164
b - Batch Download from batch_job.json \n
1116
1165
e - Export online bookmark \n
1117
1166
m - Export online user bookmark \n
1167
+ p - Export online image bookmark \n
1118
1168
d - Manage database''' )
1119
1169
parser .add_option ('-x' , '--exit_when_done' ,
1120
1170
dest = 'exit_when_done' ,
@@ -1210,7 +1260,7 @@ def setup_option_parser():
1210
1260
parser .add_option ('--bcl' , '--bookmark_count_limit' ,
1211
1261
dest = 'bookmark_count_limit' ,
1212
1262
default = - 1 ,
1213
- help = '''Bookmark count limit in integer. \n
1263
+ help = '''Bookmark count limit in integer. \n
1214
1264
Used in option 3, 5, 7, and 8.''' )
1215
1265
parser .add_option ('--rm' , '--rank_mode' ,
1216
1266
dest = 'rank_mode' ,
@@ -1220,6 +1270,11 @@ def setup_option_parser():
1220
1270
dest = 'rank_content' ,
1221
1271
default = "all" ,
1222
1272
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''' )
1223
1278
return parser
1224
1279
1225
1280
@@ -1285,6 +1340,8 @@ def main_loop(ewd, op_is_valid, selection, np_is_valid_local, args, options):
1285
1340
menu_export_online_bookmark (op_is_valid , args , options )
1286
1341
elif selection == 'm' :
1287
1342
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 )
1288
1345
elif selection == 'd' :
1289
1346
__dbManager__ .main ()
1290
1347
elif selection == 'r' :
0 commit comments