summaryrefslogtreecommitdiff
path: root/sync_iasdfus_deleted.py
diff options
context:
space:
mode:
Diffstat (limited to 'sync_iasdfus_deleted.py')
-rw-r--r--sync_iasdfus_deleted.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/sync_iasdfus_deleted.py b/sync_iasdfus_deleted.py
new file mode 100644
index 0000000..f062a19
--- /dev/null
+++ b/sync_iasdfus_deleted.py
@@ -0,0 +1,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