darkdragn / party

A quick *.party downloader
84 stars 12 forks source link

Feature Request: Using Post Title as Filename #18

Closed Pineapple1989 closed 8 months ago

Pineapple1989 commented 9 months ago

Is it possible to use the post title or the post content as the files name that is downloaded? It just makes it a bit easier to search. I tried doing it myself but had no success.

darkdragn commented 8 months ago

Yeah, I can look into it. The complication here is that we compile a list of files from all posts without preserving the origination post details. I could add that as a supplemental field, or run the download from the top level to get around this. When I threw this together, I did things the way they are to make it easier to add a progress bar. It's honestly not a big change to make. In all honesty, the CLI is the only thing that would receive the overhaul. The backend user and post libraries are already prepped to do just this. Would you prefer {PostTitle} - {FileName}.{FileExtension} or just {PostTitle} - {FileIndex}.{FileExtension} ? I would need the index to make sure posts with multiple files get everything... Hhhmmm, a bigger undertaking would be adding metadata to image posts that could preserve everything. All post details, dates and all of the API metadata, but that's a pipe dream for a later date.

darkdragn commented 8 months ago

Just finished adding it! Check it out:

darkdragn@penguin:~/src/party$ party kemono patreon Creux --post-title --limit 5
2023-11-03 01:33:28.110 | DEBUG    | party.cli:pull_user:114 - Excluded Extensions: []
⠹ User found: creux; parsing posts...Duplicate files found, recommend using post_id
Embedded objects found; saving to creux/.embedded
Downloading from user: creux
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 11/11 [00:23<00:00,  2.10s/it]
2023-11-03 01:34:16.140 | INFO     | party.cli:pull_user:199 - Output status: Counter({<StatusEnum.SUCCESS: 1>: 11})                                                                      
darkdragn@penguin:~/src/party$ ls creux/                                                                                                                                                  
'Bex & Keit - Medium Support_Bex_MediumSupport_1_Twitter.jpg'         'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_1_Twitter.jpg'                                                
'Bex & Keit - Medium Support_Bex_MediumSupport_2_Patreon.jpg'         'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_2_Twitter.jpg'
'Bex - Yellow Jacket_Bex_YellowJacket_1_Twitter.jpg'                  'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_3_Patreon.jpg'
'Bex - Yellow Jacket_Bex_YellowJacket_2_Patreon.jpg'                  'Lucia - Concept Sheet_Splatball_Lucia_1_Twitter.jpg'
'Lois Lane - Strip game - Part 1_LoisLane_StripGame01_1_Twitter.jpg'  'Lucia - Concept Sheet_Splatball_Lucia_2_Patreon.jpg'
'Lois Lane - Strip game - Part 1_LoisLane_StripGame01_2_Patreon.jpg'

If you want to mix, I added robust formatting options. You can do things like: "{ref.post_id}_{ref.post_title}_{ref.index:03}.{ref.extension}" to get something like:

darkdragn@penguin:~/src/party$ party kemono patreon Creux --limit 5 --file-format "{ref.post_id}_{ref.post_title}_{ref.index:03}.{ref.extension}"
2023-11-03 01:36:43.384 | DEBUG    | party.cli:pull_user:114 - Excluded Extensions: []
⠧ User found: creux; parsing posts...Duplicate files found, recommend using post_id
Embedded objects found; saving to creux/.embedded
Downloading from user: creux
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 16/16 [00:14<00:00,  1.09it/s]
2023-11-03 01:37:23.913 | INFO     | party.cli:pull_user:199 - Output status: Counter({<StatusEnum.SUCCESS: 1>: 16})                                                                      
darkdragn@penguin:~/src/party$ ls creux/                                                                                                                                                  
'86307825_Bex - Yellow Jacket_000.jpg'              '86462263_Lois Lane - Strip game - Part 2_003.jpg'             'Bex - Yellow Jacket_Bex_YellowJacket_1_Twitter.jpg'                   
'86307825_Bex - Yellow Jacket_001.jpg'              '88614838_Bex & Keit - Medium Support_000.jpg'                 'Bex - Yellow Jacket_Bex_YellowJacket_2_Patreon.jpg'                   
'86307825_Bex - Yellow Jacket_002.jpg'              '88614838_Bex & Keit - Medium Support_001.jpg'                 'Lois Lane - Strip game - Part 1_LoisLane_StripGame01_1_Twitter.jpg'
'86410843_Lois Lane - Strip game - Part 1_000.jpg'  '88614838_Bex & Keit - Medium Support_002.jpg'                 'Lois Lane - Strip game - Part 1_LoisLane_StripGame01_2_Patreon.jpg'
'86410843_Lois Lane - Strip game - Part 1_001.jpg'  '88831815_Lucia - Concept Sheet_000.jpg'                       'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_1_Twitter.jpg'
'86410843_Lois Lane - Strip game - Part 1_002.jpg'  '88831815_Lucia - Concept Sheet_001.jpg'                       'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_2_Twitter.jpg'
'86462263_Lois Lane - Strip game - Part 2_000.jpg'  '88831815_Lucia - Concept Sheet_002.jpg'                       'Lois Lane - Strip game - Part 2_LoisLane_StripGame02_3_Patreon.jpg'
'86462263_Lois Lane - Strip game - Part 2_001.jpg'  'Bex & Keit - Medium Support_Bex_MediumSupport_1_Twitter.jpg'  'Lucia - Concept Sheet_Splatball_Lucia_1_Twitter.jpg'
'86462263_Lois Lane - Strip game - Part 2_002.jpg'  'Bex & Keit - Medium Support_Bex_MediumSupport_2_Patreon.jpg'  'Lucia - Concept Sheet_Splatball_Lucia_2_Patreon.jpg'
darkdragn commented 8 months ago

@Pineapple1989 if you get a chance, let me know what you think about the updates. Also, check out #24 to see if you like that change too!