
    i%                     T    d Z ddlmZmZmZmZ ddl ddlZddlm	Z	  G d de
      Zy)z
    podgen.category
    ~~~~~~~~~~~~~~~

    This module contains Category, which represents a single iTunes category.

    :copyright: 2016, Thorben Dahl <thorben@sjostrom.no>
    :license: FreeBSD and LGPL, see license.* for more details.
    )absolute_importdivisionprint_functionunicode_literals)*N)LegacyCategoryWarningc                      e Zd ZdZi dg ddg ddg dg dd	g d
dg ddg ddg dg dg dg ddg ddg ddg ddg ddg Zi dg ddg ddg ddg d d!g d"d#g d$g d%g d&dg d'd(g d)dg d*d+g d,dg d-d.g d/dg d0d1g d2dg g g d3d4Zd;d6Zd7 Zed8        Z	ed9        Z
d: Zy5)<Categorya  Immutable class representing an Apple Podcasts category.

    By using this class, you can be sure that the chosen category is a
    valid category, that it is formatted correctly and you will be warned
    when using an old category.

    See https://help.apple.com/itc/podcasts_connect/#/itc9267a2f12 for an
    overview of the available categories and their subcategories.

    .. versionchanged:: 1.1.0
       Updated to reflect `the new categories <https://podnews.net/article/apple-changed-podcast-categories-2019>`_
       as of August 9th 2019 and yield a
       :class:`~podgen.warnings.LegacyCategoryWarning` when using one of the
       old categories.

    .. note::

        The categories are case-insensitive, and you may escape ampersands.
        The category and subcategory will end up properly capitalized and
        with unescaped ampersands.

    Example::

        >>> from podgen import Category
        >>> c = Category("Music")
        >>> c.category
        Music
        >>> c.subcategory
        None
        >>>
        >>> d = Category("games &amp; hobbies", "Video games")
        >>> d.category
        Games & Hobbies
        >>> d.subcategory
        Video Games
    Arts)DesignFashion & BeautyFood
LiteraturePerforming ArtsVisual ArtsBusiness)Business NewsCareers	InvestingzManagement & MarketingShoppingComedy	Education)r   zEducation TechnologyzHigher EducationzK-12zLanguage CoursesTrainingzGames & Hobbies)
AutomotiveAviationHobbieszOther GamesVideo GameszGovernment & Organizations)LocalNational
Non-ProfitRegionalHealth)Alternative HealthzFitness & Nutritionz	Self-Help	SexualityzKids & FamilyMusiczNews & PoliticszReligion & Spirituality)BuddhismChristianityHinduismIslamJudaismOtherSpiritualityzScience & Medicine)MedicineNatural SciencesSocial ScienceszSociety & Culture)HistoryPersonal Journals
PhilosophyPlaces & TravelzSports & Recreation)AmateurzCollege & High SchoolOutdoorProfessional
Technology)Gadgets	Tech News
PodcastingzSoftware How-To	TV & Film)Booksr   r   r   r   r   )r   Entrepreneurshipr   
Management	Marketingr    )zComedy InterviewsImprovzStand-up)CourseszHow TozLanguage LearningzSelf-ImprovementFiction)zComedy FictionDramazScience Fiction
Governmentr0   zHealth & Fitness)r#   Fitnessr-   zMental Health	Nutritionr$   )zEducation for Kids	ParentingzPets & AnimalszStories for KidsLeisure)zAnimation & Mangar   r   CraftsGamesr   zHome & Gardenr   )zMusic CommentaryzMusic HistoryzMusic InterviewsNews)r   z
Daily NewszEntertainment NewszNews CommentaryPoliticszSports Newsr9   )r&   r'   r(   r)   r*   Religionr,   Science)		Astronomy	ChemistryzEarth ScienceszLife SciencesMathematicsr.   NaturePhysicsr/   )Documentaryr1   r2   r3   RelationshipsSports)Baseball
BasketballCricketzFantasy SportsFootballGolfHockeyRugbyRunningSoccerSwimmingTennis
Volleyball
Wilderness	Wrestling)zAfter ShowszFilm HistoryzFilm InterviewszFilm Reviewsz
TV Reviews)z
True Crimer;   Nc                 &   |st        d|z        	 | j                  ||| j                        \  }}|| _        || _	        y# t        $ rF | j                  ||| j                        \  }}t        j                  d|d|dt        d       Y ]w xY w)u'  Create new Category object. See the class description of
        :class:´~podgen.category.Category`.

        :param category: Category of the podcast.
        :type category: str
        :param subcategory: (Optional) Subcategory of the podcast.
        :type subcategory: str or None
        z#category must be provided, was "%s"zThe category ("z", "zR") is a legacy category. Please switch to one of the new Apple Podcast categories.   )category
stacklevelN)
	TypeError_look_up_category_categories
ValueError_legacy_categorieswarningswarnr   _Category__category_Category__subcategory)selfrg   subcategorycanonical_categorycanonical_subcategorys        H/root/podcast_feed/.venv/lib/python3.12/site-packages/podgen/category.py__init__zCategory.__init__   s     ChNOO	8<8N8N  95 5* -2#  	8<8N8N''95 5 MM $%:< /	s    A ABBc                    |j                         j                  dd      j                         }|D ]  }|j                         |k(  s|} n t        d|z        d }|d|j                         j                  dd      j                         }||   D ]  }	|	j                         |k(  s|	} ||fS  t        d|d|d      ||fS )Nz&amp;&zInvalid category "%s"zInvalid subcategory "z" under category "")stripreplacelowerrl   )
rr   rg   rs   available_categoriessearch_categoryactual_categoryrt   ru   search_subcategoryactual_subcategorys
             rv   rj   zCategory._look_up_category   s     #..*227C@FFH3O$$&/9%4"	  4 4x?@@ !%"!,!2!2!4!<!<Wc!J &:;M&N"%++-1CC,>)
 "#888 'O
 !$/1C"E F F "#888    c                     | j                   S )zWThe category represented by this object. Read-only.

        :type: :obj:`str`
        )rp   rr   s    rv   rg   zCategory.category  s     r   c                     | j                   S )zVThe subcategory this object represents. Read-only.

        :type: :obj:`str`
        )rq   r   s    rv   rs   zCategory.subcategory#  s     !!!r   c                 <    d| j                   d| j                  dS )NzCategory(category=z, subcategory=))rg   rs   r   s    rv   __repr__zCategory.__repr__,  s    t//1 	1r   )N)__name__
__module____qualname____doc__rm   rk   rw   rj   propertyrg   rs   r    r   rv   r
   r
      sa   #J 3 	 ;
 	" 	 R 	 : 	% '3 	   	 	  	2!" 	" $Q#& 	 2'* 	 1+. 	  ;/2 	 *36 	R7<~ 
~ 	 
~" 	 
#~, 	 
-~8 	 
9~B 	bC~D 	2E~F 	 
G~V 	 
W~b 	 	
c~v 	 
w~@ 	 
A~R 	" $
S~d 	 

e~z 	 
{~H 	 
I~j 	bk~l 
o~K@"3H9>   " "1r   r
   )r   
__future__r   r   r   r   builtinsrn   podgen.warningsr   objectr
   r   r   rv   <module>r      s*    S R   1[1v [1r   