{"id":19360260,"url":"https://github.com/ioi-2017/print","last_synced_at":"2025-04-13T09:09:15.021Z","repository":{"id":53665267,"uuid":"108673324","full_name":"ioi-2017/print","owner":"ioi-2017","description":"IOI Printing System","archived":false,"fork":false,"pushed_at":"2021-03-19T23:43:28.000Z","size":3741,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T09:09:09.929Z","etag":null,"topics":["cups-server","network-printer"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ioi-2017.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-3RD-PARTY.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-28T18:21:41.000Z","updated_at":"2024-12-24T02:19:35.000Z","dependencies_parsed_at":"2022-09-05T07:30:53.063Z","dependency_job_id":null,"html_url":"https://github.com/ioi-2017/print","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioi-2017%2Fprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioi-2017%2Fprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioi-2017%2Fprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioi-2017%2Fprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ioi-2017","download_url":"https://codeload.github.com/ioi-2017/print/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248688565,"owners_count":21145766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cups-server","network-printer"],"created_at":"2024-11-10T07:17:33.883Z","updated_at":"2025-04-13T09:09:14.989Z","avatar_url":"https://github.com/ioi-2017.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"IOI Printing System\n===================\n\nThe IOI Printing System handles all print requests in the International\nOlympiad in Informatics, during the contests and the translation meetings.\nThe system has been developed for and was first used in the\n[IOI 2017](http://ioi2017.org/) in Tehran, Iran.\n\nThe system supports the following tasks and requests:\n  * Print requests from contestants during the contest\n    (via a custom printer installed on all contestants machines) [`contestant`]\n  * Call staff requests from the IOI Contest Management System [`cms_request`]\n  * Print requests from the IOI Translation System during the translation meetings\n    [`translation`]\n  * Custom mass print requests [`mass`]\n\n\nInstallation\n------------\n\nTo run the project, you need to install\n[docker](https://docs.docker.com/engine/installation/) and\n[docker-compose](https://docs.docker.com/compose/install/).\n(It has been deployed and tested with docker 17.06.0-ce\nand docker-compose 1.14.0, but it should work with newer versions as well.)\n\nAfter that, clone the project using the following command:\n\n```bash\ngit clone git_address/print-system.git\n```\n\nThen configure the project in `docker-compose.yml`\n(descriptions on how to configure is commented in the file), and run:\n\n```bash\ndocker-compose up\n```\n\n(You might get into errors if cups server is running or if someone else\nis using ports 631, 5000, or 6631.)\n\nThat's it! You have the printing system up and ready for work!\n\nFor running on actual server you might want to run docker-compose in daemon mode:\n\n```bash\ndocker-compose up -d\n```\n\nCheck out [docker-compose documentation](https://docs.docker.com/compose/) for more info.\n\nHow to Use\n----------\n\n#### Configure printers\n\nGo to `http://printer_server_address:6631/`, it is cups server configuration page:\n1. Go to `Administration page`, login with predefined username `admin` and password `ioi`.\n2. Click on `Add Printer`, select `Internet Printing Protocol (ipp)`, click `Continue`.\n3. Write the network printer address in `Connection`, click `Continue`. (Check your printer manual to find its ipp address)\n4. Set a `Name` for your printer and make sure `Share This Printer` is selected, click `Continue`. (The `Name` you use for your printer are the ones that you use in configuring printers in `ioiprint` in `docker-compose.yml`)\n5. Select `Generic` in the `Make` section, click `Continue`.\n6. Select `Generic IPP Everywhere Printer (en)` in the `Model` section, click `Continue`.\n7. Set default options for your printer, click `Set default options`.\n8. Play a little with printer default options and make sure print requests are handled correctly in the printer.\nYou can use `Maitenance` -\u003e `Print Test Page` in the printer page to test printing.\n\nYou can also add classes to assign a single name to multiple printers:\n1. Go to `Administration page`, click on `Add Class`.\n2. Set a `Name` for your class and select printers you want in the `Members` section, click `Continue`. (The `Name` you use for your class are the ones that you use in configuring printers in `ioiprint` in `docker-compose.yml`)\n\nThen put your printer or class names in `docker-compose.yml` (You can have a printer for each contest zone and also one default printer for `mass` and `translation` requests)\n\n#### For contestants print requests\n\nYou should add a network printer with the address `http://print_server_address:631/printers/PRINTER_NAME` on all contestants' computers.\n([This link](http://smallbusiness.chron.com/add-network-printer-linux-57531.html) can be helpful)\nPRINTER_NAME is configurable in `docker-compose.yml`. (It is `ioi_printer` by default)\n\nThe contestants can print using this printer during contest and it will be printed on the printer configured for that zone.\n\nYou can also change the templates used for rendering the first page and the last page of the prints by changing the `first.html.jinja2` and `last.html.jinja2` in `ioiprint/template` directory (They are in [Jinja2](http://jinja.pocoo.org/) format).\n\n#### For call staff requests from CMS\n\nYou should add print server address in [CMS](https://github.com/akmohtashami/cms) and it should work.\n\nFor testing you can use `scripts/cms_request.sh` (You should change `PRINT_SERVER_ADDRESS`).\n\nYou can also change the template used for rendering the prints by changing the `request.html.jinja2` in `ioiprint/template` directory (They are in [Jinja2](http://jinja.pocoo.org/) format).\n\n#### For custom translation requests from Translation System\n\nYou should add print server address in [Translation System](https://github.com/noidsirius/IOI-Translation) and it should work.\n\nFor testing you can use `scripts/translation.sh` (You should change `PRINT_SERVER_ADDRESS`).\n\n(Translation System also uses the `mass` request for non-custom prints.)\n\nYou can also change the template used for rendering the prints by changing the `translation.html.jinja2` in `ioiprint/template` directory (They are in [Jinja2](http://jinja.pocoo.org/) format).\n\n#### For custom printing\n\nYou can use `scripts/mass.sh` (You should change `PRINT_SERVER_ADDRESS`).\n\nService Details\n---------------\n\nThis service is consisted of three docker containers that are explained in details below:\n\n#### ioiprint\n\nAn http server running on port 5000 (you can change it in `docker-compose.yml`).\n\nThere are 5 type of requests system can handle:\n\n###### upload\n\n```\nendpoint: /upload\nmethod: POST\nparameters: pdf -\u003e a pdf file in multi-part form data\noutput: uploaded_file_name -\u003e Used in other requests\n```\n\nYou should upload a pdf file before using `mass`, `contestant` or `translation` requests.\nThis endpoint is used to upload files and it will give back the file name in the response body.\nYou should use this file name in the next request.\n\n###### mass\n\n```\nendpoint: /mass\nmethod: POST\nparameters: filename -\u003e output of previously called upload request\n            printer -\u003e printer or class name that is configured in cups-back server\n                       (If not given default printer is used)\n            count -\u003e number of times the system should print the file\n```\n\nThis will print the file previously uploaded `count` times on the printer specified.\n\n###### translation\n\n```\nendpoint: /translation\nmethod: POST\nparameters: filename -\u003e output of previously called upload request\n            country_code -\u003e country code of the translating country (e.g. IR)\n            country_name -\u003e country name of the translating country (e.g. Iran)\n            count -\u003e number of times the system should print the file\n```\n\nThis will add a first page and print the file previously uploaded `count` times on default printer.\n\n###### cms_request\n\n```\nendpoint: /cms_request\nmethod: POST\nparameters: request_message -\u003e The request message (e.g. Restroom)\n            ip -\u003e IP of the contestant computer\n```\n\nThis will print a page with contestant info and request message on the printer configured for the contestant zone.\n\n###### contestant\n\n```\nendpoint: /contestant\nmethod: POST\nparameters: filename -\u003e output of previously called upload request\n            ip -\u003e IP of the contestant computer\n            cups_job_id -\u003e The print job id of the cups server requesting this print\n```\n\nThis will add a first and last page to the file and print it on the printer configured for the contestant zone.\n(This endpoint is automatically called from cups-front)\n\n#### cups-front\n\nA cups server running on port 631 (You can change it in `docker-compose.yml`).\n\nThis cups server exposes a printer named `ioi_printer`, whenever a print request is received on this printer it would call `upload` and `contestant` on `ioiprint` to do the actual printing.\nThe printer is a `cups-pdf` pdf printer and a cups filter named `ioi-filter` is used to do this.\n(You can check the code in `cups` directory)\n\n#### cups-back\n\nA cups server running on port 6631 (You can change it in `docker-compose.yml`).\n\nThis cup server is the one that all printers are configured on and the actual printings are happening here.\nAll print requests from `ioiprint` comes to this cups server.\n\nChanging Contestant Data Source\n-------------------------------\n\nBy default the system will get contestant data from the IOI Network Administration System,\nand the address is configurable in `docker-compose.yml`.\n\nIf you want to change the source of contestant data (e.g. to read it from a file)\nyou should change the `get_contestant_data` function in `ioiprint/contestant_data.py` file.\nThe input of the function is the ip of the contestant's computer.\nThe output should be a python dictionary consisting of the following keys:\n- `contestant_id`: ID of the contestant\n- `contestant_name`: Name of the contestant\n- `contestant_country`: Country name of the contestant\n- `zone`: Zone that contestant sits in (It is used for determining which printer should we use for this contestant)\n- `desk_id`: ID of the contestant's desk\n- `desk_image_url` or `desk_image_path`: The SVG image of the map showing where the contestant is sitting.\nIt will be downloaded if you provide `desk_image_url` or you should use `desk_image_path` if the file is on the computer already.\n(Please note that the path should be a path inside the docker container. e.g. `/usr/src/ioiprint/svgs/contestant1.svg`)\n\nLicense\n-------\n\nThis software is distributed under the MIT license (see LICENSE.txt),\nand uses third party libraries that are distributed under their own terms\n(see LICENSE-3RD-PARTY.txt).\n\nCopyright\n---------\nCopyright (c) 2017, IOI 2017 Host Technical Committee\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioi-2017%2Fprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fioi-2017%2Fprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioi-2017%2Fprint/lists"}