else
This commit is contained in:
parent
dd74f45b00
commit
054b91b1c6
3 changed files with 62 additions and 55 deletions
Binary file not shown.
|
@ -3,16 +3,25 @@ import totaldl
|
|||
|
||||
sql = sqlite3.connect('!!testdata.db')
|
||||
cur = sql.cursor()
|
||||
cur2 = sql.cursor()
|
||||
|
||||
cur.execute('CREATE TABLE IF NOT EXISTS totaldl_urls(url TEXT)')
|
||||
sql.commit()
|
||||
cur.execute('SELECT * FROM posts WHERE self=0 AND url IS NOT NULL')
|
||||
while True:
|
||||
item = cur.fetchone()
|
||||
if item is None:
|
||||
break
|
||||
|
||||
url = item[7]
|
||||
cur2.execute('SELECT * FROM totaldl_urls WHERE url=?', [url])
|
||||
if cur2.fetchone():
|
||||
continue
|
||||
title = item[6]
|
||||
for character in '\\/?:*"><|.':
|
||||
title = title.replace(character, '')
|
||||
if len(title) > 35:
|
||||
title = title[:34] + '-'
|
||||
url = item[7]
|
||||
totaldl.handle_master(url, customname=title)
|
||||
cur2.execute('INSERT INTO totaldl_urls VALUES(?)', [url])
|
||||
sql.commit()
|
|
@ -274,9 +274,7 @@ def handle_master(url, customname=None):
|
|||
if DO_GENERIC:
|
||||
handle_generic(url, customname=customname)
|
||||
|
||||
def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, generic=True):
|
||||
print('Testing')
|
||||
if imgur:
|
||||
def test_imgur():
|
||||
# Imgur gallery album
|
||||
handle_master('http://imgur.com/gallery/s4WLG')
|
||||
|
||||
|
@ -292,7 +290,7 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
|||
# Imgur direct single
|
||||
handle_master('http://i.imgur.com/gvJUct0.jpg')
|
||||
|
||||
if gfycat:
|
||||
def test_gfycat():
|
||||
# Gfycat direct .gif
|
||||
handle_master('http://giant.gfycat.com/FatherlyBruisedIberianchiffchaff.gif')
|
||||
|
||||
|
@ -302,14 +300,14 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
|||
# Gfycat general link with customname
|
||||
handle_master('http://www.gfycat.com/RawWetFlatcoatretriever', customname='gfycatgeneral')
|
||||
|
||||
if vimeo:
|
||||
def test_vimeo():
|
||||
# Vimeo standard link
|
||||
handle_master('https://vimeo.com/109405701')
|
||||
|
||||
# Vimeo player link with customname
|
||||
handle_master('https://player.vimeo.com/video/109405701', customname='vimeoplayer')
|
||||
|
||||
if liveleak:
|
||||
def test_liveleak():
|
||||
# LiveLeak standard link
|
||||
handle_master('http://www.liveleak.com/view?i=9d1_1429192014')
|
||||
|
||||
|
@ -319,7 +317,7 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
|||
# LiveLeak standard link with customname
|
||||
handle_master('http://www.liveleak.com/view?i=9d1_1429192014', customname='liveleak')
|
||||
|
||||
if youtube:
|
||||
def test_youtube():
|
||||
# Youtube standard link
|
||||
handle_master('https://www.youtube.com/watch?v=bEgeh5hA5ko')
|
||||
|
||||
|
@ -329,7 +327,7 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
|||
# Youtube player embed link
|
||||
handle_master('https://www.youtube.com/watch?feature=player_embedded&v=bEgeh5hA5ko')
|
||||
|
||||
if generic:
|
||||
def test_generic():
|
||||
# Some link that might work
|
||||
handle_master('https://raw.githubusercontent.com/voussoir/reddit/master/SubredditBirthdays/show/statistics.txt')
|
||||
|
||||
|
@ -340,10 +338,10 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
|||
handle_master('https://github.com/voussoir/reddit/tree/master/SubredditBirthdays/show')
|
||||
|
||||
if __name__ == '__main__':
|
||||
test(
|
||||
imgur=False,
|
||||
gfycat=False,
|
||||
vimeo=False,
|
||||
liveleak=False,
|
||||
youtube=True,
|
||||
generic=False)
|
||||
#test_imgur()
|
||||
#test_gfycat()
|
||||
#test_vimeo()
|
||||
#test_liveleak()
|
||||
#test_youtube()
|
||||
#test_generic()
|
||||
pass
|
Loading…
Reference in a new issue