Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/usr/lib/python3.3/site-packages/greg/greg.py b/./tmp/greg-master/greg/greg.py
- old mode 100644
- new mode 100755
- index 6e228e1..cdcb38c
- --- a/usr/lib/python3.3/site-packages/greg/greg.py
- +++ b/./tmp/greg-master/greg/greg.py
- @@ -23,15 +23,12 @@ import subprocess
- import sys
- import time
- import re
- -import unicodedata
- -import string
- from itertools import filterfalse
- from urllib.request import urlretrieve
- from urllib.parse import urlparse
- from urllib.error import URLError
- import feedparser
- -from bs4 import BeautifulSoup
- try: # Stagger is an optional dependency
- import stagger
- @@ -159,16 +156,12 @@ class Feed():
- try:
- test = podcast.feed.updated_parsed
- sync_by_date = True
- - except AttributeError:
- - try:
- - test = podcast.entries[0].published_parsed
- - sync_by_date = True
- - except (AttributeError, IndexError): # Otherwise, we use download links.
- - print(
- - "I cannot parse the time information of this feed.\
- - I'll use your current local time instead.",
- - file=sys.stderr, flush=True)
- - sync_by_date = False
- + except AttributeError: # Otherwise, we use download links.
- + print(
- + "I cannot parse the time information of this feed.\
- + I'll use your current local time instead.",
- + file=sys.stderr, flush=True)
- + sync_by_date = False
- if not sync_by_date:
- session.feeds[name]["date_info"] = "not available"
- with open(session.data_filename, 'w') as configfile:
- @@ -216,7 +209,7 @@ class Feed():
- class Placeholders():
- - def __init__(self, feed, link, filename, title, sanitizedsummary):
- + def __init__(self, feed, link, filename, title):
- self.feed = feed
- self.link = link
- self.filename = filename
- @@ -227,14 +220,6 @@ class Placeholders():
- self.podcasttitle = feed.podcast.title
- except AttributeError:
- self.podcasttitle = feed.name
- - try:
- - subtitle = BeautifulSoup(feed.podcast.feed.subtitle)
- - self.sanitizedsubtitle = subtitle.get_text()
- - if self.sanitizedsubtitle == "":
- - self.sanitizedsubtitle = "No description"
- - except AttributeError:
- - self.sanitizedsubtitle = "No description"
- - self.entrysummary = sanitizedsummary
- self.filename_podcasttitle = sanitize(self.podcasttitle)
- self.name = feed.name
- self.date = tuple(feed.linkdate)
- @@ -270,13 +255,11 @@ feedparser.registerDateHandler(FeedburnerDateHandler)
- # The following are some auxiliary functions
- -def sanitize(data):
- -# sanestring = ''.join([x if x.isalnum() else "_" for x in string])
- - sanestring = ''.join(x if x.isalnum() else "_" for x in
- - unicodedata.normalize('NFKD', data) if x in
- - string.printable)
- +def sanitize(string):
- + sanestring = ''.join([x if x.isalnum() else "_" for x in string])
- return sanestring
- +
- def ensure_dir(dirname):
- try:
- os.makedirs(dirname)
- @@ -413,16 +396,8 @@ def download_entry(feed, entry):
- except:
- title = podname
- try:
- - summary = BeautifulSoup(entry.summary)
- - sanitizedsummary = summary.get_text()
- - if sanitizedsummary == "":
- - sanitizedsummary = "No summary available"
- - except:
- - sanitizedsummary = "No summary available"
- - try:
- placeholders = Placeholders(
- - feed, downloadlinks[podname], podname, title,
- - sanitizedsummary)
- + feed, downloadlinks[podname], podname, title)
- placeholders = check_directory(placeholders)
- condition = filtercond(placeholders)
- if condition:
- @@ -442,6 +417,7 @@ def download_entry(feed, entry):
- sys.exit("... something went wrong.\
- Are you sure you are connected to the internet?")
- +
- def parse_feed_info(info):
- entrylinks = []
- linkdates = []
- @@ -483,9 +459,7 @@ def substitute_placeholders(string, placeholders, mode):
- placeholders.podcasttitle),
- filename_podcasttitle=shlex.quote(
- placeholders.filename_podcasttitle),
- - name=shlex.quote(placeholders.name),
- - subtitle=placeholders.sanitizedsubtitle,
- - entrysummary=placeholders.entrysummary)
- + name=shlex.quote(placeholders.name))
- return newst
- # The following are the functions that correspond to the different commands
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement