diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..b0b5d983 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,29 @@ +on: + pull_request: + types: [opened, edited] + +permissions: + actions: none + checks: none + contents: none + deployments: none + issues: none + packages: none + pull-requests: write + repository-projects: none + security-events: none + statuses: none + +name: "Mark Final Task" +jobs: + label_regex: + runs-on: ubuntu-latest + name: Add label + steps: + - name: "Assign label to Final Task" + uses: Bhacaz/label-regex@v1 + with: + field: title + regex: '(?(F|f)(I|i)(N|n)(A|a)(L|l)[ -]*(T|t)(A|a)(S|s)(K|k)).*' + lowercase: true + token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/IrinaMinasyan/README.md b/IrinaMinasyan/README.md new file mode 100644 index 00000000..c01c0efb --- /dev/null +++ b/IrinaMinasyan/README.md @@ -0,0 +1,100 @@ +## RSS_Reader +RSS reader is a command-line utility which receives RSS URL and prints results in human-readable format. + +**Utility provides the following interface:** + +``` +usage: rss_reader.py [-h] [--version] [--json] [--verbose] [--limit LIMIT] + [--date DATE] [--to_html TO_HTML] [--to_pdf TO_PDF] + [source] +Performs a variety of operations on a file. + +positional arguments: + source RSS URL + +optional arguments: + -h, --help show this help message and exit. + --version Print version info. + --json Print result as JSON in stdout. + --verbose Outputs verbose status messages. + --limit LIMIT Limit news topics if this parameter provided. + In case of --limit greater than amount of received news - all available news will be displayed. + --date DATE Read cached news for provided URL. If not provided source prints all cached news for this date. + It takes a date in %Y%m%d format. + --to-html TO_HTML Converts news to html format and save it. + --to-pdf TO_PDF Convert news to pdf format and save it. +``` + +## Requirements + +The API was created using Python 3.6. To run the APP you need to install with pip packages listed in [requirements.txt] +(better to use virtual environment): + +``` +pip install -r requirements.txt +``` + +## Usage of RSS-reader + +For usage the utility use followed option: + +clone current repository and install the requirements (see the description above), it's better to use isolated environment with virtualenv. +The entire application is contained within the rss_reader.py file. For running the utility use previously listed command line arguments. For example: + +``` +rss_reader https://news.yahoo.com/rss/ --limit 3 +``` + +The output would be the following structure: + +``` +Title: WNBA star Brittney Griner ordered to trial Friday in Russia + +Date: 2022-06-27T07:41:55Z + +Link: https://news.yahoo.com/us-basketball-star-griner-due-074155275.html + +Article: MOSCOW (AP) — Shackled and looking wary, WNBA star Brittney Griner was ordered +Monday to stand trial by a court near Moscow on cannabis possession charges, +about 4 1/2 months after her arrest at an airport while returning to play for +a Russian team. +The Phoenix Mercury center and two-time U.S. Olympic gold medalist also was +ordered to remain in custody for the duration of her criminal trial, which was +to begin Friday. Griner could face 10 years in prison if convicted on charges +of large-scale transportation of drugs. Fewer than 1% of defendants in Russian +criminal cases are acquitted, and unlike in the U.S., acquittals can be +overturned. + +Image link: https://s.yimg.com/uu/api/res/1.2/1THMVZDeZ0z7PVXchxklYw--~B/aD00MDAwO3c9NjAwMDthcHBpZD15dGFjaHlvbg--/https://media.zenfs.com/en/ap.org/9f3f122d6d91ff94f9613b5d97409f0f +``` + +## Description + +#### [rss_reader/rss_reader.py] + +In rss_reader.py RSS reader utility is initialized and configured. The utility provides the following features: + +#### *Data caching:* + +The RSS news are stored in the local storage while reading. For this purpose [shelve](https://docs.python.org/3/library/shelve.html), dictionary-like object, was used. +With the optional argument ```--date %Y%m%d``` (for example: ```--date 20220624```) the cashed news can be read. Also, adding URL make the displayed news sorted by date and link. +If the news are not found - should be returned error. + +#### *Data conversion to .pdf and .html:* + +The RSS reader utility provides news converter to .pdf and .html formats. It can be done with the following optional arguments: ```--to_pdf``` and +```--to_html```. Both arguments receive the path where file would be saved. The name of the file generates automatically. + +There are two options for news conversion: + +*convert from cache* + +For this case news conversion doesn't depend on internet. With ```rss_reader.py --date 20220625 --limit 1 --to_html ~/finaltask/reader``` one news for the specified day would +be converted (the same with ```--to_pdf```), and file with it would be generated in the specified PATH.There would be clickable links to the full article +and image. + +*convert news from the Internet* + +For this case Internet is required. With ```rss_reader.py https://news.yahoo.com/rss/ --limit 1 --to_html ~/finaltask/reader``` one news from listed link +would be converted (the same with ```--to_pdf```), and file with it would be generated in the specified PATH. There would be clickable links to the full +article and image. diff --git a/IrinaMinasyan/examples/example_html.html b/IrinaMinasyan/examples/example_html.html new file mode 100644 index 00000000..718aff4e --- /dev/null +++ b/IrinaMinasyan/examples/example_html.html @@ -0,0 +1,30 @@ + + + + RSS NEWS + + +

RSS News

+
+

Officials: Georgia man sentenced to die kills self in prison

+

2022-06-27T12:50:43Z


+ Read the full article
+ +

JACKSON, Ga. (AP) — A Georgia man who was recently sentenced to death in the +killings of two corrections officers during an escape attempt five years ago +has died in prison of an apparent suicide, corrections officials said. + +Prison guards found Ricky Dubose unresponsive in his cell at the Georgia +Diagnostic and Classification Prison in Jackson around 4:45 p.m. Sunday, +according to a Department of Corrections news release. The guards called for +medical help and began rendering aid. The coroner at the prison declared +Dubose dead at 5:56 p.m. + +Dubose, 29, was sentenced to death June 16 after he was convicted of murder in +the June 2017 shooting deaths of Sgt. Christopher Monica and Sgt. Curtis +Billue. + +


