Alfa-Q / python-nozomi

Nozomi.la API for Python
MIT License
10 stars 4 forks source link

Add more meaningful file names #15

Open Alfa-Q opened 1 year ago

Alfa-Q commented 1 year ago

Option to add more meaningful file names when saving the media. This could be done through format strings. Or just a general string.

Use the fields on the Post class in the format string. So at the moment these would be the options.

The format string would always be followed by _{count} to prevent naming conflicts. The count field is just a number that increments every time there is a duplicate name.

Example

Post(
    date = '2020-11-29 08:30:31-06',
    postid = 12345678,
    artist = [
        Tag(
            tagtype = 'arist',
            tag = 'yoshida_akihiko',
            tagname_display = 'yoshida akihiko',
            tagurl = '/search.html?q=yoshida_akihiko'
        )
    ],
    character = [
        Tag(
            tagtype = 'character',
            tag = 'yorha_no._2_type_b',
            tagname_display = 'yorha no. 2 type b',
            'tagurl' = '/search.html?q=yorha_no._2_type_b'
        }
    ],
    copyright = [
        Tag(
            tagurl: '/search.html?q=nier_(series)',
            tagtype = 'copyright',
            tag = 'nier_(series)',
            tagname_display = 'nier (series)'
        ),
        Tag(
            tagurl: '/search.html?q=nier_automata',
            tagtype = 'copyright',
            tag = 'nier_automata',
            tagname_display = 'nier automata'
        )
    ]
)

{copyright}_{character}_{artist}

"nier_series_yorha_no._2_typeb\yoshida_akihiko_0" "nier_series_yorha_no._2_typeb\yoshida_akihiko_1" "nier_series_yorha_no._2_typeb\yoshida_akihiko_2"

nier_automata_{artist}

This example could be useful if you already know that you queried the posts using the positive_tag nier_automata. So if there are multiple copyright tags (i.e. nier_(series) and nier_automata) then you can apply the one you prefer.

"nier_automata_yoshidaakihiko0" "nier_automata_yoshidaakihiko1" "nier_automata_yoshidaakihiko2"

This is not a perfect solution and does have some issues... Just an idea.

SolitarySpiral commented 10 months ago

alternative for this feature is here