blob: f062a1905722173baa37d10a531d7ce28c64e184 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import sys
import urllib
import re
from photoblaster.db.models import Iasdfus
from photoblaster.db.models import ImCmd
def super_unquote(s):
for i in xrange(0,20):
s = urllib.unquote(s)
return s
deleted_urls = Iasdfus().search(deleted=True).all()
print len(deleted_urls)
#im/ff/wigglelogo_1347403794_frankhats_1347403811_frankhats.gif
bob = 0
for url in deleted_urls:
try:
parts = url.address.split("/")
dirpart = parts[1]
newfile = super_unquote(parts[2])
newfile_parts = re.split(r'\+?http', newfile)
newfile = newfile_parts[0]
matching_url = ImCmd.search(**{"dir": dirpart, "newfile": newfile}).first()
print matching_url.deleted
matching_url.update(deleted=1)
except AttributeError:
continue
except IndexError:
continue
|