# sfflib
sfflib is an opensource, miltiplatform Scanlation File Format (sff) parser made for [CanScanlate](https://github.com/NandeMD/CanScanlate/tree/man).
[.sff](test.sffx) files are basically xml files with some custom tags.
Below is the basic sff file:
```xml
<Document>
<Metadata>
<Script>Scanlation Script File v0.1.0</Script>
<App></App>
<Info>Made by NandeMD.</Info>
<TLLength>0</TLLength>
<PRLength>0</PRLength>
<CMLength>0</CMLength>
<BalloonCount>0</BalloonCount>
<LineCount>0</LineCount>
</Metadata>
<Baloon type="Square" has_image="No">
<text>
şşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşş
</text>
<text>
şşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşşş
</text>
</Baloon>
</Document>
```
# Installing
**Python 3.8 or higher is required!**
```bash
# Linux/MacOS
python3 -m pip install -U libssf
# Windows
py -m pip install -U libsff
```
# Example
```python
from libsff import Document, Balloon, Out
from random import randint
# open a test image
with open("testimg.jpg", "rb") as file:
imagefile = file.read()
# Create a blank document object
doc = Document.create_blank()
# Generate random 100 balloons
for _ in range(100):
# Randomize imge
has_image = randint(0, 1)
# Add a Balloon object to our document
docasd.add_balloon(
Balloon(
tl_content=[
"Hi, this is tl line 1",
"Hi, this is tl line 2"
],
btype=randint(0, 4),
has_img=has_image, # Yes, this is int
balloon_img=imagefile if has_image else b"",
img_type="jpg"
)
)
# Save as raw xml:
doc.save_sff("test", Out.RAW)
# Save as gzip compressed xml:
doc.save_sff("test", Out.GZIP)
# Save as lzma compressed xml:
doc.save_sff("test", Out.LZMA)
# Save as formatted text:
doc.save_sff("test", Out.TXT)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/NandeMD/libsff",
"name": "libsff",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0",
"maintainer_email": "",
"keywords": "",
"author": "NandeMD",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/20/8d/98b3bd9fcc305802a91714141a39824fd615cfe3cfd5226f23b9610bf778/libsff-0.1.3.tar.gz",
"platform": null,
"description": "# sfflib\n\nsfflib is an opensource, miltiplatform Scanlation File Format (sff) parser made for [CanScanlate](https://github.com/NandeMD/CanScanlate/tree/man).\n\n[.sff](test.sffx) files are basically xml files with some custom tags.\n\nBelow is the basic sff file:\n```xml\n<Document>\n <Metadata>\n <Script>Scanlation Script File v0.1.0</Script>\n <App></App>\n <Info>Made by NandeMD.</Info>\n <TLLength>0</TLLength>\n <PRLength>0</PRLength>\n <CMLength>0</CMLength>\n <BalloonCount>0</BalloonCount>\n <LineCount>0</LineCount>\n </Metadata>\n <Baloon type=\"Square\" has_image=\"No\">\n <text>\n \u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\n </text>\n <text>\n \u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\u015f\n </text>\n </Baloon>\n</Document>\n```\n\n# Installing\n\n**Python 3.8 or higher is required!**\n\n```bash\n# Linux/MacOS\npython3 -m pip install -U libssf\n\n# Windows\npy -m pip install -U libsff\n```\n\n# Example\n```python\nfrom libsff import Document, Balloon, Out\nfrom random import randint\n\n# open a test image\nwith open(\"testimg.jpg\", \"rb\") as file:\n imagefile = file.read()\n\n# Create a blank document object\ndoc = Document.create_blank()\n\n# Generate random 100 balloons\nfor _ in range(100):\n # Randomize imge\n has_image = randint(0, 1)\n\n # Add a Balloon object to our document\n docasd.add_balloon(\n Balloon(\n tl_content=[\n \"Hi, this is tl line 1\",\n \"Hi, this is tl line 2\"\n ],\n btype=randint(0, 4),\n has_img=has_image, # Yes, this is int\n balloon_img=imagefile if has_image else b\"\",\n img_type=\"jpg\"\n )\n )\n\n# Save as raw xml:\ndoc.save_sff(\"test\", Out.RAW)\n\n# Save as gzip compressed xml:\ndoc.save_sff(\"test\", Out.GZIP)\n\n# Save as lzma compressed xml:\ndoc.save_sff(\"test\", Out.LZMA)\n\n# Save as formatted text:\ndoc.save_sff(\"test\", Out.TXT)\n```\n\n\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "A Pyhon parser for sff files.",
"version": "0.1.3",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "340b56835393626b1c3baf1fb948d77705ce9c0eeca83388faa9d0691bbcff6e",
"md5": "06148222879b1396230aa1528c9eb821",
"sha256": "4ae705a93f1e0b77a193eeee667a3089971ae4ba264682e8b3199038c8bfc4f2"
},
"downloads": -1,
"filename": "libsff-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "06148222879b1396230aa1528c9eb821",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0",
"size": 18560,
"upload_time": "2023-01-13T09:42:44",
"upload_time_iso_8601": "2023-01-13T09:42:44.405268Z",
"url": "https://files.pythonhosted.org/packages/34/0b/56835393626b1c3baf1fb948d77705ce9c0eeca83388faa9d0691bbcff6e/libsff-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "208d98b3bd9fcc305802a91714141a39824fd615cfe3cfd5226f23b9610bf778",
"md5": "cdb792b905c0b2d5b5c61802b54c3b99",
"sha256": "abcb0d3240e13ed0089f09bf7b40fc59a06967c90f034725469ee1c8d530adda"
},
"downloads": -1,
"filename": "libsff-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "cdb792b905c0b2d5b5c61802b54c3b99",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0",
"size": 17916,
"upload_time": "2023-01-13T09:42:47",
"upload_time_iso_8601": "2023-01-13T09:42:47.545659Z",
"url": "https://files.pythonhosted.org/packages/20/8d/98b3bd9fcc305802a91714141a39824fd615cfe3cfd5226f23b9610bf778/libsff-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-13 09:42:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "NandeMD",
"github_project": "libsff",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "libsff"
}