+
+ + \ No newline at end of file diff --git a/IrinaMinasyan/examples/example_xml.xml b/IrinaMinasyan/examples/example_xml.xml new file mode 100644 index 00000000..025b3536 --- /dev/null +++ b/IrinaMinasyan/examples/example_xml.xml @@ -0,0 +1,24 @@ + + Yahoo News - Latest News & Headlines + https://www.yahoo.com/news + The latest news and headlines from Yahoo! News. Get breaking news stories and in-depth coverage with videos and photos. + en-US + Copyright (c) 2022 Yahoo! Inc. All rights reserved + Tue, 28 Jun 2022 13:10:03 -0400 + 5 + + Yahoo News - Latest News & Headlines + https://www.yahoo.com/news + http://l.yimg.com/rz/d/yahoo_news_en-US_s_f_p_168x21_news.png + + + Officials: Georgia man sentenced to die kills self in prison + https://news.yahoo.com/officials-georgia-man-sentenced-die-125043110.html + 2022-06-27T12:50:43Z + Associated Press + officials-georgia-man-sentenced-die-125043110.html + + + + + \ No newline at end of file diff --git a/IrinaMinasyan/font/ALEE_copyright.txt b/IrinaMinasyan/font/ALEE_copyright.txt new file mode 100644 index 00000000..b460ce28 --- /dev/null +++ b/IrinaMinasyan/font/ALEE_copyright.txt @@ -0,0 +1,10 @@ +This package was debianized by A Lee on +Sun, 18 Jul 2004 09:30:17 +0900. + +Copyright 2006 (C) A Lee . All rights reserved. + All the fonts are free; you can redistribute them and/or modify them + under the terms of the Artistic License; either version 1.0 of the + License, or (at your option) any later version. + + On Debian systems, the complete text of the Artistic License can be + found in the /usr/share/common-licenses/Artistic file. diff --git a/IrinaMinasyan/font/Bandal.ttf b/IrinaMinasyan/font/Bandal.ttf new file mode 100644 index 00000000..6a3d6baf Binary files /dev/null and b/IrinaMinasyan/font/Bandal.ttf differ diff --git a/IrinaMinasyan/font/Bangwool.ttf b/IrinaMinasyan/font/Bangwool.ttf new file mode 100644 index 00000000..f2d96b59 Binary files /dev/null and b/IrinaMinasyan/font/Bangwool.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSans-Bold.ttf b/IrinaMinasyan/font/DejaVuSans-Bold.ttf new file mode 100644 index 00000000..0f4d5e9d Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSans-Bold.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSans-BoldOblique.ttf b/IrinaMinasyan/font/DejaVuSans-BoldOblique.ttf new file mode 100644 index 00000000..48f06a86 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSans-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSans-ExtraLight.ttf b/IrinaMinasyan/font/DejaVuSans-ExtraLight.ttf new file mode 100644 index 00000000..01a56521 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSans-ExtraLight.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSans-Oblique.ttf b/IrinaMinasyan/font/DejaVuSans-Oblique.ttf new file mode 100644 index 00000000..44856388 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSans-Oblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSans.ttf b/IrinaMinasyan/font/DejaVuSans.ttf new file mode 100644 index 00000000..27cff476 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSans.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansCondensed-Bold.ttf b/IrinaMinasyan/font/DejaVuSansCondensed-Bold.ttf new file mode 100644 index 00000000..9edd89c3 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansCondensed-Bold.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansCondensed-BoldOblique.ttf b/IrinaMinasyan/font/DejaVuSansCondensed-BoldOblique.ttf new file mode 100644 index 00000000..e2db5ce0 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansCondensed-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansCondensed-Oblique.ttf b/IrinaMinasyan/font/DejaVuSansCondensed-Oblique.ttf new file mode 100644 index 00000000..7cec04c2 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansCondensed-Oblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansCondensed.ttf b/IrinaMinasyan/font/DejaVuSansCondensed.ttf new file mode 100644 index 00000000..826e619b Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansCondensed.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansMono-Bold.ttf b/IrinaMinasyan/font/DejaVuSansMono-Bold.ttf new file mode 100644 index 00000000..09d42796 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansMono-Bold.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansMono-BoldOblique.ttf b/IrinaMinasyan/font/DejaVuSansMono-BoldOblique.ttf new file mode 100644 index 00000000..0344c227 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansMono-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansMono-Oblique.ttf b/IrinaMinasyan/font/DejaVuSansMono-Oblique.ttf new file mode 100644 index 00000000..bc16d51b Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansMono-Oblique.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSansMono.ttf b/IrinaMinasyan/font/DejaVuSansMono.ttf new file mode 100644 index 00000000..7260bd65 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSansMono.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerif-Bold.ttf b/IrinaMinasyan/font/DejaVuSerif-Bold.ttf new file mode 100644 index 00000000..afa2d5ec Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerif-Bold.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerif-BoldItalic.ttf b/IrinaMinasyan/font/DejaVuSerif-BoldItalic.ttf new file mode 100644 index 00000000..ce9443ea Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerif-BoldItalic.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerif-Italic.ttf b/IrinaMinasyan/font/DejaVuSerif-Italic.ttf new file mode 100644 index 00000000..c1864a30 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerif-Italic.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerif.ttf b/IrinaMinasyan/font/DejaVuSerif.ttf new file mode 100644 index 00000000..ed53a296 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerif.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerifCondensed-Bold.ttf b/IrinaMinasyan/font/DejaVuSerifCondensed-Bold.ttf new file mode 100644 index 00000000..55adca41 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerifCondensed-Bold.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerifCondensed-BoldItalic.ttf b/IrinaMinasyan/font/DejaVuSerifCondensed-BoldItalic.ttf new file mode 100644 index 00000000..e2119573 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerifCondensed-BoldItalic.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerifCondensed-Italic.ttf b/IrinaMinasyan/font/DejaVuSerifCondensed-Italic.ttf new file mode 100644 index 00000000..275b26d9 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerifCondensed-Italic.ttf differ diff --git a/IrinaMinasyan/font/DejaVuSerifCondensed.ttf b/IrinaMinasyan/font/DejaVuSerifCondensed.ttf new file mode 100644 index 00000000..83120cd9 Binary files /dev/null and b/IrinaMinasyan/font/DejaVuSerifCondensed.ttf differ diff --git a/IrinaMinasyan/font/DejaVu_LICENSE.txt b/IrinaMinasyan/font/DejaVu_LICENSE.txt new file mode 100644 index 00000000..254e2cc4 --- /dev/null +++ b/IrinaMinasyan/font/DejaVu_LICENSE.txt @@ -0,0 +1,99 @@ +Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. +Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) + +Bitstream Vera Fonts Copyright +------------------------------ + +Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is +a trademark of Bitstream, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of the fonts accompanying this license ("Fonts") and associated +documentation files (the "Font Software"), to reproduce and distribute the +Font Software, including without limitation the rights to use, copy, merge, +publish, distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to the +following conditions: + +The above copyright and trademark notices and this permission notice shall +be included in all copies of one or more of the Font Software typefaces. + +The Font Software may be modified, altered, or added to, and in particular +the designs of glyphs or characters in the Fonts may be modified and +additional glyphs or characters may be added to the Fonts, only if the fonts +are renamed to names not containing either the words "Bitstream" or the word +"Vera". + +This License becomes null and void to the extent applicable to Fonts or Font +Software that has been modified and is distributed under the "Bitstream +Vera" names. + +The Font Software may be sold as part of a larger software package but no +copy of one or more of the Font Software typefaces may be sold by itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, +TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME +FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING +ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE +FONT SOFTWARE. + +Except as contained in this notice, the names of Gnome, the Gnome +Foundation, and Bitstream Inc., shall not be used in advertising or +otherwise to promote the sale, use or other dealings in this Font Software +without prior written authorization from the Gnome Foundation or Bitstream +Inc., respectively. For further information, contact: fonts at gnome dot +org. + +Arev Fonts Copyright +------------------------------ + +Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the fonts accompanying this license ("Fonts") and +associated documentation files (the "Font Software"), to reproduce +and distribute the modifications to the Bitstream Vera Font Software, +including without limitation the rights to use, copy, merge, publish, +distribute, and/or sell copies of the Font Software, and to permit +persons to whom the Font Software is furnished to do so, subject to +the following conditions: + +The above copyright and trademark notices and this permission notice +shall be included in all copies of one or more of the Font Software +typefaces. + +The Font Software may be modified, altered, or added to, and in +particular the designs of glyphs or characters in the Fonts may be +modified and additional glyphs or characters may be added to the +Fonts, only if the fonts are renamed to names not containing either +the words "Tavmjong Bah" or the word "Arev". + +This License becomes null and void to the extent applicable to Fonts +or Font Software that has been modified and is distributed under the +"Tavmjong Bah Arev" names. + +The Font Software may be sold as part of a larger software package but +no copy of one or more of the Font Software typefaces may be sold by +itself. + +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL +TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +Except as contained in this notice, the name of Tavmjong Bah shall not +be used in advertising or otherwise to promote the sale, use or other +dealings in this Font Software without prior written authorization +from Tavmjong Bah. For further information, contact: tavmjong @ free +. fr. + +$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $ diff --git a/IrinaMinasyan/font/Eunjin.ttf b/IrinaMinasyan/font/Eunjin.ttf new file mode 100644 index 00000000..c37dc328 Binary files /dev/null and b/IrinaMinasyan/font/Eunjin.ttf differ diff --git a/IrinaMinasyan/font/EunjinNakseo.ttf b/IrinaMinasyan/font/EunjinNakseo.ttf new file mode 100644 index 00000000..afa5ead7 Binary files /dev/null and b/IrinaMinasyan/font/EunjinNakseo.ttf differ diff --git a/IrinaMinasyan/font/FireFly_COPYRIGHT.txt b/IrinaMinasyan/font/FireFly_COPYRIGHT.txt new file mode 100644 index 00000000..06b636b9 --- /dev/null +++ b/IrinaMinasyan/font/FireFly_COPYRIGHT.txt @@ -0,0 +1,172 @@ + Copyright (C) 1994-1999, Arphic Technology Co., Ltd. + Copyright (C) 1999-2004, Firefly and Arphic Technology Co., Ltd. + +Author/Designer: + Original author: + Arphic Technology Co., Ltd. + http://www.arphic.com.tw/ + + Modified by: + Firefly + http://firefly.idv.tw + +NOTICE: This Truetype font contains embedded bitmap fonts made + by firefly and is released as a whole + under the ARPHIC PUBLIC LICENSE. + There are also seperate bitmap fonts made by Firefly and + released under the GENERAL PUBLIC LICENSE (GPL): + http://www.study-area.org/apt/firefly-font/bitmaps/ + +Copyright: + (Copied from 'license/english/ARPHICPL.TXT'. + See 'license/big5/ARPHICPL.TXT' or 'license/gb/ARPHICPL.TXT' + for the Chinese version.) + +========================================================================== + +ARPHIC PUBLIC LICENSE + +Copyright (C) 1999 Arphic Technology Co., Ltd. +11Fl. No.168, Yung Chi Rd., Taipei, 110 Taiwan +All rights reserved except as specified below. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is forbidden. + +Preamble + + The licenses for most software are designed to take away your freedom +to share and change it. By contrast, the ARPHIC PUBLIC LICENSE +specifically permits and encourages you to use this software, provided +that you give the recipients all the rights that we gave you and make +sure they can get the modifications of this software. + +Legal Terms + +0. Definitions: + Throughout this License, "Font" means the TrueType fonts "AR PL +Mingti2L Big5", "AR PL KaitiM Big5" (BIG-5 character set) and "AR PL +SungtiL GB", "AR PL KaitiM GB" (GB character set) which are originally +distributed by Arphic, and the derivatives of those fonts created +through any modification including modifying glyph, reordering glyph, +converting format, changing font name, or adding/deleting some +characters in/from glyph table. + + "PL" means "Public License". + + "Copyright Holder" means whoever is named in the copyright or +copyrights for the Font. + + "You" means the licensee, or person copying, redistributing or +modifying the Font. + + "Freely Available" means that you have the freedom to copy or modify +the Font as well as redistribute copies of the Font under the same +conditions you received, not price. If you wish, you can charge for this +service. + +1. Copying & Distribution + You may copy and distribute verbatim copies of this Font in any +medium, without restriction, provided that you retain this license file +(ARPHICPL.TXT) unaltered in all copies. + +2. Modification + You may otherwise modify your copy of this Font in any way, including +modifying glyph, reordering glyph, converting format, changing font +name, or adding/deleting some characters in/from glyph table, and copy +and distribute such modifications under the terms of Section 1 above, +provided that the following conditions are met: + + a) You must insert a prominent notice in each modified file stating +how and when you changed that file. + + b) You must make such modifications Freely Available as a whole to +all third parties under the terms of this License, such as by offering +access to copy the modifications from a designated place, or +distributing the modifications on a medium customarily used for software +interchange. + + c) If the modified fonts normally reads commands interactively when +run, you must cause it, when started running for such interactive use in +the most ordinary way, to print or display an announcement including an +appropriate copyright notice and a notice that there is no warranty (or +else, saying that you provide a warranty) and that users may +redistribute the Font under these conditions, and telling the user how +to view a copy of this License. + + These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Font, and +can be reasonably considered independent and separate works in +themselves, then this License and its terms, do not apply to those +sections when you distribute them as separate works. Therefore, mere +aggregation of another work not based on the Font with the Font on a +volume of a storage or distribution medium does not bring the other work +under the scope of this License. + +3. Condition Subsequent + You may not copy, modify, sublicense, or distribute the Font except +as expressly provided under this License. Any attempt otherwise to copy, +modify, sublicense or distribute the Font will automatically +retroactively void your rights under this License. However, parties who +have received copies or rights from you under this License will keep +their licenses valid so long as such parties remain in full compliance. + +4. Acceptance + You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to copy, modify, +sublicense or distribute the Font. These actions are prohibited by law +if you do not accept this License. Therefore, by copying, modifying, +sublicensing or distributing the Font, you indicate your acceptance of +this License and all its terms and conditions. + +5. Automatic Receipt + Each time you redistribute the Font, the recipient automatically +receives a license from the original licensor to copy, distribute or +modify the Font subject to these terms and conditions. You may not +impose any further restrictions on the recipients' exercise of the +rights granted herein. You are not responsible for enforcing compliance +by third parties to this License. + +6. Contradiction + If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot distribute +so as to satisfy simultaneously your obligations under this License and +any other pertinent obligations, then as a consequence you may not +distribute the Font at all. For example, if a patent license would not +permit royalty-free redistribution of the Font by all those who receive +copies directly or indirectly through you, then the only way you could +satisfy both it and this License would be to refrain entirely from +distribution of the Font. + + If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +7. NO WARRANTY + BECAUSE THE FONT IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE FONT, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS OR OTHER PARTIES +PROVIDE THE FONT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE FONT IS WITH YOU. SHOULD THE FONT +PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR +OR CORRECTION. + +8. DAMAGES WAIVER + UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, IN NO +EVENT WILL ANY COPYRIGHTT HOLDERS, OR OTHER PARTIES WHO MAY COPY, MODIFY +OR REDISTRIBUTE THE FONT AS PERMITTED ABOVE, BE LIABLE TO YOU FOR ANY +DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, SPECIAL OR EXEMPLARY +DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE FONT (INCLUDING +BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +USE, DATA OR PROFITS; OR BUSINESS INTERRUPTION), EVEN IF SUCH HOLDERS OR +OTHER PARTIES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +====================================================================== + + diff --git a/IrinaMinasyan/font/Garuda-Bold.ttf b/IrinaMinasyan/font/Garuda-Bold.ttf new file mode 100644 index 00000000..372d6da6 Binary files /dev/null and b/IrinaMinasyan/font/Garuda-Bold.ttf differ diff --git a/IrinaMinasyan/font/Garuda-BoldOblique.ttf b/IrinaMinasyan/font/Garuda-BoldOblique.ttf new file mode 100644 index 00000000..5bdd486c Binary files /dev/null and b/IrinaMinasyan/font/Garuda-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Garuda-Oblique.ttf b/IrinaMinasyan/font/Garuda-Oblique.ttf new file mode 100644 index 00000000..d76bffb2 Binary files /dev/null and b/IrinaMinasyan/font/Garuda-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Garuda.ttf b/IrinaMinasyan/font/Garuda.ttf new file mode 100644 index 00000000..54304f5f Binary files /dev/null and b/IrinaMinasyan/font/Garuda.ttf differ diff --git a/IrinaMinasyan/font/Guseul.ttf b/IrinaMinasyan/font/Guseul.ttf new file mode 100644 index 00000000..3d742da8 Binary files /dev/null and b/IrinaMinasyan/font/Guseul.ttf differ diff --git a/IrinaMinasyan/font/Kedage-b.ttf b/IrinaMinasyan/font/Kedage-b.ttf new file mode 100644 index 00000000..75711163 Binary files /dev/null and b/IrinaMinasyan/font/Kedage-b.ttf differ diff --git a/IrinaMinasyan/font/Kedage-n.ttf b/IrinaMinasyan/font/Kedage-n.ttf new file mode 100644 index 00000000..6a84298f Binary files /dev/null and b/IrinaMinasyan/font/Kedage-n.ttf differ diff --git a/IrinaMinasyan/font/Kinnari-Bold.ttf b/IrinaMinasyan/font/Kinnari-Bold.ttf new file mode 100644 index 00000000..da9cb017 Binary files /dev/null and b/IrinaMinasyan/font/Kinnari-Bold.ttf differ diff --git a/IrinaMinasyan/font/Kinnari-BoldItalic.ttf b/IrinaMinasyan/font/Kinnari-BoldItalic.ttf new file mode 100644 index 00000000..38bc001f Binary files /dev/null and b/IrinaMinasyan/font/Kinnari-BoldItalic.ttf differ diff --git a/IrinaMinasyan/font/Kinnari-BoldOblique.ttf b/IrinaMinasyan/font/Kinnari-BoldOblique.ttf new file mode 100644 index 00000000..5262f257 Binary files /dev/null and b/IrinaMinasyan/font/Kinnari-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Kinnari-Italic.ttf b/IrinaMinasyan/font/Kinnari-Italic.ttf new file mode 100644 index 00000000..4d3ecadf Binary files /dev/null and b/IrinaMinasyan/font/Kinnari-Italic.ttf differ diff --git a/IrinaMinasyan/font/Kinnari-Oblique.ttf b/IrinaMinasyan/font/Kinnari-Oblique.ttf new file mode 100644 index 00000000..825e806c Binary files /dev/null and b/IrinaMinasyan/font/Kinnari-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Kinnari.ttf b/IrinaMinasyan/font/Kinnari.ttf new file mode 100644 index 00000000..0e840fc4 Binary files /dev/null and b/IrinaMinasyan/font/Kinnari.ttf differ diff --git a/IrinaMinasyan/font/Loma-Bold.ttf b/IrinaMinasyan/font/Loma-Bold.ttf new file mode 100644 index 00000000..98d8f75b Binary files /dev/null and b/IrinaMinasyan/font/Loma-Bold.ttf differ diff --git a/IrinaMinasyan/font/Loma-BoldOblique.ttf b/IrinaMinasyan/font/Loma-BoldOblique.ttf new file mode 100644 index 00000000..09cf2d7b Binary files /dev/null and b/IrinaMinasyan/font/Loma-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Loma-Oblique.ttf b/IrinaMinasyan/font/Loma-Oblique.ttf new file mode 100644 index 00000000..0223cef0 Binary files /dev/null and b/IrinaMinasyan/font/Loma-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Loma.ttf b/IrinaMinasyan/font/Loma.ttf new file mode 100644 index 00000000..ab5535d3 Binary files /dev/null and b/IrinaMinasyan/font/Loma.ttf differ diff --git a/IrinaMinasyan/font/Malige-b.ttf b/IrinaMinasyan/font/Malige-b.ttf new file mode 100644 index 00000000..1f1692f2 Binary files /dev/null and b/IrinaMinasyan/font/Malige-b.ttf differ diff --git a/IrinaMinasyan/font/Malige-n.ttf b/IrinaMinasyan/font/Malige-n.ttf new file mode 100644 index 00000000..7947a3a5 Binary files /dev/null and b/IrinaMinasyan/font/Malige-n.ttf differ diff --git a/IrinaMinasyan/font/Meera_04.ttf b/IrinaMinasyan/font/Meera_04.ttf new file mode 100644 index 00000000..e4610fe4 Binary files /dev/null and b/IrinaMinasyan/font/Meera_04.ttf differ diff --git a/IrinaMinasyan/font/MuktiNarrow.ttf b/IrinaMinasyan/font/MuktiNarrow.ttf new file mode 100644 index 00000000..7c80f981 Binary files /dev/null and b/IrinaMinasyan/font/MuktiNarrow.ttf differ diff --git a/IrinaMinasyan/font/MuktiNarrowBold.ttf b/IrinaMinasyan/font/MuktiNarrowBold.ttf new file mode 100644 index 00000000..4cd05c77 Binary files /dev/null and b/IrinaMinasyan/font/MuktiNarrowBold.ttf differ diff --git a/IrinaMinasyan/font/Norasi-Bold.ttf b/IrinaMinasyan/font/Norasi-Bold.ttf new file mode 100644 index 00000000..b9b79e36 Binary files /dev/null and b/IrinaMinasyan/font/Norasi-Bold.ttf differ diff --git a/IrinaMinasyan/font/Norasi-BoldItalic.ttf b/IrinaMinasyan/font/Norasi-BoldItalic.ttf new file mode 100644 index 00000000..b23afec8 Binary files /dev/null and b/IrinaMinasyan/font/Norasi-BoldItalic.ttf differ diff --git a/IrinaMinasyan/font/Norasi-BoldOblique.ttf b/IrinaMinasyan/font/Norasi-BoldOblique.ttf new file mode 100644 index 00000000..3ee71a73 Binary files /dev/null and b/IrinaMinasyan/font/Norasi-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Norasi-Italic.ttf b/IrinaMinasyan/font/Norasi-Italic.ttf new file mode 100644 index 00000000..e0fb2757 Binary files /dev/null and b/IrinaMinasyan/font/Norasi-Italic.ttf differ diff --git a/IrinaMinasyan/font/Norasi-Oblique.ttf b/IrinaMinasyan/font/Norasi-Oblique.ttf new file mode 100644 index 00000000..8094d204 Binary files /dev/null and b/IrinaMinasyan/font/Norasi-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Norasi.ttf b/IrinaMinasyan/font/Norasi.ttf new file mode 100644 index 00000000..34d84b95 Binary files /dev/null and b/IrinaMinasyan/font/Norasi.ttf differ diff --git a/IrinaMinasyan/font/Purisa-Bold.ttf b/IrinaMinasyan/font/Purisa-Bold.ttf new file mode 100644 index 00000000..0f529ff0 Binary files /dev/null and b/IrinaMinasyan/font/Purisa-Bold.ttf differ diff --git a/IrinaMinasyan/font/Purisa-BoldOblique.ttf b/IrinaMinasyan/font/Purisa-BoldOblique.ttf new file mode 100644 index 00000000..2481fcff Binary files /dev/null and b/IrinaMinasyan/font/Purisa-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Purisa-Oblique.ttf b/IrinaMinasyan/font/Purisa-Oblique.ttf new file mode 100644 index 00000000..d0660487 Binary files /dev/null and b/IrinaMinasyan/font/Purisa-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Purisa.ttf b/IrinaMinasyan/font/Purisa.ttf new file mode 100644 index 00000000..31ca5f1e Binary files /dev/null and b/IrinaMinasyan/font/Purisa.ttf differ diff --git a/IrinaMinasyan/font/Sawasdee-Bold.ttf b/IrinaMinasyan/font/Sawasdee-Bold.ttf new file mode 100644 index 00000000..30df0729 Binary files /dev/null and b/IrinaMinasyan/font/Sawasdee-Bold.ttf differ diff --git a/IrinaMinasyan/font/Sawasdee-BoldOblique.ttf b/IrinaMinasyan/font/Sawasdee-BoldOblique.ttf new file mode 100644 index 00000000..b98067de Binary files /dev/null and b/IrinaMinasyan/font/Sawasdee-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Sawasdee-Oblique.ttf b/IrinaMinasyan/font/Sawasdee-Oblique.ttf new file mode 100644 index 00000000..a9244d6c Binary files /dev/null and b/IrinaMinasyan/font/Sawasdee-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Sawasdee.ttf b/IrinaMinasyan/font/Sawasdee.ttf new file mode 100644 index 00000000..ab77d342 Binary files /dev/null and b/IrinaMinasyan/font/Sawasdee.ttf differ diff --git a/IrinaMinasyan/font/TlwgMono-Bold.ttf b/IrinaMinasyan/font/TlwgMono-Bold.ttf new file mode 100644 index 00000000..7a08ff58 Binary files /dev/null and b/IrinaMinasyan/font/TlwgMono-Bold.ttf differ diff --git a/IrinaMinasyan/font/TlwgMono-BoldOblique.ttf b/IrinaMinasyan/font/TlwgMono-BoldOblique.ttf new file mode 100644 index 00000000..930d6a3e Binary files /dev/null and b/IrinaMinasyan/font/TlwgMono-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgMono-Oblique.ttf b/IrinaMinasyan/font/TlwgMono-Oblique.ttf new file mode 100644 index 00000000..5f88d6c2 Binary files /dev/null and b/IrinaMinasyan/font/TlwgMono-Oblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgMono.ttf b/IrinaMinasyan/font/TlwgMono.ttf new file mode 100644 index 00000000..ff3032dc Binary files /dev/null and b/IrinaMinasyan/font/TlwgMono.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypewriter-Bold.ttf b/IrinaMinasyan/font/TlwgTypewriter-Bold.ttf new file mode 100644 index 00000000..e8e543c7 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypewriter-Bold.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypewriter-BoldOblique.ttf b/IrinaMinasyan/font/TlwgTypewriter-BoldOblique.ttf new file mode 100644 index 00000000..c3164184 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypewriter-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypewriter-Oblique.ttf b/IrinaMinasyan/font/TlwgTypewriter-Oblique.ttf new file mode 100644 index 00000000..2d4df24a Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypewriter-Oblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypewriter.ttf b/IrinaMinasyan/font/TlwgTypewriter.ttf new file mode 100644 index 00000000..4f8e26cd Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypewriter.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypist-Bold.ttf b/IrinaMinasyan/font/TlwgTypist-Bold.ttf new file mode 100644 index 00000000..e824aee0 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypist-Bold.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypist-BoldOblique.ttf b/IrinaMinasyan/font/TlwgTypist-BoldOblique.ttf new file mode 100644 index 00000000..ea6069b3 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypist-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypist-Oblique.ttf b/IrinaMinasyan/font/TlwgTypist-Oblique.ttf new file mode 100644 index 00000000..5ab2e105 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypist-Oblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypist.ttf b/IrinaMinasyan/font/TlwgTypist.ttf new file mode 100644 index 00000000..3e7426f8 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypist.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypo-Bold.ttf b/IrinaMinasyan/font/TlwgTypo-Bold.ttf new file mode 100644 index 00000000..8542d90a Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypo-Bold.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypo-BoldOblique.ttf b/IrinaMinasyan/font/TlwgTypo-BoldOblique.ttf new file mode 100644 index 00000000..f5977957 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypo-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypo-Oblique.ttf b/IrinaMinasyan/font/TlwgTypo-Oblique.ttf new file mode 100644 index 00000000..376bfbd2 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypo-Oblique.ttf differ diff --git a/IrinaMinasyan/font/TlwgTypo.ttf b/IrinaMinasyan/font/TlwgTypo.ttf new file mode 100644 index 00000000..a722d5a0 Binary files /dev/null and b/IrinaMinasyan/font/TlwgTypo.ttf differ diff --git a/IrinaMinasyan/font/Umpush-Bold.ttf b/IrinaMinasyan/font/Umpush-Bold.ttf new file mode 100644 index 00000000..c8298080 Binary files /dev/null and b/IrinaMinasyan/font/Umpush-Bold.ttf differ diff --git a/IrinaMinasyan/font/Umpush-BoldOblique.ttf b/IrinaMinasyan/font/Umpush-BoldOblique.ttf new file mode 100644 index 00000000..195d40e7 Binary files /dev/null and b/IrinaMinasyan/font/Umpush-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Umpush-Light.ttf b/IrinaMinasyan/font/Umpush-Light.ttf new file mode 100644 index 00000000..2226df1c Binary files /dev/null and b/IrinaMinasyan/font/Umpush-Light.ttf differ diff --git a/IrinaMinasyan/font/Umpush-LightOblique.ttf b/IrinaMinasyan/font/Umpush-LightOblique.ttf new file mode 100644 index 00000000..d625a527 Binary files /dev/null and b/IrinaMinasyan/font/Umpush-LightOblique.ttf differ diff --git a/IrinaMinasyan/font/Umpush-Oblique.ttf b/IrinaMinasyan/font/Umpush-Oblique.ttf new file mode 100644 index 00000000..922fc6d8 Binary files /dev/null and b/IrinaMinasyan/font/Umpush-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Umpush.ttf b/IrinaMinasyan/font/Umpush.ttf new file mode 100644 index 00000000..f2da8f08 Binary files /dev/null and b/IrinaMinasyan/font/Umpush.ttf differ diff --git a/IrinaMinasyan/font/Waree-Bold.ttf b/IrinaMinasyan/font/Waree-Bold.ttf new file mode 100644 index 00000000..2a969c0d Binary files /dev/null and b/IrinaMinasyan/font/Waree-Bold.ttf differ diff --git a/IrinaMinasyan/font/Waree-BoldOblique.ttf b/IrinaMinasyan/font/Waree-BoldOblique.ttf new file mode 100644 index 00000000..69c6bf86 Binary files /dev/null and b/IrinaMinasyan/font/Waree-BoldOblique.ttf differ diff --git a/IrinaMinasyan/font/Waree-Oblique.ttf b/IrinaMinasyan/font/Waree-Oblique.ttf new file mode 100644 index 00000000..23461c31 Binary files /dev/null and b/IrinaMinasyan/font/Waree-Oblique.ttf differ diff --git a/IrinaMinasyan/font/Waree.ttf b/IrinaMinasyan/font/Waree.ttf new file mode 100644 index 00000000..a671ec92 Binary files /dev/null and b/IrinaMinasyan/font/Waree.ttf differ diff --git a/IrinaMinasyan/font/fireflysung.ttf b/IrinaMinasyan/font/fireflysung.ttf new file mode 100644 index 00000000..1484f5ae Binary files /dev/null and b/IrinaMinasyan/font/fireflysung.ttf differ diff --git a/IrinaMinasyan/font/gargi.ttf b/IrinaMinasyan/font/gargi.ttf new file mode 100644 index 00000000..8ac690af Binary files /dev/null and b/IrinaMinasyan/font/gargi.ttf differ diff --git a/IrinaMinasyan/font/indic_copyright.txt b/IrinaMinasyan/font/indic_copyright.txt new file mode 100644 index 00000000..a5f015c4 --- /dev/null +++ b/IrinaMinasyan/font/indic_copyright.txt @@ -0,0 +1,118 @@ +Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 +Name: ttf-indic-fonts-core +Maintainer: Arne Goetje + +Files: * +Copyright: Copyright 2010 Arne Goetje +License: GPL-2+ + +Files: MuktiNarrow*.ttf +Copyright: Copyright (C) 2003 Mukta Bangla Font Project +License: GPL-2+ + +Files: lohit*.ttf +Copyright: Copyright (C) 2003 Automatic Control Equipments, Pune, INDIA + Copyright (C) 2006 Modular Infotech Pvt Ltd. + Copyright (C) 2009 Red Hat, Inc. +License: GPL-2+-BY-Font + +Files: gargi*.ttf +Copyright: Glyphs Copyright (C) Cyberscape Multimedia Ltd + Open Type rules and extra glyphsets made by Localization Team HBCSE,TIFR + Devanagari character shapes improved and maintained by Monika Shah and + Sonali Sonania of janabhaaratii Team, C-DAC, Mumbai. + +License: GPL-2+ + +Files: Rekha*.ttf +Copyright: Copyright (C) 2004-2007 Magnet Technologies Pvt Ltd +License: GPL-2+ + +Files: Kedage-*.ttf +Copyright: Copyright (C) 2005 Indian Institute of Science, Bangalore. +License: GPL-2+ + +Files: Malige-*.ttf +Copyright: Copyright (C) 2005 Indian Institute of Science, Bangalore. +License: GPL-2+ + +Files: Meera_*.ttf +Copyright: Copyright (C) 2007 Hussain K H, + Suresh P, + Swathanthra Malayalam Computing +License: GPL-2+ + +Files: Rachana_*.ttf +Copyright: Copyright (C) 2005 Rachana Akshara Vedi + (Chitrajakumar R, Hussain KH, Rajeev Sebastian, + Gangadharan N, Vijayakumaran Nair, Subash Kuraiakose) +License: GPL-2+ + +Files: utkal*.ttf +Copyright: Copyright (C) 2003 Andy White, Rajesh Pradhan + This font was constructed using modified glyphs from GPLed font ori-1-n + from Cyberscape Multimedia . +License: GPL-2+ + +Files: Pothana2000.ttf +Copyright: Copyright (C) 2000-2006 K.Desikachary +License: GPL-2+ + +Files: Vemana*.ttf +Copyright: Copyright (C) 2000-2006 K.Desikachary +License: GPL-2+ + +License: GPL-2+ + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the complete text of the GNU General Public License, + can be found in /usr/share/common-licenses/GPL-2 and + /usr/share/common-licenses/GPL-3. + +License: GPL-2+-BY-Font + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the complete text of the GNU General Public License, + can be found in /usr/share/common-licenses/GPL-2 and + /usr/share/common-licenses/GPL-3. + . + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the + document, this font does not by itself cause the resulting document + to be covered by the GNU General Public License. This exception does + not however invalidate any other reasons why the document might be + covered by the GNU General Public License. If you modify this font, + you may extend this exception to your version of the font, but you + are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. + diff --git a/IrinaMinasyan/font/lohit_bn.ttf b/IrinaMinasyan/font/lohit_bn.ttf new file mode 100644 index 00000000..a6495580 Binary files /dev/null and b/IrinaMinasyan/font/lohit_bn.ttf differ diff --git a/IrinaMinasyan/font/lohit_gu.ttf b/IrinaMinasyan/font/lohit_gu.ttf new file mode 100644 index 00000000..569ce87d Binary files /dev/null and b/IrinaMinasyan/font/lohit_gu.ttf differ diff --git a/IrinaMinasyan/font/lohit_hi.ttf b/IrinaMinasyan/font/lohit_hi.ttf new file mode 100644 index 00000000..711f17d8 Binary files /dev/null and b/IrinaMinasyan/font/lohit_hi.ttf differ diff --git a/IrinaMinasyan/font/lohit_ta.ttf b/IrinaMinasyan/font/lohit_ta.ttf new file mode 100644 index 00000000..94ec9da4 Binary files /dev/null and b/IrinaMinasyan/font/lohit_ta.ttf differ diff --git a/IrinaMinasyan/font/thai_tlwg_copyright.txt b/IrinaMinasyan/font/thai_tlwg_copyright.txt new file mode 100644 index 00000000..b138e04c --- /dev/null +++ b/IrinaMinasyan/font/thai_tlwg_copyright.txt @@ -0,0 +1,131 @@ +Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=173 +Upstream-Name: thaifonts-scalable +Upstream-Contact: Theppitak Karoonboonyanan +Source: ftp://linux.thai.net/pub/thailinux/software/thaifonts-scalable + +Files: * +Copyright: 2003-2011 Theppitak Karoonboonyanan +License: GPL-2+ + On Debian systems, the complete text of the GNU General Public License, + version 2, can be found in /usr/share/common-licenses/GPL-2. + +Files: debian/* +Copyright: 2003 Chanop Silpa-Anan +Copyright: 2004 Pattara Kiatisevi +Copyright: 2005-2011 Theppitak Karoonboonyanan +License: GPL-2+ + On Debian systems, the complete text of the GNU General Public License, + version 2, can be found in /usr/share/common-licenses/GPL-2. + +Files: nf/Kinnari*.sfd +Copyright: 1999 Db Type +Copyright: 2007 National Electronics and Computer Technology Center +License: GPL-2+ with Font exception + +Files: nf/Garuda*.sfd +Copyright: Originally Public Domain +Copyright: 2001-2009 Theppitak Karoonboonyanan +License: GPL-2+ with Font exception + +Files: nf/Norasi*.sfd +Copyright: 1999 The National Font Project +Copyright: 1999 Yannis Haralambous, Virach Sornlertlamvanich and + Anutara Tantraporn +Copyright: 1999 URW++ Design & Development +Copyright: 2003-2004 Chanop Silpa-Anan +License: GPL-2+ with Font exception + +Files: nectec/Loma*.sfd +Copyright: 2003 National Electronics and Computer Technology Center +License: GPL-2+ with Font exception + +Files: tlwg/TlwgMono*.sfd +Copyright: 2003 Poonlap Veerathanabutr +License: GPL-2+ with Font exception + +Files: tlwg/TlwgTypewriter*.sfd +Copyright: 2003, 2004 Poonlap Veerathanabutr +License: GPL-2+ with Font exception + +Files: tlwg/TlwgTypist*.sfd +Copyright: 2003, 2004 Poonlap Veerathanabutr +Copyright: 2005-2007 Theppitak Karoonboonyanan +License: GPL-2+ with Font exception + +Files: tlwg/TlwgTypo*.sfd +Copyright: 2003, 2004 Poonlap Veerathanabutr +Copyright: 2005-2007 Theppitak Karoonboonyanan +License: GPL-2+ with Font exception + +Files: tlwg/Purisa.sfd +Copyright: 2003, 2004 Poonlap Veerathanabutr +License: GPL-2+ with Font exception + +Files: tlwg/Sawasdee*.sfd +Copyright: 2007 Pol Udomwittayanukul +License: GPL-2+ with Font exception + +Files: tlwg/Umpush*.sfd +Copyright: 2003 National Electronics and Computer Technology Center +Copyright: Copyright 2007 Widhaya Trisarnwadhana +License: GPL-2+ with Font exception + +Files: tlwg/Waree*.sfd +Copyright: 2003 Bitstream, Inc. +License: other + Permission is hereby granted, free of charge, to any person obtaining + a copy of the fonts accompanying this license ("Fonts") and associated + documentation files (the "Font Software"), to reproduce and distribute + the Font Software, including without limitation the rights to use, + copy, merge, publish, distribute, and/or sell copies of the Font + Software, and to permit persons to whom the Font Software is furnished + to do so, subject to the following conditions: + . + The above copyright and trademark notices and this permission notice + shall be included in all copies of one or more of the Font Software + typefaces. + . + The Font Software may be modified, altered, or added to, and in + particular the designs of glyphs or characters in the Fonts may be + modified and additional glyphs or characters may be added to the + Fonts, only if the fonts are renamed to names not containing either + the words "Bitstream" or the word "Vera". + . + This License becomes null and void to the extent applicable to Fonts + or Font Software that has been modified and is distributed under the + "Bitstream Vera" names. + . + The Font Software may be sold as part of a larger software package + but no copy of one or more of the Font Software typefaces may be sold + by itself. + . + THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL + BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, + OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT + SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. + . + Except as contained in this notice, the names of Gnome, the Gnome + Foundation, and Bitstream Inc., shall not be used in advertising or + otherwise to promote the sale, use or other dealings in this Font + Software without prior written authorization from the Gnome Foundation + or Bitstream Inc., respectively. For further information, contact: + fonts at gnome dot org. + +License: GPL-2+ with Font exception + On Debian GNU/Linux systems, the complete text of the GNU General Public + License version 2 can be found in `/usr/share/common-licenses/GPL-2'. + . + As a special exception, if you create a document which uses this font, + and embed this font or unaltered portions of this font into the + document, this font does not by itself cause the resulting document + to be covered by the GNU General Public License. This exception does + not however invalidate any other reasons why the document might be + covered by the GNU General Public License. If you modify this font, + you may extend this exception to your version of the font, but you + are not obligated to do so. If you do not wish to do so, delete this + exception statement from your version. diff --git a/IrinaMinasyan/reader/__init__.py b/IrinaMinasyan/reader/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/IrinaMinasyan/reader/add_args.py b/IrinaMinasyan/reader/add_args.py new file mode 100644 index 00000000..7ac923e7 --- /dev/null +++ b/IrinaMinasyan/reader/add_args.py @@ -0,0 +1,31 @@ +"""Add arguments, which will be available, when we work with command-line""" +import argparse + + +def check_positive(value): + """Given argument must be positive""" + check_digit(value) + value = int(value) + if value <= 0: + raise argparse.ArgumentTypeError(f"can only be positive. Your input = {value}.") + return value + + +def check_digit(value): + """Given argument must be digit""" + if not value.isdigit(): + raise argparse.ArgumentTypeError(f"can only be integer. Your input = {value}.") + return value + + +parser = argparse.ArgumentParser(description="Pure Python command-line RSS reader.") +parser.add_argument("source", nargs='?', help="RSS URL") +parser.add_argument("--version", help="Print version info", action="store_true") +parser.add_argument("--json", help="Print result as JSON in stdout", action="store_true") +parser.add_argument("--verbose", help="Output verbose status messages", action="store_true") +parser.add_argument("--limit", help="Limit news topics if this parameter provided", type=check_positive) +parser.add_argument("--date", help="Read cached news for provided URL. If not provided source " + "- prints all cached news for this date.", type=check_digit,) +parser.add_argument("--to_pdf", help="Converts news to pdf format and save it", action="store_true") +parser.add_argument("--to_html", help="Converts news to html format and save it", action="store_true") +args = parser.parse_args() diff --git a/IrinaMinasyan/reader/cache.py b/IrinaMinasyan/reader/cache.py new file mode 100644 index 00000000..f4eb09a1 --- /dev/null +++ b/IrinaMinasyan/reader/cache.py @@ -0,0 +1,48 @@ +"""This class implements news items cache""" +import shelve + +from dateutil.parser import parse +from reader.exceptions import CacheNotFound + + +class Cache: + """Class which definite characteristics of the caching. + Attributes + cache : dict + The format of the cached data that will be stored in the file. + Cache format is {date: {url: set(news_article)}}. + """ + def __init__(self): + """Initialise empty cache""" + self.cache = shelve.open('cache_rss') + + def save_in_cache(self, news, url): + """Save news_articles to cache""" + parsed_date = parse(news.get_date()) + date = parsed_date.strftime('%Y%m%d') + key = date + url + if key in self.cache: + self.cache[key] += [[news, news.get_news()]] + else: + self.cache[key] = [[news, news.get_news()]] + self.cache.close() + + def read_from_cache(self, date, url=None, limit=None): + """Get cache for this url from file․ If the address + is not specified receive all the news for that date, + else receive news only for these urls and dates. + """ + if not url: + try: + for key in self.cache.keys(): + if key[:8] == date: + special_key = key + return self.cache[special_key][:limit] + except Exception: + raise CacheNotFound + else: + key = date + url + if key in self.cache: + return self.cache[key][:limit] + else: + raise CacheNotFound diff --git a/IrinaMinasyan/reader/channel.py b/IrinaMinasyan/reader/channel.py new file mode 100644 index 00000000..5044e2fc --- /dev/null +++ b/IrinaMinasyan/reader/channel.py @@ -0,0 +1,67 @@ +"""This class implements RSS channel""" +import requests +import xml.etree.ElementTree as ET + +from reader import item +from reader.exceptions import NotRssFormat, MissingHTTP +from reader import utils + + +class Channel: + """Class which definite characteristics of the News Channel. + Attributes + _title : str + The name for the feed. + _link : str + The url for the webpage containing information + that directly relates to the feed. + _date : str + The date and time when the feed’s content is + to be published. + _description : str + A phase or sentence that describes the feed. + _items : list + Each feed must contain at least one valid item entry(news). + """ + + def __init__(self, rss_url): + """Initialise class Channel _title, _link, + _description, _date and _item variables + """ + try: + response = requests.get(rss_url) + except Exception: + raise MissingHTTP + try: + channel_xml = ET.fromstring(response.text) + except Exception: + raise NotRssFormat + self._title = channel_xml.find('channel').find('title').text + self._link = channel_xml.find('channel').find('link').text + self._description = channel_xml.find('channel').find('description').text + self._date = utils.date_verification(channel_xml) + self._items = [item.NewsItem(item_xml) for item_xml in channel_xml.iter('item')] + + def get_channel_title(self): + """Get title of the channel""" + return self._title + + def get_channel_link(self): + """Get link of the channel""" + return self._link + + def get_channel_description(self): + """Get description of the channel""" + return self._description + + def get_channel_date(self): + """Get last update date of the channel""" + return self._date + + def get_channel_news(self, limit=None): + """Get all news or part of the news (if a limit is set) from the channel""" + if (limit is None) or (limit > len(self._items)): + return self._items + else: + limit_news = self._items[:limit] + return limit_news diff --git a/IrinaMinasyan/reader/convert.py b/IrinaMinasyan/reader/convert.py new file mode 100644 index 00000000..e64ac110 --- /dev/null +++ b/IrinaMinasyan/reader/convert.py @@ -0,0 +1,94 @@ +"""This class generate files for news item.""" +import dominate.tags as tag + +from dominate import document +from fpdf import FPDF +from os import path, getcwd +from reader.exceptions import PATHError + + +class Convert: + @classmethod + def converter(cls, to_html, to_pdf, news_item): + """For the given argument generate pdf and/or html files""" + if to_html: + cls.create_html_file(news_item) + if to_pdf: + cls.create_pdf_file(news_item) + + @classmethod + def create_html_file(cls, all_news): + """Creates and fills in the HTML file with the required data.""" + path_to_html = path.join(getcwd(), 'RSS_NEWS.html') + html_doc = document(title='RSS NEWS') + with html_doc: + tag.h1("RSS News") + for news in all_news: + html_file = cls.convert_news_in_html(news, html_doc) + try: + with open(path_to_html, 'w') as file: + file.write(str(html_file)) + except FileNotFoundError: + raise PATHError + print(f"Download HTML file with the required news to the {path_to_html}") + + @staticmethod + def convert_news_in_html(news, html_file): + """Convert news to HTML format""" + + with html_file: + with tag.div(): + tag.h2(news.get_title()) + tag.p(news.get_date()) + tag.br() + tag.a("Read the full article", href=news.get_link()) + tag.br() + + if news.get_image() is not None: + tag.img(src=news.get_image(), width=600) + tag.p(news.get_news()) + tag.br() + + return html_file + + @classmethod + def create_pdf_file(cls, all_news): + """Creates and fills in the PDF file with the required data""" + path_to_pdf = path.join(getcwd(), 'RSS_NEWS.pdf') + pdf = FPDF() + pdf.add_page() + + pdf.add_font('DejaVu', fname=path.join(getcwd(), 'font', 'DejaVuSans.ttf'), uni=True) + pdf.set_font('DejaVu', size=40) + pdf.set_text_color(100, 100, 50) + pdf.cell(200, 20, txt='RSS News', ln=True, align='C') + + for news in all_news: + cls.convert_news_in_pdf(pdf, news) + pdf.output(path_to_pdf) + print(f"Download PDF file with the required news to the {path_to_pdf}") + + @staticmethod + def convert_news_in_pdf(pdf, news): + """Convert news to PDF format""" + + pdf.set_font('DejaVu', size=16) + pdf.set_text_color(0, 150, 150) + pdf.multi_cell(200, 5, txt=news.get_title(), ln=True) + + pdf.set_font('DejaVu', '', 8) + pdf.set_text_color(0, 150, 250) + pdf.cell(100, 5, txt=news.get_date(), ln=True) + + pdf.set_font('DejaVu', 'U', 10) + pdf.set_text_color(0, 50, 200) + pdf.cell(200, 10, txt="Read the full article", link=news.get_link(), ln=True) + + if news.get_image() is not None: + pdf.set_font('DejaVu', '', 16) + pdf.image(w=120, h=80, name=news.get_image()) + + pdf.set_font('DejaVu', '', 8) + pdf.set_text_color(0, 150, 150) + pdf.multi_cell(400, 5, txt=news.get_news(), ln=True) + pdf.ln(5) diff --git a/IrinaMinasyan/reader/convert_from_cache.py b/IrinaMinasyan/reader/convert_from_cache.py new file mode 100644 index 00000000..14e94985 --- /dev/null +++ b/IrinaMinasyan/reader/convert_from_cache.py @@ -0,0 +1,87 @@ +"""This class generate files for news item.""" +import dominate.tags as tag + +from dominate import document +from fpdf import FPDF +from os import path, getcwd +from reader.exceptions import PATHError + + +class ConvertCache: + @classmethod + def converter(cls, to_html, to_pdf, news_item): + """For the given argument generate pdf and/or html files""" + if to_html: + cls.create_html_file(news_item) + if to_pdf: + cls.create_pdf_file(news_item) + + @classmethod + def create_html_file(cls, all_news): + """Creates and fills in the HTML file with the required data.""" + path_to_html = path.join(getcwd(), 'RSS_NEWS.html') + html_doc = document(title='RSS NEWS') + with html_doc: + tag.h1("RSS News") + for news in all_news: + html_file = cls.convert_news_in_html(news, html_doc) + try: + with open(path_to_html, 'w') as file: + file.write(str(html_file)) + except FileNotFoundError: + raise PATHError + print(f"Download HTML file with the required news to the {path_to_html}") + + @staticmethod + def convert_news_in_html(news, html_file): + """Convert news to HTML format""" + + with html_file: + with tag.div(): + tag.h2(news[0].get_title()) + tag.p(news[0].get_date()) + tag.br() + tag.a("Read the full article", href=news[0].get_link()) + tag.br() + tag.p(news[1]) + tag.br() + + return html_file + + @classmethod + def create_pdf_file(cls, all_news): + """Creates and fills in the PDF file with the required data""" + path_to_pdf = path.join(getcwd(), 'RSS_NEWS.pdf') + pdf = FPDF() + pdf.add_page() + + pdf.add_font('DejaVu', fname=path.join(getcwd(), 'font', 'DejaVuSans.ttf'), uni=True) + pdf.set_font('DejaVu', size=40) + pdf.set_text_color(100, 100, 50) + pdf.cell(200, 20, txt='RSS News', ln=True, align='C') + + for news in all_news: + cls.convert_news_in_pdf(pdf, news) + pdf.output(path_to_pdf) + print(f"Download PDF file with the required news to the {path_to_pdf}") + + @staticmethod + def convert_news_in_pdf(pdf, news): + """Convert news to PDF format""" + + pdf.set_font('DejaVu', size=16) + pdf.set_text_color(0, 150, 150) + pdf.multi_cell(200, 5, txt=news[0].get_title(), ln=True) + + pdf.set_font('DejaVu', '', 8) + pdf.set_text_color(0, 150, 250) + pdf.cell(100, 5, txt=news[0].get_date(), ln=True) + + pdf.set_font('DejaVu', 'U', 10) + pdf.set_text_color(0, 50, 200) + pdf.cell(200, 10, txt="Read the full article", link=news[0].get_link(), ln=True) + + pdf.set_font('DejaVu', '', 8) + pdf.set_text_color(0, 150, 150) + pdf.multi_cell(400, 5, txt=news[1], ln=True) + pdf.ln(5) diff --git a/IrinaMinasyan/reader/exceptions.py b/IrinaMinasyan/reader/exceptions.py new file mode 100644 index 00000000..63b882f9 --- /dev/null +++ b/IrinaMinasyan/reader/exceptions.py @@ -0,0 +1,31 @@ +"""RSS_reader exception classes""" + + +class URLError(Exception): + """No such URL exist""" + pass + + +class NotRssFormat(Exception): + """URL doesn't match the RSS format""" + pass + + +class MissingHTTP(Exception): + """In URL Missing https""" + pass + + +class CacheNotFound(Exception): + """Could not find articles for the specified url or date""" + pass + + +class NoImgFound(Exception): + """News doesn't contain images.""" + pass + + +class PATHError(Exception): + """Setted PATH is invalid""" + pass diff --git a/IrinaMinasyan/reader/item.py b/IrinaMinasyan/reader/item.py new file mode 100644 index 00000000..97af60dd --- /dev/null +++ b/IrinaMinasyan/reader/item.py @@ -0,0 +1,91 @@ +"""This class implements RSS channel news items""" +import json +import requests + +from bs4 import BeautifulSoup +from html2text import HTML2Text +from reader.exceptions import NoImgFound +from reader import utils + + +class NewsItem: + """Class which definite characteristics of the News item. + Attributes + _title : str + The headline for the item’s content. + _link : str + The URL for the webpage, or for the section of a webpage, + that contains the item’s full content. + _date : str + The date and time when the item is to be made available. + """ + + def __init__(self, item_xml): + """Initialise class NewItem _title, _link + and _date variables""" + self._title = item_xml.find('title').text + self._link = item_xml.find('link').text + self._date = item_xml.find('pubDate').text + self._description = utils.description_verification(item_xml) + self._media_content = utils.media_content_verification(item_xml) + self._image = utils.image_verification(item_xml) + + def get_title(self): + """Get title of the news item""" + return self._title + + def get_link(self): + """Get link of the news item""" + return self._link + + def get_date(self): + """Get date to create of the news item""" + return self._date + + def get_news(self): + """Get the first piece of the news item""" + news_url = requests.get(self.get_link()) + soup = BeautifulSoup(news_url.content, 'html.parser') + all_news = soup.find_all('p') + to_text = HTML2Text() + to_text.ignore_links = True + return to_text.handle(''.join(str(all_news[i]) for i in range(min(len(all_news), 3)))) + + def find_image_link(self): + """Find image link from the parsed page.""" + if self._image: + return self._image + if self._media_content: + return self._media_content['url'] + if self._description: + desc_soup = BeautifulSoup(self._description, 'html.parser') + try: + image_item = desc_soup.find('img') + image = image_item.get('src') + return image + except Exception: + raise NoImgFound + + def get_image(self): + """Get news item image link """ + try: + image = self.find_image_link() + return image + except NoImgFound: + print(NoImgFound.__doc__) + pass + + def get_json(self): + """Get JSON representation of the news item""" + return json.dumps({"Title": self.get_title(), + "Date": self.get_date(), + "Link": self.get_link(), + "Image link": self.get_image()}, ensure_ascii=False) + + def print_news(self): + """Prints title, link, date and the first piece of the news item""" + print(self.get_title()) + print(self.get_date()) + print(self.get_link()) + print(self.get_image()) + diff --git a/IrinaMinasyan/reader/rss_reader.py b/IrinaMinasyan/reader/rss_reader.py new file mode 100644 index 00000000..f0f39c86 --- /dev/null +++ b/IrinaMinasyan/reader/rss_reader.py @@ -0,0 +1,78 @@ +"""Accepts arguments from the command line and prints news according to the given arguments.""" +import sys + +from datetime import datetime +from reader.add_args import args +from reader.exceptions import URLError, CacheNotFound +from reader.cache import Cache +from reader.convert import Convert +from reader.convert_from_cache import ConvertCache +from reader.utils import dump_news_to_json, verification + +VERSION = 1.5 + + +class RSSReader: + @staticmethod + def show_news_from_cache(): + """Prints news in normal or in json format from cache""" + try: + all_news = Cache().read_from_cache(url=args.source, limit=args.limit, date=args.date) + except CacheNotFound: + print(CacheNotFound.__doc__) + sys.exit() + if args.to_pdf or args.to_html: + ConvertCache().converter(to_html=args.to_html, to_pdf=args.to_pdf, news_item=all_news) + number = 1 + for news in all_news: + if args.verbose: + print(f'{number} news is displayed') + if args.json: + dump_news_to_json(news[0]) + else: + news[0].print_news() + print(news[1]) + number += 1 + + @staticmethod + def show_news_from_source(): + """Prints news in normal or in json format""" + try: + reader = verification() + except URLError: + print(URLError.__doc__) + sys.exit() + if args.verbose: + print(str(datetime.now()) + " News are parsed successfully.") + all_news = reader.get_channel_news(args.limit) + if args.to_pdf or args.to_html: + Convert().converter(to_html=args.to_html, to_pdf=args.to_pdf, news_item=all_news) + number = 1 + for news in all_news: + if args.verbose: + print(f'{number} news is displayed') + Cache().save_in_cache(news, args.source) + if args.json: + dump_news_to_json(news) + else: + news.print_news() + print(news.get_news()) + number += 1 + + +def main(): + rss_reader = RSSReader() + if args.version: + print(VERSION) + elif not (args.date or args.source): + print('url or date required') + elif args.date: + if args.verbose: + print("Getting results from cache.") + rss_reader.show_news_from_cache() + else: + rss_reader.show_news_from_source() + + +if __name__ == '__main__': + main() diff --git a/IrinaMinasyan/reader/utils.py b/IrinaMinasyan/reader/utils.py new file mode 100644 index 00000000..84bf899d --- /dev/null +++ b/IrinaMinasyan/reader/utils.py @@ -0,0 +1,62 @@ +import json +import sys + +from reader.add_args import args +from reader import channel +from reader.exceptions import MissingHTTP, NotRssFormat, URLError + + +def date_verification(channel_xml): + """Date attribute verification.""" + try: + return channel_xml.find('channel').find('pubDate').text + except AttributeError: + pass + + +def description_verification(item_xml): + """Description attribute verification""" + try: + return item_xml.find('description').text + except AttributeError: + pass + + +def media_content_verification(item_xml): + """Media attribute verification""" + try: + namespaces = {'media': "http://search.yahoo.com/mrss/"} + media_content = item_xml.find("{%s}content" % namespaces['media']) + return {'url': media_content.get('url')} + except AttributeError: + pass + + +def image_verification(item_xml): + """Image attribute verification""" + try: + return item_xml.find('image').text + except AttributeError: + pass + + +def verification(): + """Create a channel object """ + try: + instance = channel.Channel(args.source) + return instance + except NotRssFormat: + print(NotRssFormat.__doc__) + sys.exit() + except MissingHTTP: + print(MissingHTTP.__doc__) + sys.exit() + except Exception: + raise URLError + + +def dump_news_to_json(news_item): + """Prints json format news as title-instance""" + json_news = json.loads(news_item.get_json()) + for key, value in json_news.items(): + print(f'{key}:{value}') diff --git a/IrinaMinasyan/requirements.txt b/IrinaMinasyan/requirements.txt new file mode 100644 index 00000000..d756fd74 --- /dev/null +++ b/IrinaMinasyan/requirements.txt @@ -0,0 +1,7 @@ +requests +bs4 +html2text +pytest +dateutil +dominate +fpdf2 \ No newline at end of file diff --git a/IrinaMinasyan/setup.py b/IrinaMinasyan/setup.py new file mode 100644 index 00000000..1ff06662 --- /dev/null +++ b/IrinaMinasyan/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup( + name="rss_reader", + version="1.5", + author="Irina Minasyan", + author_email="irina71757@gmail.com", + description="RSS-reader, which can help you to read news " + "from the source you will give it.", + install_requires=['requests', 'bs4', 'html2text', 'pytest', 'python-dateutil', 'dominate', 'fpdf2'], + + packages=['reader'], + python_requires='>=3.6', + entry_points={ + 'console_scripts': ['rss_reader=reader.rss_reader:main'] + }, + include_package_data=True, +) diff --git a/IrinaMinasyan/test_channel.py b/IrinaMinasyan/test_channel.py new file mode 100644 index 00000000..7893074b --- /dev/null +++ b/IrinaMinasyan/test_channel.py @@ -0,0 +1,37 @@ +"""Comparison of data that we expect to receive from methods""" +import pytest + + +from reader.channel import Channel +from reader.exceptions import NotRssFormat, MissingHTTP + +channel_item = Channel("https://news.yahoo.com/rss/") + + +def test_channel_title(): + """Comparing the title of the channel and our script""" + assert channel_item.get_channel_title() == 'Yahoo News - Latest News & Headlines' + + +def test_channel_link(): + """Comparing the title of the channel and our script""" + assert channel_item.get_channel_link() == 'https://www.yahoo.com/news' + + +def test_channel_description(): + """Comparing the title of the channel and our script""" + assert channel_item.get_channel_description() == 'The latest news and headlines from Yahoo! News. ' \ + 'Get breaking news stories and in-depth coverage with ' \ + 'videos and photos.' + + +def test_parse_error(): + """Expect this error if the wrong url was sent""" + with pytest.raises(NotRssFormat): + Channel("https://news.yahoo.com") + + +def test_missing_schema_error(): + """Expect this error if the HyperText Transfer Protocol is missing 'https://'""" + with pytest.raises(MissingHTTP): + Channel("www.news.yahoo.com") diff --git a/IrinaMinasyan/test_convert_format.py b/IrinaMinasyan/test_convert_format.py new file mode 100644 index 00000000..d27b2015 --- /dev/null +++ b/IrinaMinasyan/test_convert_format.py @@ -0,0 +1,27 @@ +import pytest +import xml.etree.ElementTree as ET + +from reader.convert import Convert +from os import path, getcwd +from reader.item import NewsItem +from reader.cache import Cache +from reader.exceptions import CacheNotFound + +tree = ET.parse(path.join(getcwd(), 'examples', 'example_xml.xml')) +root = tree.getroot() +news_item = root.find('channel').find('item') +news = NewsItem(news_item) + + +def test_html_convert(): + with open(path.join(getcwd(), 'examples', 'example_html.html'), 'r') as efile: + exam_file = efile.read() + Convert.create_html_file([news]) + with open(path.join(getcwd(), 'RSS_NEWS.html'), 'r') as rfile: + read_file = rfile.read() + assert exam_file == read_file + + +def test_read_from_cache(): + with pytest.raises(CacheNotFound): + Cache().read_from_cache('23232323') diff --git a/IrinaMinasyan/test_newsitem.py b/IrinaMinasyan/test_newsitem.py new file mode 100644 index 00000000..d00e38b0 --- /dev/null +++ b/IrinaMinasyan/test_newsitem.py @@ -0,0 +1,57 @@ +"""Comparison of data that we expect to receive from methods""" +import pytest +import argparse + +from reader.item import NewsItem +from reader import add_args +from os import path, getcwd +import xml.etree.ElementTree as ET +from reader.utils import media_content_verification + +tree = ET.parse(path.join(getcwd(), 'examples', 'example_xml.xml')) +root = tree.getroot() +news_item = root.find('channel').find('item') + +def test_get_json(): + """Comparing json format""" + news = NewsItem(news_item) + assert NewsItem.get_json(news) == str({"Title": news.get_title(), + "Date": news.get_date(), + "Link": news.get_link(), + "Image link": news.get_image()}).replace("'", '"') + + +def test_item_title(): + assert NewsItem(news_item).get_title() == 'Officials: Georgia man sentenced to die kills self in prison' + + +def test_item_date(): + assert NewsItem(news_item).get_date() == '2022-06-27T12:50:43Z' + + +def test_item_link(): + assert NewsItem(news_item).get_link() == 'https://news.yahoo.com/officials-georgia-man-sentenced-die-125043110.html' + + +def test_item_image(): + assert NewsItem(news_item).get_image() == "https://s.yimg.com/uu/api/res/1.2/zEeBoPLQVzw1u2VjZt.THA--~B/aD03NDk7dz0xMDAwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/ap.org/5cf8e923a8d9dec8758480785184f376" + + +def test_attribute_error(): + """Expect this error if the not xml format was sent""" + with pytest.raises(AttributeError): + NewsItem("https://news.yahoo.com") + + +def test_args_digit_type_error(): + with pytest.raises(argparse.ArgumentTypeError): + add_args.check_digit('hello') + + +def test_args_positive_type_error(): + with pytest.raises(argparse.ArgumentTypeError): + add_args.check_positive('-15') + + +def test_img_verification(): + assert media_content_verification(news_item)['url'] == "https://s.yimg.com/uu/api/res/1.2/zEeBoPLQVzw1u2VjZt.THA--~B/aD03NDk7dz0xMDAwO2FwcGlkPXl0YWNoeW9u/https://media.zenfs.com/en/ap.org/5cf8e923a8d9dec8758480785184f376" diff --git a/README.md b/README.md deleted file mode 100644 index c86d1e65..00000000 --- a/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# How to create a PR with a homework task - -1. Create fork from the following repo: https://github.com/E-P-T/Homework. (Docs: https://docs.github.com/en/get-started/quickstart/fork-a-repo ) -2. Clone your forked repo in your local folder. -3. Create separate branches for each session.Example(`session_2`, `session_3` and so on) -4. Create folder with you First and Last name in you forked repo in the created session. -5. Add your task into created folder -6. Push finished session task in the appropriate branch in accordance with written above. - You should get the structure that looks something like that - -``` - Branch: Session_2 - DzmitryKolb - |___Task1.py - |___Task2.py - Branch: Session_3 - DzmitryKolb - |___Task1.py - |___Task2.py -``` - -7. When you finish your work on task you should create Pull request to the appropriate branch of the main repo https://github.com/E-P-T/Homework (Docs: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork). -Please use the following instructions to prepare good description of the pull request: - - Pull request header should be: `Session - `. - Example: `Session 2 - Dzmitry Kolb` - - Pull request body: You should write here what tasks were implemented. - Example: `Finished: Task 1.2, Task 1.3, Task 1.6` -