mirror of https://gitlab.com/bashrc2/epicyon
				
				
				
			Merge branch 'main' of gitlab.com:bashrc2/epicyon
						commit
						8f83e0918a
					
				| 
						 | 
				
			
			@ -223,6 +223,10 @@ body, html {
 | 
			
		|||
    image-rendering: var(--rendering);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
audio {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
video {
 | 
			
		||||
    width: 100%;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										38
									
								
								newswire.py
								
								
								
								
							
							
						
						
									
										38
									
								
								newswire.py
								
								
								
								
							| 
						 | 
				
			
			@ -228,6 +228,10 @@ def _add_newswire_dict_entry(base_dir: str, domain: str,
 | 
			
		|||
 | 
			
		||||
    # Include tags from podcast categories
 | 
			
		||||
    if podcast_properties:
 | 
			
		||||
        if podcast_properties.get('explicit'):
 | 
			
		||||
            if '#NSFW' not in post_tags:
 | 
			
		||||
                post_tags.append('#NSFW')
 | 
			
		||||
 | 
			
		||||
        post_tags += podcast_properties['categories']
 | 
			
		||||
 | 
			
		||||
    # combine the tags into a single list
 | 
			
		||||
| 
						 | 
				
			
			@ -568,10 +572,20 @@ def get_link_from_rss_item(rss_item: str) -> (str, str):
 | 
			
		|||
                    if '://' in link:
 | 
			
		||||
                        return link, mime_type
 | 
			
		||||
 | 
			
		||||
    link = rss_item.split('<link>')[1]
 | 
			
		||||
    link = link.split('</link>')[0]
 | 
			
		||||
    if '://' not in link:
 | 
			
		||||
        return None, None
 | 
			
		||||
    if '<link>' in rss_item and '</link>' in rss_item:
 | 
			
		||||
        link = rss_item.split('<link>')[1]
 | 
			
		||||
        link = link.split('</link>')[0]
 | 
			
		||||
        if '://' not in link:
 | 
			
		||||
            return None, None
 | 
			
		||||
    elif '<link ' in rss_item:
 | 
			
		||||
        link_str = rss_item.split('<link ')[1]
 | 
			
		||||
        if '>' in link_str:
 | 
			
		||||
            link_str = link_str.split('>')[0]
 | 
			
		||||
            if 'href="' in link_str:
 | 
			
		||||
                link_str = link_str.split('href="')[1]
 | 
			
		||||
                if '"' in link_str:
 | 
			
		||||
                    link = link_str.split('"')[0]
 | 
			
		||||
 | 
			
		||||
    return link, mime_type
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -610,9 +624,7 @@ def _xml2str_to_dict(base_dir: str, domain: str, xml_str: str,
 | 
			
		|||
            continue
 | 
			
		||||
        if '</title>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<link>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '</link>' not in rss_item:
 | 
			
		||||
        if '<link' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<pubDate>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
| 
						 | 
				
			
			@ -709,9 +721,7 @@ def _xml1str_to_dict(base_dir: str, domain: str, xml_str: str,
 | 
			
		|||
            continue
 | 
			
		||||
        if '</title>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<link>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '</link>' not in rss_item:
 | 
			
		||||
        if '<link' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<dc:date>' not in rss_item:
 | 
			
		||||
            continue
 | 
			
		||||
| 
						 | 
				
			
			@ -794,9 +804,7 @@ def _atom_feed_to_dict(base_dir: str, domain: str, xml_str: str,
 | 
			
		|||
            continue
 | 
			
		||||
        if '</title>' not in atom_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<link>' not in atom_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '</link>' not in atom_item:
 | 
			
		||||
        if '<link' not in atom_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if '<updated>' not in atom_item:
 | 
			
		||||
            continue
 | 
			
		||||
| 
						 | 
				
			
			@ -980,7 +988,11 @@ def _atom_feed_yt_to_dict(base_dir: str, domain: str, xml_str: str,
 | 
			
		|||
    atom_items = xml_str.split('<entry>')
 | 
			
		||||
    post_ctr = 0
 | 
			
		||||
    max_bytes = max_feed_item_size_kb * 1024
 | 
			
		||||
    first_entry = True
 | 
			
		||||
    for atom_item in atom_items:
 | 
			
		||||
        if first_entry:
 | 
			
		||||
            first_entry = False
 | 
			
		||||
            continue
 | 
			
		||||
        if not atom_item:
 | 
			
		||||
            continue
 | 
			
		||||
        if not atom_item.strip():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								tests.py
								
								
								
								
							
							
						
						
									
										10
									
								
								tests.py
								
								
								
								
							| 
						 | 
				
			
			@ -6477,6 +6477,16 @@ def _test_get_link_from_rss_item() -> None:
 | 
			
		|||
    assert link.startswith('https://anchor.fm')
 | 
			
		||||
    assert not mime_type
 | 
			
		||||
 | 
			
		||||
    rss_item = \
 | 
			
		||||
        '<link href="' + \
 | 
			
		||||
        'https://test.link/creativecommons/episodes/' + \
 | 
			
		||||
        'Hessel-van-Oorschot-of-Tribe-of-Noise--Free-Music-Archive-e1crvce' + \
 | 
			
		||||
        '"/>' + \
 | 
			
		||||
        '<pubDate>Wed, 12 Jan 2022 14:28:46 GMT</pubDate>'
 | 
			
		||||
    link, mime_type = get_link_from_rss_item(rss_item)
 | 
			
		||||
    assert link
 | 
			
		||||
    assert link.startswith('https://test.link/creativecommons')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def run_all_tests():
 | 
			
		||||
    base_dir = os.getcwd()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,8 @@ from webapp_utils import html_keyboard_navigation
 | 
			
		|||
def _html_podcast_performers(podcast_properties: {}) -> str:
 | 
			
		||||
    """Returns html for performers of a podcast
 | 
			
		||||
    """
 | 
			
		||||
    if not podcast_properties:
 | 
			
		||||
        return ''
 | 
			
		||||
    if not podcast_properties.get('persons'):
 | 
			
		||||
        return ''
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +74,8 @@ def _html_podcast_soundbites(link_url: str, extension: str,
 | 
			
		|||
                             translate: {}) -> str:
 | 
			
		||||
    """Returns html for podcast soundbites
 | 
			
		||||
    """
 | 
			
		||||
    if not podcast_properties:
 | 
			
		||||
        return ''
 | 
			
		||||
    if not podcast_properties.get('soundbites'):
 | 
			
		||||
        return ''
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue