Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Fixed a bug where titles would have double spaces where parentheses o…
Browse files Browse the repository at this point in the history
…r brackets used to be
  • Loading branch information
Mark Kubiak committed Oct 18, 2014
1 parent f6fd421 commit 3271c7e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions wallpaper-reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def save_info(url, title):
#out - string - title without any annoying tags
#removes the [tags] throughout the image
def remove_tags(str):
#removes brackets and contents of brackets
tag = False
str1 = ''
for i in str:
Expand All @@ -411,16 +412,23 @@ def remove_tags(str):
str1 = str1 + i
if i == ']':
tag = False
#removes parentheses and contents of parentheses
tag = False
title = ''
str2 = ''
for i in str1:
if i == '[':
tag = True
if not tag:
title = title + i
str2 = str2 + i
if i == ']':
tag = False
return title.strip()
#removes any double spaces (from previous removals) and any spaces at the beginning and end
title = ''
for i in (range(len(str2)-1)):
if not(str2[i] == ' ' and str2[i+1] == ' '):
title = title + str2[i]
title = title.strip()
return title

#saves the wallpaper in the save directory from the config
#naming scheme is wallpaperN
Expand Down

0 comments on commit 3271c7e

Please sign in to comment.