{"id":16974632,"url":"https://github.com/alttiri/tags-line-generator","last_synced_at":"2026-05-17T19:38:56.362Z","repository":{"id":104053199,"uuid":"544060520","full_name":"AlttiRi/tags-line-generator","owner":"AlttiRi","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-30T19:29:31.000Z","size":152,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T17:11:56.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlttiRi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-01T14:38:52.000Z","updated_at":"2025-07-30T19:29:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1b2b99c-0ed2-4fb0-82bf-3df46f26ac3f","html_url":"https://github.com/AlttiRi/tags-line-generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlttiRi/tags-line-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlttiRi%2Ftags-line-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlttiRi%2Ftags-line-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlttiRi%2Ftags-line-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlttiRi%2Ftags-line-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlttiRi","download_url":"https://codeload.github.com/AlttiRi/tags-line-generator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlttiRi%2Ftags-line-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33152213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T01:07:20.792Z","updated_at":"2026-05-17T19:38:56.331Z","avatar_url":"https://github.com/AlttiRi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TagsLineGenerator\n\nThis library allows you to generate a tag line based on the declarative rules described in JSON format.\n\nIt's mainly aimed for generating tag lines for using them in filenames when you download a content from online galleries.\n\n## Hello World example\n\nThe expected input is an object with keys contain a set of tags (as a `string`, or `string[]` value) and some others _optional_ keys like this one:\n\n```js\nconst propsObject = {    \n    \"category\": \"example\",\n    \"extension\": \"jpg\",\n    \"filename\": \"7ad864fb2d2bc8bcd2cec9bec094e0fe\",\n    \"id\": 12345,\n    \"md5\": \"7ad864fb2d2bc8bcd2cec9bec094e0fe\",\n    \"created_at\": \"2013-10-07T12:07:25.000-00:00\",\n    \"uploader\": \"anonymous\",\n    \"tag_string\": \"1girl brown_eyes brown_hair chair closed_mouth curly_hair dress extremely_high_resolution female grey_dress leonardo_da_vinci long_dress long_hair long_sleeves looking_at_viewer mona_lisa original sitting smile solo upper_body\",\n    \"tag_string_artist\": \"leonardo_da_vinci\",\n    \"tag_string_character\": \"mona_lisa\",\n    \"tag_string_copyright\": \"original\",\n    \"tag_string_general\": \"1girl brown_hair chair closed_mouth curly_hair dress female grey_dress long_dress long_hair long_sleeves looking_at_viewer sitting smile solo upper_body brown_eyes\",\n    \"tag_string_meta\": \"extremely_high_resolution\"\n};\n```\n\n_The props object `propsObject` are intended to be similar to a JSON response usually is returned by API._\n\nThe most simple use case is to order the tags by type — the most important tags are first (like `artist` and `character` types tags),\nthe less important ones are at the end.\n\nHere is the generator's setting object for this case:\n```js\nconst genSettings = {\n    \"props\": \"tag_string_artist tag_string_character tag_string_copyright tag_string_general tag_string_meta\"\n};\n```\n\n`props` option determines which tags sets should be used from `propsObject`. It's order sensitive.\n\nThe example of using `TagsLineGenerator` class with the `propsObject` and `genSettings` variables above:\n\n```js\nconst tagsLineGen = new TagsLineGenerator(genSettings);\nconst result = tagsLineGen.generateLine(propsObject);\nconsole.log(result);\n```\n\nThe `result` is the follow `string`:\n```js\n\"leonardo_da_vinci mona_lisa original 1girl brown_hair chair closed_mouth curly_hair dress female grey_dress long_dress\"\n```\n\nSince it's aimed to be used for as a filename part, by default, the generator limits the result tag line length up to 120 characters.\nThe last tag are not cut. If some tag is too long to be fitted in the length limit the generator looks for the follow tags.\n\nOnce the `TagsLineGenerator` is created, `generateLine` method can be used multiple times with the different props objects:\n\n```js\nconst result2 = tagsLineGen.generateLine(propsObject2);\nconsole.log(result2);\n\nconst result3 = tagsLineGen.generateLine(propsObject3);\nconsole.log(result3);\n```\n\nIt's recommended to reuse the same `TagsLineGenerator` instance due to optimisations.\n\n---\n\n## API\n\n...\n\n---\n\n### v2 -\u003e v3 changes\n\n```\n\"custom-sets\"   -\u003e  \"custom-props\"\n\"source\"        -\u003e  \"props\"        (\"custom-sets.source\"  -\u003e  \"custom-props.props\")\n\"selected-sets\" -\u003e  \"props\"\n\"chars-limit\"   -\u003e  \"len-limit\"\n```\n\n---\n\nThe bonus config example:\n\n```json\n{\n  \"custom-props\": {\n    \"__important\": {\n      \"props\": \"tags\",\n      \"only\": \"third-party_edit sound_edit ai_generated artist_request\"\n    },\n    \"__important_medium\": {\n      \"props\": \"tags_medium\",\n      \"only\": \"3d\"\n    },\n    \"__filtered_medium\": {\n      \"props\": \"tags_medium\",\n      \"ignore\": \"*filesize *resolution *filesize *aspect_ratio hd fhd\"\n    }\n  },\n  \"ignore\": \"tagme  cg_art game_cg artist_cg  webm mp4  video animated\",\n  \"replace\": [\n    [\"megane\", \"glasses\"]\n  ],\n  \"only-one\": [\n    [\"third-party_edit\", \"edit\"],\n    [\"sound_edit\", \"edit\"]\n  ],\n  \"props\": [\n    \"tags_artist __important tags_character tags_copyright tags_studio\",\n    \"__important_medium tags_genre __filtered_medium tags_meta\"\n  ],\n  \"len-limit\": 100\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falttiri%2Ftags-line-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falttiri%2Ftags-line-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falttiri%2Ftags-line-generator/lists"}